Getting Access to *FLAGS in build

Michael Dickens michaelld at macports.org
Thu Nov 14 08:14:02 PST 2013


[Sorry, I didn't finish before my mail program sent ... let's try this
again ...]

I have a few ports which need access to various of the *FLAGS during the
build stage, as created during the configure stage.  I've read through
the code in port1.0/portconfigure.tcl:configure_main, and it seems like
it goes through the process of creating the flags from those set mainly
in configure.*, pushed into the configure.env_array array.  Then, at the
end of portutil.tcl:command_exec, the array is deleted and thus is not
available for use in any other stage.  I can, of course, re-create the
actual *FLAGS, but that seems wasteful.

If I change portutil.tcl:command_exec to not delete this array, and add
a proc "environment_value_to_string" in portutil.tcl that returns the
string value for the given command and key, then I can gain easy access
to these values and use them for what I need.  I've tried this, and it
works very nicely.  All of the octave-* ports will require this change
in order to "use the right compiler" and for some of them to even just
compile.

Am I missing something here about getting / using *FLAGS from within a
Portfile or PortGroup?  Is there a better way?  I thought we used to be
able to get full *FLAGS after configure was done ... maybe I'm
mis-remembering? - MLD


More information about the macports-dev mailing list