Skip to content

Commit c4ed8fd

Browse files
committed
Misc: add a release target for source tarballs
"make -f misc/GNUmakefile release" packages a tag into a njs-<version>.tar.gz tarball with a checksum file. The optional "release-check" target builds the extracted tarball.
1 parent 57354eb commit c4ed8fd

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules/
22
package-lock.json
33
/build/
44
/Makefile
5+
/njs-*.tar.gz
6+
/njs-*.tar.gz.sha256

misc/GNUmakefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
VER = $(shell grep 'define NJS_VERSION ' src/njs.h \
3+
| sed -e 's/^.*"\(.*\)".*/\1/')
4+
NJS = njs-$(VER)
5+
TAG ?= $(VER)
6+
TARBALL = $(NJS).tar.gz
7+
8+
9+
release:
10+
git archive --format=tar.gz --prefix=$(NJS)/ -o $(TARBALL) $(TAG)
11+
12+
sha256sum $(TARBALL) > $(TARBALL).sha256
13+
14+
@echo "excluded from $(TARBALL):"
15+
@{ git ls-tree -r --name-only $(TAG); \
16+
tar -t -z -f $(TARBALL) | grep -v "/$$" \
17+
| sed -e "s|^$(NJS)/||"; } \
18+
| sort | uniq -u
19+
20+
21+
# Builds the extracted tarball in a temporary directory, which is kept
22+
# around on failure.
23+
24+
release-check:
25+
@dir=`mktemp -d`; \
26+
echo "extracting $(TARBALL) into $$dir"; \
27+
tar -x -z -f $(TARBALL) -C $$dir \
28+
&& cd $$dir/$(NJS) \
29+
&& ./configure \
30+
&& $(MAKE) njs \
31+
&& $(MAKE) unit_test \
32+
&& rm -rf $$dir \
33+
&& echo "$(TARBALL) builds"
34+
35+
36+
.PHONY: release release-check

0 commit comments

Comments
 (0)