From 1c5794d6a31b35cefebb91aea419a757074c5faa Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 08:40:00 +0100 Subject: [PATCH 01/13] use XDG_DATA/CONFIG_DIRs for data and config --- gameheaders/stratagus-game-launcher.h | 34 ++++++++++++++++++++------- src/stratagus/parameters.cpp | 34 ++++++++++++++------------- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/gameheaders/stratagus-game-launcher.h b/gameheaders/stratagus-game-launcher.h index 836e0cf6d9..99a717eaab 100644 --- a/gameheaders/stratagus-game-launcher.h +++ b/gameheaders/stratagus-game-launcher.h @@ -197,17 +197,33 @@ static void SetUserDataPath(char* data_path) { } } SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, data_path); - // strcpy(data_path, getenv("APPDATA")); -#else - strcpy(data_path, getenv("HOME")); -#endif - int datalen = strlen(data_path); -#if defined(WIN32) + if (!data_path[0]) { + strcpy(data_path, getenv("APPDATA")); + } strcat(data_path, "\\Stratagus\\"); -#elif defined(USE_MAC) - strcat(data_path, "/Library/Stratagus/"); #else - strcat(data_path, "/.stratagus/"); + std::string appimage = std::string(getenv("APPIMAGE")); + if (!appimage.empty() && fs::exists(fs::path(appimage))) { + if (fs::exists(fs::path(appimage + ".data"))) { + strcpy(data_path, (appimage + ".data/stratagus").c_str()); + return; + } + } + char *dataDir = getenv("XDG_DATA_DIR"); + if (dataDir) { + strcpy(data_path, dataDir); + strcat(data_path, "/stratagus/"); + } else { + dataDir = getenv("HOME"); + if (dataDir) { + strcpy(data_path, dataDir); +#ifdef USE_MAC + strcat(data_path, "/Library/Stratagus/"); +#else + strcat(data_path, "/.local/share/stratagus/"); +#endif + } + } #endif strcat(data_path, "data." GAME_NAME); } diff --git a/src/stratagus/parameters.cpp b/src/stratagus/parameters.cpp index f9066422c7..bb99e2adfc 100644 --- a/src/stratagus/parameters.cpp +++ b/src/stratagus/parameters.cpp @@ -66,24 +66,26 @@ void Parameters::SetDefaultUserDirectory(bool noPortable) } char data_path[4096] = {'\0'}; SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, 0, data_path); - userDirectory = data_path; - // userDirectory = getenv("APPDATA"); -#else - userDirectory = getenv("HOME"); -#endif - - if (!userDirectory.empty()) { - userDirectory += "/"; + if (data_path[0]) { + userDirectory = std::string(data_path) + "/Stratagus"; + } else if (getenv("APPDATA")) { + userDirectory = std::string(getenv("APPDATA")) + "/Stratagus"; } - -#ifdef USE_GAME_DIR -#elif USE_WIN32 - userDirectory += "Stratagus"; -#elif defined(USE_MAC) - userDirectory += "Library/Stratagus"; +#else // USE_GAME_DIR + char *configDir = getenv("XDG_CONFIG_DIR"); + if (configDir) { + userDirectory = std::string(configDir) + "/stratagus"; + } else { + configDir = getenv("HOME"); + if (configDir) { +#ifdef USE_MAC + userDirectory = std::string(configDir) + "/Library/Stratagus"; #else - userDirectory += ".stratagus"; -#endif + userDirectory = std::string(configDir) + "/.config/stratagus"; +#endif // USE_MAC + } + } +#endif // USE_GAME_DIR } static std::string GetLocalPlayerNameFromEnv() From f82a0ecb691634505b1158a69dfce21943c5d110 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 08:58:10 +0100 Subject: [PATCH 02/13] add appimage builder script --- tools/build_appimage.sh | 130 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 tools/build_appimage.sh diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh new file mode 100644 index 0000000000..ffc29f2dc6 --- /dev/null +++ b/tools/build_appimage.sh @@ -0,0 +1,130 @@ +#!/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 + echo "Need GAME_VERSION set or passed as third argument" + exit 1 + 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 + apt-get update && apt-get install -yy git build-essential + apt-get install -yy zlib1g-dev file + # ubuntu SDL dependencies + apt-get install -yy libx11-dev libxext-dev libxrandr-dev libxi-dev libxfixes-dev libxcursor-dev + apt-get install -yy libpulse-dev + apt-get install -yy libgl1-mesa-dev libgles2-mesa-dev + apt-get install -yy libwayland-dev +fi + +# cmake +curl -L -O https://cmake.org/files/v3.20/cmake-3.20.0.tar.gz +tar zxf cmake-3.* +pushd cmake-3.* + sed -i 's/cmake_options="-DCMAKE_BOOTSTRAP=1"/cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=OFF"/' bootstrap + ./bootstrap --prefix=/usr/local + make -j + make install + popd + +git clone --depth 1 https://github.com/Wargus/stratagus +git clone --depth 1 https://github.com/Wargus/${GAME_ID} + +pushd stratagus + 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 + make -j install DESTDIR=../../AppDir + popd + popd +pushd ${GAME_ID} + git submodule update --init --recursive + mkdir build + pushd build + cmake .. \ + -DENABLE_VENDORED_LIBS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DSTRATAGUS_INCLUDE_DIR=$PWD/../../stratagus/gameheaders \ + -DSTRATAGUS=stratagus \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DDATA_PATH=../../share/games/stratagus/${GAME_ID}/ \ + -DGAMEDIR=/usr/bin \ + -DICONDIR=/usr/share/icons/default/64x64/ \ + -DGAMEDIRABS="" + make -j install DESTDIR=../../AppDir + 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 + 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 + echo ' exec_args: --argv0=${APPDIR}/usr/bin/{{GAME_ID}} $@' >> appimagebuilder.yaml + echo "AppImage:" >> appimagebuilder.yaml + echo " arch: '{{GAME_ARCH}}'" >> appimagebuilder.yaml + appimage-builder --recipe appimagebuilder.yaml +fi From c9003dd867e18bd9925b9a924f123ed1318a114a Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 09:18:29 +0100 Subject: [PATCH 03/13] add github action to build appimage --- .github/workflows/appimage.yml | 42 ++++++++++++++++++++++++++++++++++ tools/build_appimage.sh | 37 +++++++++++++++--------------- 2 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/appimage.yml diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml new file mode 100644 index 0000000000..77a4348322 --- /dev/null +++ b/.github/workflows/appimage.yml @@ -0,0 +1,42 @@ +name: AppImage Continuous + +on: + push: + branches: + - master + workflow_dispatch: + +env: + BUILD_TYPE: RelWithDebInfo + +jobs: + linux-appimage-continuous: + strategy: + matrix: + game: [{id: wargus, name: Wargus}, {id: war1gus, name: War1gus}] + name: Linux x64_64 (Continuous) + runs-on: ubuntu-18.04 + steps: + - name: Build game ${{ matrix.game.id }} + run: bash -x ./tools/build_appimage.sh ${{ matrix.game.id }} ${{ matrix.game.name }} + - name: Build appimage + uses: AppImageCrafters/build-appimage@master + with: + recipe: "./appimagebuilder.yaml" + - name: Create continuous release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "*.AppImage*" + body: | + :heavy_check_mark: AppImage built from latest commit ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})). + :scroll: Build log: https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks?check_suite_id=${{ github.run_id }} + commit: ${{ github.sha }} + draft: false + name: Continuous appimage builds + prerelease: true + removeArtifacts: false + replacesArtifacts: true + skipIfReleaseExists: false + tag: continuous + token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index ffc29f2dc6..ed216fe642 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -26,8 +26,7 @@ if [ -z "$GAME_VERSION" ]; then if [ $# -gt 2 ]; then export GAME_VERSION="$3" else - echo "Need GAME_VERSION set or passed as third argument" - exit 1 + export GAME_VERSION="$(head -1 debian/changelog | cut -f2 -d' ' | sed 's/(//' | sed 's/)//')" fi fi export GAME_ARCH=$(uname -m) @@ -64,10 +63,10 @@ pushd cmake-3.* make install popd -git clone --depth 1 https://github.com/Wargus/stratagus +# git clone --depth 1 https://github.com/Wargus/stratagus git clone --depth 1 https://github.com/Wargus/${GAME_ID} -pushd stratagus +# pushd stratagus git submodule update --init --recursive mkdir build pushd build @@ -80,7 +79,7 @@ pushd stratagus -DGAMEDIR=/usr/bin make -j install DESTDIR=../../AppDir popd - popd +# popd pushd ${GAME_ID} git submodule update --init --recursive mkdir build @@ -114,17 +113,19 @@ if [ -n "$CENTOS" ]; then ./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir AppDir --output appimage else # using appimage-builder - 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 - echo ' exec_args: --argv0=${APPDIR}/usr/bin/{{GAME_ID}} $@' >> appimagebuilder.yaml - echo "AppImage:" >> appimagebuilder.yaml - echo " arch: '{{GAME_ARCH}}'" >> appimagebuilder.yaml - appimage-builder --recipe appimagebuilder.yaml + 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 + echo -n ' exec_args: --argv0=${APPDIR}/usr/bin/' >> appimagebuilder.yaml + 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 fi From 93b38852b07e61e88e9289d859ac62992125e4cd Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 09:22:22 +0100 Subject: [PATCH 04/13] update workflow --- .github/workflows/appimage.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 77a4348322..c16cb9b83b 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -2,21 +2,19 @@ name: AppImage Continuous on: push: - branches: - - master - workflow_dispatch: - -env: - BUILD_TYPE: RelWithDebInfo + branches: [ master ] + pull_request: + branches: [ master ] jobs: - linux-appimage-continuous: + build-appimage: strategy: matrix: game: [{id: wargus, name: Wargus}, {id: war1gus, name: War1gus}] name: Linux x64_64 (Continuous) runs-on: ubuntu-18.04 steps: + - uses: actions/checkout@v2 - name: Build game ${{ matrix.game.id }} run: bash -x ./tools/build_appimage.sh ${{ matrix.game.id }} ${{ matrix.game.name }} - name: Build appimage From 01837c6f520449f0ab4a7ca836262f31cb8a5c46 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 09:23:28 +0100 Subject: [PATCH 05/13] update workflow --- .github/workflows/appimage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index c16cb9b83b..386e0526e2 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -7,7 +7,7 @@ on: branches: [ master ] jobs: - build-appimage: + build: strategy: matrix: game: [{id: wargus, name: Wargus}, {id: war1gus, name: War1gus}] From 231fac82312232dafd5355170db222cc7f833a98 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 13:16:01 +0100 Subject: [PATCH 06/13] update workflow file --- .github/workflows/appimage.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 386e0526e2..fa873963c4 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -21,20 +21,20 @@ jobs: uses: AppImageCrafters/build-appimage@master with: recipe: "./appimagebuilder.yaml" - - name: Create continuous release - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: "*.AppImage*" - body: | - :heavy_check_mark: AppImage built from latest commit ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})). - :scroll: Build log: https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks?check_suite_id=${{ github.run_id }} - commit: ${{ github.sha }} - draft: false - name: Continuous appimage builds - prerelease: true - removeArtifacts: false - replacesArtifacts: true - skipIfReleaseExists: false - tag: continuous - token: "${{ secrets.GITHUB_TOKEN }}" + - name: Create continuous release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: "*.AppImage*" + body: | + :heavy_check_mark: AppImage built from latest commit ([${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})). + :scroll: Build log: https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks?check_suite_id=${{ github.run_id }} + commit: ${{ github.sha }} + draft: false + name: Continuous appimage builds + prerelease: true + removeArtifacts: false + replacesArtifacts: true + skipIfReleaseExists: false + tag: continuous + token: "${{ secrets.GITHUB_TOKEN }}" From 7eb39f25b64068e0d5de5ed0386936cd2e82488e Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 16:55:23 +0100 Subject: [PATCH 07/13] fix buildscript --- tools/build_appimage.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index ed216fe642..83f5dffcdb 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -44,19 +44,19 @@ if [ -n "$CENTOS" ]; then yum install -yy wayland-devel else # ubuntu (>= 18.04) build tools - apt-get update && apt-get install -yy git build-essential - apt-get install -yy zlib1g-dev file + sudo apt-get update && apt-get install -yy git build-essential + sudo apt-get install -yy zlib1g-dev file # ubuntu SDL dependencies - apt-get install -yy libx11-dev libxext-dev libxrandr-dev libxi-dev libxfixes-dev libxcursor-dev - apt-get install -yy libpulse-dev - apt-get install -yy libgl1-mesa-dev libgles2-mesa-dev - apt-get install -yy libwayland-dev + 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 fi # cmake curl -L -O https://cmake.org/files/v3.20/cmake-3.20.0.tar.gz -tar zxf cmake-3.* -pushd cmake-3.* +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 @@ -77,7 +77,7 @@ git clone --depth 1 https://github.com/Wargus/${GAME_ID} -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DGAMEDIR=/usr/bin - make -j install DESTDIR=../../AppDir + make -j$(nproc) install DESTDIR=../../AppDir popd # popd pushd ${GAME_ID} @@ -94,7 +94,7 @@ pushd ${GAME_ID} -DGAMEDIR=/usr/bin \ -DICONDIR=/usr/share/icons/default/64x64/ \ -DGAMEDIRABS="" - make -j install DESTDIR=../../AppDir + make -j$(nproc) install DESTDIR=../../AppDir popd popd From f3d371b538fb02b0e52468ef6d5bd9b32ffea9b8 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 17:37:36 +0100 Subject: [PATCH 08/13] update buildscript --- tools/build_appimage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index 83f5dffcdb..f95edc0579 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -59,7 +59,7 @@ 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 + make -j$(nproc) make install popd From 961e4624e60ba6f10a83aaab85714b8b0c2cc689 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 20:11:05 +0100 Subject: [PATCH 09/13] update build script --- tools/build_appimage.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index f95edc0579..aff5ee8016 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -53,15 +53,17 @@ else sudo apt-get install -yy libwayland-dev fi -# 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 +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 # git clone --depth 1 https://github.com/Wargus/stratagus git clone --depth 1 https://github.com/Wargus/${GAME_ID} @@ -87,7 +89,7 @@ pushd ${GAME_ID} cmake .. \ -DENABLE_VENDORED_LIBS=ON \ -DCMAKE_BUILD_TYPE=Release \ - -DSTRATAGUS_INCLUDE_DIR=$PWD/../../stratagus/gameheaders \ + -DSTRATAGUS_INCLUDE_DIR=$PWD/../../gameheaders \ -DSTRATAGUS=stratagus \ -DCMAKE_INSTALL_PREFIX=/usr \ -DDATA_PATH=../../share/games/stratagus/${GAME_ID}/ \ @@ -122,7 +124,7 @@ else echo " icon: '${GAME_ID}'" >> appimagebuilder.yaml echo " version: '${GAME_VERSION}'" >> appimagebuilder.yaml echo " exec: usr/bin/${GAME_ID}" >> appimagebuilder.yaml - echo -n ' exec_args: --argv0=${APPDIR}/usr/bin/' >> appimagebuilder.yaml + echo -n ' exec_args: "--argv0=$APPDIR/usr/bin/"' >> appimagebuilder.yaml echo -n "${GAME_ID} " >> appimagebuilder.yaml echo '$@' >> appimagebuilder.yaml echo "AppImage:" >> appimagebuilder.yaml From c7ee37479ba9789b85e641aaef58474194a4c171 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 21:09:33 +0100 Subject: [PATCH 10/13] try fix yml --- tools/build_appimage.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index aff5ee8016..5c3d9c049a 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -124,9 +124,7 @@ else echo " icon: '${GAME_ID}'" >> appimagebuilder.yaml echo " version: '${GAME_VERSION}'" >> appimagebuilder.yaml echo " exec: usr/bin/${GAME_ID}" >> appimagebuilder.yaml - echo -n ' exec_args: "--argv0=$APPDIR/usr/bin/"' >> appimagebuilder.yaml - echo -n "${GAME_ID} " >> appimagebuilder.yaml - echo '$@' >> appimagebuilder.yaml + echo " exec_args: '\"--argv0=\$APPDIR/usr/bin/${GAME_ID}\" \$@'" >> appimagebuilder.yaml echo "AppImage:" >> appimagebuilder.yaml echo " arch: '${GAME_ARCH}'" >> appimagebuilder.yaml appimage-builder --recipe appimagebuilder.yaml || true # in github, we run this after From dfbbc40f7c3248b3eaf0163d60b69e15636e521a Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 21:23:34 +0100 Subject: [PATCH 11/13] install squashfstools --- tools/build_appimage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index 5c3d9c049a..9731ffc2a0 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -45,7 +45,7 @@ if [ -n "$CENTOS" ]; then else # ubuntu (>= 18.04) build tools sudo apt-get update && apt-get install -yy git build-essential - sudo apt-get install -yy zlib1g-dev file + sudo apt-get install -yy zlib1g-dev file squashfs-tools # ubuntu SDL dependencies sudo apt-get install -yy libx11-dev libxext-dev libxrandr-dev libxi-dev libxfixes-dev libxcursor-dev sudo apt-get install -yy libpulse-dev From 3d0b7428c0566ce3139e99273b1d2fdffe1631f6 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 21:49:46 +0100 Subject: [PATCH 12/13] build appimage in-script --- .github/workflows/appimage.yml | 4 ---- tools/build_appimage.sh | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index fa873963c4..20c3b3243b 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -17,10 +17,6 @@ jobs: - uses: actions/checkout@v2 - name: Build game ${{ matrix.game.id }} run: bash -x ./tools/build_appimage.sh ${{ matrix.game.id }} ${{ matrix.game.name }} - - name: Build appimage - uses: AppImageCrafters/build-appimage@master - with: - recipe: "./appimagebuilder.yaml" - name: Create continuous release uses: ncipollo/release-action@v1 with: diff --git a/tools/build_appimage.sh b/tools/build_appimage.sh index 9731ffc2a0..4100047fc9 100644 --- a/tools/build_appimage.sh +++ b/tools/build_appimage.sh @@ -45,7 +45,7 @@ if [ -n "$CENTOS" ]; then else # ubuntu (>= 18.04) build tools sudo apt-get update && apt-get install -yy git build-essential - sudo apt-get install -yy zlib1g-dev file squashfs-tools + sudo apt-get install -yy zlib1g-dev file # ubuntu SDL dependencies sudo apt-get install -yy libx11-dev libxext-dev libxrandr-dev libxi-dev libxfixes-dev libxcursor-dev sudo apt-get install -yy libpulse-dev @@ -127,5 +127,11 @@ else echo " exec_args: '\"--argv0=\$APPDIR/usr/bin/${GAME_ID}\" \$@'" >> appimagebuilder.yaml echo "AppImage:" >> appimagebuilder.yaml echo " arch: '${GAME_ARCH}'" >> appimagebuilder.yaml - appimage-builder --recipe appimagebuilder.yaml || true # in github, we run this after + APPIMAGEBUILDER=`which appimage-builder || true` + if [ -z "$APPIMAGEBUILDER" ]; then + wget https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage + chmod +x appimage-builder-1.1.0-x86_64.AppImage + APPIMAGEBUILDER=$(pwd)/appimage-builder-1.1.0-x86_64.AppImage + fi + $APPIMAGEBUILDER --recipe appimagebuilder.yaml fi From efd60ef5e9e660ef4c2144100e1b289377a5279e Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 14 Jan 2023 21:55:23 +0100 Subject: [PATCH 13/13] only wrgus --- .github/workflows/appimage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 20c3b3243b..2707b60db5 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -10,7 +10,7 @@ jobs: build: strategy: matrix: - game: [{id: wargus, name: Wargus}, {id: war1gus, name: War1gus}] + game: [{id: wargus, name: Wargus}] name: Linux x64_64 (Continuous) runs-on: ubuntu-18.04 steps: