diff options
author | Mitch Tishmack <mitch.tishmack@gmail.com> | 2017-05-28 21:13:51 +0000 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2017-10-27 23:04:31 +0200 |
commit | cc57909e25afdd9fcefdb2cb74492e51c7ab0bb3 (patch) | |
tree | 61c18a4529acb425a0a51bc9905c6d3362f60222 /testing/idris/APKBUILD | |
parent | 002dd9d33ccb052baf19eae26c2d9fab05328251 (diff) | |
download | aports-cc57909e25afdd9fcefdb2cb74492e51c7ab0bb3.tar.bz2 aports-cc57909e25afdd9fcefdb2cb74492e51c7ab0bb3.tar.xz |
testing/idris: Fix build of idris with newer pkg versions
The use of cabal freeze only works for install/configure. cabal fetch
does not honor the cabal.config.
Ref:
https://github.com/haskell/cabal/issues/4256
Change the build to still use the freeze file, however put the cabal
directory to $srcdir/cabal, do not set CABAL_CONFIG so that constraints
get shadowed if future packages are released, when installing libffi
constrain libffi to version 0.1 and extract constraints from the
cabal.config.
Additionally, for cabal freeze add switch to ignore the base ghc packages
as they're not relevant to cabal install/fetch/build.
Finally, add any libffi transitive depdendencies missing from the cabal.config
file for idris. For now only one applies. Also force constraints manually on
cabal install libffi as cabal.config wasn't getting picked up.
Diffstat (limited to 'testing/idris/APKBUILD')
-rw-r--r-- | testing/idris/APKBUILD | 73 |
1 files changed, 59 insertions, 14 deletions
diff --git a/testing/idris/APKBUILD b/testing/idris/APKBUILD index 1d122f7428..ca52a56cf3 100644 --- a/testing/idris/APKBUILD +++ b/testing/idris/APKBUILD @@ -6,7 +6,8 @@ pkgver=1.0 pkgrel=0 pkgdesc="A Language with Dependent Types" url="http://www.idris-lang.org" -arch="x86_64" +# Note: same as ghc, if it gets ported elsewhere this should run too +arch="armhf x86_64" license="BSD3" depends="gmp-dev gcc" makedepends="ghc cabal libffi-dev ncurses-dev zlib-dev" @@ -15,7 +16,10 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/idris-lang/Idris-dev/archive cabal.config" builddir="$srcdir/Idris-dev-$pkgver" -export CABAL_CONFIG="$srcdir/cabal/cabal.config" +_cabal_home="$srcdir/cabal" + +# Prevent cabal setup from using unbounded memory +_cabal_install_opts=" --max-backjumps=10000" cabal_update() { msg "Updating constraints" @@ -23,11 +27,11 @@ cabal_update() { cd "$builddir" # Create cabal config and fetch index. - HOME="${CABAL_CONFIG%/*}" cabal update + HOME="$_cabal_home" cabal update # Resolve deps and generate fresh cabal.config with version constraints. rm -f cabal.config - cabal freeze + HOME="$_cabal_home" cabal freeze --shadow-installed-packages # Add version tag at the first line. sed -i "1i--$pkgver" cabal.config @@ -38,6 +42,41 @@ cabal_update() { abuild checksum } + +# Used by the subsequent two functions. +# This barf of a pipeline converts the cabal freeze config file lines from: +# constraints: foo ==VERSION, +# bar ==VERSION +# etc... +# To something we can more easily munge into what we need for other purposes +# aka we end up with: +# foo==VERSION bar==VERSION ... +_cabal_constraints_prime() { + printf "$(grep '==' cabal.config | \ + sed -e 's/constraints[:]//g' | \ + tr -d '[:space:]' | \ + sed -e 's/[,]/ /g')" +} + +# Take the output from above and replace =='s to -'s so we can cabal fetch +# the specific package-version's via cabal +_cabal_pkgs() { + printf "$(_cabal_constraints_prime)" | sed -e 's/==/-/g' +} + +# Similar to the above, but convert to --constraint args used for cabal install +# so that our cabal install line can use the same constraints for idris in cabal.config. +# +# This works around us running against a newer hackage index where one of the packages +# in the freeze file has a newer version that cabal install libffi could end up +# selecting due to libffi having more relaxed constraints than idris. +# +# That is: +# --constraint=foo==VERSION --constraint=bar==VERSION +_cabal_constraints() { + printf " $(_cabal_constraints_prime)" | sed -e 's/ / --constraint=/g' +} + prepare() { default_prepare @@ -48,28 +87,34 @@ prepare() { cd "$builddir" # Create cabal config and fetch index. - HOME="${CABAL_CONFIG%/*}" cabal update + HOME="$_cabal_home" 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 + HOME="$_cabal_home" cabal sandbox init # Fetch all dependencies. - cabal fetch libffi . + # Note: cabal-doctest is a transitive dependency for libffi-0.1 not idris + HOME="$_cabal_home" cabal fetch --no-dependencies $(_cabal_pkgs) \ + cabal-doctest-1.0.2 libffi-0.1 } build() { cd "$builddir" - # Build dependencies. - cabal install --offline -v libffi - cabal install --only-dependencies --offline -v + # Build dependencies + # Note: for libffi force constraints manually via the freeze file to prevent + # cabal from possibly using newer constraints for libffi that might intersect + # with those idris uses. + HOME="$_cabal_home" cabal install $_cabal_install_opts --offline --constraint=cabal-doctest==1.0.2 \ + $(_cabal_constraints) -v libffi-0.1 + HOME="$_cabal_home" cabal install $_cabal_install_opts --offline --only-dependencies -v # Note: ordering of prefixes is important! - cabal configure \ + HOME="$_cabal_home" cabal configure \ --prefix='/usr' \ --docdir='$prefix/share/doc' \ --datadir='$prefix/share' \ @@ -80,7 +125,7 @@ build() { --dynlibdir="$pkgname" \ --disable-shared \ --flags='GMP FFI standalone' - cabal build + HOME="$_cabal_home" cabal build } # TODO: Run upstream tests and/or figure out how to set paths to be able @@ -94,7 +139,7 @@ check() { package() { cd "$builddir" - cabal copy --destdir="$pkgdir" + HOME="$_cabal_home" cabal copy --destdir="$pkgdir" cd "$pkgdir" @@ -108,4 +153,4 @@ package() { } sha512sums="a350004a8510f01d1cc8f965a9a4e2dab219f003980b98354ebb5ae42f73b32c90c98dce193943e9709d994cb92ad35814a46b79412a1afc85d42e1018c6ba10 idris-1.0.tar.gz -e078892987816012034295be81118fbc710e3dbf08af18257e5390fc159bb5d64e1aae8a802835ca92b1e0d065524833d657bc9edffc9ebefc8cb5c02935694a cabal.config" +adce625aed6ab6f36adf6d91e5671c85c91a1009e17419a88071e3cd500962c1c545406b2eb431cd3efa45d3dacadac913a9a27a5956e8233bd13b4630ff2ab4 cabal.config" |