support building with BUILDER=stack to use stack instead of cabal

This commit is contained in:
Joey Hess 2015-12-28 14:10:08 -04:00
parent ee8113959a
commit 441573a92b
Failed to extract signature
3 changed files with 21 additions and 11 deletions

View file

@ -1,7 +1,8 @@
mans=$(shell find doc -maxdepth 1 -name git-annex*.mdwn | sed -e 's/^doc/man/' -e 's/\.mdwn/\.1/')
all=git-annex mans docs
CABAL?=cabal # set to "./Setup" if you lack a cabal program
# set to "./Setup" if you lack a cabal program. Or can be set to "stack"
BUILDER?=cabal
GHC?=ghc
PREFIX?=/usr
@ -15,13 +16,21 @@ endif
build: $(all)
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
$(CABAL) configure --ghc-options="$(shell Build/collect-ghc-options.sh)"
if [ "$(BUILDER)" = ./Setup ]; then ghc --make Setup; fi
if [ "$(BUILDER)" = stack ]; then \
$(BUILDER) build -j1; \
else \
$(BUILDER) configure --ghc-options="$(shell Build/collect-ghc-options.sh)"; \
fi
# -j1 is used for reproducible build
git-annex: Build/SysConfig.hs
$(CABAL) build -j1
ln -sf dist/build/git-annex/git-annex git-annex
$(BUILDER) build -j1
if [ "$(BUILDER)" = stack ]; then \
ln -sf $(shell find .stack-work/ -name git-annex -type f | grep build/git-annex/git-annex) git-annex; \
else \
ln -sf dist/build/git-annex/git-annex git-annex; \
fi
man/%.1: doc/%.mdwn
./Build/mdwn2man $@ 1 $< > $@
@ -89,6 +98,7 @@ docs: mans
--exclude='users/*' --exclude='devblog/*' --exclude='thanks'
clean:
$(BUILDER) clean
rm -rf tmp dist git-annex $(mans) configure *.tix .hpc \
doc/.ikiwiki html dist tags Build/SysConfig.hs \
Setup Build/InstallDesktopFile Build/EvilSplicer \
@ -206,9 +216,9 @@ ANDROID_FLAGS?=
# Uses https://github.com/neurocyte/ghc-android
android: Build/EvilSplicer
echo "Running native build, to get TH splices.."
if [ ! -e dist/setup/setup ]; then $(CABAL) configure -O0 $(ANDROID_FLAGS) -fAndroidSplice; fi
if [ ! -e dist/setup/setup ]; then $(BUILDER) configure -O0 $(ANDROID_FLAGS) -fAndroidSplice; fi
mkdir -p tmp
if ! $(CABAL) build --ghc-options=-ddump-splices 2> tmp/dump-splices; then tail tmp/dump-splices >&2; exit 1; fi
if ! $(BUILDER) build --ghc-options=-ddump-splices 2> tmp/dump-splices; then tail tmp/dump-splices >&2; exit 1; fi
echo "Setting up Android build tree.."
./Build/EvilSplicer tmp/splices tmp/dump-splices standalone/no-th/evilsplicer-headers.hs
rsync -az --exclude tmp --exclude dist . tmp/androidtree
@ -250,8 +260,8 @@ fast: dist/caballog
@$(MAKE) tags >/dev/null 2>&1 &
dist/caballog: git-annex.cabal
$(CABAL) configure -f"-Production" -O0 --enable-executable-dynamic
$(CABAL) build -v2 | tee $@
$(BUILDER) configure -f"-Production" -O0 --enable-executable-dynamic
$(BUILDER) build -v2 | tee $@
# Hardcoded command line to make hdevtools start up and work.
# You will need some memory. It's worth it.

View file

@ -1,6 +1,6 @@
#!/bin/sh
# It would be more usual to use:
# export CABAL=./Setup
# export BUILDER=./Setup
# But Setup currently has a very bad dependency resolver, and very bad
# debugging output, and tends to eat all memory and die on small buildds.
# See https://github.com/haskell/cabal/issues/2777

2
debian/rules vendored
View file

@ -1,6 +1,6 @@
#!/usr/bin/make -f
export CABAL=debian/cabal-wrapper
export BUILDER=debian/cabal-wrapper
STANDALONE_BUILD=$(shell grep -qe '^Package: git-annex-standalone' debian/control \
&& echo 1 || echo 0)