From c24da9f9211122baecaf765633efd4d583092d96 Mon Sep 17 00:00:00 2001 From: Grillo del Mal Date: Thu, 17 Oct 2024 00:33:56 -0300 Subject: [PATCH] Add flatpak bundle build --- .github/workflows/build-flatpak.yml | 95 +++++++++++++++++++ .../flatpak/com.inochi2d.inochi-session.yml | 65 +++++++++++++ .../flatpak/extras/flatpak-remote/LICENSE | 19 ++++ .../com.inochi2d.inochi-session.metainfo.xml | 51 ++++++++++ .../flatpak/nightly/inochi-session.desktop | 6 ++ .../com.inochi2d.inochi-session.metainfo.xml | 44 +++++++++ .../flatpak/release/inochi-session.desktop | 6 ++ 7 files changed, 286 insertions(+) create mode 100644 .github/workflows/build-flatpak.yml create mode 100644 build-aux/linux/flatpak/com.inochi2d.inochi-session.yml create mode 100644 build-aux/linux/flatpak/extras/flatpak-remote/LICENSE create mode 100644 build-aux/linux/flatpak/nightly/com.inochi2d.inochi-session.metainfo.xml create mode 100644 build-aux/linux/flatpak/nightly/inochi-session.desktop create mode 100644 build-aux/linux/flatpak/release/com.inochi2d.inochi-session.metainfo.xml create mode 100644 build-aux/linux/flatpak/release/inochi-session.desktop diff --git a/.github/workflows/build-flatpak.yml b/.github/workflows/build-flatpak.yml new file mode 100644 index 0000000..d3a0911 --- /dev/null +++ b/.github/workflows/build-flatpak.yml @@ -0,0 +1,95 @@ +name: 'Build Inochi Session (Flatpak)' + +on: + workflow_call: + flatpak_branch: + required: true + type: string + + +jobs: + build-flatpak: + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08 + options: --privileged + + env: + MANIFEST_PATH: build-aux/linux/flatpak/com.inochi2d.inochi-session.yml + FLATPAK_BRANCH: ${{ inputs.flatpak_branch }} + FLATPAK_BUILD_DIR: build-dir + FLATPAK_BUILD_REPO: build-repo + + steps: + - uses: actions/checkout@v4.1.7 + with: + submodules: true + + - name: Dump canonical manifest + run: | + set -e + flatpak-builder --show-manifest ${MANIFEST_PATH} > canonical-manifest.json + + - name: Download flatpak SDK and sources + run: | + set -e + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + flatpak-builder --default-branch=${FLATPAK_BRANCH} --install-deps-from=flathub --install-deps-only --user /dev/null ${MANIFEST_PATH} + flatpak-builder --default-branch=${FLATPAK_BRANCH} --download-only /dev/null ${MANIFEST_PATH} + + - name: Prime cache + uses: actions/cache@v3 + with: + path: | + .flatpak-builder/ccache + key: flatpak-builder-${{ hashFiles('canonical-manifest.json') }} + restore-keys: | + flatpak-builder- + + - name: Build flatpak + run: | + set -e + flatpak-builder --default-branch=${FLATPAK_BRANCH} --ccache --repo=${FLATPAK_BUILD_REPO} ${FLATPAK_BUILD_DIR} ${MANIFEST_PATH} + + - name: Upload flatpak repo + uses: actions/upload-artifact@v4 + with: + name: ${{ env.FLATPAK_BUILD_REPO }} + path: | + ${{ env.FLATPAK_BUILD_REPO }} + !${{ env.FLATPAK_BUILD_REPO }}/.lock + + build-flatpak-bundle: + needs: build-flatpak + runs-on: ubuntu-latest + + env: + APP_ID: com.inochi2d.inochi-session + FLATPAK_BUNDLE: inochi-session + FLATPAK_BRANCH: ${{ inputs.flatpak_branch }} + FLATPAK_BUILD_REPO: build-repo + + steps: + - uses: actions/checkout@v2 + + - name: Install flatpak + run: | + set -e + sudo apt install -y flatpak + + - name: Download flatpak repo + uses: actions/download-artifact@v4 + with: + name: ${{ env.FLATPAK_BUILD_REPO }} + + - name: Create flatpak bundle + run: | + set -e + mkdir -p ${FLATPAK_BUILD_REPO}/{extensions,refs/{mirrors,remotes},state,tmp/cache} + flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo ${FLATPAK_BUILD_REPO} ${FLATPAK_BUNDLE}.flatpak ${APP_ID} ${FLATPAK_BRANCH} + + - name: Upload flatpak bundle + uses: actions/upload-artifact@v4 + with: + name: "build-flatpak" + path: ${{ env.FLATPAK_BUNDLE }}.flatpak \ No newline at end of file diff --git a/build-aux/linux/flatpak/com.inochi2d.inochi-session.yml b/build-aux/linux/flatpak/com.inochi2d.inochi-session.yml new file mode 100644 index 0000000..d83eafb --- /dev/null +++ b/build-aux/linux/flatpak/com.inochi2d.inochi-session.yml @@ -0,0 +1,65 @@ +id: com.inochi2d.inochi-session +runtime: org.freedesktop.Platform +runtime-version: '24.08' +sdk: org.freedesktop.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.ldc + - org.freedesktop.Sdk.Extension.llvm18 +command: inochi-session +finish-args: + - --device=all # OpenGL rendering, webcams (may be required? not sure) + - --socket=fallback-x11 + - --share=ipc + - --share=network # Needed to communicate with external trackers + - --socket=wayland + - --filesystem=host # This is a dev tool, it should probably have as much access to the host as it can. Also needs it for "Recent Files" + +modules: + + # --- Inochi Session --- + - name: Inochi-Session + buildsystem: simple + build-options: + build-args: + - "--share=network" + + append-path: /usr/lib/sdk/ldc/bin + prepend-path: /usr/lib/sdk/llvm18/bin + prepend-ld-library-path: /usr/lib/sdk/llvm18/lib + env: + DFLAGS: '-g --d-debug' + build-commands: + - chmod +x ./gentl.sh; ./gentl.sh + - git clone https://github.com/Inochi2D/i2d-imgui.git --recurse-submodules; + git clone https://github.com/Inochi2D/dcv-i2d; + dub add-local i2d-imgui/ "0.8.0"; + dub add-local dcv-i2d/ "0.3.0"; + dub build --config=update-version; + dub build --config=meta; + dub build --config=linux-nightly --debug=InExperimental + - install -Dm 755 ./out/inochi-session /app/bin/inochi-session + - install -Dm 755 ./out/cimgui.so /app/bin/cimgui.so + # Uncomment when session translations are actually a thing. + #- install -Dm644 ./out/*.mo /app/bin + + sources: + - type: dir + path: ../../.. # The root of the Inochi Session repo + + - name: Metadata + buildsystem: simple + build-commands: + + - install -Dm644 com.inochi2d.inochi-session.metainfo.xml /app/share/metainfo/com.inochi2d.inochi-session.metainfo.xml + - install -Dm644 ./session/icon_128.png /app/share/icons/hicolor/128x128/apps/com.inochi2d.inochi-session.png + - install -Dm644 ./session/icon_256.png /app/share/icons/hicolor/256x256/apps/com.inochi2d.inochi-session.png + - install -Dm644 ./session/icon_512.png /app/share/icons/hicolor/512x512/apps/com.inochi2d.inochi-session.png + - install -Dm644 inochi-session.desktop /app/share/applications/com.inochi2d.inochi-session.desktop + + sources: + - type: git + url: https://github.com/Inochi2D/branding.git + commit: 7caad43eb2b6d423275a3d972ac1e7ee36da2850 + + - type: dir + path: ./nightly/ diff --git a/build-aux/linux/flatpak/extras/flatpak-remote/LICENSE b/build-aux/linux/flatpak/extras/flatpak-remote/LICENSE new file mode 100644 index 0000000..f967bd6 --- /dev/null +++ b/build-aux/linux/flatpak/extras/flatpak-remote/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2021 TheEvilSkeleton + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/build-aux/linux/flatpak/nightly/com.inochi2d.inochi-session.metainfo.xml b/build-aux/linux/flatpak/nightly/com.inochi2d.inochi-session.metainfo.xml new file mode 100644 index 0000000..f973142 --- /dev/null +++ b/build-aux/linux/flatpak/nightly/com.inochi2d.inochi-session.metainfo.xml @@ -0,0 +1,51 @@ + + + com.inochi2d.inochi-session + Inochi Session + Stream with Inochi2D puppets + + Luna the Foxgirl + + com.inochi2d.inochi-session.desktop + CC0-1.0 + BSD-2-Clause + +

Inochi2D is a framework for realtime 2D puppet animation which can be used for VTubing, + game development and digital animation.

+

Inochi Session is a tool that lets you use your Inochi2D models for live streaming.

+
+ + + Title screen + https://user-images.githubusercontent.com/7032834/181119161-f83e8e57-2f9e-409f-90bd-1b1b9c047bcc.png + + + + + https://github.com/Inochi2D/inochi-session/ + +

This is a nightly build of Inochi Session!

+

Inochi Session may crash unexpectedly and you will likely encounter bugs.

+

Make sure to save and back up your work often!

+
+
+
+ https://lunafoxgirlvt.itch.io/inochi-session + https://github.com/Inochi2D/inochi-session/issues + https://docs.inochi2d.com + https://inochi2d.com/#donate + https://github.com/Inochi2D/inochi-session + https://github.com/Inochi2D/inochi-session + + Graphics + + + pointing + keyboard + + + #dbdbdb + #242424 + + +
diff --git a/build-aux/linux/flatpak/nightly/inochi-session.desktop b/build-aux/linux/flatpak/nightly/inochi-session.desktop new file mode 100644 index 0000000..aa2bd15 --- /dev/null +++ b/build-aux/linux/flatpak/nightly/inochi-session.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Inochi Session (Nightly) +Exec=inochi-session +Icon=com.inochi2d.inochi-session +Type=Application +Categories=Utility \ No newline at end of file diff --git a/build-aux/linux/flatpak/release/com.inochi2d.inochi-session.metainfo.xml b/build-aux/linux/flatpak/release/com.inochi2d.inochi-session.metainfo.xml new file mode 100644 index 0000000..34de628 --- /dev/null +++ b/build-aux/linux/flatpak/release/com.inochi2d.inochi-session.metainfo.xml @@ -0,0 +1,44 @@ + + + com.inochi2d.inochi-session + Inochi Session + Stream with Inochi2D puppets + + Luna the Foxgirl + + com.inochi2d.inochi-session.desktop + CC0-1.0 + BSD-2-Clause + +

Inochi2D is a framework for realtime 2D puppet animation which can be used for VTubing, + game development and digital animation.

+

Inochi Session is a tool that lets you use your Inochi2D models for live streaming.

+
+ + + Title screen + https://user-images.githubusercontent.com/7032834/181119161-f83e8e57-2f9e-409f-90bd-1b1b9c047bcc.png + + + + + + https://lunafoxgirlvt.itch.io/inochi-session + https://github.com/Inochi2D/inochi-session/issues + https://docs.inochi2d.com + https://inochi2d.com/#donate + https://github.com/Inochi2D/inochi-session + https://github.com/Inochi2D/inochi-session + + Graphics + + + pointing + keyboard + + + #dbdbdb + #242424 + + +
diff --git a/build-aux/linux/flatpak/release/inochi-session.desktop b/build-aux/linux/flatpak/release/inochi-session.desktop new file mode 100644 index 0000000..b7b18f5 --- /dev/null +++ b/build-aux/linux/flatpak/release/inochi-session.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=Inochi Session +Exec=inochi-session +Icon=com.inochi2d.inochi-session +Type=Application +Categories=Utility \ No newline at end of file