Ticket #13407: Portfile.diff

File Portfile.diff, 10.5 KB (added by bfulgham@…, 16 years ago)

Patch to build 6.8.2 under Leopard (Intel)

  • Portfile

     
    22
    33PortSystem 1.0
    44name            ghc
    5 version         6.6.1
     5version         6.8.2
    66categories      lang
    77maintainers     gwright@macports.org
    88platforms       darwin
     
    2828distfiles       ${name}-${version}-src.tar.bz2          \
    2929                ${name}-${version}-src-extralibs.tar.bz2
    3030
    31 checksums       ${name}-${version}-src.tar.bz2                  md5 ba9f4aec2fde5ff1e1548ae69b78aeb0 \
    32                 ${name}-${version}-src-extralibs.tar.bz2        md5 43a26b81608b206c056adc3032f7da2a
     31checksums       ${name}-${version}-src.tar.bz2                  md5 43108417594be7eba0918c459e871e40 \
     32                ${name}-${version}-src-extralibs.tar.bz2        md5 d199c50814188fb77355d41058b8613c
    3333
    34 patchfiles      patch-configure.ac      \
    35                 patch-GHC.hs            \
    36                 patch-package.conf.in
     34patchfiles      patch-Install.hs \
     35        patch-configure.ac
     36#               patch-package.conf.in
    3737
    3838depends_lib     port:readline \
    3939                port:gmp
     
    7474
    7575                depends_lib-append      port:readline-5
    7676
    77                 pre-configure   {
    78                         cd ${worksrcpath}
    79                         system "autoreconf"
    80 
    81                         set cfg [open "${worksrcpath}/mk/build.mk" w]
    82                         puts $cfg "#"
    83                         puts $cfg "# Local configuration overrides for MacPorts"
    84                         puts $cfg "#"
    85                         puts $cfg "SRC_CC_OPTS += -I${prefix}/include"
    86                         puts $cfg "SRC_HC_OPTS += -I${prefix}/include -I/usr/include -L${prefix}/lib -L/usr/lib"
    87                         puts $cfg "EXTRA_HSC2HS_OPTS += -I${prefix}/include"
    88                         puts $cfg "EXTRA_LD_OPTS += -L${prefix}/lib"
    89                         puts $cfg "EXTRA_LD_OPTS += -L/usr/lib"
    90                         close $cfg
    91 
    92                         reinplace "s|/opt/local|${workpath}/ghc-bootstrap|g" ${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/package.conf
    93 
    94                         reinplace "s|GHCBIN=\"/opt/local|GHCBIN=\"${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc
    95 
    96                         reinplace "s|TOPDIROPT=\"-B/opt/local|TOPDIROPT=\"-B${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc
    97 
    98                         reinplace "s|-L/opt/local|-L${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc
    99 
    100                         reinplace "s|-I/opt/local|-I${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc
    101 
    102                         reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-asm
    103 
    104                         reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-split
    105                 }
    106 
    10777                configure.args-append --with-ghc='${workpath}/${name}-bootstrap/bin/ghc'
    10878                build.cmd       gmake
    10979        }
     
    12393                                        ${name}-${version}-src-extralibs.tar.bz2 \
    12494                                        ${name}-${ghc_bootversion}-darwin-bootstrap-tiger.tar.bz2
    12595
    126                 pre-configure   {
    127                         cd ${worksrcpath}
    128                         system "autoreconf"
    129 
    130                         set cfg [open "${worksrcpath}/mk/build.mk" w]
    131                         puts $cfg "#"
    132                         puts $cfg "# Local configuration overrides for MacPorts"
    133                         puts $cfg "#"
    134                         puts $cfg "SRC_CC_OPTS += -I${prefix}/include"
    135                         puts $cfg "SRC_HC_OPTS += -I${prefix}/include -I/usr/include -L${prefix}/lib -L/usr/lib"
    136                         puts $cfg "EXTRA_HSC2HS_OPTS += -I${prefix}/include"
    137                         puts $cfg "EXTRA_LD_OPTS += -L${prefix}/lib"
    138                         puts $cfg "EXTRA_LD_OPTS += -L/usr/lib"
    139                         close $cfg
    140 
    141                         reinplace "s|/opt/local|${workpath}/ghc-bootstrap|g" ${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/package.conf
    142 
    143                         reinplace "s|GHCBIN=\"/opt/local|GHCBIN=\"${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc
    144 
    145                         reinplace "s|TOPDIROPT=\"-B/opt/local|TOPDIROPT=\"-B${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc
    146 
    147                         reinplace "s|-L/opt/local|-L${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc
    148 
    149                         reinplace "s|-I/opt/local|-I${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc
    150 
    151                         reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-asm
    152 
    153                         reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-split
    154                 }
    155 
    15696                configure.args-append --with-ghc='${workpath}/${name}-bootstrap/bin/ghc'
    15797        }
    15898
     
    171111                                        ${name}-${version}-src-extralibs.tar.bz2 \
    172112                                        ${name}-${ghc_bootversion}-i386-apple-darwin-bootstrap.tar.bz2
    173113
    174                 pre-configure   {
    175                         cd ${worksrcpath}
    176                         system "autoreconf"
     114                configure.args-append --with-ghc='${workpath}/${name}-bootstrap/bin/ghc'
     115        }
    177116
    178                         set cfg [open "${worksrcpath}/mk/build.mk" w]
    179                         puts $cfg "#"
    180                         puts $cfg "# Local configuration overrides for MacPorts"
    181                         puts $cfg "#"
    182                         puts $cfg "SRC_CC_OPTS += -I${prefix}/include"
    183                         puts $cfg "SRC_HC_OPTS += -I${prefix}/include -I/usr/include -L${prefix}/lib -L/usr/lib"
    184                         puts $cfg "EXTRA_HSC2HS_OPTS += -I${prefix}/include"
    185                         puts $cfg "EXTRA_LD_OPTS += -L${prefix}/lib"
    186                         puts $cfg "EXTRA_LD_OPTS += -L/usr/lib"
    187                         close $cfg
     117platform darwin 9 i386 {
     118                global ghc_bootversion
     119                set ghc_bootversion     6.8.2
    188120
    189                         reinplace "s|/opt/local|${workpath}/ghc-bootstrap|g" ${workpath}/ghc-bootstrap/lib/ghc-${ghc_bootversion}/package.conf
     121                master_sites-append     ${homepage}/dist/${ghc_bootversion}/:bootstrap
    190122
    191                         reinplace "s|GHCBIN=\"/opt/local|GHCBIN=\"${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc
     123                distfiles-append        ${name}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2:bootstrap
    192124
    193                         reinplace "s|TOPDIROPT=\"-B/opt/local|TOPDIROPT=\"-B${workpath}/${name}-bootstrap|" ${workpath}/${name}-bootstrap/bin/ghc
     125                checksums-append        ${name}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2 md5 735a6dca41f36044199784d5bd1ece69
    194126
    195                         reinplace "s|-L/opt/local|-L${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc
     127                extract.only            ${name}-${version}-src.tar.bz2 \
     128                                               ${name}-${version}-src-extralibs.tar.bz2 \
     129                                               ${name}-${ghc_bootversion}-darwin-i386-leopard-bootstrap.tar.bz2
    196130
    197                         reinplace "s|-I/opt/local|-I${prefix}|" ${workpath}/${name}-bootstrap/bin/ghc
     131                configure.args-append --with-ghc='${workpath}/${name}-bootstrap/bin/ghc'
     132        }
    198133
    199                         reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-asm
     134pre-configure   {
     135        system "cd ${worksrcpath} && autoreconf"
    200136
    201                         reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-split
    202                 }
     137        set cfg [open "${worksrcpath}/mk/build.mk" w]
     138        puts $cfg "#"
     139        puts $cfg "# Local configuration overrides for MacPorts"
     140        puts $cfg "#"
     141        puts $cfg "SRC_CC_OPTS += -I${prefix}/include"
     142        puts $cfg "SRC_HC_OPTS += -I${prefix}/include -I/usr/include -L${prefix}/lib -L/usr/lib"
     143        puts $cfg "EXTRA_HSC2HS_OPTS += -I${prefix}/include"
     144        puts $cfg "EXTRA_LD_OPTS += -L${prefix}/lib"
     145        puts $cfg "EXTRA_LD_OPTS += -L/usr/lib"
     146        puts $cfg "CPPFLAGS += -I${prefix}/include"
     147        puts $cfg "LDFLAGS += -L${prefix}/lib"
     148        close $cfg
    203149
    204                 configure.args-append --with-ghc='${workpath}/${name}-bootstrap/bin/ghc'
    205         }
     150    # Prepare bootstrap compiler for use in building current GHC
     151        reinplace "s|/opt/local|${workpath}/ghc-bootstrap|g" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/package.conf
     152        reinplace "s|GHCBIN=/opt/local\\(.*\\)|GHCBIN=${workpath}/${name}-bootstrap\\1|" ${workpath}/${name}-bootstrap/bin/ghc
     153        reinplace "s|TOPDIROPT=-B/opt/local\\(.*\\)|TOPDIROPT=-B${workpath}/${name}-bootstrap\\1|" ${workpath}/${name}-bootstrap/bin/ghc
     154        reinplace "s|-L/opt/local\\(.*\\)|-L${prefix}\\1|" ${workpath}/${name}-bootstrap/bin/ghc
     155        reinplace "s|-I/opt/local\\(.*\\)|-I${prefix}\\1|" ${workpath}/${name}-bootstrap/bin/ghc
     156        reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-asm
     157        reinplace "s|/opt/local|${prefix}|" ${workpath}/${name}-bootstrap/lib/ghc-${ghc_bootversion}/ghc-split
    206158
     159        # Deal with GMP
     160        reinplace "s|GHC_CC_OPTS += \\(.*\\)|GHC_CC_OPTS += ${prefix}/include \\1|" ${worksrcpath}/libraries/Cabal/Distribution/Simple/GHC/Makefile.in
     161        system "ln -sf ${prefix}/include/gmp.h ${worksrcpath}/libraries/base/include"
     162        system "ln -sf ${prefix}/include/gmpxx.h ${worksrcpath}/libraries/base/include"
     163        system "ln -sf ${prefix}/include/gmp.h ${worksrcpath}/includes"
     164        system "ln -sf ${prefix}/include/gmpxx.h ${worksrcpath}/includes"
    207165
     166        reinplace "s|\\(SUBDIRS += \$\(wildcard OpenAL\).*\\)|#\\1|" ${worksrcpath}/libraries/Makefile
     167}
     168
     169
     170
    208171#bugs           GHC does not support DESTDIR. Instead, we install       \
    209172#               everything into ${destroot}/${prefix}, and then fix up  \
    210173#               the five scripts which actually have the installation   \
    211174#               path hard coded.
    212175
    213 configure.ldflags-append        "-L/usr/lib"
     176configure.ldflags-append        "-L/usr/lib -L${prefix}/lib"
    214177configure.cflags-append         "-I${prefix}/include"
    215 configure.env           DYLD_FALLBACK_LIBRARY_PATH=${prefix}/lib
     178configure.env           DYLD_FALLBACK_LIBRARY_PATH=${prefix}/lib \
     179                    CFLAGS=-I${prefix}/include
    216180
    217 configure.args  --prefix=${destroot}/${prefix}                  \
    218                 --mandir=${destroot}/${prefix}/share/man/       \
     181configure.args  --prefix=${destroot}${prefix}                   \
     182                --mandir=${destroot}${prefix}/share/man/        \
    219183                --with-readline-includes=${prefix}/include      \
    220184                --with-readline-libraries=${prefix}/lib         \
     185                --with-gmp-libraries=${prefix}/lib \
     186                --with-gmp-includes=${prefix}/include \
    221187                --disable-openal                                \
    222188                --disable-alut
    223189
     
    227193        system "env DYLD_FALLBACK_LIBRARY_PATH=${prefix}/lib ${build.cmd} ${build.target}"
    228194}
    229195
     196destroot {
     197        system "${build.cmd} install"
     198}
    230199
    231 
    232200# Note the middle "/" in the ${destroot}/${prefix} pattern. It is required,
    233201# because the actual text we are trying to match has a "//" between the
    234202# destroot and the prefix pieces.
    235203
    236204post-destroot   {
    237         reinplace s|${destroot}/${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghc
    238         reinplace s|${destroot}/${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghci
    239         reinplace s|${destroot}/${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghc-pkg
    240         reinplace s|${destroot}/${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghcprof
    241         reinplace s|${destroot}/${prefix}|${prefix}|g ${destroot}/${prefix}/bin/hsc2hs
     205        reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghc
     206        reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghci
     207        reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghc-pkg
     208        reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}/${prefix}/bin/ghcprof
     209        reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}/${prefix}/bin/hsc2hs
    242210
    243211        reinplace "s|\\\$@\"\}|\\\$@\"\} -L${prefix}/lib -I${prefix}/include |" ${destroot}/${prefix}/bin/ghc
    244212
    245         reinplace s|${destroot}/${prefix}|${prefix}|g ${destroot}${prefix}/lib/${name}-${version}/package.conf
     213        reinplace s|${destroot}${prefix}|${prefix}|g ${destroot}${prefix}/lib/${name}-${version}/package.conf
    246214
    247         cd ${destroot}${prefix}/lib/ghc-${version}
    248         system "ranlib *.a"
     215        system "cd ${destroot}${prefix}/lib/ghc-${version} && ranlib *.a"
    249216}