aboutsummaryrefslogtreecommitdiffstats
path: root/community/ghc/APKBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'community/ghc/APKBUILD')
-rw-r--r--community/ghc/APKBUILD182
1 files changed, 84 insertions, 98 deletions
diff --git a/community/ghc/APKBUILD b/community/ghc/APKBUILD
index 59ed36933b4..88466b457dc 100644
--- a/community/ghc/APKBUILD
+++ b/community/ghc/APKBUILD
@@ -1,20 +1,21 @@
-# Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com>
+# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Contributor: Mitch Tishmack <mitch.tishmack@gmail.com>
+# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=ghc
-pkgver=8.8.4
-_llvmver=11
+# XXX: GHC is tightly coupled with community/cabal-stage0.
+# Only update to GHC versions supported by cabal bootstrapping setup.
+pkgver=9.8.2
pkgrel=1
+# GHC version used to bootstrap the build. This is relevant for the
+# bootstrapping of the Hadrian build system used by GHC these days.
+_bootstrapver=9.8.2
# Normal non rc candidate
_urlprefix="$pkgver"
_pkgprefix="$pkgname-$pkgver"
+_llvmver=15
pkgdesc="The Glasgow Haskell Compiler"
-# Next 5 variables only needed for release candidate testing
-#pkgrcver=8.2.2
-#pkgrc=rc3
-#pkgdate=20171108
-#urlprefix="$pkgrcver-$pkgrc"
-#pkgprefix="ghc-$pkgver.$pkgdate"
-url="https://haskell.org/"
-arch="x86_64"
+url="https://haskell.org/ghc"
+arch="aarch64 x86_64"
# Note ghc's license is basically BSD-3. If you'd like to know more visit:
# * https://www.haskell.org/ghc/license
# * https://ghc.haskell.org/trac/ghc/wiki/Licensing
@@ -23,92 +24,74 @@ license="BSD-3-Clause"
#
# Ref: https://ghc.haskell.org/trac/ghc/wiki/Status/GHC-8.0.1
# https://ghc.haskell.org/trac/ghc/wiki/ImprovedLLVMBackend
-depends="gmp-dev perl gcc>=6.2.1 llvm$_llvmver libffi-dev"
+#
+# Without libffi-dev in $depends linking of software via ghc(1) fails.
+depends="gmp-dev libffi-dev perl gcc>=6.2.1 llvm$_llvmver"
# ghc is self-hosted, so we need ghc to build ghc. ghc-bootstrap is provided by
# this aport (see below).
-makedepends_build="$pkgname-bootstrap
- autoconf cpio binutils binutils-gold libffi-dev ncurses-dev xz coreutils grep"
-makedepends_host="linux-headers musl-dev zlib-dev gmp-dev binutils-dev libffi-dev ncurses-dev cpio" # need GNU cpio
+makedepends_build="$pkgname-bootstrap~=$_bootstrapver
+ autoconf automake binutils libffi-dev ncurses-dev xz coreutils grep py3-sphinx"
+makedepends_host="linux-headers musl-dev zlib-dev gmp-dev binutils-dev
+ libffi-dev ncurses-dev"
makedepends="$makedepends_build $makedepends_host"
-checkdepends="python3"
+checkdepends="python3 diffutils bash"
# XXX: ghc-bootstrap is a hack to allow this abuild to depend on itself.
# Adding "ghc" to makedepends would not work, because abuild implicitly removes
# $pkgname and $subpackages from the abuild's dependencies.
provides="$pkgname-bootstrap=$pkgver-r$pkgrel"
subpackages="$pkgname-doc $pkgname-dev"
install="$pkgname.post-install"
-options="!strip" # we strip it manually in build()
+ldpath="/usr/lib/ghc-$pkgver"
+options="!strip ldpath-recursive" # we strip it manually in build()
source="https://downloads.haskell.org/~ghc/$_urlprefix/$_pkgprefix-src.tar.xz
https://downloads.haskell.org/~ghc/$_urlprefix/$_pkgprefix-testsuite.tar.xz
- 0005-buildpath-abi-stability.patch
- fix-testsuite.patch
- 0001-testsuite-unset-MAKEFLAGS-when-calling-python.patch
- 0001-testsuite-Fix-T8602-on-musl.patch
- 0001-testsuite-Ensure-that-ffi005-output-order-is-predict.patch
- 0001-testsuite-Ensure-T5423-flushes-C-output-buffer.patch
- 0001-testsuite-Skip-broken-tests-on-Alpine.patch
- 0001-testsuite-T12600-avoid-broken-pipe-on-Alpine.patch
- autoconf-ac-prog-c99-fix.patch
+ $pkgname-$pkgver-hadrian-ghc-$_bootstrapver.tar.gz::https://dev.alpinelinux.org/archive/ghc-hadrian/ghc-$pkgver/ghc-$_bootstrapver-hadrian-bootstrap-source.tar.gz
+
+ ghc-self-bootstrap.patch
+ fix-T21035.patch
+ fix-T7060.patch
"
-# We only need the bootstrap patch when bootstrapping a new arches ghc.
-if [ "$CBUILD" != "$CTARGET" ]; then
- source="$source 0000-bootstrap.patch"
-fi
+# Adjust path for specific LLVM version target by GHC.
+export PATH="$PATH:/usr/lib/llvm$_llvmver/bin"
-prepare() {
- default_prepare
-
- cp mk/build.mk.sample mk/build.mk
-
- cat >> mk/build.mk <<-EOF
- BuildFlavour = perf-llvm
- INTEGER_LIBRARY = integer-gmp
- BeConservative = YES
- GhcStage3HcOpts += -O3
- SplitSections = YES
- EOF
-
- if [ "$CBUILD" != "$CTARGET" ]; then
- # cross-build
- cat >> mk/build.mk <<-EOF
- BuildFlavour = perf-cross
- HADDOCK_DOCS = NO
- BUILD_SPHINX_HTML = NO
- BUILD_SPHINX_PS = NO
- BUILD_SPHINX_PDF = NO
- EOF
- fi
+case "$CARCH" in
+aarch64)
+ # 116 more failures
+ options="$options !check"
+ ;;
+esac
- # Due to patches to the configure script
- autoreconf -fi
-}
+_hadrian="hadrian/bootstrap/_build/bin/hadrian"
+_hadrian_args="-j${JOBS:-1}"
-build() {
- local ffi_inc=$(pkg-config libffi --cflags-only-I); ffi_inc="${ffi_inc%% }"
- local ffi_lib=$(pkg-config libffi --libs-only-L); ffi_lib="${ffi_lib%% }"
+if [ "$CBUILD" != "$CTARGET" ]; then
+ _hadrian_args="$_hadrian_args --docs=none --flavour=quickest"
+else
+ _hadrian_args="$_hadrian_args --docs=no-sphinx-pdfs --flavour=release"
+fi
- GHCLD=${CROSS_COMPILE}ld.gold
+build() {
+ # Build the hadrian build system.
+ #
+ # See:
+ # * https://gitlab.haskell.org/ghc/ghc/-/tree/master/hadrian/bootstrap
+ # * https://www.haskell.org/ghc/blog/20220805-make-to-hadrian.html
+ cd hadrian/bootstrap/
+ ./bootstrap.py -w /usr/bin/ghc -s "$srcdir"/$pkgname-$pkgver-hadrian-ghc-$_bootstrapver.tar.gz
# NOTE: ghc build system requires host == build, and it ends up
# compiling the cross-compiler (stage1) and cross-compiling with
# that the native compiler (stage2)
+ cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CBUILD \
--target=$CTARGET \
--prefix=/usr \
--with-system-libffi \
- ${ffi_inc:+--with-ffi-includes="${ffi_inc#-I}"} \
- ${ffi_lib:+--with-ffi-libraries="${ffi_lib#-L}"} \
- --with-ar=${CROSS_COMPILE}ar \
- --with-nm=${CROSS_COMPILE}nm \
- --with-ranlib=${CROSS_COMPILE}ranlib \
- --with-objdump=${CROSS_COMPILE}objdump \
--disable-ld-override \
- CONF_CPP_OPTS_STAGE0=" $ffi_inc $ffi_lib " \
- CONF_CC_OPTS_STAGE0=" $ffi_inc $ffi_lib " \
- LD=$GHCLD
+ LD=${LD:-ld}
# Switch llvm-targets from unknown-linux-gnueabihf->alpine-linux
# so we can match the llvm vendor string alpine uses
@@ -116,25 +99,35 @@ build() {
sed -i -e 's/unknown-linux-gnueabi/alpine-linux/g' llvm-targets
sed -i -e 's/unknown-linux-gnu/alpine-linux/g' llvm-targets
- make
+ "$_hadrian" $_hadrian_args
}
check() {
- cd "$builddir/testsuite"
- make fast SKIP_PERF_TESTS=YES THREADS=$JOBS
-}
-
-doc() {
- default_doc
- install -Dm644 "$builddir/LICENSE" \
- "$subpkgdir/usr/share/licenses/$subpkgname/LICENSE"
+ # Broken tests are known upstream to be broken on musl.
+ # See: https://gitlab.haskell.org/ghc/ghc/-/commit/cdd45a61ecfc34d3610dff4b654f1bca5dcb6829
+ "$_hadrian" $_hadrian_args test --skip-perf --test-speed=fast \
+ --broken-test=encoding004 --broken-test=T10458 \
+ --broken-test=linker_unload_native
}
package() {
- local ghclib="usr/lib/ghc-$pkgver"
+ local ghclib="$pkgdir/usr/lib/ghc-$pkgver/lib"
local newpath path target
- make DESTDIR="$pkgdir" install
+ # Hadrian's install command doesn't support DESTDIR.
+ # Hence, we need to install via the bindist.
+ "$_hadrian" $_hadrian_args binary-dist-dir
+ cd _build/bindist/ghc-*
+ # Need to re-run configure.
+ # See: https://gitlab.haskell.org/ghc/ghc/-/issues/22058
+ ./configure --prefix=/usr \
+ --with-system-libffi \
+ --disable-ld-override \
+ LD=${LD:-ld}
+ make DESTDIR="$pkgdir" RECACHE_PACKAGE_DB=NO install
+
+ install -Dm644 "$builddir/LICENSE" \
+ "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
cd "$pkgdir"
@@ -155,12 +148,12 @@ package() {
mv "$path" "$newpath"
fi
done
-
- # Remove triplet prefix from settings -- the intention is
- # that the native compiler will use native gcc/ld on the target.
- sed -i "s|$CTARGET-||g" usr/lib/$CTARGET-ghc-$pkgver/settings
fi
+ # Remove triplet prefix from settings -- the intention is
+ # that the native compiler will use native gcc/ld on the target.
+ sed -i "s|$CTARGET-||g" "$ghclib"/settings
+
# Can't do a full strip on archives.
find . -type f \( -name "*.so" -o -name "*.a" \) \
-exec ${CROSS_COMPILE}strip --strip-unneeded {} \;
@@ -177,21 +170,14 @@ dev() {
install -dm755 "$subpkgdir"
- local pfiles=$(find . \( -type f -o -type l \) \( -name "*.p_*" -o -name "lib*_p.a" \))
- echo "$pfiles" | cpio -pamVd "$subpkgdir"
- echo "$pfiles" | xargs rm -fr
+ amove $(find . \( -type f -o -type l \) \( -name "*.p_*" -o -name "lib*_p.a" \))
}
sha512sums="
-efd23bd819f7429486696a3a929a040471db7ea8a2d1f1d832e4cf0825b9e1e0c5e6ecad0ab8376f58b74e9c28c1d2f773bd126596d6d853c9e57d57e5ceb090 ghc-8.8.4-src.tar.xz
-79d8fb0ba8de0fb48c938bd54c8c3278f1895d8ce5c700ce8cf6b3fc550073bb757208e85d4f9818400ebecca96f51d9248b8bbdac9eb2995671756164d08c16 ghc-8.8.4-testsuite.tar.xz
-e1c2cef06d307eda4b35521204e95eb54ace5dbcd22de659e95356f884b4424d6304365e4ab45c5116192cba4c095e2e91114bc7cb73d7c7173a7035287d0854 0005-buildpath-abi-stability.patch
-6be1706f430883ff71bcbf18c2d17add6f54b6c4eaf902f519bb7c553acc8922f7eb718eda0a5ec8a108c91eb66da1471b45c4a03b71f2019b6dc16b27c3b8bb fix-testsuite.patch
-ac2ad793b4d33ea890e236820af4cd10996b47d0f4249c825b31450145cb8195c2be62f2d7942cc3bf564f768dca187379196b251f4b37ed326ed2a0a5f59e8a 0001-testsuite-unset-MAKEFLAGS-when-calling-python.patch
-3e955b3e025e7dc6521c8545107c747506cdf40aef55210cbc0b0a7adc8a1ac1b5206f2766dd13dbb114c7fb943e439864774422928f7a4ad10484a5e80ac09c 0001-testsuite-Fix-T8602-on-musl.patch
-cc552b3d01b8d1a31d7a609dc5c82dc7d602a14f427a2594abfdd5c1d6e92d6cf47aafd9cc46e84e2c678e040039b98c673f3dc88efa809f221e75110850f60a 0001-testsuite-Ensure-that-ffi005-output-order-is-predict.patch
-6be53550fee8e59b63355a1f4ce6ef0a5fdc545008a7808a50cb1d0c1b5219e4b2c215f21ae0e2f953486e88dc7c5f1d193b01190553405e620fa3ac9dd31a61 0001-testsuite-Ensure-T5423-flushes-C-output-buffer.patch
-328433df26351acfe67c61c14a365d6b942c7d9d51bfbe099e9f6e26f147a78f3ce5be350df2e896bd179c27b80e0b2a98e0fb8a7590920edca866ed7dc22a39 0001-testsuite-Skip-broken-tests-on-Alpine.patch
-b71bb7945c6cae3ea324ff1de9576b883f0e63169fbe50d781acc0f4fb694387c43bf7aa1bd1cca236613ff202dd503c4577dc06368614752affdc54a5c62101 0001-testsuite-T12600-avoid-broken-pipe-on-Alpine.patch
-000a6f764ae8c8070b39e35193bfa74121a831fa691b699f1e143d72bf96c51212e8c79e62a4d63f83ed685b9132751750f7204d22456fd9865620c4bcd8ec89 autoconf-ac-prog-c99-fix.patch
+9b677d5ead5ebb5df7bc960055a76ef00e68ed8102844997b12154bf71bdbfafdfff9ca31edce86b3df759242a7c98f52a464887973b53985f54ecd9fc4b4627 ghc-9.8.2-src.tar.xz
+e7766fcd98b4f70400d94ec33b39e633c2f6ab788f3b3e8431bb75e1f2a62081fc4c77e8d39b624702662168c3b5f7715d9b7866835f78d766dfa244feafe9d1 ghc-9.8.2-testsuite.tar.xz
+e5961b6de84ebe5095ad77c8c94ab328a8ab652b8acf3b832e8ab3beaf11cd7b869da56231206ec7a279e4f511b991a2fab7079e34e9f7bbe0ac66001031597a ghc-9.8.2-hadrian-ghc-9.8.2.tar.gz
+1a97002ec396d532af881e712377d80748fa9f6693931d961634524cab1ef681141b0f69ef007c0c8cd404c4e673c08b254880a581eac34dcfc49daaddb97f9f ghc-self-bootstrap.patch
+be5a8639b151b7828ad50b0f63775d34411d971aae73b0fe5c0226e4c70d1ee8353545b1d04c8de7825730b6d73a2e75f855757348b5ffa2d620d20d7e57f8c6 fix-T21035.patch
+28433f5e86b571ef591ee61153c804eb4a540fda120b7a7aa14f39af46eda6917361d0cd41127356e20f24cf5b9d493ae404023eae31b863c2485fb8cffa0c6a fix-T7060.patch
"