]> git.kaiwu.me - njs.git/commitdiff
Misc: add a release target for source tarballs
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 11 Aug 2026 01:59:07 +0000 (18:59 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 13 Aug 2026 16:09:25 +0000 (09:09 -0700)
"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.

.gitignore
misc/GNUmakefile [new file with mode: 0644]

index 3a18683a015ea2316f60678c360ba15c5b747776..7121b28e5d047a3a83076054055cead1e72456a8 100644 (file)
@@ -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 (file)
index 0000000..9d64989
--- /dev/null
@@ -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