portconfigure.tcl - why does appending to an ENV variable (like CFLAGS) not also append to configure.cflags ?

Ken Cunningham ken.cunningham.webuse at gmail.com
Thu Nov 8 16:16:07 UTC 2018


OK. I guess the answer to my question then really is that it is apparently purposelful and desired behavoir that 

configure.cxxflags is not set up the same as CXXFLAGS

and  likewise for all the others as well. That concept is a new one for me, but I'll try to wrap my head arond this.

Thanks,

Ken


> On Nov 8, 2018, at 04:38, Ryan Schmidt <ryandesign at macports.org> wrote:
> 
> 
> 
>> On Nov 7, 2018, at 17:28, Ken Cunningham wrote:
>> 
>> Thanks for the detailed explanation. I do understand what you mean about +universal. Just to point out that this port is not actually building universal here, it's just building normally.
> 
> I'm sure. But as I explained, SDK flags can vary based on whether one is building universal or not. That's why the SDK flags is not run until we know for sure whether or not the portfile has a universal variant.
> 
> 
>> What I was expecting would be that portconfigure.tcl would do something like this at the end of the process
>> 
>> foreach item in CXXFLAGS
>>   configure.cxxflags-append item
>> end
>> 
>> so then ${configure.cxxflags} would exactly match CXXFLAGS in the environment.
>> 
>> Then a whole lot of Portfile shenanigans could go away, I think.
> 
> By "the end of the process" you mean at the end of portconfigure::configure_main? If so, there are two problems with that suggestion.
> 
> First, the value of e.g. ${configure.cxxflags} that you see in the global part of the portfile would be different from the value you would see in a phase. So the following two methods would see different results:
> 
> 
> build.args-append CXXFLAGS="${configure.cxxflags}"
> 
> 
> pre-build {
>    build.args-append CXXFLAGS="${configure.cxxflags}"
> }
> 
> 
> That might be confusing.
> 
> And since the flags would hypothetically be added at the end of the configure phase, what would happen if the user runs "sudo port configure" separately from "sudo port build"? The answer is that the revised cxxflags would not be seen in the build phase or later. However they would be seen if "sudo port build" (or destroot or install) is run without "sudo port configure" having been run separately before. That would definitely be confusing.
> 


More information about the macports-dev mailing list