[126356] trunk/base/src/port1.0/portconfigure.tcl
larryv at macports.org
larryv at macports.org
Wed Oct 8 10:32:15 PDT 2014
Revision: 126356
https://trac.macports.org/changeset/126356
Author: larryv at macports.org
Date: 2014-10-08 10:32:15 -0700 (Wed, 08 Oct 2014)
Log Message:
-----------
portconfigure.tcl: Trace cxx_stdlib
Modified Paths:
--------------
trunk/base/src/port1.0/portconfigure.tcl
Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl 2014-10-08 17:32:13 UTC (rev 126355)
+++ trunk/base/src/port1.0/portconfigure.tcl 2014-10-08 17:32:15 UTC (rev 126356)
@@ -58,7 +58,8 @@
default configure.cxx {[portconfigure::configure_get_compiler cxx]}
default configure.cxx_archflags {[portconfigure::configure_get_archflags cxx]}
default configure.cxx_stdlib {$cxx_stdlib}
-default configure.cxxflags {${configure.optflags}}
+default configure.cxxflags \
+ {[portconfigure::construct_cxxflags ${configure.optflags}]}
default configure.objcxx {[portconfigure::configure_get_compiler objcxx]}
default configure.objcxx_archflags {[portconfigure::configure_get_archflags objcxx]}
# No current reason for OBJCXXFLAGS to differ from CXXFLAGS.
@@ -66,6 +67,33 @@
default configure.universal_cxxflags {[portconfigure::configure_get_universal_cflags]}
default configure.universal_objcxxflags {${configure.universal_cxxflags}}
+# Don't let Portfiles trash "-stdlib"; if they want to remove it, they
+# should clear configure.cxx_stdlib.
+option_proc configure.cxxflags portconfigure::stdlib_trace
+option_proc configure.objcxxflags portconfigure::stdlib_trace
+
+proc portconfigure::should_add_stdlib {} {
+ set has_stdlib [expr {[option configure.cxx_stdlib] ne ""}]
+ set is_clang [string match *clang* [option configure.cxx]]
+ return [expr {$has_stdlib && $is_clang}]
+}
+proc portconfigure::construct_cxxflags args {
+ if {[portconfigure::should_add_stdlib]} {
+ lappend args -stdlib=[option configure.cxx_stdlib]
+ }
+ return $args
+}
+proc portconfigure::stdlib_trace {opt action args} {
+ if {$action ne "read" || ![portconfigure::should_add_stdlib]} {
+ return
+ }
+ foreach flag [lsearch -all -inline [option $opt] -stdlib=*] {
+ $opt-delete $flag
+ }
+ $opt-append -stdlib=[option configure.cxx_stdlib]
+ return
+}
+
# *****************************************
@@ -759,12 +787,6 @@
}
}
- # Add flags to specify C++ STL implementation
- if {${configure.cxx_stdlib} ne "" && [string match "*clang*" [option configure.cxx]]} {
- append_to_environment_value configure CXXFLAGS -stdlib=${configure.cxx_stdlib}
- append_to_environment_value configure OBJCXXFLAGS -stdlib=${configure.cxx_stdlib}
- }
-
# Execute the command (with the new environment).
if {[catch {command_exec configure} result]} {
global configure.dir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141008/624ce6a2/attachment.html>
More information about the macports-changes
mailing list