forked from d-e-s-o/nitrocli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (48 loc) · 2.18 KB
/
Makefile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
# Makefile
# Copyright (C) 2017-2021 The Nitrocli Developers
# SPDX-License-Identifier: GPL-3.0-or-later
SHELL := bash
PS2PDF ?= ps2pdf
NITROCLI_MAN := doc/nitrocli.1
NITROCLI_PDF := $(addsuffix .pdf,$(NITROCLI_MAN))
.PHONY: doc
doc: $(NITROCLI_PDF)
# We assume and do not check existence of man, which, false, and echo
# commands.
$(NITROCLI_PDF): $(NITROCLI_MAN)
@which $(PS2PDF) &> /dev/null || \
(echo "$(PS2PDF) command not found, unable to generate documentation"; false)
@man --local-file --troff $(<) | $(PS2PDF) - $(@)
KEY ?= 0x952DD6F8F34D8B8E
.PHONY: sign
sign:
@test -n "$(REL)" || \
(echo "Please set REL environment variable to the release to verify (e.g., '0.2.1')."; false)
@mkdir -p pkg/
wget --quiet "https://github.com/d-e-s-o/nitrocli/archive/v$(REL).zip" \
-O "pkg/nitrocli-$(REL).zip"
@set -euo pipefail && DIR1=$$(mktemp -d) && DIR2=$$(mktemp -d) && \
unzip -q pkg/nitrocli-$(REL).zip -d $${DIR1} && \
git -C $$(git rev-parse --show-toplevel) archive --prefix=nitrocli-$(REL)/ v$(REL) | \
tar -x -C $${DIR2} && \
diff -u -r $${DIR1} $${DIR2} && \
echo "Github zip archive verified successfully" && \
(rm -r $${DIR1} && rm -r $${DIR2})
wget --quiet "https://github.com/d-e-s-o/nitrocli/archive/v$(REL).tar.gz" \
-O "pkg/nitrocli-$(REL).tar.gz"
@set -euo pipefail && DIR1=$$(mktemp -d) && DIR2=$$(mktemp -d) && \
tar -xz -C $${DIR1} -f pkg/nitrocli-$(REL).tar.gz && \
git -C $$(git rev-parse --show-toplevel) archive --prefix=nitrocli-$(REL)/ v$(REL) | \
tar -x -C $${DIR2} && \
diff -u -r $${DIR1} $${DIR2} && \
echo "Github tarball verified successfully" && \
(rm -r $${DIR1} && rm -r $${DIR2})
@cd pkg && sha256sum nitrocli-$(REL).tar.gz nitrocli-$(REL).zip > nitrocli-$(REL).sha256.DIGEST
@gpg --sign --armor --detach-sign --default-key=$(KEY) --yes \
--output pkg/nitrocli-$(REL).sha256.DIGEST.sig pkg/nitrocli-$(REL).sha256.DIGEST
@gpg --verify pkg/nitrocli-$(REL).sha256.DIGEST.sig
@cd pkg && sha256sum --check < nitrocli-$(REL).sha256.DIGEST
@echo "All checks successful. Please attach"
@echo " pkg/nitrocli-$(REL).sha256.DIGEST"
@echo " pkg/nitrocli-$(REL).sha256.DIGEST.sig"
@echo "to https://github.com/d-e-s-o/nitrocli/releases/tag/v$(REL)"