summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoey Hess2020-06-17 17:57:04 -0400
committerJoey Hess2020-06-17 17:58:12 -0400
commit745784f61bdd678e20b1b18743f18d458836a802 (patch)
tree7a345c7c4bb7a7ead33c86d1dabe1f5840f11d1a /Makefile
parent298f437253fd87a3f412ae875a56b7833da956e0 (diff)
Support bootstrapping to hosts using cabal 3.x, with new-dist directory.
* Support bootstrapping to hosts using cabal 3.x, with new-dist directory. * Makefile: Fix build with cabal 3.x. This assumes that, once a new-dist directory is created, the host won't revert back to using dist. So it always prefers binaries from new-dist over dist. This commit was sponsored by LND on Patreon.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 22 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 0e4b2ca3..b5d5708b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,43 @@
CABAL?=cabal
DATE := $(shell dpkg-parsechangelog 2>/dev/null | grep Date | cut -d " " -f2-)
-build: tags propellor.1 dist/setup-config
+build: tags propellor.1 configured
$(CABAL) build
- ln -sf dist/build/propellor-config/propellor-config propellor
+ @if [ -d dist-newstyle ]; then \
+ ln -sf $$(find dist-newstyle/ -executable -type f | grep 'build/propellor-config/propellor-config$$') propellor; \
+ else \
+ ln -sf dist/build/propellor-config/propellor-config propellor; \
+ fi
install:
install -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/src/propellor
- install -s dist/build/propellor/propellor $(DESTDIR)/usr/bin/propellor
- mkdir -p dist/gittmp
- $(CABAL) sdist
- cat dist/propellor-*.tar.gz | (cd dist/gittmp && tar zx --strip-components=1)
+ if [ -d dist-newstyle ]; then \
+ install -s $$(find dist-newstyle/ -executable -type f | grep 'build/propellor/propellor$$') $(DESTDIR)/usr/bin/propellor; \
+ else \
+ install -s dist/build/propellor/propellor $(DESTDIR)/usr/bin/propellor; \
+ fi
+ mkdir -p gittmp
+ $(CABAL) sdist -o - | (cd gittmp && tar zx --strip-components=1)
# cabal sdist does not preserve symlinks, so copy over file
- cd dist/gittmp && for f in $$(find -type f); do rm -f $$f; cp -a ../../$$f $$f; done
+ cd gittmp && for f in $$(find -type f); do rm -f $$f; cp -a ../$$f $$f; done
# reset mtime on files in git bundle so bundle is reproducible
- find dist/gittmp -print0 | xargs -0r touch --no-dereference --date="$(DATE)"
+ find gittmp -print0 | xargs -0r touch --no-dereference --date="$(DATE)"
export GIT_AUTHOR_NAME=build \
&& export GIT_AUTHOR_EMAIL=build@buildhost \
&& export GIT_AUTHOR_DATE="$(DATE)" \
&& export GIT_COMMITTER_NAME=build \
&& export GIT_COMMITTER_EMAIL=build@buildhost \
&& export GIT_COMMITTER_DATE="$(DATE)" \
- && cd dist/gittmp && git init \
+ && cd gittmp && git init \
&& git add . \
&& git commit -q -m "distributed version of propellor" \
&& git bundle create $(DESTDIR)/usr/src/propellor/propellor.git master HEAD \
&& git show-ref master --hash > $(DESTDIR)/usr/src/propellor/head
- rm -rf dist/gittmp
+ rm -rf gittmp
clean:
- rm -rf dist Setup tags propellor propellor.1 privdata/local
+ rm -rf dist dist-newstyle configured Setup \
+ tags propellor propellor.1 privdata/local
find . -name \*.o -exec rm {} \;
find . -name \*.hi -exec rm {} \;
@@ -37,11 +45,12 @@ clean:
# duplicate tags with Propellor.Property. removed from the start, as we
# often import qualified by just the module base name.
tags:
- find . | grep -v /.git/ | grep -v /tmp/ | grep -v /dist/ | grep -v /doc/ | egrep '\.hs$$' | xargs hothasktags 2>/dev/null | perl -ne 'print; s/Propellor\.Property\.//; print' | sort > tags || true
+ @find . | grep -v /.git/ | grep -v /tmp/ | grep -v dist/ | grep -v /doc/ | egrep '\.hs$$' | xargs hothasktags 2>/dev/null | perl -ne 'print; s/Propellor\.Property\.//; print' | sort > tags || true
-dist/setup-config: propellor.cabal
+configured: propellor.cabal
@if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
@$(CABAL) configure
+ touch configured
propellor.1: doc/usage.mdwn doc/mdwn2man
doc/mdwn2man propellor 1 < doc/usage.mdwn > propellor.1