| SUMMARY="The Glasgow Haskell Compiler" | |
| DESCRIPTION=" | |
| The Glorious Glasgow Haskell Compilation system (GHC) is a compiler for Haskell. | |
| Haskell is "the" standard lazy functional programming language. | |
| " | |
| HOMEPAGE="https://www.haskell.org/ghc/" | |
| COPYRIGHT="The Glasgow Haskell Team" | |
| LICENSE="The Glasgow Haskell Compiler License" | |
| VENDOR="jessicah.org" | |
| SRC_URI_1="https://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-src.tar.bz2#noarchive" | |
| SRC_URI_2="https://raw.githubusercontent.com/jessicah/haiku-ghc/bindist/haiku-fixes.patch#noarchive" | |
| SRC_URI_3="https://raw.githubusercontent.com/jessicah/haiku-ghc/bindist/network-2.6.0.2.patch#noarchive" | |
| SRC_URI_4="http://hackage.haskell.org/package/cabal-install-1.18.0.4/cabal-install-1.18.0.4.tar.gz#noarchive" | |
| SRC_URI_5="http://hackage.haskell.org/package/HTTP-4000.2.18/HTTP-4000.2.18.tar.gz#noarchive" | |
| SRC_URI_6="http://hackage.haskell.org/package/parsec-3.1.7/parsec-3.1.7.tar.gz#noarchive" | |
| SRC_URI_7="http://hackage.haskell.org/package/text-1.2.0.0/text-1.2.0.0.tar.gz#noarchive" | |
| SRC_URI_8="http://hackage.haskell.org/package/network-uri-2.6.0.1/network-uri-2.6.0.1.tar.gz#noarchive" | |
| SRC_URI_9="http://hackage.haskell.org/package/mtl-2.1.3.1/mtl-2.1.3.1.tar.gz#noarchive" | |
| SRC_URI_10="http://hackage.haskell.org/package/network-2.6.0.2/network-2.6.0.2.tar.gz#noarchive" | |
| SRC_URI_11="http://hackage.haskell.org/package/stm-2.4.3/stm-2.4.3.tar.gz#noarchive" | |
| SRC_URI_12="http://hackage.haskell.org/package/random-1.0.1.3/random-1.0.1.3.tar.gz#noarchive" | |
| SRC_URI_13="http://hackage.haskell.org/package/zlib-0.5.4.1/zlib-0.5.4.1.tar.gz#noarchive" | |
| SRC_URI_14="http://hackage.haskell.org/package/Cabal-1.22.0.0/Cabal-1.22.0.0.tar.gz#noarchive" | |
| SRC_URI_15="http://hackage.haskell.org/package/cabal-install-1.22.0.0/cabal-install-1.22.0.0.tar.gz#noarchive" | |
| SRC_URI_16="https://raw.githubusercontent.com/jessicah/haiku-ghc/bindist/cabal-install-1.18.0.4.patch#noarchive" | |
| SRC_URI_17="https://github.com/jessicah/haiku-ghc/releases/download/v7.8.3-1/ghc-7.8.3-i386-unknown-haiku.tar.bz2#noarchive" | |
| # Hopefully we shouldn't need this patch anymore with cabal 1.22... | |
| CHECKSUM_SHA256_1="2358826f8424bf571dcc313bd882422fe108a340d6e37db4339ff6d5d6ac3f37" | |
| CHECKSUM_SHA256_2="25c86ffe99ce1277afaced5efcd97dc4ebf53a94ce20313fabab9c0e17ae33e0" | |
| CHECKSUM_SHA256_3="666a6b8207e1bcd093e86915a3e853a0f5142fc3adf707fc8a83bb9c2c4bf8f7" | |
| CHECKSUM_SHA256_4="9359d3151abc045013a4a524cbc15c2bad39f597f33fd66240686fee486f4d93" | |
| CHECKSUM_SHA256_5="93c8228f7521cdd85d0c0521071dafb037e0abbd55dbcb2516a341ded68cc0ca" | |
| CHECKSUM_SHA256_6="8aa31e78a7dc017d23a04cf99c8f836f1a49e2bda3f9149a8b89ab77ccb0078a" | |
| CHECKSUM_SHA256_7="e623663243fb5b04187754296b610509a3a72291c07f7c8eac11198c950fc830" | |
| CHECKSUM_SHA256_8="67dc2394a92c66654e1a051b8611a56a9ccc6c8f96a876e1c34f22115655d527" | |
| CHECKSUM_SHA256_9="77af766957fb49361fe63446f272a698bddb13398669edc363022e5c2517f6f6" | |
| CHECKSUM_SHA256_10="846d4099c4b1b3d05bec32c52cbef57313d513696a3e7a19a146bd5295d26789" | |
| CHECKSUM_SHA256_11="3ac21ea4aa37ee064ac2195dfd274b7c528faa0f88b21c89774c97668026fc6f" | |
| CHECKSUM_SHA256_12="41b4a9ae6d561fe539b26a8c66220eb9619dbcf471113b75f99114564097ab1a" | |
| CHECKSUM_SHA256_13="cca365e4c52c90be41a5754943134da5ce6c60bb52fa00c128fd118e0505a550" | |
| CHECKSUM_SHA256_14="88c8c14bcf30f1389245b9be55b4980437a42d13dede7d0b857f1f146926288d" | |
| CHECKSUM_SHA256_15="5f9a8d4cb4d75ac8c350eed09fe7c35dace3e8a71f123c61a392ab9ee7128e9d" | |
| CHECKSUM_SHA256_16="24370072932820518fc40e9423a262814e45a1a1124ad32d6760f381a83594f6" | |
| CHECKSUM_SHA256_17="b9aff70e514ee6f3cd242c2ae337315e98c83c66ebecea44b0f9e5bf967dfb88" | |
| REVISION="10"; updateRevisionVariables | |
| ARCHITECTURES="x86" | |
| if [ $effectiveTargetArchitecture != x86_gcc2 ]; then | |
| # x86_gcc2 is fine as primary target architecture as long as we're building | |
| # for a different secondary architecture. | |
| ARCHITECTURES="$ARCHITECTURES x86_gcc2" | |
| fi | |
| SECONDARY_ARCHITECTURES="x86" | |
| ###PATCHES="haiku-fixes.patch" | |
| GLOBAL_WRITABLE_FILES=" | |
| settings/ghc directory keep-old | |
| settings/cabal directory keep-old | |
| " | |
| PROVIDES=" | |
| ghc$secondaryArchSuffix = $portVersion | |
| cmd:ghc | |
| cmd:ghci | |
| cmd:ghc_pkg | |
| cmd:cabal | |
| cmd:haddock | |
| cmd:hp2ps | |
| cmd:hpc | |
| cmd:hsc2hs | |
| cmd:runghc | |
| cmd:runhaskell | |
| cmd:ghc_7.8.3 | |
| cmd:ghc_pkg_7.8.3 | |
| cmd:ghci_7.8.3 | |
| cmd:haddock_ghc_7.8.3 | |
| lib:libHSCabal_1.22.0.0_ghc7.8.3_x86 | |
| lib:libHSrandom_1.1_ghc7.8.3_x86 | |
| " | |
| REQUIRES=" | |
| haiku$secondaryArchSuffix >= $haikuVersion | |
| lib:libz$secondaryArchSuffix | |
| lib:libiconv$secondaryArchSuffix | |
| " | |
| BUILD_REQUIRES=" | |
| haiku${secondaryArchSuffix}_devel >= $haikuVersion | |
| haiku_devel >= $haikuVersion | |
| devel:libz$secondaryArchSuffix | |
| devel:libiconv$secondaryArchSuffix | |
| devel:libncurses$secondaryArchSuffix | |
| " | |
| BUILD_PREREQUIRES=" | |
| cmd:gcc$secondaryArchSuffix | |
| cmd:ld$secondaryArchSuffix | |
| cmd:make | |
| cmd:tar | |
| cmd:perl | |
| cmd:sed | |
| cmd:find | |
| cmd:sort | |
| cmd:awk | |
| cmd:grep | |
| cmd:autoconf | |
| " | |
| BUILD() | |
| { | |
| echo "Installing bootstrap GHC..." | |
| pwd | |
| # 1. Extract, configure, and install the bindist bootstrap GHC | |
| mkdir -p ghc-bootstrap | |
| pushd ghc-bootstrap | |
| tar xjf $portDir/download/ghc-7.8.3-i386-unknown-haiku.tar.bz2 | |
| pushd ghc-7.8.3 | |
| configure --prefix=/tmp/bootstrap | |
| make install | |
| popd | |
| popd | |
| # 2. Build GHC using the bootstrap compiler; we create a "dyn" only install | |
| echo "Building GHC proper..." | |
| if [ ! -e flag.configured ] ; then | |
| tar xjQf ghc-7.8.3-src.tar.bz2 | |
| pushd ghc-7.8.3 | |
| patch -Np1 < $portDir/download/haiku-fixes.patch | |
| cat > mk/build.mk <<-EOF | |
| V = 0 | |
| GhcLibWays = dyn | |
| SRC_HC_OPTS = -O -H64m | |
| GhcStage1HcOpts = -O -fasm | |
| GhcStage2HcOpts = -O2 -fasm | |
| GhcHcOpts = -Rghc-timing | |
| GhcLibHcOpts = -O2 | |
| DYNAMIC_BY_DEFAULT = YES | |
| NoFibWays = | |
| STRIP_CMD = : | |
| EOF | |
| # update cabal to 1.22 -- this will make pandoc work, for example | |
| #tar -C libraries/Cabal/Cabal -xf $portDir/download/Cabal-1.22.0.0.tar.gz --strip-components 1 | |
| #tar -C libraries/Cabal/cabal-install -xf $portDir/download/cabal-install-1.22.0.0.tar.gz --strip-components 1 | |
| # haikuporter's buildspec confuses GHC, so we omit it, and we can't | |
| # have a gcc2 GHC, so just install directly into $prefix/bin | |
| runConfigure --omit-buildspec --omit-dirs binDir configure --bindir=$prefix/bin --with-ghc=/tmp/bootstrap/bin/ghc --with-gcc=/bin/gcc-x86 | |
| touch ../flag.configured | |
| else | |
| echo "Skipping patch/configure..." | |
| pushd ghc-7.8.3 | |
| fi | |
| make $jobArgs | |
| popd | |
| } | |
| INSTALL() | |
| { | |
| export GHC_PACKAGE_PATH=$settingsDir/ghc/package.conf.d | |
| /tmp/bootstrap/bin/ghc-pkg init $GHC_PACKAGE_PATH | |
| unset GHC_PACKAGE_PATH | |
| # 1. Install our new GHC | |
| echo "Installing GHC!" | |
| pushd ghc-7.8.3 | |
| make install | |
| popd | |
| # 2. Move package.conf.d to settings | |
| #mkdir -p $settingsDir/ghc/ | |
| #mv $libDir/ghc-7.8.3/package.conf.d $settingsDir/ghc/ | |
| #rm $settingsDir/ghc/package.conf.d/package.cache | |
| sed -i -e '/^PKGCONF=/c\ | |
| PKGCONF='"$settingsDir"'/ghc/package.conf.d' $prefix/bin/ghc-pkg-7.8.3 | |
| unset GHC_PACKAGE_PATH | |
| # 3. We build cabal here, instead of in BUILD() as we need our installed GHC | |
| echo "Building and installing Cabal!" | |
| #if [ ! -e $libDir/ghc-7.8.3/package.conf.d/package.cache ] ; then | |
| # echo "Warning: recreating default package.conf.d..." | |
| # rm -rf $libDir/ghc-7.8.3/package.conf.d | |
| # $prefix/bin/ghc-pkg init $libDir/ghc-7.8.3/package.conf.d | |
| #fi | |
| # move package.conf.d files to the right place... | |
| mv $libDir/ghc-7.8.3/package.conf.d/*.conf $settingsDir/ghc/package.conf.d/ | |
| $prefix/bin/ghc-pkg recache | |
| # now we should be ready to configure/install... | |
| for pkg in zlib-0.5.4.1 random-1.0.1.3 mtl-2.1.3.1 stm-2.4.3 text-1.2.0.0 parsec-3.1.7 network-2.6.0.2 network-uri-2.6.0.1 HTTP-4000.2.18 cabal-install-1.18.0.4; do | |
| tar zxf $portDir/download/$pkg.tar.gz | |
| pushd $pkg | |
| if [ -e $portDir/download/$pkg.patch ]; then | |
| patch -Np1 < $portDir/download/$pkg.patch | |
| fi | |
| # we didn't build the vanilla way for GHC, so disable here too: --disable-library-vanilla | |
| $prefix/bin/runghc -package-db --ghc-arg=$settingsDir/ghc/package.conf.d Setup.* configure --disable-library-vanilla --enable-executable-dynamic \ | |
| --enable-shared --with-ghc=$prefix/bin/ghc --package-db=$settingsDir/ghc/package.conf.d \ | |
| --bindir=$prefix/bin --docdir=$docDir --libexecdir=$libExecDir --datadir=$dataDir \ | |
| --libdir=$libDir --prefix=$prefix --sysconfdir=$sysconfDir | |
| $prefix/bin/runghc -package-db --ghc-arg=$settingsDir/ghc/package.conf.d Setup.* build -v | |
| $prefix/bin/runghc -package-db --ghc-arg=$settingsDir/ghc/package.conf.d Setup.* install -v | |
| popd | |
| rm -rf $pkg | |
| done | |
| # 4. Setup the cabal configuration | |
| mkdir -p /tmp/home | |
| export HOME=/tmp/home | |
| $prefix/bin/cabal update | |
| export CONFIG=/tmp/home/config/settings/cabal/config | |
| sed -i -e 's/-- library-vanilla:.*/library-vanilla: False/' $CONFIG | |
| sed -i -e 's/-- executable-dynamic:.*/executable-dynamic: True/' $CONFIG | |
| sed -i -e 's/-- user-install:.*/user-install: False/' $CONFIG | |
| sed -i -e 's/ -- libsubdir:.*/ libsubdir:/g' $CONFIG | |
| sed -i -e 's/ -- ar-location:.*/ ar-location: \/bin\/x86\/ar/' $CONFIG | |
| sed -i -e 's/ -- gcc-location:.*/ gcc-location: \/bin\/x86\/gcc/' $CONFIG | |
| sed -i -e 's/ -- ld-location:.*/ ld-location: \/bin\/x86\/ld/' $CONFIG | |
| sed -i -e 's/ boot\//\/boot\//g' $CONFIG | |
| # fix occurences of " boot/" -> "/boot/" | |
| # and upgrade our cabal to the latest -- at time of writing, this is 1.22.0.0 | |
| $prefix/bin/cabal install cabal-install --with-ghc=$prefix/bin/ghc --package-db=$settingsDir/ghc/package.conf.d \ | |
| --bindir=$prefix/bin --docdir=$docDir --libexecdir=$libExecDir --datadir=$dataDir \ | |
| --libdir=$libDir --prefix=$prefix --sysconfdir=$sysconfDir | |
| mkdir -p $settingsDir/cabal | |
| mv $CONFIG $settingsDir/cabal/config | |
| # In theory, we should be finished, and have a working GHC installation... now just needs testing! :p | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment