Files
seagull-game/build-desktop.sh

58 lines
1.6 KiB
Bash
Raw Normal View History

2025-07-29 12:50:35 -07:00
#!/bin/bash
2025-08-05 17:57:43 -07:00
srcdir=$(pwd)
BUILD_DIR=${BUILD_DIR:-$srcdir/build}
CACHE_DIR=${CACHE_DIR:-$srcdir/build_cache}
2025-08-05 17:57:43 -07:00
echo "$srcdir => $BUILD_DIR"
2025-07-29 12:50:35 -07:00
die () {
echo "$@" >&2
exit 1
}
findcmd () {
command -v $1 || die "missing command: $1"
}
findcmd cargo
findcmd python
findcmd rsync
mkdir -p $BUILD_DIR && cd $BUILD_DIR
mkdir -p $CACHE_DIR
2025-08-05 17:57:43 -07:00
rsync -rv --include-from=$srcdir/.rsync-include $srcdir/ $BUILD_DIR/
2025-07-29 12:50:35 -07:00
# rant
if [[ -f $CACHE_DIR/rant.tar.zst ]]; then
pv -bprt -N "unpacking: rant" $CACHE_DIR/rant.tar.zst | tar -x --zstd -f -
else
mkdir -p opt/rant
cargo install rant --version 4.0.0-alpha.33 --root $BUILD_DIR/opt/rant --features cli
tar -c -f - --zstd opt/rant | pv -bprt -N "caching: rant" > $CACHE_DIR/rant.tar.zst
fi
2025-08-05 17:57:43 -07:00
python $srcdir/render-wordlists.py -i $srcdir/ext/imsky/wordlists -o rant $BUILD_DIR/app/rant/wordlist.rant
2025-07-29 12:50:35 -07:00
# python venv
if [[ -f $CACHE_DIR/pyvenv.tar.zst ]]; then
pv -bprt -N "unpacking: pyvenv" $CACHE_DIR/pyvenv.tar.zst | tar -x --zstd -f -
source pyvenv/bin/activate
else
python -m venv pyvenv
source pyvenv/bin/activate
pip install -r app/requirements.txt
pip install -r app/requirements-build-desktop.txt
pip install -r app/requirements-desktop.txt
[[ $(uname -s) == "Linux" ]] && pip install -r app/requirements-desktop-linux.txt
#[[ $(uname -s) == "Darwin" ]] && pip install -r app/requirements-desktop-macos.txt
tar -c -f - --zstd pyvenv | pv -bprt -N "caching: pyvenv" > $CACHE_DIR/pyvenv.tar.zst
fi
2025-07-29 12:50:35 -07:00
pyinstaller seagull.spec
deactivate
cd $srcdir
cp -fv $BUILD_DIR/dist/seagull $srcdir
rm -fr $BUILD_DIR
du -sh seagull
echo "You should be able to run ./seagull now"