From cad66c7db85da3fdda1e8daf0f60842410a21dd3 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 17 Sep 2023 12:00:33 -0700 Subject: [PATCH] Rename make-windows-releases.sh and add source archive generation --- .gitignore | 2 ++ scripts/gen-release-archives.sh | 37 ++++++++++++++++++++++++++++++++ scripts/make-windows-releases.sh | 21 ------------------ 3 files changed, 39 insertions(+), 21 deletions(-) create mode 100755 scripts/gen-release-archives.sh delete mode 100755 scripts/make-windows-releases.sh diff --git a/.gitignore b/.gitignore index 3a696efc..c0c091a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /build* +/libdeflate-*-windows-* +/libdeflate-*.tar.gz cscope* tags diff --git a/scripts/gen-release-archives.sh b/scripts/gen-release-archives.sh new file mode 100755 index 00000000..ca79122a --- /dev/null +++ b/scripts/gen-release-archives.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -eu -o pipefail + +# This script generates source and binary archives that should be posted for +# each new release of libdeflate. + +prefix="libdeflate-$(git describe HEAD | sed 's/^v//')" + +# Generate source code archive libdeflate-*.tar.gz +tarball="${prefix}.tar.gz" +echo "Generating $tarball" +git archive --format=tar --prefix="${prefix}/" HEAD \ + | libdeflate-gzip -12 > "$tarball" + +# Generate Windows binary releases libdeflate-*-windows-*-bin.zip +for arch in 'i686' 'x86_64'; do + dir=${prefix}-windows-${arch}-bin + zipfile="${dir}.zip" + echo "Generating $zipfile" + rm -rf build "$dir" "$zipfile" + CFLAGS="-Werror" ${arch}-w64-mingw32-cmake -B build -G Ninja \ + -DLIBDEFLATE_BUILD_TESTS=1 > /dev/null + cmake --build build > /dev/null + mkdir "$dir" + cp libdeflate.h build/libdeflate.{dll,dll.a,a} \ + build/programs/{benchmark,checksum}.exe "$dir" + cp build/programs/libdeflate-gzip.exe "$dir"/gzip.exe + cp build/programs/libdeflate-gzip.exe "$dir"/gunzip.exe + ${arch}-w64-mingw32-strip "$dir"/libdeflate.dll "$dir"/*.exe + for file in COPYING NEWS.md README.md; do + sed < $file > "$dir/${file}.txt" -e 's/$/\r/g' + done + (cd "$dir" && zip -q -r "../${zipfile}" .) +done + +echo "Successfully generated release files" diff --git a/scripts/make-windows-releases.sh b/scripts/make-windows-releases.sh deleted file mode 100755 index 332f42c5..00000000 --- a/scripts/make-windows-releases.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -eu -o pipefail - -for arch in 'i686' 'x86_64'; do - dir=libdeflate-$(git describe --tags | tr -d v)-windows-${arch}-bin - rm -rf build "$dir" "$dir.zip" - CFLAGS="-Werror" ${arch}-w64-mingw32-cmake -B build -G Ninja \ - -DLIBDEFLATE_BUILD_TESTS=1 - cmake --build build - mkdir "$dir" - cp libdeflate.h build/libdeflate.{dll,dll.a,a} \ - build/programs/{benchmark,checksum}.exe "$dir" - cp build/programs/libdeflate-gzip.exe "$dir"/gzip.exe - cp build/programs/libdeflate-gzip.exe "$dir"/gunzip.exe - ${arch}-w64-mingw32-strip "$dir"/libdeflate.dll "$dir"/*.exe - for file in COPYING NEWS.md README.md; do - sed < $file > "$dir/${file}.txt" -e 's/$/\r/g' - done - (cd "$dir" && zip -r "../${dir}.zip" .) -done