aboutsummaryrefslogtreecommitdiffstats
path: root/community/ghc/APKBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'community/ghc/APKBUILD')
-rw-r--r--community/ghc/APKBUILD149
1 files changed, 84 insertions, 65 deletions
diff --git a/community/ghc/APKBUILD b/community/ghc/APKBUILD
index c68012c2624..a01b7699ba2 100644
--- a/community/ghc/APKBUILD
+++ b/community/ghc/APKBUILD
@@ -1,11 +1,18 @@
-# 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=9.0.1
+# XXX: GHC is tightly coupled with community/cabal-stage0.
+# Only update to GHC versions supported by cabal bootstrapping setup.
+pkgver=9.4.8
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.4.8
# Normal non rc candidate
_urlprefix="$pkgver"
_pkgprefix="$pkgname-$pkgver"
-_llvmver=12
+_llvmver=14
pkgdesc="The Glasgow Haskell Compiler"
# Next 5 variables only needed for release candidate testing
#pkgrcver=8.2.2
@@ -13,8 +20,8 @@ pkgdesc="The Glasgow Haskell Compiler"
#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,15 +30,17 @@ 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"
+#
+# 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 binutils binutils-gold libffi-dev ncurses-dev xz coreutils grep"
+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.
@@ -42,55 +51,57 @@ 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
+ $pkgname-$pkgver-hadrian-ghc-$_bootstrapver.tar.gz::https://dev.alpinelinux.org/archive/ghc-hadrian/ghc-$pkgver/ghc-$_bootstrapver-hadrian-bootstrap-source.tar.gz
- 0001-Replace-more-autotools-obsolete-macros-19189.patch
- 0002-configure-fix-the-use-of-some-obsolete-macros-19189.patch
- 0003-llvmGen-Accept-range-of-LLVM-versions.patch
- 0004-Fix-autoconf-after-6d6edb1bbb.patch
- 0005-Set-min-LLVM-version-to-9-and-make-version-checking-.patch
- 0006-Optimiser-Correctly-deal-with-strings-starting-with-unicode.patch
-
- 0005-buildpath-abi-stability.patch
0001-testsuite-unset-MAKEFLAGS-when-calling-python.patch
- 0001-testsuite-T12600-avoid-broken-pipe-on-Alpine.patch
- skip-tests.patch
- "
+ 0001-testsuite-Make-tests-compatible-with-GNU-grep-3.8.patch
+ 0005-buildpath-abi-stability.patch
-prepare() {
- default_prepare
+ llvm14.patch
+ fix-T7060.patch
+ fix-T21035.patch
+ "
- cp mk/build.mk.sample mk/build.mk
+# Adjust path for LLVM-14.
+export PATH="$PATH:/usr/lib/llvm14/bin"
- cat >> mk/build.mk <<-EOF
- BuildFlavour = perf-llvm
- EOF
+case "$CARCH" in
+aarch64)
+ # 116 more failures
+ options="$options !check"
+ ;;
+esac
- 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
+_hadrian="hadrian/bootstrap/_build/bin/hadrian"
+_hadrian_args="-j${JOBS:-1}"
- # Due to patches to the configure script
- autoreconf -fi
-}
+if [ "$CBUILD" != "$CTARGET" ]; then
+ _hadrian_args="$_hadrian_args --docs=none --flavour=quickest"
+else
+ _hadrian_args="$_hadrian_args --docs=no-sphinx-pdfs --flavour=release"
+fi
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 \
- --disable-ld-override
+ --disable-ld-override \
+ LD=${LD:-ld}
# Switch llvm-targets from unknown-linux-gnueabihf->alpine-linux
# so we can match the llvm vendor string alpine uses
@@ -98,24 +109,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() {
- make fasttest SKIP_PERF_TESTS=YES THREADS=${JOBS:-$(nproc)}
-}
-
-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"
@@ -136,12 +158,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 {} \;
@@ -162,16 +184,13 @@ dev() {
}
sha512sums="
-bee7950a5118be8d8cefe0db5070139a5a93ca21c5bc6f8bf453429831f0c44f5e0fb5ee569865d6b8b92749044ee4123be06920928ac7a1ec9cffa9404a3e53 ghc-9.0.1-src.tar.xz
-13fbe0f0ab5e2426820d0fb37f0a75e1198ef2a660398508806e8ef094fd23647ca3d386815a2118168d12253d8df3273043678dbb37cf3924c689dd0fd1932e ghc-9.0.1-testsuite.tar.xz
-6390cb76b7786efb89acc854fdf68766c149412dddbf8c5f399aa90e204e704d6e476e6d850361d66e8e821e1a69dc55cb6b3b883dcd02e9ec5c6f5288ee280b 0001-Replace-more-autotools-obsolete-macros-19189.patch
-c1a4906f4a0a3abf5b2ed03a3d24c6ab097910f3fab5486c443dfc87ffbba399f95218663421ebf7e43d6d066ff0b364931d9bc3e5aa2162684f8b8511bc7531 0002-configure-fix-the-use-of-some-obsolete-macros-19189.patch
-cb90cf9c3af2704acb15e9c18b1b7d6b1de32bc4014c3d631e3d34bdf07ef91b03869b0ae3721ab73acb9f7dbd2e2805462e10c9c5431ed17464dd274121228a 0003-llvmGen-Accept-range-of-LLVM-versions.patch
-775ef373ed60f752138d5ff728c2205b7d18ec72d8cf86152f6473a154003d0c9379d82310aeca2211123bfe48f6a5414af00d50a26680638b6db9718160199e 0004-Fix-autoconf-after-6d6edb1bbb.patch
-b3aeaf4c4f9e816350b97f1060cb2de3f9dcacd2c10c714cceb5e50d47ad94e845c2dae63eea22d806437c307ab6f561bfb385ec98087465c4172e22d755f402 0005-Set-min-LLVM-version-to-9-and-make-version-checking-.patch
-8523a5fef22e391c668e315d115792c90de072e817f7a171e0c94e360684536e5c75eabe8a02ca73029431fb32462096bbdf6b8210dc862f72a79e28ec0ca27a 0006-Optimiser-Correctly-deal-with-strings-starting-with-unicode.patch
-4133c70bb46b7aba9b8eba87cdbd58d802584e5e8ffb01450c80bb4607e6e90a45a437ea142aa8a8cb199dc6f46e769437c3c47769976093490de71161a3943d 0005-buildpath-abi-stability.patch
+e5cfb30adc73dc0054f5db2921e5f255c8a980e005798882a2e9daa8df2409ddbe1ec6403e1f6862efc9e4700db4b68d5cae36999d77c7d3fd2fe0ab51cb9923 ghc-9.4.8-src.tar.xz
+a4291722e95d2d0b9f84de11fe30f88be98ab83904f4cdc37f8d81db30baa75ebaf11ca23049fb4418d69d4a5da8fb63d248b97495fc5cd29d1adb20fbd0ea99 ghc-9.4.8-testsuite.tar.xz
+d26eedf79071629f194eb3ef9dc64c2c2bcbaecab79e2af85928ce057bb37a41a908ce4da396df8cffe985db5f8b57643e6e318d8c5a79abef1032abaffee4da ghc-9.4.8-hadrian-ghc-9.4.8.tar.gz
ac2ad793b4d33ea890e236820af4cd10996b47d0f4249c825b31450145cb8195c2be62f2d7942cc3bf564f768dca187379196b251f4b37ed326ed2a0a5f59e8a 0001-testsuite-unset-MAKEFLAGS-when-calling-python.patch
-b71bb7945c6cae3ea324ff1de9576b883f0e63169fbe50d781acc0f4fb694387c43bf7aa1bd1cca236613ff202dd503c4577dc06368614752affdc54a5c62101 0001-testsuite-T12600-avoid-broken-pipe-on-Alpine.patch
-253dab8d9eea886b085c8136b313bb753997a1fed0fcdea15848ccaa51a3a2230298df858a893f996054f27e9add2259bf1938e3afd07c8a50d84b9152c095be skip-tests.patch
+524dec6a4fc2ce45f7a35f089f936fb3020aa8283612de6f0dad34146213df638d654c0943147c77126d54c24f632edc53a0400f1af15bfe0d9d3f20cc4ae869 0001-testsuite-Make-tests-compatible-with-GNU-grep-3.8.patch
+b9339a7220bab708eff6233db610f900183cd75b59c4fb479c557b1ef8dd7ccca258da2305218f18ba576c3561d048ce2c07deab3c78c15309e6bb1d1d8342d7 0005-buildpath-abi-stability.patch
+2dbfec447171dbe86b34fe7bd99c61376c25f5713b19876d4b59eeedcbb7158eee604e278a6430cb9fd5eb61985ea526c376f6f9fb1837759bed4939c18192fa llvm14.patch
+28433f5e86b571ef591ee61153c804eb4a540fda120b7a7aa14f39af46eda6917361d0cd41127356e20f24cf5b9d493ae404023eae31b863c2485fb8cffa0c6a fix-T7060.patch
+be5a8639b151b7828ad50b0f63775d34411d971aae73b0fe5c0226e4c70d1ee8353545b1d04c8de7825730b6d73a2e75f855757348b5ffa2d620d20d7e57f8c6 fix-T21035.patch
"