From 1107798e29501074b63e8562f2efa39f631af8eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Sun, 17 Mar 2024 23:24:46 +0100 Subject: [PATCH] Add Flatpak support for Linux Allows to use Flatpak as the way to play the game on Linux. --- .ci_scripts/build_upload.sh | 6 ++++++ .ci_scripts/install_dependencies.sh | 6 ++++++ .ci_scripts/run_build.sh | 4 ++++ .ci_scripts/run_cmake.sh | 2 ++ .github/workflows/main.yml | 4 ++++ com.github.bvschaik.julius.json | 28 ++++++++++++++++++++++++++++ 6 files changed, 50 insertions(+) create mode 100644 com.github.bvschaik.julius.json diff --git a/.ci_scripts/build_upload.sh b/.ci_scripts/build_upload.sh index 8f301a87f0..31e9de71be 100755 --- a/.ci_scripts/build_upload.sh +++ b/.ci_scripts/build_upload.sh @@ -33,6 +33,12 @@ case "$DEPLOY" in DEPLOY_FILE=julius-$VERSION-linux-x86_64.zip cp "${build_dir}/julius.zip" "deploy/$DEPLOY_FILE" ;; +"flatpak") + flatpak build-export export repo + DEPLOY_FILE=julius-$VERSION-linux.flatpak + flatpak build-bundle export julius.flatpak com.github.bvschaik.julius --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo + cp julius.flatpak "deploy/$DEPLOY_FILE" + ;; "appimage") PACKAGE=linux-appimage DEPLOY_FILE=julius-$VERSION-linux.AppImage diff --git a/.ci_scripts/install_dependencies.sh b/.ci_scripts/install_dependencies.sh index 3a4e95b218..bfa6edd856 100755 --- a/.ci_scripts/install_dependencies.sh +++ b/.ci_scripts/install_dependencies.sh @@ -84,6 +84,12 @@ mkdir -p deps if [ "$BUILD_TARGET" == "appimage" ] || [ "$BUILD_TARGET" == "codeql-cpp" ] then sudo apt-get update && sudo apt-get -y install libgl1-mesa-dev libsdl2-dev libsdl2-mixer-dev +elif [ "$BUILD_TARGET" == "flatpak" ] +then + sudo apt-get update && sudo apt-get -y install flatpak-builder + sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + sudo flatpak-builder repo com.github.bvschaik.julius.json --install-deps-from=flathub --install-deps-only --delete-build-dirs + sudo rm -R .flatpak-builder elif [ ! -z "$SDL_VERSION" ] && [ ! -z "$SDL_MIXER_VERSION" ] then if [ "$BUILD_TARGET" == "mac" ] diff --git a/.ci_scripts/run_build.sh b/.ci_scripts/run_build.sh index 0e8717cee3..a2e9b29589 100755 --- a/.ci_scripts/run_build.sh +++ b/.ci_scripts/run_build.sh @@ -20,6 +20,10 @@ case "$BUILD_TARGET" in echo "Creating disk image" hdiutil create -volname Julius -srcfolder julius.app -ov -format UDZO julius.dmg ;; +"flatpak") + flatpak-builder repo com.github.bvschaik.julius.json --install-deps-from=flathub --keep-build-dirs + cp .flatpak-builder/build/julius/res/version.txt res/version.txt + ;; "appimage") cd build && make -j4 && make test make DESTDIR=AppDir install diff --git a/.ci_scripts/run_cmake.sh b/.ci_scripts/run_cmake.sh index f784aaca53..dd6fd3bb12 100755 --- a/.ci_scripts/run_cmake.sh +++ b/.ci_scripts/run_cmake.sh @@ -10,6 +10,8 @@ case "$BUILD_TARGET" in "mac") mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" .. ;; +"flatpak") + ;; "appimage") mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DSYSTEM_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr .. ;; diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d121341778..c65c7cc82c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,6 +13,10 @@ jobs: fail-fast: false matrix: include: + - name: Linux Flatpak + os: ubuntu-20.04 + BUILD_TARGET: flatpak + DEPLOY: flatpak - name: Linux AppImage os: ubuntu-20.04 BUILD_TARGET: appimage diff --git a/com.github.bvschaik.julius.json b/com.github.bvschaik.julius.json new file mode 100644 index 0000000000..e73dd7a2da --- /dev/null +++ b/com.github.bvschaik.julius.json @@ -0,0 +1,28 @@ +{ + "id" : "com.github.bvschaik.julius", + "runtime" : "org.freedesktop.Platform", + "runtime-version" : "23.08", + "sdk" : "org.freedesktop.Sdk", + "command" : "julius", + "finish-args" : [ + "--filesystem=home", + "--share=ipc", + "--device=dri", + "--socket=wayland", + "--socket=fallback-x11", + "--socket=pulseaudio" + ], + "modules" : [ + { + "name" : "julius", + "buildsystem" : "cmake-ninja", + "sources" : [ + { + "type" : "git", + "url" : "https://github.com/bvschaik/julius.git", + "branch" : "master" + } + ] + } + ] +}