default / options keywords

Bryan Blackburn blb at macports.org
Sun Jul 12 20:06:19 PDT 2009


On Sun, Jul 12, 2009 at 09:44:38PM -0500, Ryan Schmidt said:
> Are the workings of the "default" and "options" keywords documented
> somewhere, or where in the code do I look to understand exactly how
> that's working?
> 
> It seems to be about late variable substitution, e.g. when the xcode
> portgroup says
> 
> default destroot.destdir    {DSTROOT="${destroot}"}
> 
> the curly brackets around the whole thing prevent variable
> substitution at the time the portgroup is loaded, and MacPorts plugs
> in the value of destroot into that string later, yes? It gives the
> port a chance to change destroot before it gets plugged into the
> string.
> 
> It also seems to be about being able to access portgroup variables
> without everyone having to "global" them first, e.g. you can just say
> "xcode.target something" in a portfile without having to first say
> "global xcode.target".
> 
> Is this all it is or is there more?

For the most part; 'default' helps to do the delayed evaluation with some
tracing.  'options' is what lets you use the more declarative style you
usually see in Portfiles ("name   portname") as well as setting up how to
handle *-append, *-delete, and *-replace.

Both are procs in port1.0/portutil.tcl if you want to see the full code, not
sure of what documentation there is.

Bryan



More information about the macports-dev mailing list