File: build-appimage.sh

package info (click to toggle)
openrct2 0.4.31%2Bds-1
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 105,012 kB
  • sloc: cpp: 677,649; ansic: 1,322; javascript: 716; xml: 646; sh: 439; python: 313; php: 34; makefile: 19
file content (42 lines) | stat: -rwxr-xr-x 1,040 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash

set -ex

# use RAM disk if possible
if [ -z "$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 [ -z "$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

curl -fLO 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"/