[50200] trunk/dports/devel/glib2

mcalhoun at macports.org mcalhoun at macports.org
Mon Apr 27 10:50:06 PDT 2009


Revision: 50200
          http://trac.macports.org/changeset/50200
Author:   mcalhoun at macports.org
Date:     2009-04-27 10:50:05 -0700 (Mon, 27 Apr 2009)
Log Message:
-----------
glib2: Fix endian detection and simplify universal code.

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

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

Modified: trunk/dports/devel/glib2/Portfile
===================================================================
--- trunk/dports/devel/glib2/Portfile	2009-04-27 16:53:17 UTC (rev 50199)
+++ trunk/dports/devel/glib2/Portfile	2009-04-27 17:50:05 UTC (rev 50200)
@@ -69,9 +69,6 @@
     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
     reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/gio/xdgmime/xdgmime.c
-
-    # Allow endian.h to be found.
-    #reinplace "s|endian.h|machine/endian.h|g" ${worksrcpath}/configure
 }
 
 platform darwin {
@@ -95,9 +92,6 @@
 }
 
 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 merger_configure_cppflags merger_configure_ldflags
 
@@ -109,71 +103,43 @@
             set merger_configure_ldflags(x86_64)   "-framework Carbon"
         }
 
+        # Find architectures which will not run on build platform.
         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"
+                set cross_archs "ppc ppc64"
             } else {
-                set merger_configure_env(ppc)  "NM='/usr/bin/nm -p'"
+                set cross_archs "ppc64"
+                set host_archs  "ppc ppc64"
+                set big_endian  "yes"
             }
-            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"
-                }
-            }
+            set cross_archs "i386 x86_64"
+            set host_archs  "i386 x86_64"
+            set big_endian  "no"
+        }
 
-            # 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
-                }
-            }
+        set run_arch [lindex ${universal_archs} 0]
+        if { [lsearch ${cross_archs} ${run_arch}] >= 0 } {
+            ui_msg "When building a universal binary of ${name}, make sure none of {${cross_archs}} is first in universal_archs in ${prefix}/etc/macports/macports.conf"
+            error "incompatible universal_archs value"
+        }
 
-            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"
+        foreach arch ${cross_archs} {
+            lappend merger_configure_env(${arch}) \
+                GLIB_GENMARSHAL=${worksrcpath}-${run_arch}/gobject/glib-genmarshal \
+                glib_cv_stack_grows=no \
+                glib_cv_uscore=no \
+                ac_cv_func_posix_getpwuid_r=yes \
+                ac_cv_func_posix_getgrgid_r=yes
         }
-    }
 
-    post-extract {
-        # Answers to questions configure can't determine without running a program.
-        copy ${filespath}/config.cache ${worksrcpath}
+        # Correct NM values is not found.
+        # With -arch, ac_cv_c_bigendian is set to universal, which defaults to little endian.
+        foreach arch ${host_archs} {
+             lappend merger_configure_env(${arch}) \
+                NM='/usr/bin/nm -p' \
+                ac_cv_c_bigendian=${big_endian}
+        }
     }
 
     pre-destroot {

Deleted: trunk/dports/devel/glib2/files/config.cache
===================================================================
--- trunk/dports/devel/glib2/files/config.cache	2009-04-27 16:53:17 UTC (rev 50199)
+++ trunk/dports/devel/glib2/files/config.cache	2009-04-27 17:50:05 UTC (rev 50200)
@@ -1,4 +0,0 @@
-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/20090427/c019cb83/attachment.html>


More information about the macports-changes mailing list