#-*-mode: Shell-script; coding: utf-8;-*- # Maintainer: Mitch Tishmack # # Build/bootstrap ghc similarly to the go package. # Caveat: bootstrapping isn't a commonly tested piece of ghc. # # Note: This only exists to build the native ghc. It is # huge in size and slow and also intentionally lacks modules # in the native compiler. pkgname=ghc-bootstrap pkgver=8.0.2 pkgrel=1 pkgdesc="The Glasgow haskell compiler (bootstrapped)" license="custom:bsd3" url="https://haskell.org" depends="bash libffi musl zlib gcc binutils-gold llvm3.7" install="" subpackages="" makedepends="" source="http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-x86_64.tar.xz" # The bootstrap process uses docker to build ghc from a debian glibc host # then upload the bootstrap compiler to where that source url is. # # Ensure that docker is running prior to calling this. # # Note, this docker image is large, ~10G the dockerfile wasn't built # to be small. Once built the container should likely be removed. snapshot() { docker build -t alpine-ghc-bootstrap:x86_64 -f Dockerfile.x86_64 . \ || return 1 docker run -a stdout alpine-ghc-bootstrap:x86_64 \ /bin/cat "/tmp/ghc-${pkgver}-x86_64.tar.xz" > ghc-${pkgver}-x86_64.tar.xz || return 1 } package() { cd "$srcdir/x86_64" install -d "$pkgdir" || return 1 mv usr "$pkgdir" || return 1 local settings="$(find $pkgdir -name settings -type f)" sed -i 's/C compiler supports -no-pie\"\, \"NO\"/C compiler supports -no-pie\"\, \"YES\"/' "$settings" || return 1 sed -i 's|/usr/.*-gcc|gcc|' "$settings" || return 1 sed -i 's|/usr/.*-ar|ar|' "$settings" || return 1 sed -i 's|/usr/.*-ld.gold|ld.gold|' "$settings" || return 1 sed -i 's|/usr/.*-ld|ld.gold|' "$settings" || return 1 sed -i 's|/usr/.*/llc|llc-3.7|' "$settings" || return 1 sed -i 's|/usr/.*/opt|opt-3.7|' "$settings" || return 1 } sha512sums="84404cd23677755e010e90c357e7eea940524531ae82bd70d215fda61fc63c1ef4c367b3fe7a938e8d8f415d8130ae98e77eee122450a80b41099b623fa99f9f ghc-8.0.2-x86_64.tar.xz"