Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts/gen-tarball.sh #329

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/build*
/libdeflate-*-windows-*
/libdeflate-*.tar.gz
cscope*
tags
37 changes: 37 additions & 0 deletions scripts/gen-release-archives.sh
Original file line number Diff line number Diff line change
@@ -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 archives"
21 changes: 0 additions & 21 deletions scripts/make-windows-releases.sh

This file was deleted.