aboutsummaryrefslogtreecommitdiffstats
path: root/testing/idris/APKBUILD
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-05-16 01:36:03 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-05-17 13:38:42 +0200
commitbf5f52db4540a8eac95a255c1b9b3c226ae08e49 (patch)
tree6bf1689a4d7ea7675db6b1fea97c987a2913482b /testing/idris/APKBUILD
parent735829e7c6918524a9f139fc9dd95cf8c73f326d (diff)
downloadaports-bf5f52db4540a8eac95a255c1b9b3c226ae08e49.tar.bz2
aports-bf5f52db4540a8eac95a255c1b9b3c226ae08e49.tar.xz
testing/idris: use cabal freeze and sandbox for great good
Diffstat (limited to 'testing/idris/APKBUILD')
-rw-r--r--testing/idris/APKBUILD96
1 files changed, 68 insertions, 28 deletions
diff --git a/testing/idris/APKBUILD b/testing/idris/APKBUILD
index 4f8bb22b6e..2222b3c30d 100644
--- a/testing/idris/APKBUILD
+++ b/testing/idris/APKBUILD
@@ -1,4 +1,9 @@
+# Contributor: Mitch Tishmack <mitch.tishmack@gmail.com>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com>
+#
+# Note: This abuilds downloads Haskell dependencies in the prepare phase
+# without any verification!
pkgname=idris
pkgver=1.0
pkgrel=0
@@ -9,44 +14,78 @@ license="BSD3"
depends="gmp-dev gcc"
makedepends="ghc cabal libffi-dev ncurses-dev zlib-dev"
subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::https://github.com/idris-lang/Idris-dev/archive/v$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/idris-lang/Idris-dev/archive/v$pkgver.tar.gz
+ cabal.config"
builddir="$srcdir/Idris-dev-$pkgver"
-_home="$builddir/deps"
-_tmp="$builddir/tmp"
+export CABAL_CONFIG="$srcdir/cabal/cabal.config"
+
+cabal_update() {
+ msg "Updating constraints"
+
+ cd "$builddir"
+
+ # Create cabal config and fetch index.
+ HOME="${CABAL_CONFIG%/*}" cabal update
+
+ # Resolve deps and generate fresh cabal.config with version constraints.
+ rm -f cabal.config
+ cabal freeze
+
+ # Add version tag at the first line.
+ sed -i "1i--$pkgver" cabal.config
+
+ mv cabal.config "$startdir"/
+
+ cd "$startdir"
+ abuild checksum
+}
prepare() {
default_prepare
+ if [ "$(head -n 1 "$srcdir"/cabal.config)" != "--$pkgver" ]; then
+ die "Requirements file is outdated, run 'abuild cabal_update'"
+ fi
+
cd "$builddir"
- mkdir -p "$_tmp" "$_home"
- (
- export HOME="$_home"
- export TMPDIR="$_tmp"
- cabal update
- cabal install libffi -v
- cabal install --dependencies-only -v
- )
+
+ # Create cabal config and fetch index.
+ HOME="${CABAL_CONFIG%/*}" cabal update
+
+ # Cabal implicitly loads cabal.config from the project's directory.
+ ln -sf "$srcdir"/cabal.config .
+
+ # Create Cabal sandbox that will be used for all subsequent cabal
+ # invocations. This is something like Python virtual env.
+ cabal sandbox init
+
+ # Fetch all dependencies.
+ # XXX: This should always fetch the same versions as defined in
+ # our cabal.config, but Cabal does not verify packages integrity!
+ cabal fetch libffi .
}
build() {
cd "$builddir"
- (
- export HOME="$_home"
- export TMPDIR="$_tmp"
- # Note, ordering of prefixes is important!
- cabal configure --prefix='/usr' \
- --docdir='$prefix/share/doc' \
- --datadir='$prefix/share' \
- --htmldir='$docdir/html' \
- --libdir='$prefix/lib' \
- --libsubdir="$pkgname" \
- --datasubdir="$pkgname" \
- --dynlibdir="$pkgname" \
- --disable-shared \
- --flags='GMP FFI standalone'
- cabal build
- )
+
+ # Build dependencies.
+ cabal install --offline -v libffi
+ cabal install --only-dependencies --offline -v
+
+ # Note: ordering of prefixes is important!
+ cabal configure \
+ --prefix='/usr' \
+ --docdir='$prefix/share/doc' \
+ --datadir='$prefix/share' \
+ --htmldir='$docdir/html' \
+ --libdir='$prefix/lib' \
+ --libsubdir="$pkgname" \
+ --datasubdir="$pkgname" \
+ --dynlibdir="$pkgname" \
+ --disable-shared \
+ --flags='GMP FFI standalone'
+ cabal build
}
# TODO: Run upstream tests and/or figure out how to set paths to be able
@@ -73,4 +112,5 @@ package() {
mv usr/share/doc/LICENSE usr/share/licenses/$pkgname/
}
-sha512sums="a350004a8510f01d1cc8f965a9a4e2dab219f003980b98354ebb5ae42f73b32c90c98dce193943e9709d994cb92ad35814a46b79412a1afc85d42e1018c6ba10 idris-1.0.tar.gz"
+sha512sums="a350004a8510f01d1cc8f965a9a4e2dab219f003980b98354ebb5ae42f73b32c90c98dce193943e9709d994cb92ad35814a46b79412a1afc85d42e1018c6ba10 idris-1.0.tar.gz
+e078892987816012034295be81118fbc710e3dbf08af18257e5390fc159bb5d64e1aae8a802835ca92b1e0d065524833d657bc9edffc9ebefc8cb5c02935694a cabal.config"