configure.cflags and -arch flags
jmr at macports.org
Fri Jun 24 16:55:34 PDT 2011
On 2011-6-25 09:31 , Ryan Schmidt wrote:
> On Jun 24, 2011, at 17:02, Joshua Root wrote:
>> On 2011-6-25 07:44 , Ryan Schmidt wrote:
>>> I am curious if there is a good reason why variables like configure.cflags don't contain the -arch flags. During the standard configure phase, MacPorts does put the -arch flags into e.g. the CFLAGS environment variable, but if you use e.g. configure.cflags yourself to fix ports that don't use a standard configure phase, the -arch flags are missing, and must be handled separately, both for single-arch and universal cases. This kind of conditional code is tedious, and Toby thinks this didn't used to be required:
>> You can't know whether a universal variant exists until you finish
>> parsing the portfile.
> But variables like configure.cflags are evaluated lazily. They're not set until they're accessed for the first time. What if, by the time configure.cflags were first accessed, the universal variant had been declared? Wouldn't that provide enough opportunity for base to add the right -arch flags?
Sure, if that were always the case, we could do it that way. It's not.
> On a related note, it would be convenient if there were a variable that could be accessed that contained all the arch flags, regardless of whether we're building universal or single-arch. That would eliminate the need for this construct currently being used in many ports:
Yep. It would still be unusable until after the universal variant is
declared (or known not to be) though.
> Even more related, another variable would be helpful, namely a Tcl list containing all the archs being used. Currently ports have to add logic to decide whether to use build_arch or universal_archs or universal_archs_to_use and it would be nice if there were a single variable that always did the right thing.
Well, universal_archs_to_use is muniversal doing its own thing for some
reason. I don't know why it doesn't just use configure.universal_archs.
You can use [get_canonical_archs] for this purpose otherwise (which,
again, can't be relied upon before the universal variant is declared in
ports that have one). It wouldn't really be appropriate for it to be a
variable since you can't actually set it.
More information about the macports-dev