2023-01-14 00:58:10 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tested with
|
|
|
|
# appimagecrafters/appimage-builder
|
|
|
|
# and
|
|
|
|
# centos:centos-7
|
|
|
|
|
|
|
|
# config
|
|
|
|
if [ -z "$GAME_ID" ]; then
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
export GAME_ID="$1"
|
|
|
|
else
|
|
|
|
echo "Need GAME_ID set or passed as first argument"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "$GAME_NAME" ]; then
|
|
|
|
if [ $# -gt 1 ]; then
|
|
|
|
export GAME_NAME="$2"
|
|
|
|
else
|
|
|
|
echo "Need GAME_NAME set or passed as second argument"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -z "$GAME_VERSION" ]; then
|
|
|
|
if [ $# -gt 2 ]; then
|
|
|
|
export GAME_VERSION="$3"
|
|
|
|
else
|
2023-01-14 01:18:29 -07:00
|
|
|
export GAME_VERSION="$(head -1 debian/changelog | cut -f2 -d' ' | sed 's/(//' | sed 's/)//')"
|
2023-01-14 00:58:10 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
export GAME_ARCH=$(uname -m)
|
|
|
|
|
|
|
|
CENTOS=`which yum || true`
|
|
|
|
if [ -n "$CENTOS" ]; then
|
|
|
|
# centos (>= 7) build tools
|
|
|
|
yum install -yy centos-release-scl && yum install -yy git devtoolset-7-toolchain
|
|
|
|
yum install -yy zlib-devel file
|
|
|
|
scl enable devtoolset-7 bash
|
|
|
|
# centos SDL dependencies
|
|
|
|
yum install -yy libX11-devel libXext-devel libXrandr-devel libXi-devel libXfixes-devel libXcursor-devel
|
|
|
|
yum install -yy pulseaudio-libs-devel
|
|
|
|
yum install -yy mesa-libGL-devel
|
|
|
|
yum install -yy wayland-devel
|
|
|
|
else
|
|
|
|
# ubuntu (>= 18.04) build tools
|
2023-01-14 08:55:23 -07:00
|
|
|
sudo apt-get update && apt-get install -yy git build-essential
|
|
|
|
sudo apt-get install -yy zlib1g-dev file
|
2023-01-14 00:58:10 -07:00
|
|
|
# ubuntu SDL dependencies
|
2023-01-14 08:55:23 -07:00
|
|
|
sudo apt-get install -yy libx11-dev libxext-dev libxrandr-dev libxi-dev libxfixes-dev libxcursor-dev
|
|
|
|
sudo apt-get install -yy libpulse-dev
|
|
|
|
sudo apt-get install -yy libgl1-mesa-dev libgles2-mesa-dev
|
|
|
|
sudo apt-get install -yy libwayland-dev
|
2023-01-14 00:58:10 -07:00
|
|
|
fi
|
|
|
|
|
2023-01-14 12:11:05 -07:00
|
|
|
if [ -n "$CENTOS" ]; then
|
|
|
|
# cmake
|
|
|
|
curl -L -O https://cmake.org/files/v3.20/cmake-3.20.0.tar.gz
|
|
|
|
tar zxf cmake-3.20.0.tar.gz
|
|
|
|
pushd cmake-3.20.0
|
|
|
|
sed -i 's/cmake_options="-DCMAKE_BOOTSTRAP=1"/cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=OFF"/' bootstrap
|
|
|
|
./bootstrap --prefix=/usr/local
|
|
|
|
make -j$(nproc)
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
fi
|
2023-01-14 00:58:10 -07:00
|
|
|
|
2023-01-14 01:18:29 -07:00
|
|
|
# git clone --depth 1 https://github.com/Wargus/stratagus
|
2023-01-14 00:58:10 -07:00
|
|
|
git clone --depth 1 https://github.com/Wargus/${GAME_ID}
|
|
|
|
|
2023-01-14 01:18:29 -07:00
|
|
|
# pushd stratagus
|
2023-01-14 00:58:10 -07:00
|
|
|
git submodule update --init --recursive
|
|
|
|
mkdir build
|
|
|
|
pushd build
|
|
|
|
cmake .. \
|
|
|
|
-DBUILD_VENDORED_LUA=ON \
|
|
|
|
-DBUILD_VENDORED_SDL=ON \
|
|
|
|
-DBUILD_VENDORED_MEDIA_LIBS=ON \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DGAMEDIR=/usr/bin
|
2023-01-14 08:55:23 -07:00
|
|
|
make -j$(nproc) install DESTDIR=../../AppDir
|
2023-01-14 00:58:10 -07:00
|
|
|
popd
|
2023-01-14 01:18:29 -07:00
|
|
|
# popd
|
2023-01-14 00:58:10 -07:00
|
|
|
pushd ${GAME_ID}
|
|
|
|
git submodule update --init --recursive
|
|
|
|
mkdir build
|
|
|
|
pushd build
|
|
|
|
cmake .. \
|
|
|
|
-DENABLE_VENDORED_LIBS=ON \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2023-01-14 12:11:05 -07:00
|
|
|
-DSTRATAGUS_INCLUDE_DIR=$PWD/../../gameheaders \
|
2023-01-14 00:58:10 -07:00
|
|
|
-DSTRATAGUS=stratagus \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DDATA_PATH=../../share/games/stratagus/${GAME_ID}/ \
|
|
|
|
-DGAMEDIR=/usr/bin \
|
|
|
|
-DICONDIR=/usr/share/icons/default/64x64/ \
|
|
|
|
-DGAMEDIRABS=""
|
2023-01-14 08:55:23 -07:00
|
|
|
make -j$(nproc) install DESTDIR=../../AppDir
|
2023-01-14 00:58:10 -07:00
|
|
|
popd
|
|
|
|
popd
|
|
|
|
|
|
|
|
if [ -n "$CENTOS" ]; then
|
|
|
|
# using linuxdeploy
|
|
|
|
echo '#!/bin/sh' > AppDir/AppRun
|
|
|
|
echo -n 'exec $APPDIR/usr/bin/' >> AppDir/AppRun
|
|
|
|
echo -n "${GAME_ID}" >> AppDir/AppRun
|
|
|
|
echo -n ' --argv0=$APPDIR/usr/bin/' >> AppDir/AppRun
|
|
|
|
echo -n "${GAME_ID}" >> AppDir/AppRun
|
|
|
|
echo ' $@' >> AppDir/AppRun
|
|
|
|
chmod +x AppDir/AppRun
|
|
|
|
cat AppDir/AppRun
|
|
|
|
curl -L -O "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
|
|
|
chmod +x linuxdeploy-x86_64.AppImage
|
|
|
|
./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir --output appimage
|
|
|
|
else
|
|
|
|
# using appimage-builder
|
2023-01-14 01:18:29 -07:00
|
|
|
echo "version: 1" > appimagebuilder.yaml
|
|
|
|
echo "AppDir:" >> appimagebuilder.yaml
|
|
|
|
echo " path: ./AppDir" >> appimagebuilder.yaml
|
|
|
|
echo " app_info:" >> appimagebuilder.yaml
|
|
|
|
echo " id: com.stratagus.${GAME_ID}" >> appimagebuilder.yaml
|
|
|
|
echo " name: '${GAME_NAME}'" >> appimagebuilder.yaml
|
|
|
|
echo " icon: '${GAME_ID}'" >> appimagebuilder.yaml
|
|
|
|
echo " version: '${GAME_VERSION}'" >> appimagebuilder.yaml
|
|
|
|
echo " exec: usr/bin/${GAME_ID}" >> appimagebuilder.yaml
|
2023-01-14 12:11:05 -07:00
|
|
|
echo -n ' exec_args: "--argv0=$APPDIR/usr/bin/"' >> appimagebuilder.yaml
|
2023-01-14 01:18:29 -07:00
|
|
|
echo -n "${GAME_ID} " >> appimagebuilder.yaml
|
|
|
|
echo '$@' >> appimagebuilder.yaml
|
|
|
|
echo "AppImage:" >> appimagebuilder.yaml
|
|
|
|
echo " arch: '${GAME_ARCH}'" >> appimagebuilder.yaml
|
|
|
|
appimage-builder --recipe appimagebuilder.yaml || true # in github, we run this after
|
2023-01-14 00:58:10 -07:00
|
|
|
fi
|