OpenRCT2/scripts/linux/build-appimage.sh

41 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash -ex
# use RAM disk if possible
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
fi
2018-08-29 22:05:57 +02:00
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"
2019-11-19 16:00:51 +01:00
export VERSION=$(cd "$REPO_ROOT" && git describe --tags)
2018-08-29 22:05:57 +02:00
# standard linuxdeploy pattern
#see https://docs.appimage.org/packaging-guide/from-source/index.html for more information
2018-09-29 15:00:30 +02:00
cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja -k0
2018-08-29 22:23:53 +02:00
DESTDIR=AppDir ninja install
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
2018-08-29 22:05:57 +02:00
./linuxdeploy*.AppImage --appimage-extract-and-run --appdir AppDir/ --output appimage
mv OpenRCT2*.AppImage "$OLD_CWD"/