[36764] trunk/base/src
jmr at macports.org
jmr at macports.org
Wed May 14 02:11:08 PDT 2008
Revision: 36764
http://trac.macosforge.org/projects/macports/changeset/36764
Author: jmr at macports.org
Date: 2008-05-14 02:11:07 -0700 (Wed, 14 May 2008)
Log Message:
-----------
Reworked the handling of the default universal variant. We can now avoid
adding it at all when we know it won't work. Fix for #12170.
Modified Paths:
--------------
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/port1.0/portmain.tcl
trunk/base/src/port1.0/portutil.tcl
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2008-05-14 08:50:08 UTC (rev 36763)
+++ trunk/base/src/macports1.0/macports.tcl 2008-05-14 09:11:07 UTC (rev 36764)
@@ -946,6 +946,12 @@
macports::worker_init $workername $portpath [macports::getportbuildpath $portpath] $options $variations
$workername eval source Portfile
+
+ # add the default universal variant, but only if
+ # it will work and another one isn't already present
+ if {[$workername eval default_universal_variant_allowed]} {
+ $workername eval add_default_universal_variant
+ }
# evaluate the variants
if {[$workername eval eval_variants variations] != 0} {
Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl 2008-05-14 08:50:08 UTC (rev 36763)
+++ trunk/base/src/port1.0/portmain.tcl 2008-05-14 09:11:07 UTC (rev 36764)
@@ -44,6 +44,7 @@
options prefix name version revision epoch categories maintainers
options long_description description homepage
options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
+options universal_variant os.universal_supported
# Export options via PortInfo
options_export name version revision epoch categories maintainers platforms description long_description homepage
@@ -96,6 +97,7 @@
default os.arch {$os_arch}
# Remove trailing "Endian"
default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
+default os.universal_supported no
set macosx_version {}
if {$os_platform == "darwin"} {
@@ -105,26 +107,18 @@
default macosx_deployment_target {$macosx_version}
+default universal_variant yes
+
# Select implicit variants
if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
if {[info exists os.platform] && (${os.platform} == "darwin") && ![file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(puredarwin)]} { variant_set puredarwin }
if {[info exists os.platform] && (${os.platform} == "darwin") && [file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(macosx)]} { variant_set macosx }
if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
- # Declare default universal variant, on >10.3
- variant universal description {Build for multiple architectures} {
- if {[tbool use_xmkmf] || ![tbool use_configure]} {
- return -code error "Default universal variant only works with ports based on configure"
- }
- eval configure.args-append ${configure.universal_args}
- if {![file exists ${configure.universal_sysroot}]} {
- return -code error "Universal SDK is not installed (are we running on 10.3? did you forget to install it?) and building with +universal will very likely fail"
- }
- eval configure.cflags-append ${configure.universal_cflags}
- eval configure.cppflags-append ${configure.universal_cppflags}
- eval configure.cxxflags-append ${configure.universal_cxxflags}
- eval configure.ldflags-append ${configure.universal_ldflags}
- }
+ # the universal variant itself is now created in
+ # add_default_universal_variant, which is called from mportopen
+ option os.universal_supported yes
+
if {[info exists variations(universal)] && $variations(universal) == "+"} {
# cannot go into the variant, due to the amount of ports overriding it
global configure.universal_target
@@ -132,20 +126,6 @@
eval macosx_deployment_target ${configure.universal_target}
}
}
-
- # This is not a standard option, because we need to take an action when it's
- # set, in order to alter the PortInfo structure in time.
- proc universal_variant {state} {
- if {${state} == "no"} {
- variant_undef universal
- }
- }
-} else {
- proc universal_variant {state} {
- if {${state} != "no"} {
- ui_error "+universal is only available on +macosx"
- }
- }
}
proc main {args} {
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2008-05-14 08:50:08 UTC (rev 36763)
+++ trunk/base/src/port1.0/portutil.tcl 2008-05-14 09:11:07 UTC (rev 36764)
@@ -1652,6 +1652,43 @@
return $result
}
+proc default_universal_variant_allowed {args} {
+
+ if {[variant_exists universal]} {
+ ui_debug "universal variant already exists, so not adding the default one"
+ return no
+ } elseif {[exists universal_variant] && ![option universal_variant]} {
+ ui_debug "'universal_variant no' specified, so not adding the default universal variant"
+ return no
+ } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
+ ui_debug "using xmkmf, so not adding the default universal variant"
+ return no
+ } elseif {[exists use_configure] && ![option use_configure]} {
+ ui_debug "not using configure, so not adding the default universal variant"
+ return no
+ } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
+ ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
+ return no
+ } else {
+ ui_debug "adding the default universal variant"
+ return yes
+ }
+}
+
+proc add_default_universal_variant {args} {
+ # Declare default universal variant, on >10.3
+ variant universal description {Build for multiple architectures} {
+ if {![file exists ${configure.universal_sysroot}]} {
+ return -code error "Universal SDK is not installed (are we running on 10.3? did you forget to install it?) and building with +universal will very likely fail"
+ }
+ eval configure.args-append ${configure.universal_args}
+ eval configure.cflags-append ${configure.universal_cflags}
+ eval configure.cppflags-append ${configure.universal_cppflags}
+ eval configure.cxxflags-append ${configure.universal_cxxflags}
+ eval configure.ldflags-append ${configure.universal_ldflags}
+ }
+}
+
# Target class definition.
# constructor for target object
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080514/9b144134/attachment.html
More information about the macports-changes
mailing list