outfly/build/pack.sh

44 lines
2.1 KiB
Bash
Raw Normal View History

2024-03-31 17:49:59 +00:00
#!/bin/sh
2024-04-21 16:23:40 +00:00
# ▄████████▄ + ███ + ▄█████████ ███ +
# ███▀ ▀███ + + ███ ███▀ + ███ + +
# ███ + ███ ███ ███ █████████ ███ ███ ███ ███
2024-04-21 17:34:00 +00:00
# ███ +███ ███ ███ ███ ███▐██████ ███ ███ ███
2024-04-21 16:23:40 +00:00
# ███ + ███ ███+ ███ +███ ███ + ███ ███ + ███
# ███▄ ▄███ ███▄ ███ ███ + ███ + ███ ███▄ ███
# ▀████████▀ + ▀███████ ███▄ ███▄ ▀████ ▀███████
# + + + ███
# + ▀████████████████████████████████████████████████████▀
#
2024-03-31 17:58:22 +00:00
# A script to package release binaries + README.md into zip files.
2024-04-23 15:57:11 +00:00
# Usage: cd outfly; build/pack.sh [-b]
# Options: -b: cross-compile targets before packing
2024-03-31 17:49:59 +00:00
set -e
2024-04-02 15:39:57 +00:00
if [ "$1" == "-b" ]; then
2024-04-23 13:39:46 +00:00
cargo build --release --target=x86_64-unknown-linux-gnu --no-default-features --features "x11 wayland embed_assets"
cargo build --release --target=x86_64-pc-windows-gnu --no-default-features --features "embed_assets"
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"