[66924] trunk/base/src

jmr at macports.org jmr at macports.org
Sun Apr 25 18:08:45 PDT 2010


Revision: 66924
          http://trac.macports.org/changeset/66924
Author:   jmr at macports.org
Date:     2010-04-25 18:08:40 -0700 (Sun, 25 Apr 2010)
Log Message:
-----------
allow setting macosx_deployment_target in macports.conf, set sdkroot if not targeting the current version (#19875)

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/port1.0/portconfigure.tcl
    trunk/base/src/port1.0/portmain.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2010-04-26 00:04:01 UTC (rev 66923)
+++ trunk/base/src/macports1.0/macports.tcl	2010-04-26 01:08:40 UTC (rev 66924)
@@ -45,7 +45,7 @@
         porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir developer_dir universal_archs build_arch \
+        applications_dir frameworks_dir developer_dir universal_archs build_arch macosx_deployment_target \
         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
@@ -55,7 +55,7 @@
         rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
-        os_arch os_endian os_version os_major os_platform macosx_version $user_options"
+        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
@@ -466,6 +466,7 @@
     global macports::os_major
     global macports::os_platform
     global macports::macosx_version
+    global macports::macosx_deployment_target
 
     # Set the system encoding to utf-8
     encoding system utf-8
@@ -822,6 +823,10 @@
         set macports::build_arch [lindex $macports::build_arch 0]
     }
 
+    if {![info exists macports::macosx_deployment_target]} {
+        set macports::macosx_deployment_target $macosx_version
+    }
+
     # ENV cleanup.
     set keepenvkeys {
         DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH

Modified: trunk/base/src/port1.0/portconfigure.tcl
===================================================================
--- trunk/base/src/port1.0/portconfigure.tcl	2010-04-26 00:04:01 UTC (rev 66923)
+++ trunk/base/src/port1.0/portconfigure.tcl	2010-04-26 01:08:40 UTC (rev 66924)
@@ -152,10 +152,10 @@
 default configure.pkg_config        {}
 default configure.pkg_config_path   {}
 
-options configure.build_arch
+options configure.build_arch configure.ld_archflags configure.sdkroot
 default configure.build_arch {[portconfigure::choose_supported_archs ${build_arch}]}
-options configure.ld_archflags
 default configure.ld_archflags {[portconfigure::configure_get_ld_archflags]}
+default configure.sdkroot {[portconfigure::configure_get_sdkroot]}
 foreach tool {cc cxx objc f77 f90 fc} {
     options configure.${tool}_archflags
     default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
@@ -165,7 +165,7 @@
 default configure.universal_archs       {[portconfigure::choose_supported_archs ${universal_archs}]}
 default configure.universal_args        {--disable-dependency-tracking}
 default configure.universal_cflags      {[portconfigure::configure_get_universal_cflags]}
-default configure.universal_cppflags    {[portconfigure::configure_get_universal_cppflags]}
+default configure.universal_cppflags    {}
 default configure.universal_cxxflags    {[portconfigure::configure_get_universal_cflags]}
 default configure.universal_ldflags     {[portconfigure::configure_get_universal_ldflags]}
 
@@ -269,6 +269,22 @@
     }
 }
 
+proc portconfigure::configure_get_sdkroot {} {
+    global developer_dir macosx_deployment_target macosx_version os.major os.arch os.platform
+    if {${os.platform} == "darwin" && ($macosx_deployment_target != $macosx_version
+        || ([variant_isset universal] && ${os.arch} == "powerpc" && ${os.major} == "8"))} {
+        if {${os.major} == "8"} {
+            set sdk "${developer_dir}/SDKs/MacOSX10.4u.sdk"
+        } else {
+            set sdk "${developer_dir}/SDKs/MacOSX${macosx_deployment_target}.sdk"
+        }
+        if {[file exists $sdk]} {
+            return $sdk
+        }
+    }
+    return ""
+}
+
 # internal function to determine the "-arch xy" flags for the compiler
 proc portconfigure::configure_get_universal_archflags {args} {
     global configure.universal_archs
@@ -283,37 +299,14 @@
     return $flags
 }
 
-# internal function to determine the CPPFLAGS for the compiler
-proc portconfigure::configure_get_universal_cppflags {args} {
-    global os.arch os.major developer_dir
-    set flags ""
-    # include sysroot in CPPFLAGS too (twice), for the benefit of autoconf
-    if {${os.arch} == "powerpc" && ${os.major} == "8"} {
-        set flags "-isysroot ${developer_dir}/SDKs/MacOSX10.4u.sdk"
-    }
-    return $flags
-}
-
 # internal function to determine the CFLAGS for the compiler
 proc portconfigure::configure_get_universal_cflags {args} {
-    global os.arch os.major developer_dir
-    set flags [configure_get_universal_archflags]
-    # these flags should be valid for C/C++ and similar compiler frontends
-    if {${os.arch} == "powerpc" && ${os.major} == "8"} {
-        set flags "-isysroot ${developer_dir}/SDKs/MacOSX10.4u.sdk ${flags}"
-    }
-    return $flags
+    return [configure_get_universal_archflags]
 }
 
 # internal function to determine the LDFLAGS for the compiler
 proc portconfigure::configure_get_universal_ldflags {args} {
-    global os.arch os.major developer_dir
-    set flags [configure_get_universal_archflags]
-    # works around linking without using the CFLAGS, outside of automake
-    if {${os.arch} == "powerpc" && ${os.major} == "8"} {
-        set flags "-Wl,-syslibroot,${developer_dir}/SDKs/MacOSX10.4u.sdk ${flags}"
-    }
-    return $flags
+    return [configure_get_universal_archflags]
 }
 
 # internal proc to determine if the compiler supports -arch
@@ -336,12 +329,12 @@
 
 # internal function to determine the default compiler
 proc portconfigure::configure_get_default_compiler {args} {
-    global os.platform os.major
-    switch -exact "${os.platform} ${os.major}" {
-        "darwin 8"  -
-        "darwin 9"  { return gcc-4.0 }
-        "darwin 10" { return gcc-4.2 }
-        "darwin 11" { return llvm-gcc-4.2 }
+    global macosx_deployment_target
+    switch -exact ${macosx_deployment_target} {
+        "10.4"      -
+        "10.5"      { return gcc-4.0 }
+        "10.6"      { return gcc-4.2 }
+        "10.7"      { return llvm-gcc-4.2 }
         default     { return gcc }
     }
 }
@@ -506,7 +499,7 @@
     global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
     global configure.env configure.pipe configure.libs configure.classpath configure.universal_args
     global configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
-    global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune
+    global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune configure.sdkroot
     foreach tool {cc cxx objc f77 f90 fc ld} {
         global configure.${tool} configure.${tool}_archflags
     }
@@ -589,14 +582,21 @@
         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}
-        
+
+        # add SDK flags if cross-compiling (or universal on ppc tiger)
+        if {${configure.sdkroot} != ""} {
+            foreach flags {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS} {
+                append_list_to_environment_value configure $flags "-isysroot ${configure.sdkroot}"
+            }
+            append_list_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]} {
             foreach flags {CFLAGS OBJCFLAGS} {
                 append_list_to_environment_value configure $flags ${configure.universal_cflags}
             }
             append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
-            append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
             append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
             eval configure.pre_args-append ${configure.universal_args}
         } else {

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2010-04-26 00:04:01 UTC (rev 66923)
+++ trunk/base/src/port1.0/portmain.tcl	2010-04-26 01:08:40 UTC (rev 66924)
@@ -96,8 +96,6 @@
 }
 ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
 
-default macosx_deployment_target {$macosx_version}
-
 default universal_variant yes
 
 # sub-platforms of darwin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100425/f94c1473/attachment-0001.html>


More information about the macports-changes mailing list