aboutsummaryrefslogtreecommitdiffstats
path: root/community/cabal/APKBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'community/cabal/APKBUILD')
-rw-r--r--community/cabal/APKBUILD91
1 files changed, 72 insertions, 19 deletions
diff --git a/community/cabal/APKBUILD b/community/cabal/APKBUILD
index dc08a1e1d50..2ba0f57efa4 100644
--- a/community/cabal/APKBUILD
+++ b/community/cabal/APKBUILD
@@ -1,35 +1,88 @@
# Contributor: Steeve Chailloux <steeve.chailloux@orus.io>
-# 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=cabal
-pkgver=3.2.0.0
+pkgver=3.10.3.0
pkgrel=0
pkgdesc="The Haskell Cabal"
-url="https://haskell.org/"
-arch="x86_64"
+url="https://haskell.org/cabal"
+arch="aarch64 x86_64" # Limited by GHC
license="BSD-3-Clause"
-depends="gmp zlib"
-makedepends="ghc gmp-dev libffi-dev zlib-dev binutils-gold chrpath"
-options="!check" # todo
+depends="ghc gmp zlib curl"
+makedepends="ghc>=9.4.6 gmp-dev libffi-dev zlib-dev cabal-bootstrap"
+options="net !check" # TODO: enable tests
+subpackages="$pkgname-doc"
source="https://hackage.haskell.org/package/cabal-install-$pkgver/cabal-install-$pkgver.tar.gz
- cabal-0001-force-ld.gold.patch
- ghc-8.8.patch
- "
+ cabal.project.freeze"
+builddir="$srcdir/cabal-install-$pkgver"
-builddir="$srcdir/$pkgname-install-$pkgver"
+# We currently don't package Haskell dependencies in aports. As such,
+# building cabal requires a pre-existing cabal version to download all
+# dependencies of the cabal package itself. Presently, this is achieved
+# through the separate cabal-stage0 package which bootstraps cabal
+# from source using a provided Python script. From that point onward,
+# we can use the previous version of cabal to compile cabal.
+#
+# For this reason, both community/cabal-stage0 and community/cabal
+# provide the virtual cabal-bootstrap package but the former has the
+# lower priority.
+#
+# See also https://lists.alpinelinux.org/~alpine/devel/%3C33KG0XO61I4IL.2Z7RTAZ5J3SY6%408pit.net%3E
+provides="cabal-bootstrap"
+provider_priority=100 # highest
+
+# Directory were cabal files are stored.
+_cabal_home="$srcdir/dist"
+
+cabal_update() {
+ cd $builddir
+ # Build a freeze file to make the build reproducible.
+ # This freeze file is stored in $source and thus tracked in Git.
+ HOME="$_cabal_home" cabal v2-update
+ (
+ cd "$builddir"
+ HOME="$_cabal_home" cabal v2-freeze \
+ --shadow-installed-packages
+ mv cabal.project.freeze "$startdir/"
+ )
+}
+
+prepare() {
+ default_prepare
+ ln -sf "$srcdir/cabal.project.freeze" \
+ "$builddir/cabal.project.freeze"
+}
build() {
- # Note: we don't want to build profiling or shared libraries, that is why
- # EXTRA_CONFIGURE_OPTS is set
- env HOME="$builddir" EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh --jobs --no-doc
+ # ghc version path
+ export PATH="$PATH:/usr/lib/llvm15/bin"
+ HOME="$_cabal_home" cabal v2-update
+ HOME="$_cabal_home" cabal v2-build cabal-install:exes \
+ --jobs=${JOBS:-1} \
+ --prefix=/usr \
+ --docdir=/usr/share/doc/$pkgname \
+ --sysconfdir=/etc
}
package() {
- install -m 755 -D dist/build/cabal/cabal "$pkgdir/usr/bin/cabal"
- chrpath -d "$pkgdir/usr/bin/cabal"
+ # With v2- cabal no longer wants us to separate v2-build and
+ # v2-install, however, we don't want to build everything in a
+ # fakeroot. We work around this by copying binaries build in the
+ # previous step manually.
+ #
+ # See https://github.com/haskell/cabal/issues/6919#issuecomment-761563498
+ HOME="$_cabal_home" cabal list-bin cabal-install:exes | \
+ xargs install -Dm755 -t "$pkgdir"/usr/bin
+
+ mkdir -p "$pkgdir"/usr/share/man/man1
+ HOME="$_cabal_home" cabal man --raw \
+ > "$pkgdir"/usr/share/man/man1/cabal.1
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
-sha512sums="ad937b2df42b688e4608aa2b91a25daf1042e5573626202e5182cbfeca9acc5933194853405a6396c60d0d28d6d0d5c5276fd85cb6acf4be2c8cd12afe747062 cabal-install-3.2.0.0.tar.gz
-735a1aa9084d7eb7297076587cf2896af2951d4a2ecc20c5a6758a91c3751f5c212b65668befc25cfbc273633041543bda3da0fe9cee59795eeb3f40b3fb4922 cabal-0001-force-ld.gold.patch
-8d6f9c770a9f2b24ca10b81235ae339385213c260712bcd65f19fc033d740d286ab30ff669a43e9aec63372937355e2c191fcf795a846c6291a10ff3895e6503 ghc-8.8.patch"
+sha512sums="
+e004dfc05903316c3264aa7a056d287e25f0589fa9adea2e93114e1750f3ae9774177b5d274c78fee37b6ba4bd5c03455d72437258b168607c2a81856ef06ddb cabal-install-3.10.3.0.tar.gz
+0b5d4302eb326376385636e17dd42ea592f6b9395c2df7c9b14cca81b41d24629a1b6f4c65fe674b8cd072c9ee164776e88fb520c19da14f853d5d5113847775 cabal.project.freeze
+"