outfly/build/pack.sh

33 lines
962 B
Bash
Raw Normal View History

2024-03-31 17:49:59 +00:00
#!/bin/sh
2024-03-31 17:58:22 +00:00
# A script to package release binaries + README.md into zip files.
# Usage: cd outfly; doc/scripts/pack.sh
2024-03-31 17:49:59 +00:00
set -e
2024-04-02 15:39:57 +00:00
if [ "$1" == "-b" ]; then
cargo build --release --target=x86_64-unknown-linux-gnu --features "x11 wayland"
cargo build --release --target=x86_64-pc-windows-gnu --no-default-features
2024-04-02 15:39:57 +00:00
fi
VERSION="$(sed -nr 's/^\s*version\s*=\s*"(.*)"\s*$/\1/p' Cargo.toml)"
test -z "$VERSION" && echo 'Error: Could not extract version from Cargo.toml' && exit
echo "Extracted version from Cargo.toml: $VERSION"
2024-03-31 17:49:59 +00:00
TMPPATH=ZIP_TMP_PATH
mkdir "$TMPPATH"
cd "$TMPPATH"
SRCPATH="outfly_v$VERSION"
mkdir "$SRCPATH"
cp ../README.md "$SRCPATH"
2024-04-19 21:47:40 +00:00
cp ../target/x86_64-pc-windows-gnu/release/outfly.exe "$SRCPATH"/OutFly.exe
2024-03-31 17:49:59 +00:00
zip -v -r -9 ../"outfly_v${VERSION}_windows.zip" "$SRCPATH"
2024-04-19 21:47:40 +00:00
rm "$SRCPATH"/OutFly.exe
2024-04-15 23:40:57 +00:00
cp ../target/x86_64-unknown-linux-gnu/release/outfly "$SRCPATH"
2024-03-31 17:49:59 +00:00
zip -v -r -9 ../"outfly_v${VERSION}_linux.zip" "$SRCPATH"
cd ..
rm -rf "$TMPPATH"