From: Dmitry Volyntsev Date: Tue, 11 Aug 2026 01:59:07 +0000 (-0700) Subject: Misc: add a release target for source tarballs X-Git-Tag: 1.0.1~14 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=85e2ff5b770ce37e4cd96ae1366a564d62a76e45;p=njs.git Misc: add a release target for source tarballs "make -f misc/GNUmakefile release" packages a tag into a njs-.tar.gz tarball with a checksum file. The optional "release-check" target builds the extracted tarball. --- diff --git a/.gitignore b/.gitignore index 3a18683a..7121b28e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules/ package-lock.json /build/ /Makefile +/njs-*.tar.gz +/njs-*.tar.gz.sha256 diff --git a/misc/GNUmakefile b/misc/GNUmakefile new file mode 100644 index 00000000..9d649890 --- /dev/null +++ b/misc/GNUmakefile @@ -0,0 +1,35 @@ + +VER = $(shell grep 'define NJS_VERSION ' src/njs.h \ + | sed -e 's/^.*"\(.*\)".*/\1/') +NJS = njs-$(VER) +TARBALL = $(NJS).tar.gz + + +release: + git archive --format=tar.gz --prefix=$(NJS)/ -o $(TARBALL) HEAD + + sha256sum $(TARBALL) > $(TARBALL).sha256 + + @echo "excluded from $(TARBALL):" + @{ git ls-tree -r --name-only HEAD; \ + tar -t -z -f $(TARBALL) | grep -v "/$$" \ + | sed -e "s|^$(NJS)/||"; } \ + | sort | uniq -u + + +# Builds the extracted tarball in a temporary directory, which is kept +# around on failure. + +release-check: + @dir=`mktemp -d`; \ + echo "extracting $(TARBALL) into $$dir"; \ + tar -x -z -f $(TARBALL) -C $$dir \ + && cd $$dir/$(NJS) \ + && ./configure \ + && $(MAKE) njs \ + && $(MAKE) unit_test \ + && rm -rf $$dir \ + && echo "$(TARBALL) builds" + + +.PHONY: release release-check