Invoking tcl
Jordan K. Hubbard
jkh at apple.com
Fri Nov 6 22:02:04 PST 2009
On Nov 6, 2009, at 6:24 PM, Scott Haneda wrote:
> Doing this sucks:
>
> variant lang_brazilian description "Use Brazilian language for server messages" { configure.args-append --with-language=brazilian }
>
> variant lang_czech description "Use Czech language for server messages" { configure.args-append --with-language=czech }
And how many ports do that? I mean, if this pattern is pervasive across the collection then you probably want to create some sort of "lang" procedure which sets the appropriate configure args and checks an internal variable to see if two languages have been specified in conflict. Otherwise, you'd still have to stick the same work procedure into each Portfile that wanted to use it, so I'm not sure how much it would save you unless each port also declared such variants multiple times.
> I can not get the eval to work when I run port variants pure-ftpd, it just ignores it.
Well, variant is itself a procedure and it's probably not going to eval its arguments in the way you want, unless you mean something else here... Otherwise, you can insert any Tcl code you like into a Portfile and it will run if called through one of the existing hooks, so a hook proc could always create an expression dynamically and eval that, if that's what you want...
- Jordan
More information about the macports-dev
mailing list