]> Sergey Matveev's repositories - tofuproxy.git/blobdiff - makedist
No redo, refactor project building, simplify it
[tofuproxy.git] / makedist
diff --git a/makedist b/makedist
new file mode 100755 (executable)
index 0000000..b44a525
--- /dev/null
+++ b/makedist
@@ -0,0 +1,82 @@
+#!/bin/sh -ex
+
+cur=$(pwd)
+tmp=$(mktemp -d)
+release=$1
+[ -n "$release" ]
+
+git clone . $tmp/tofuproxy-$release
+cd $tmp/tofuproxy-$release
+git checkout v$release
+
+redo-ifchange VERSION
+
+########################################################################
+cd doc
+cat > download.texi <<EOF
+You can obtain releases source code prepared tarballs on
+@url{http://www.tofuproxy.stargrave.org}.
+EOF
+
+mkinfo() {
+    ${MAKEINFO:-makeinfo} --plaintext \
+        --set-customization-variable ASCII_PUNCTUATION=1 \
+        -D "VERSION `cat ../VERSION`" $@
+}
+
+texi=$(mktemp)
+
+cat > $texi <<EOF
+\input texinfo
+@documentencoding UTF-8
+@settitle INSTALL
+@include install.texi
+@bye
+EOF
+mkinfo --output INSTALL $texi
+
+rm $texi
+redo tofuproxy.info
+mv tofuproxy.info INSTALL ..
+cd ..
+
+########################################################################
+
+go mod vendor
+rm -rf vendor/golang.org/x/sys/windows
+find . \( -name .gitignore -o -name .travis.yml \) -delete
+
+########################################################################
+
+rm -rf .redo .git makedist VERSION.do
+find . -type d -exec chmod 755 {} +
+find . -type f -exec chmod 644 {} +
+chmod +x build state-init fifos/ensure fifos/multitail cmd/zstd/build
+
+cd ..
+tar cvf tofuproxy-"$release".tar --uid=0 --gid=0 --numeric-owner tofuproxy-"$release"
+zstd -19 -v tofuproxy-"$release".tar
+tarball=tofuproxy-"$release".tar.zst
+gpg --detach-sign --sign --local-user 12AD32689C660D426967FD75CB8205632107AD8A "$tarball"
+gpg --enarmor < "$tarball".sig |
+    sed "/^Comment:/d ; s/ARMORED FILE/SIGNATURE/" > "$tarball".asc
+meta4-create -file "$tarball" -mtime "$tarball" -sig "$tarball".asc \
+    http://www.tofuproxy.stargrave.org/download/"$tarball" \
+    http://y.www.tofuproxy.stargrave.org/download/"$tarball" > "$tarball".meta4
+
+size=$(( $(stat -f %z $tarball) / 1024 ))
+hash=$(gpg --print-md SHA256 < $tarball)
+release_date=$(date "+%Y-%m-%d")
+
+release_underscored=`echo $release | tr . _`
+cat <<EOF
+An entry for documentation:
+@item $release @tab $release_date @tab $size KiB
+@tab
+    @url{download/$tarball.meta4, meta4}
+    @url{download/$tarball, link}
+    @url{download/$tarball.sig, sig}
+@tab @code{$hash}
+EOF
+
+mv $tmp/$tarball $tmp/"$tarball".sig $tarball.meta4 $cur/doc/tofuproxy.html/download