Ticket #17042: glib2-Portfile.diff

File glib2-Portfile.diff, 6.2 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 16 years ago)
  • Portfile

    old new  
    11# $Id: Portfile 47122 2009-02-22 11:15:44Z ryandesign@macports.org $
    22
    33PortSystem              1.0
     4PortGroup               muniversal 1.0
    45
    56name                    glib2
    67set my_name             glib
    7 version                 2.18.3
     8version                 2.20.0
    89set branch              [join [lrange [split ${version} .] 0 1] .]
    910categories              devel
    1011maintainers             ryandesign
     
    2728    ftp://ftp.gtk.org/pub/${my_name}/${branch}/
    2829
    2930checksums \
    30     md5     f13996a7bd57525d796a6593f26a7771 \
    31     sha1    293f639fb85ea47347eb34e122327c60ef7606e4 \
    32     rmd160  cf43fbba04250becaabdb7b7f55bcdec584f019e
     31    md5     05188e560dbd8bddd568e24ce10dd003 \
     32    sha1    4d653ef39fd1ebe7b64217fd824dfb1bbbde7007 \
     33    rmd160  fc343fab4712d20b527ee690dcbf67ff52b3f6fc
    3334
     35# ${prefix}/include/glib-2.0/glib/gi18n.h requires -I${prefix}/opt/local/include to find libintl.h
     36# See http://trac.macports.org/changeset/27148
    3437patchfiles \
    3538    patch-glib-2.0.pc.in.diff \
    36     patch-gutils.c.diff \
    37     patch-gi18n.h.diff \
    38     patch-which.diff
     39    patch-gi18n.h.diff
     40
     41if { ${os.major} < 9 } {
     42    # Prior to Leopard, which returns 0 even if it can not find the program.
     43    patchfiles-append patch-which.diff
     44}
    3945
    4046depends_build \
    4147    port:pkgconfig
     
    4652    path:bin/perl:perl5 \
    4753    bin:python:python_select
    4854
    49 configure.ldflags-append \
    50     -bind_at_load
    51 
    52 configure.cflags-append \
    53     -funroll-loops \
    54     -fstrict-aliasing
    55 
    5655configure.args \
    5756    --enable-static
    5857
     
    6261post-patch {
    6362    reinplace "s|data_dirs = \"/usr|data_dirs = \"${prefix}/share:/usr|g" ${worksrcpath}/glib/gutils.c
    6463    reinplace "s|path = \"/bin|path = \"${prefix}/bin:/bin|g" ${worksrcpath}/glib/gutils.c ${worksrcpath}/glib/gspawn.c
     64
     65    # Allow endian.h to be found.
     66    #reinplace "s|endian.h|machine/endian.h|g" ${worksrcpath}/configure
    6567}
    6668
    6769platform darwin {
    6870    patchfiles-append \
    69         patch-child-test.c.diff \
    70         patch-configure.diff
    71 }
    72 
    73 platform powerpc {
    74     if {[variant_isset universal]} {
    75         post-configure {
    76             reinplace {s|^#define G_ATOMIC_POWERPC 1$|#undef G_ATOMIC_POWERPC|} ${worksrcpath}/config.h
    77         }
    78     }
     71        patch-child-test.c.diff
    7972}
    8073
    8174test.run                yes
     
    9386    }
    9487}
    9588
    96 platform darwin 9 {
    97     patchfiles-append patch-glib_gutils.h.diff
     89if {[variant_isset universal]} {
     90    # When cross-compiling, use --config-cache to answer questions configure can't determine without running a program.
     91    # When cross-compiling, configure script does not find correct value of NM,
     92    #     so replicate NM value found when not cross-compiling.
     93    pre-configure {
     94        global merger_configure_args merger_configure_env
     95
     96        if { ${os.arch}=="i386" } {
     97            # Determine if any cross-compiling is required.
     98            set need_cross  "no"
     99            foreach arch ${universal_archs_to_use} {
     100                if { ${arch}=="ppc64" || (${os.major} >= 10 && ${arch}=="ppc") } {
     101                    set need_cross "yes"
     102                }
     103            }
     104
     105            # Find an architecture whose binaries will run on this platform.
     106            set run_arch ""
     107            foreach arch ${universal_archs_to_use} {
     108                if { ${arch}=="i386" || ${arch}=="x86_64" || (${os.major} < 10 && ${arch}=="ppc") } {
     109                    set run_arch ${arch}
     110                    break
     111                }
     112            }
     113
     114            if { ${need_cross}=="yes" && ${run_arch}=="" } {
     115                ui_msg "When building a universal binary of ${name}, put i386 first in universal_archs in ${prefix}/etc/macports/macports.conf"
     116                return -code error "incompatible universal_archs value"
     117            }
     118
     119            if { ${os.major} >= 10 } { set merger_configure_args(ppc)  --config-cache }
     120            set merger_configure_args(ppc64)  --config-cache
     121            if { ${os.major} >= 10 } {
     122                set merger_configure_env(ppc)  "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${workpath}/${run_arch}/gobject/glib-genmarshal"
     123            } else {
     124                set merger_configure_env(ppc)  "NM='/usr/bin/nm -p'"
     125            }
     126            set merger_configure_env(ppc64)    "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${workpath}/${run_arch}/gobject/glib-genmarshal"
     127        } else {
     128            # Determine if any cross-compiling is required.
     129            set need_cross  "no"
     130            foreach arch ${universal_archs_to_use} {
     131                if { ${arch}=="i386" || ${arch}=="x86_64" } {
     132                    set need_cross "yes"
     133                }
     134            }
     135
     136            # Find an architecture whose binaries will run on this platform.
     137            set run_arch ""
     138            foreach arch ${universal_archs_to_use} {
     139                if { ${arch}=="ppc" || ${arch}=="ppc64" } {
     140                    set run_arch ${arch}
     141                    break
     142                }
     143            }
     144
     145            if { ${need_cross}=="yes" && ${run_arch}=="" } {
     146                ui_msg "When building a universal binary of ${name}, put ppc first in universal_archs in ${prefix}/etc/macports/macports.conf"
     147                return -code error "incompatible universal_archs value"
     148            }
     149            array set merger_configure_args {
     150                i386    --config-cache
     151                x86_64  --config-cache
     152            }
     153            set merger_configure_env(i386)    "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${workpath}/${run_arch}/gobject/glib-genmarshal"
     154            set merger_configure_env(x86_64)  "NM='/usr/bin/nm -p' GLIB_GENMARSHAL=${workpath}/${run_arch}/gobject/glib-genmarshal"
     155        }
     156    }
     157
     158    post-extract {
     159        # Answers to questions configure can't determine without running a program.
     160        copy ${filespath}/config.cache ${worksrcpath}
     161    }
     162
     163    pre-destroot {
     164        global merger_dont_diff
     165
     166        # These tests must be done in pre-destroot to ensure universal_archs_to_use has the correct values.
     167        if { [llength ${universal_archs_to_use}] > 2 } {
     168            set merger_dont_diff ${prefix}/lib/glib-2.0/include/glibconfig.h
     169        }
     170    }
    98171}
    99172
    100173livecheck.check         regex