[49134] trunk/dports/devel/glib2

mcalhoun at macports.org mcalhoun at macports.org
Fri Apr 3 23:54:47 PDT 2009


Revision: 49134
          http://trac.macports.org/changeset/49134
Author:   mcalhoun at macports.org
Date:     2009-04-03 23:54:47 -0700 (Fri, 03 Apr 2009)
Log Message:
-----------
glib2: Use muniversal PortGroup.
Fixes #17042 (maintainer timeout).

Modified Paths:
--------------
    trunk/dports/devel/glib2/Portfile

Added Paths:
-----------
    trunk/dports/devel/glib2/files/config.cache

Modified: trunk/dports/devel/glib2/Portfile
===================================================================
--- trunk/dports/devel/glib2/Portfile	2009-04-04 06:53:03 UTC (rev 49133)
+++ trunk/dports/devel/glib2/Portfile	2009-04-04 06:54:47 UTC (rev 49134)
@@ -1,6 +1,7 @@
 # $Id$
 
 PortSystem              1.0
+PortGroup               muniversal 1.0
 
 name                    glib2
 set my_name             glib
@@ -66,6 +67,9 @@
 post-patch {
     reinplace "s|data_dirs = \"/usr|data_dirs = \"${prefix}/share:/usr|g" ${worksrcpath}/glib/gutils.c
     reinplace "s|path = \"/bin|path = \"${prefix}/bin:/bin|g" ${worksrcpath}/glib/gutils.c ${worksrcpath}/glib/gspawn.c
+
+    # Allow endian.h to be found.
+    #reinplace "s|endian.h|machine/endian.h|g" ${worksrcpath}/configure
 }
 
 platform darwin {
@@ -73,14 +77,6 @@
         patch-child-test.c.diff
 }
 
-platform powerpc {
-    if {[variant_isset universal]} {
-        post-configure {
-            reinplace {s|^#define G_ATOMIC_POWERPC 1$|#undef G_ATOMIC_POWERPC|} ${worksrcpath}/config.h
-        }
-    }
-}
-
 test.run                yes
 test.target             check
 
@@ -96,6 +92,90 @@
     }
 }
 
+if {[variant_isset universal]} {
+    # When cross-compiling, use --config-cache to answer questions configure can't determine without running a program.
+    # When cross-compiling, configure script does not find correct value of NM,
+    #     so replicate NM value found when not cross-compiling.
+    pre-configure {
+        global merger_configure_args merger_configure_env
+
+        if { ${os.arch}=="i386" } {
+            # Determine if any cross-compiling is required.
+            set need_cross  "no"
+            foreach arch ${universal_archs_to_use} {
+                if { ${arch}=="ppc64" || (${os.major} >= 10 && ${arch}=="ppc") } {
+                    set need_cross "yes"
+                }
+            }
+
+            # Find an architecture whose binaries will run on this platform.
+            set run_arch ""
+            foreach arch ${universal_archs_to_use} {
+                if { ${arch}=="i386" || ${arch}=="x86_64" || (${os.major} < 10 && ${arch}=="ppc") } {
+                    set run_arch ${arch}
+                    break
+                }
+            }
+
+            if { ${need_cross}=="yes" && ${run_arch}=="" } {
+                ui_msg "When building a universal binary of ${name}, put i386 first in universal_archs in ${prefix}/etc/macports/macports.conf" 
+ 		return -code error "incompatible universal_archs value" 
+            }
+
+            if { ${os.major} >= 10 } { set merger_configure_args(ppc)  --config-cache }
+            set merger_configure_args(ppc64)  --config-cache
+            if { ${os.major} >= 10 } {
+                set merger_configure_env(ppc)  "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${worksrcpath}-${run_arch}/gobject/glib-genmarshal"
+            } else {
+                set merger_configure_env(ppc)  "NM='/usr/bin/nm -p'"
+            }
+            set merger_configure_env(ppc64)    "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${worksrcpath}-${run_arch}/gobject/glib-genmarshal"
+        } else {
+            # Determine if any cross-compiling is required.
+            set need_cross  "no"
+            foreach arch ${universal_archs_to_use} {
+                if { ${arch}=="i386" || ${arch}=="x86_64" } {
+                    set need_cross "yes"
+                }
+            }
+
+            # Find an architecture whose binaries will run on this platform.
+            set run_arch ""
+            foreach arch ${universal_archs_to_use} {
+                if { ${arch}=="ppc" || ${arch}=="ppc64" } {
+                    set run_arch ${arch}
+                    break
+                }
+            }
+
+            if { ${need_cross}=="yes" && ${run_arch}=="" } {
+                ui_msg "When building a universal binary of ${name}, put ppc first in universal_archs in ${prefix}/etc/macports/macports.conf" 
+ 		return -code error "incompatible universal_archs value"
+            }
+            array set merger_configure_args {
+                i386    --config-cache
+                x86_64  --config-cache
+            }
+            set merger_configure_env(i386)    "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${worksrcpath}-${run_arch}/gobject/glib-genmarshal"
+            set merger_configure_env(x86_64)  "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${worksrcpath}-${run_arch}/gobject/glib-genmarshal"
+        }
+    }
+
+    post-extract {
+        # Answers to questions configure can't determine without running a program.
+        copy ${filespath}/config.cache ${worksrcpath}
+    }
+
+    pre-destroot {
+        global merger_dont_diff
+
+        # These tests must be done in pre-destroot to ensure universal_archs_to_use has the correct values.
+        if { [llength ${universal_archs_to_use}] > 2 } {
+            set merger_dont_diff ${prefix}/lib/glib-2.0/include/glibconfig.h
+        }
+    }
+}
+
 livecheck.check         regex
 livecheck.url           http://ftp.gnome.org/pub/GNOME/sources/${my_name}/${branch}/?C=M&O=D
 livecheck.regex         ${my_name}-(\[0-9.\]+)\\.tar

Added: trunk/dports/devel/glib2/files/config.cache
===================================================================
--- trunk/dports/devel/glib2/files/config.cache	                        (rev 0)
+++ trunk/dports/devel/glib2/files/config.cache	2009-04-04 06:54:47 UTC (rev 49134)
@@ -0,0 +1,4 @@
+glib_cv_stack_grows=no
+glib_cv_uscore=no
+ac_cv_func_posix_getpwuid_r=yes
+ac_cv_func_posix_getgrgid_r=yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090403/97112833/attachment.html>


More information about the macports-changes mailing list