[46483] trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl

mcalhoun at macports.org mcalhoun at macports.org
Thu Feb 5 08:47:18 PST 2009


Revision: 46483
          http://trac.macports.org/changeset/46483
Author:   mcalhoun at macports.org
Date:     2009-02-05 08:47:17 -0800 (Thu, 05 Feb 2009)
Log Message:
-----------
muniversal-1.0.tcl:
Using variables merger_must_run_binaries and merger_no_3_archs, allow
    user to specify that supported architectures must run on build platform and
    that three architectures are not supported.
Not being able to run binaries is a common reason to set universal_archs_supported, so make it easier.
Having three architectures will often lead to an incorrect merge of header files.

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl
===================================================================
--- trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl	2009-02-05 12:58:28 UTC (rev 46482)
+++ trunk/dports/_resources/port1.0/group/muniversal-1.0.tcl	2009-02-05 16:47:17 UTC (rev 46483)
@@ -42,11 +42,21 @@
 #    merger_configure_cxxflags: associative array of configure.cxxflags
 #     merger_configure_ldflags: associative array of configure.ldflags
 #             merger_dont_diff: list of file names for which diff will not work
+#     merger_must_run_binaries: if yes, build platform must be able to run binaries for supported architectures
+#            merger_no_3_archs: if yes, merger will not work correctly if there are three supported architectures
 
 if { ! [info exists universal_archs_supported] } {
     set universal_archs_supported  ${universal_archs}
 }
 
+if { ! [info exists merger_must_run_binaries] } {
+    set merger_must_run_binaries "no"
+}
+
+if { ! [info exists merger_no_3_archs] } {
+    set merger_no_3_archs "no"
+}
+
 variant universal {
     global universal_archs_to_use
 
@@ -62,6 +72,16 @@
         configure.ldflags-delete   -arch ${arch}
     }
 
+    # user has specified that build platform must be able to run binaries for supported architectures
+    if { ${merger_must_run_binaries}=="yes" } {
+        if { ${os.arch}=="i386" } {
+            set universal_archs_supported [ldelete ${universal_archs_supported} "ppc64"]
+        } else {
+            set universal_archs_supported [ldelete ${universal_archs_supported} "i386"]
+            set universal_archs_supported [ldelete ${universal_archs_supported} "x86_64"]
+        }
+    }
+
     # set universal_archs_to_use as the intersection of universal_archs and universal_archs_supported
     set universal_archs_to_use {}
     foreach arch ${universal_archs} {
@@ -76,6 +96,30 @@
         }
     }
 
+    # if merger_no_3_archs is yes, prune universal_archs_to_use until it only has two elements
+    if { ${merger_no_3_archs}=="yes" } {
+        if { [llength ${universal_archs_to_use}] == 3 } {
+            # first try to remove cross-compiled 64-bit arch
+            if { ${os.arch}=="i386" } {
+                set universal_archs_to_use [ldelete ${universal_archs_to_use} "ppc64"]
+            } else {
+                set universal_archs_to_use [ldelete ${universal_archs_to_use} "x86_64"]
+            }
+        }
+        if { [llength ${universal_archs_to_use}] == 3 } {
+            # next try to remove cross-compiled 32-bit arch
+            if { ${os.arch}=="i386" } {
+                set universal_archs_to_use [ldelete ${universal_archs_to_use} "ppc"]
+            } else {
+                set universal_archs_to_use [ldelete ${universal_archs_to_use} "i386"]
+            }
+        }
+        if { [llength ${universal_archs_to_use}] == 3 } {
+            # at least one arch should have been removed from universal_archs_to_use
+            error "Should Not Happen"
+        }
+    }
+
     configure {
         foreach arch ${universal_archs_to_use} {
             ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %1\$s for architecture %2\$s"] [option portname] ${arch}]"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090205/99271b00/attachment.html>


More information about the macports-changes mailing list