diff options
authorPhil Ruffwind2017-09-13 16:55:44 -0400
committerPhil Ruffwind2017-09-14 02:05:38 -0400
commitc2b9a66c0e6509bb34922c12ffc1d0fd95326b74 (patch)
parent85e184d1264ae6c1a8469b1da7db3595ff075095 (diff)
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!
2 files changed, 26 insertions, 13 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 51091ea4128..4e289184753 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 =
- pkgrel = 2
+ pkgrel = 3
url =
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 f0147125113..01484678a77 100644
@@ -1,29 +1,40 @@
# Maintainer: Phil Ruffwind <>
pkgdesc="A wiki backed by a git, darcs, or mercurial filestore"
arch=(i686 x86_64)
-depends=(gmp zlib)
+depends=(libffi gmp zlib)
optdepends=("git: git support" "mercurial: mercurial support")
+makedepends=(ghc-pristine ghc-static)
+prepare() {
+ mkdir -p "$srcdir/.cabal"
+ cat >"$srcdir/.cabal/config" <<EOF
+ url:
+remote-repo-cache: $srcdir/.cabal/packages
+with-compiler: /usr/share/ghc-pristine/bin/ghc
+jobs: \$ncpus
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"