Ticket #50290: Portfile_95.diff

File Portfile_95.diff, 4.6 KB (added by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), 9 years ago)
  • Portfile

    old new  
    44PortSystem 1.0
    55PortGroup select 1.0
    66PortGroup compiler_blacklist_versions 1.0
     7PortGroup muniversal 1.0
    78
    89#remember to update the -doc and -server as well
    910name                    postgresql95
     
    6263compiler.blacklist-append {clang < 421}
    6364notes "To use the postgresql server, install the ${name}-server port"
    6465
    65 if {[variant_isset universal]} {
    66     configure.cflags-append     -DAC_APPLE_UNIVERSAL_BUILD
    67     post-configure {
    68         system "cd ${worksrcpath}/src/include \
    69                 && ed - pg_config.h < ${filespath}/pg95_config.h.ed \
    70                 && touch stamp-h"
    71         system "cd ${worksrcpath}/src/interfaces/ecpg/include \
    72                 && ed - ecpg_config.h < ${filespath}/ecpg_config.h.ed \
    73                 && touch stamp-h"
    74     }
    75 }
    76 
    7766build.type              gnu
    7867build.target
    7968
     
    8978# prepare the contrib modules
    9079set contribs {}
    9180
    92 post-build {
    93 # remove a Linux-specific contrib before continuing
     81if { ![variant_isset universal] } {
     82    post-build {
     83        # remove a Linux-specific contrib before continuing
    9484    file delete -force ${worksrcpath}/contrib/sepgsql
    95 # remove perl-specific contrib, if no perl variant
     85        # remove perl-specific contrib, if no perl variant
    9686    if {![variant_isset perl]} {
    9787        file delete -force ${worksrcpath}/contrib/hstore_plperl
    9888    }
    99 # remove python-specific contrib, if no python27 variant
     89        # remove python-specific contrib, if no python27 variant
    10090    if {![variant_isset python27]} {
    10191        file delete -force ${worksrcpath}/contrib/hstore_plpython
    10292        file delete -force ${worksrcpath}/contrib/ltree_plpython
     
    110100        foreach contrib ${contribs} {
    111101                system "cd ${worksrcpath}/contrib/${contrib}/ && ${build.cmd}"
    112102        }
     103    }
     104} else {
     105    post-build {
     106        foreach arch ${universal_archs_to_use} {
     107            # remove a Linux-specific contrib before continuing
     108            file delete -force ${worksrcpath}-${arch}/contrib/sepgsql
     109            # remove perl-specific contrib, if no perl variant
     110            if {![variant_isset perl]} {
     111                file delete -force ${worksrcpath}-${arch}/contrib/hstore_plperl
     112            }
     113            # remove python-specific contrib, if no python27 variant
     114            if {![variant_isset python27]} {
     115                file delete -force ${worksrcpath}-${arch}/contrib/hstore_plpython
     116                file delete -force ${worksrcpath}-${arch}/contrib/ltree_plpython
     117            }
     118            set contribdirs [glob -nocomplain -type d ${worksrcpath}-${arch}/contrib/*]
     119            foreach d [lsort $contribdirs] {
     120                if { [file exists $d/Makefile] } {
     121                    lappend contribs [file tail $d]
     122                }
     123            }
     124            foreach contrib ${contribs} {
     125                system "cd ${worksrcpath}-${arch}/contrib/${contrib}/ && ${build.cmd}"
     126            }
     127        }
     128    }
    113129}
    114130
    115 post-destroot {
     131if { ![variant_isset universal] } {
     132    post-destroot {
    116133        foreach contrib ${contribs} {
    117134                system "echo contrib: \"${contrib}\""
    118135                system "cd ${worksrcpath}/contrib/${contrib}/ && \
    119136                        ${destroot.cmd} install ${destroot.destdir} && touch DONE"
    120137        }
    121         system "cd ${destroot}${prefix}/bin && ln -sf ${libdir}/bin/psql psql95"
    122         file delete -force ${destroot}${prefix}/share/doc/postgresql \
    123                 ${destroot}${prefix}/share/man
    124138               
     139        # remove architecture flags from global Makefile
    125140        reinplace -E "s#-arch\[\[:space:\]\]+\[\[:alnum:\]_\]+##g" \
    126141            ${destroot}${prefix}/lib/${name}/pgxs/src/Makefile.global
     142    }
     143} else {
     144    merger-post-destroot {
     145        foreach arch ${universal_archs_to_use} {
     146            foreach contrib ${contribs} {
     147                system "echo contrib: \"${contrib}\""
     148                system "cd ${worksrcpath}-${arch}/contrib/${contrib}/ && \
     149                        ${destroot.cmd} install ${destroot.destdir}-${arch} && touch DONE"
     150            }
     151
     152            # remove architecture flags from global Makefile
     153            reinplace -E "s#-arch\[\[:space:\]\]+\[\[:alnum:\]_\]+##g" \
     154                ${destroot}-${arch}${prefix}/lib/${name}/pgxs/src/Makefile.global
     155
     156            reinplace "s#${worksrcpath}-${arch}#${worksrcpath}#g" \
     157                ${destroot}-${arch}${prefix}/lib/${name}/pgxs/src/Makefile.global
     158        }
     159    }
     160}
     161
     162post-destroot {
     163        system "cd ${destroot}${prefix}/bin && ln -sf ${libdir}/bin/psql psql95"
     164        file delete -force ${destroot}${prefix}/share/doc/postgresql \
     165                ${destroot}${prefix}/share/man
    127166       
    128167        reinplace -E "s#^CFLAGS =#CFLAGS +=#g" \
    129168            ${destroot}${prefix}/lib/${name}/pgxs/src/Makefile.global