Skip to content

Commit

Permalink
Add flatpak bundle build
Browse files Browse the repository at this point in the history
  • Loading branch information
grillo-delmal committed Oct 17, 2024
1 parent affd74e commit c24da9f
Show file tree
Hide file tree
Showing 7 changed files with 286 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/build-flatpak.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
65 changes: 65 additions & 0 deletions build-aux/linux/flatpak/com.inochi2d.inochi-session.yml
Original file line number Diff line number Diff line change
@@ -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/
19 changes: 19 additions & 0 deletions build-aux/linux/flatpak/extras/flatpak-remote/LICENSE
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.inochi2d.inochi-session</id>
<name>Inochi Session</name>
<summary>Stream with Inochi2D puppets</summary>
<developer id="com.inochi2d">
<name>Luna the Foxgirl</name>
</developer>
<launchable type="desktop-id">com.inochi2d.inochi-session.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-2-Clause</project_license>
<description>
<p>Inochi2D is a framework for realtime 2D puppet animation which can be used for VTubing,
game development and digital animation.</p>
<p>Inochi Session is a tool that lets you use your Inochi2D models for live streaming.</p>
</description>
<screenshots>
<screenshot type="default">
<caption>Title screen</caption>
<image type="source">https://user-images.githubusercontent.com/7032834/181119161-f83e8e57-2f9e-409f-90bd-1b1b9c047bcc.png</image>
</screenshot>
</screenshots>
<releases>
<release version="nightly">
<url>https://github.com/Inochi2D/inochi-session/</url>
<description>
<p>This is a nightly build of Inochi Session!</p>
<p>Inochi Session may crash unexpectedly and you will likely encounter bugs.</p>
<p>Make sure to save and back up your work often!</p>
</description>
</release>
</releases>
<url type="homepage">https://lunafoxgirlvt.itch.io/inochi-session</url>
<url type="bugtracker">https://github.com/Inochi2D/inochi-session/issues</url>
<url type="help">https://docs.inochi2d.com</url>
<url type="donation">https://inochi2d.com/#donate</url>
<url type="vcs-browser">https://github.com/Inochi2D/inochi-session</url>
<url type="contribute">https://github.com/Inochi2D/inochi-session</url>
<categories>
<category>Graphics</category>
</categories>
<recommends>
<control>pointing</control>
<control>keyboard</control>
</recommends>
<branding>
<color type="primary" scheme_preference="light">#dbdbdb</color>
<color type="primary" scheme_preference="dark">#242424</color>
</branding>
<content_rating type="oars-1.1"/>
</component>
6 changes: 6 additions & 0 deletions build-aux/linux/flatpak/nightly/inochi-session.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Name=Inochi Session (Nightly)
Exec=inochi-session
Icon=com.inochi2d.inochi-session
Type=Application
Categories=Utility
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.inochi2d.inochi-session</id>
<name>Inochi Session</name>
<summary>Stream with Inochi2D puppets</summary>
<developer id="com.inochi2d">
<name>Luna the Foxgirl</name>
</developer>
<launchable type="desktop-id">com.inochi2d.inochi-session.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>BSD-2-Clause</project_license>
<description>
<p>Inochi2D is a framework for realtime 2D puppet animation which can be used for VTubing,
game development and digital animation.</p>
<p>Inochi Session is a tool that lets you use your Inochi2D models for live streaming.</p>
</description>
<screenshots>
<screenshot type="default">
<caption>Title screen</caption>
<image type="source">https://user-images.githubusercontent.com/7032834/181119161-f83e8e57-2f9e-409f-90bd-1b1b9c047bcc.png</image>
</screenshot>
</screenshots>
<releases>
<release version="stable"/>
</releases>
<url type="homepage">https://lunafoxgirlvt.itch.io/inochi-session</url>
<url type="bugtracker">https://github.com/Inochi2D/inochi-session/issues</url>
<url type="help">https://docs.inochi2d.com</url>
<url type="donation">https://inochi2d.com/#donate</url>
<url type="vcs-browser">https://github.com/Inochi2D/inochi-session</url>
<url type="contribute">https://github.com/Inochi2D/inochi-session</url>
<categories>
<category>Graphics</category>
</categories>
<recommends>
<control>pointing</control>
<control>keyboard</control>
</recommends>
<branding>
<color type="primary" scheme_preference="light">#dbdbdb</color>
<color type="primary" scheme_preference="dark">#242424</color>
</branding>
<content_rating type="oars-1.1"/>
</component>
6 changes: 6 additions & 0 deletions build-aux/linux/flatpak/release/inochi-session.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Name=Inochi Session
Exec=inochi-session
Icon=com.inochi2d.inochi-session
Type=Application
Categories=Utility

0 comments on commit c24da9f

Please sign in to comment.