aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e50bbe66a7dbe338199abdd92f2ec5f97500af15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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)'