summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Ruffwind2017-09-13 16:55:44 -0400
committerPhil Ruffwind2017-09-14 02:05:38 -0400
commitc2b9a66c0e6509bb34922c12ffc1d0fd95326b74 (patch)
treecec5bdf7192c2ce1132f218bdc22b92f4483cea7
parent85e184d1264ae6c1a8469b1da7db3595ff075095 (diff)
downloadaur-c2b9a66c0e6509bb34922c12ffc1d0fd95326b74.tar.gz
Go back to cabal because stack can't install data files
Switching back to cabal due to a bug in stack (see jgm/gitit#599 and commercialhaskell/stack/#848 ) that's impossible to cleanly work around. A local .cabal/config file is used to avoid contamination from the user's ~/.cabal/config file. ghc-pristine prevents trouble caused by the haskell-* packages, which lack the static libraries we need (that was the original reason we switched to stack). The presence of data files complicates this a lot: while "cabal copy" does copy the data files of gitit, it doesn't copy the data files of other dependent libraries (e.g. filestore). Therefore, we need to copy all the data files straight from the .cabal-sandbox. To avoid conflicts with other packages, we namespace all the data files under /usr/share/gitit. And to avoid copying the docs, we re-override docdir to something else. Cabal still installs the man pages and we can't re-override that, so we just rm it during packaging. Lastly, "cabal install" doesn't have a --destdir, and the --prefix has to be the sandbox. This means the binaries will definitely store the wrong path for data files. Thankfully, --enable-relocatable avoids hardcoded paths entirely, so we just need to preserve relative paths. At this point there's no reason to bother using "cabal copy", so we may as well use "cabal install" and avoid the configure and build steps. gitit only has one executable anyway!
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD31
2 files changed, 26 insertions, 13 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 51091ea41287..4e2891847539 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,16 @@
# Generated by mksrcinfo v8
-# Thu Aug 31 18:49:33 UTC 2017
+# Thu Sep 14 06:05:38 UTC 2017
pkgbase = gitit
pkgdesc = A wiki backed by a git, darcs, or mercurial filestore
pkgver = 0.12.2.1
- pkgrel = 2
+ pkgrel = 3
url = https://hackage.haskell.org/package/gitit
arch = i686
arch = x86_64
license = GPL
- makedepends = stack
+ makedepends = ghc-pristine
+ makedepends = ghc-static
+ depends = libffi
depends = gmp
depends = zlib
optdepends = git: git support
diff --git a/PKGBUILD b/PKGBUILD
index f01471251131..01484678a77a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,29 +1,40 @@
# Maintainer: Phil Ruffwind <rf@rufflewind.com>
pkgname=gitit
pkgver=0.12.2.1
-pkgrel=2
+pkgrel=3
pkgdesc="A wiki backed by a git, darcs, or mercurial filestore"
arch=(i686 x86_64)
url=https://hackage.haskell.org/package/gitit
license=(GPL)
-depends=(gmp zlib)
+depends=(libffi gmp zlib)
optdepends=("git: git support" "mercurial: mercurial support")
-makedepends=(stack)
+makedepends=(ghc-pristine ghc-static)
source=(https://github.com/jgm/gitit/archive/$pkgver.tar.gz)
sha256sums=('017cd716c8844036600e8aee858861ac41d8ef3c1ab02b43cd50532e4d5472b9')
+prepare() {
+ mkdir -p "$srcdir/.cabal"
+ cat >"$srcdir/.cabal/config" <<EOF
+repository hackage.haskell.org
+ url: https://hackage.haskell.org/
+remote-repo-cache: $srcdir/.cabal/packages
+with-compiler: /usr/share/ghc-pristine/bin/ghc
+jobs: \$ncpus
+EOF
+}
+
build() {
- if [ `df -P "$srcdir" | awk 'NR==2 {print $4}'` -lt 8388608 ]; then
- echo >&2 "Error: need >= 8GiB in $srcdir; set BUILDDIR to something else"
- return 1
- fi
cd "$srcdir/gitit-$pkgver"
- stack --stack-root "$srcdir/.stack" --install-ghc build --ghc-options=-rtsopts
+ cabal --config="$srcdir/.cabal/config" update
+ cabal --config="$srcdir/.cabal/config" sandbox init
+ cabal --config="$srcdir/.cabal/config" install --enable-relocatable --datadir='$prefix/share/gitit' --docdir='$prefix/share/doc/$abi/$pkgid' --ghc-options=-rtsopts
}
package() {
cd "$srcdir/gitit-$pkgver"
- mkdir -p "$pkgdir/usr/bin"
- PATH=$pkgdir/usr/bin:$PATH stack --stack-root "$srcdir/.stack" install --local-bin-path "$pkgdir/usr/bin"
+ mkdir -p "$pkgdir/usr/share"
+ cp -PR .cabal-sandbox/share/gitit "$pkgdir/usr/share/"
+ rm -fr "$pkgdir/usr/share/gitit/man"
+ install -Dm755 .cabal-sandbox/bin/gitit "$pkgdir/usr/bin/gitit"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/gitit/LICENSE"
}