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-05-12 21:15:17 +00:00
|
|
|
# Usage: cd outfly; build/pack.sh [-b]
|
2024-04-23 15:57:11 +00:00
|
|
|
# Options: -b: cross-compile targets before packing
|
2024-03-31 17:49:59 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-05-07 19:21:43 +00:00
|
|
|
function check_uncommitted_assets() {
|
|
|
|
( cd assets; [ $(git status --porcelain . | wc -l) -gt 0 ] )
|
|
|
|
}
|
|
|
|
|
|
|
|
if check_uncommitted_assets; then
|
|
|
|
echo "Please make sure there are no uncommited files in the 'asset' directory before packing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-04-02 15:39:57 +00:00
|
|
|
if [ "$1" == "-b" ]; then
|
2024-04-26 22:32:38 +00:00
|
|
|
cargo build --release --target=x86_64-unknown-linux-gnu --no-default-features --features release_linux
|
|
|
|
cargo build --release --target=x86_64-pc-windows-gnu --no-default-features --features release_windows
|
2024-04-02 15:39:57 +00:00
|
|
|
fi
|
|
|
|
|
2024-05-14 16:25:07 +00:00
|
|
|
VERSION="$(sed -nr 's/^\s*version\s*=\s*"(.*)"\s*$/\1/p' Cargo.toml | head -n1)"
|
2024-03-31 18:06:51 +00:00
|
|
|
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-29 13:43:00 +00:00
|
|
|
cp ../LICENSE.md "$SRCPATH"
|
2024-04-29 13:57:37 +00:00
|
|
|
cp ../CHANGELOG.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"
|