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
Wed Nov 7 17:00:57 UTC 2018
> On Nov 6, 2018, at 1:54 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
>
>
>
> On Nov 6, 2018, at 14:48, Ken Cunningham wrote:
>
>> I noticed this recently "fixing" some ports that don't use a configure step.
>>
>> During the run of portconfigure.tcl, various things (sdkroot) might be tested, and the appropriate values appended to the ENV variables.
>>
>> But these things don't seem to come out in the configure.variables, like I would have expected them to.
>>
>> Is this desired behaviour?
>>
>> Or should portconfigure flesh out the configure.variables at the same time as it's appending to the ENV variables (like I would have expected)?
>>
>> (Please tell me I'm missing some well-known step that everyone else knows about but I don't :> )
>
> Can you give a specific example?
>
OK. Let’s say to you want to build lz4 against an SDK. I defined the SDK to 10.13. To make the Portfile show the configure environment, I had to give it a sham configure phase by doing this tiny change:
#use_configure no
configure.cmd /usr/bin/true
When you go to build the port, sudo port -d build lz4, you see the configure environment variables are set up right, wth the SDK specified in several places, as it should be:
DEBUG: Preferred compilers: clang macports-clang-5.0 macports-clang-4.0
DEBUG: Using compiler 'Xcode Clang'
DEBUG: Executing org.macports.configure (lz4)
DEBUG: Environment:
CC='/usr/bin/clang'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/universal/var/macports/build/_opt_universal_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_archivers_lz4/lz4/work/.CC_PRINT_OPTIONS'
CFLAGS='-pipe -Os -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64'
CPATH='/opt/universal/include'
CPPFLAGS='-I/opt/universal/include -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk'
CXX='/usr/bin/clang++'
CXXFLAGS='-pipe -Os -stdlib=libc++ -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64'
F77FLAGS='-m64'
F90FLAGS='-pipe -Os -m64'
FCFLAGS='-pipe -Os -m64'
FFLAGS='-pipe -Os'
INSTALL='/usr/bin/install -c'
LDFLAGS='-L/opt/universal/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64'
LIBRARY_PATH='/opt/universal/lib'
MACOSX_DEPLOYMENT_TARGET='10.13'
OBJC='/usr/bin/clang'
OBJCFLAGS='-pipe -Os -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64'
OBJCXX='/usr/bin/clang++'
OBJCXXFLAGS='-pipe -Os -stdlib=libc++ -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -arch x86_64'
Executing: cd "/opt/universal/var/macports/build/_opt_universal_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_archivers_lz4/lz4/work/lz4-1.8.3" && /usr/bin/true --prefix=/opt/universal
DEBUG: system: cd "/opt/universal/var/macports/build/_opt_universal_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_archivers_lz4/lz4/work/lz4-1.8.3" && /usr/bin/true --prefix=/opt/universal
DEBUG: Privilege de-escalation not attempted as not running as root.
DEBUG: build phase started at Wed Nov 7 08:51:33 PST 2018
However, when the port is actually being built, the build args, which should be setup correctly by this:
build.args-append CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \
CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]"
don’t actually show up on the build line with all the ${configure.cxxflags} as above. Instead, you just get the “default” values from the top of portconfigure.tcl:
Executing: cd "/opt/universal/var/macports/build/_opt_universal_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_archivers_lz4/lz4/work/lz4-1.8.3" && /usr/bin/make -j16 -w all CC=/usr/bin/clang CXX=/usr/bin/clang++ PREFIX=/opt/universal CFLAGS="-Os -arch x86_64" CXXFLAGS="-Os -stdlib=libc++ -arch x86_64"
DEBUG: system: cd "/opt/universal/var/macports/build/_opt_universal_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_archivers_lz4/lz4/work/lz4-1.8.3" && /usr/bin/make -j16 -w all CC=/usr/bin/clang CXX=/usr/bin/clang++ PREFIX=/opt/universal CFLAGS="-Os -arch x86_64" CXXFLAGS="-Os -stdlib=libc++ -arch x86_64"
The lz4 portfile has manually added the -stdlib=llibc++ in the Portfile, but it should not need to do that as it is already being done by portconfigure.tcl — but the modifications made by portconfigure.tcl to the CXXFLAGS are not making it into ${configure.cxxflags}, at least at the point where the build arguments are being set up.
I hope this is a sufficiently clean example.
Best, Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20181107/1eb2407b/attachment-0001.html>
More information about the macports-dev
mailing list