[108139] trunk/base/src/port1.0
larryv at macports.org
larryv at macports.org
Sat Jul 13 15:32:30 PDT 2013
Revision: 108139
https://trac.macports.org/changeset/108139
Author: larryv at macports.org
Date: 2013-07-13 15:32:30 -0700 (Sat, 13 Jul 2013)
Log Message:
-----------
portutil.tcl: Rewrite append_to_environment_value to take variable args.
This obviates the need for append_list_to_environment_value.
Modified Paths:
--------------
trunk/base/src/port1.0/portconfigure.tcl
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl 2013-07-13 22:05:13 UTC (rev 108138)
+++ trunk/base/src/port1.0/portconfigure.tcl 2013-07-13 22:32:30 UTC (rev 108139)
@@ -676,13 +676,13 @@
if {[tbool use_xmkmf]} {
parse_environment xmkmf
- append_list_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
+ append_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
if {[catch {command_exec xmkmf} result]} {
return -code error "[format [msgcat::mc "%s failure: %s"] xmkmf $result]"
}
parse_environment xmkmf
- append_list_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
+ append_to_environment_value xmkmf "IMAKECPP" ${configure.cpp}
if {[catch {command_exec "cd ${worksrcpath} && make Makefiles" -varprefix xmkmf} result]} {
return -code error "[format [msgcat::mc "%s failure: %s"] "make Makefiles" $result]"
}
@@ -692,82 +692,82 @@
# Set pre-compiler filter to use (ccache/distcc), if any.
if {[tbool configure.ccache] && [tbool configure.distcc]} {
- set filter "ccache "
- append_list_to_environment_value configure "CCACHE_PREFIX" "distcc"
+ set filter ccache
+ append_to_environment_value configure "CCACHE_PREFIX" "distcc"
} elseif {[tbool configure.ccache]} {
- set filter "ccache "
+ set filter ccache
} elseif {[tbool configure.distcc]} {
- set filter "distcc "
+ set filter distcc
} else {
set filter ""
}
# Set flags controlling the kind of compiler output.
if {[tbool configure.pipe]} {
- set output "-pipe "
+ set output -pipe
} else {
set output ""
}
# Append configure flags.
- append_list_to_environment_value configure "CC" ${filter}${configure.cc}
- append_list_to_environment_value configure "CXX" ${filter}${configure.cxx}
- append_list_to_environment_value configure "OBJC" ${filter}${configure.objc}
- append_list_to_environment_value configure "OBJCXX" ${filter}${configure.objcxx}
- append_list_to_environment_value configure "FC" ${configure.fc}
- append_list_to_environment_value configure "F77" ${configure.f77}
- append_list_to_environment_value configure "F90" ${configure.f90}
- append_list_to_environment_value configure "JAVAC" ${configure.javac}
- append_list_to_environment_value configure "CFLAGS" ${output}${configure.cflags}
- append_list_to_environment_value configure "CPPFLAGS" ${configure.cppflags}
- append_list_to_environment_value configure "CXXFLAGS" ${output}${configure.cxxflags}
- append_list_to_environment_value configure "OBJCFLAGS" ${output}${configure.objcflags}
- append_list_to_environment_value configure "OBJCXXFLAGS" ${output}${configure.objcxxflags}
- append_list_to_environment_value configure "LDFLAGS" ${configure.ldflags}
- append_list_to_environment_value configure "LIBS" ${configure.libs}
- append_list_to_environment_value configure "FFLAGS" ${output}${configure.fflags}
- append_list_to_environment_value configure "F90FLAGS" ${output}${configure.f90flags}
- append_list_to_environment_value configure "FCFLAGS" ${output}${configure.fcflags}
- append_list_to_environment_value configure "CLASSPATH" ${configure.classpath}
- append_list_to_environment_value configure "PERL" ${configure.perl}
- append_list_to_environment_value configure "PYTHON" ${configure.python}
- append_list_to_environment_value configure "RUBY" ${configure.ruby}
- append_list_to_environment_value configure "INSTALL" ${configure.install}
- append_list_to_environment_value configure "AWK" ${configure.awk}
- append_list_to_environment_value configure "BISON" ${configure.bison}
- append_list_to_environment_value configure "PKG_CONFIG" ${configure.pkg_config}
- append_list_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
+ append_to_environment_value configure "CC" ${filter} ${configure.cc}
+ append_to_environment_value configure "CXX" ${filter} ${configure.cxx}
+ append_to_environment_value configure "OBJC" ${filter} ${configure.objc}
+ append_to_environment_value configure "OBJCXX" ${filter} ${configure.objcxx}
+ append_to_environment_value configure "FC" ${configure.fc}
+ append_to_environment_value configure "F77" ${configure.f77}
+ append_to_environment_value configure "F90" ${configure.f90}
+ append_to_environment_value configure "JAVAC" ${configure.javac}
+ append_to_environment_value configure "CFLAGS" ${output} ${configure.cflags}
+ append_to_environment_value configure "CPPFLAGS" ${configure.cppflags}
+ append_to_environment_value configure "CXXFLAGS" ${output} ${configure.cxxflags}
+ append_to_environment_value configure "OBJCFLAGS" ${output} ${configure.objcflags}
+ append_to_environment_value configure "OBJCXXFLAGS" ${output} ${configure.objcxxflags}
+ append_to_environment_value configure "LDFLAGS" ${configure.ldflags}
+ append_to_environment_value configure "LIBS" ${configure.libs}
+ append_to_environment_value configure "FFLAGS" ${output} ${configure.fflags}
+ append_to_environment_value configure "F90FLAGS" ${output} ${configure.f90flags}
+ append_to_environment_value configure "FCFLAGS" ${output} ${configure.fcflags}
+ append_to_environment_value configure "CLASSPATH" ${configure.classpath}
+ append_to_environment_value configure "PERL" ${configure.perl}
+ append_to_environment_value configure "PYTHON" ${configure.python}
+ append_to_environment_value configure "RUBY" ${configure.ruby}
+ append_to_environment_value configure "INSTALL" ${configure.install}
+ append_to_environment_value configure "AWK" ${configure.awk}
+ append_to_environment_value configure "BISON" ${configure.bison}
+ append_to_environment_value configure "PKG_CONFIG" ${configure.pkg_config}
+ append_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
# https://trac.macports.org/ticket/34221
if {${os.platform} == "darwin" && ${os.major} == 12} {
- append_list_to_environment_value configure "__CFPREFERENCES_AVOID_DAEMON" 1
+ append_to_environment_value configure "__CFPREFERENCES_AVOID_DAEMON" 1
}
# add SDK flags if cross-compiling (or universal on ppc tiger)
if {${configure.sdkroot} != ""} {
foreach flags {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS} {
- append_list_to_environment_value configure $flags "-isysroot ${configure.sdkroot}"
+ append_to_environment_value configure $flags -isysroot ${configure.sdkroot}
}
- append_list_to_environment_value configure "LDFLAGS" "-Wl,-syslibroot,${configure.sdkroot}"
+ append_to_environment_value configure "LDFLAGS" -Wl,-syslibroot,${configure.sdkroot}
}
# add extra flags that are conditional on whether we're building universal
if {[variant_exists universal] && [variant_isset universal]} {
- append_list_to_environment_value configure "CFLAGS" ${configure.universal_cflags}
- append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
- append_list_to_environment_value configure "OBJCFLAGS" ${configure.universal_objcflags}
- append_list_to_environment_value configure "OBJCXXFLAGS" ${configure.universal_objcxxflags}
- append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
- append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
+ append_to_environment_value configure "CFLAGS" ${configure.universal_cflags}
+ append_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
+ append_to_environment_value configure "OBJCFLAGS" ${configure.universal_objcflags}
+ append_to_environment_value configure "OBJCXXFLAGS" ${configure.universal_objcxxflags}
+ append_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
+ append_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
eval [linsert ${configure.universal_args} 0 configure.pre_args-append]
} else {
foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS objcxx OBJCXXFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {
- append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
+ append_to_environment_value configure $flags [set configure.${tool}_archflags]
if {${configure.march} != {}} {
- append_list_to_environment_value configure $flags "-march=${configure.march}"
+ append_to_environment_value configure $flags -march=${configure.march}
}
if {${configure.mtune} != {}} {
- append_list_to_environment_value configure $flags "-mtune=${configure.mtune}"
+ append_to_environment_value configure $flags -mtune=${configure.mtune}
}
}
}
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2013-07-13 22:05:13 UTC (rev 108138)
+++ trunk/base/src/port1.0/portutil.tcl 2013-07-13 22:32:30 UTC (rev 108139)
@@ -818,36 +818,21 @@
}
}
-# Append to the value in the parsed environment.
-# Leave the environment untouched if the value is empty.
-proc append_to_environment_value {command key value} {
- global ${command}.env_array
+# Append one or more items to the key in the parsed environment.
+proc append_to_environment_value {command key args} {
+ upvar #0 ${command}.env_array($key) env_key
+ foreach value $args {
+ if {$value eq {}} {
+ continue
+ }
+ # Parse out any delimiters. Is this even necessary anymore?
+ regexp {^(['"])(.*)\1$} $value -> delim value
- if {[string length $value] == 0} {
- return
+ lappend env_key $value
}
-
- # Parse out any delimiter.
- set append_value $value
- if {[regexp {^("|')(.*)\1$} $append_value matchVar append_delim matchedValue]} {
- set append_value $matchedValue
- }
-
- if {[info exists ${command}.env_array($key)]} {
- set original_value [set ${command}.env_array($key)]
- set ${command}.env_array($key) "${original_value} ${append_value}"
- } else {
- set ${command}.env_array($key) $append_value
- }
+ catch {set env_key [join $env_key]}
}
-# Append several items to a value in the parsed environment.
-proc append_list_to_environment_value {command key vallist} {
- foreach {value} $vallist {
- append_to_environment_value ${command} $key $value
- }
-}
-
# Return a string representation of the specified environment, for
# debugging purposes.
proc environment_array_to_string {environment_array} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130713/e62ccec1/attachment.html>
More information about the macports-changes
mailing list