aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 43 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e50bbe6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,43 @@
+-include config.mk
+
+GHC_VERSION ?= 9.8.3
+img = quay.io/benz0li/ghc-musl:$(GHC_VERSION)
+
+annex_version := $(shell git -C git-annex describe)
+
+cabal_root = git-annex/dist-newstyle/build/x86_64-linux
+# NB: For a non-tagged commit, annex_version will be {tag}-N-g{hash}
+# while cabal will build under .../git-annex-{tag}/. That discrepancy
+# doesn't matter because bin/build aborts if git-annex repo is on a
+# non-tagged commit.
+binary = $(cabal_root)/ghc-$(GHC_VERSION)/git-annex-$(annex_version)/build/git-annex/git-annex
+
+build_dir = builds/git-annex-$(annex_version)
+meta_dir = meta/git-annex-$(annex_version)
+
+tgz = $(build_dir)-linux-amd64.tar.gz
+
+.PHONY: help
+help:
+ $(info build - build $(tgz))
+ $(info sign - sign $(tgz))
+ @:
+
+.PHONY: build
+build: $(tgz)
+
+.PHONY: sign
+sign: $(tgz).asc
+
+$(tgz): $(binary)
+ ./bin/package '$(GHC_VERSION)' '$(annex_version)'
+ mkdir -p '$(meta_dir)'
+ mv git-annex/cabal.project.freeze '$(meta_dir)'/cabal.project.freeze
+ ./bin/check '$(annex_version)'
+
+$(tgz).asc: $(tgz)
+ gpg --armor --detach-sign '$<'
+
+$(binary):
+ $(info Building git-annex $(annex_version))
+ ./bin/build '$(img)'