OpenRCT2/scripts/linux/build-appimage.sh
Margen67 3188865313
Script improvements (#14452)
shebang:
 Move parameters from set.
 Add newline after for consistency.
curl:
 Add -f;
  Prevents output on error.
 Use -O where applicable;
  -o with the same filename as the URL is pointless.
 Add -S after -s:
  Makes curl still error despite being silent.
build-symbols:
 Add zip fallback.
get-discord-rpc:
 Move git clone parameters before repository for readability.
 Use --depth 1 to speed up cloning.
install-nsis:
 Use ProgramData environment variable.
build-appimage-docker.sh:
 Add -e to docker run.
 Run script directly.
build-appimage.sh:
 Make if more consistent.
Remove unused Travis scripts.
setenv:
 unset instead of blanking variables.
vstool.cmd:
 Use ProgramFiles(x86) environment variable.
2021-04-12 19:01:15 -03:00

41 lines
1 KiB
Bash
Executable file

#!/bin/bash -ex
# use RAM disk if possible
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
fi
BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" OpenRCT2-appimage-build-XXXXXX)
cleanup () {
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
}
if [ "$NO_CLEANUP" == "" ] && trap cleanup EXIT
# store repo root as variable
REPO_ROOT=$(readlink -f $(dirname "$0")/../..)
OLD_CWD=$(readlink -f .)
pushd "$BUILD_DIR"
export VERSION=$(cd "$REPO_ROOT" && git describe --tags)
# standard linuxdeploy pattern
#see https://docs.appimage.org/packaging-guide/from-source/index.html for more information
cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja -k0
DESTDIR=AppDir ninja install
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
./linuxdeploy*.AppImage --appimage-extract-and-run --appdir AppDir/ --output appimage
mv OpenRCT2*.AppImage "$OLD_CWD"/