diff --git a/.github/workflows/flatpak-build.yml b/.github/workflows/flatpak-build.yml new file mode 100644 index 000000000..8ff3c8184 --- /dev/null +++ b/.github/workflows/flatpak-build.yml @@ -0,0 +1,25 @@ +name: Flatpak Build + +on: + push: + branches: [master] + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + container: + image: bilelmoussaoui/flatpak-github-actions:gnome-42 + options: --privileged + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build Flatpak bundle + uses: flatpak/flatpak-github-actions/flatpak-builder@v6 + with: + bundle: modrinthApp.flatpak + manifest-path: distribution/com.modrinth.ModrinthApp.yml + cache-key: flatpak-builder-${{ github.ref }} diff --git a/.gitignore b/.gitignore index 363fe7422..772972ead 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,6 @@ fabric.properties theseus.iml +# flatpak +.flatpak-builder +flatbuild diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..5a47e2862 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "distribution/shared-modules"] + path = distribution/shared-modules + url = https://github.com/flathub/shared-modules.git diff --git a/distribution/com.modrinth.ModrinthApp.desktop b/distribution/com.modrinth.ModrinthApp.desktop new file mode 100644 index 000000000..ecb762ae2 --- /dev/null +++ b/distribution/com.modrinth.ModrinthApp.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=Modrinth App +Comment=Modrinth's game launcher for creating and playing Modrinth projects +Exec=modrinth-app +Icon=com.modrinth.ModrinthApp +Type=Application +Terminal=false +StartupNotify=true +Categories=Game;ActionGame;AdventureGame;Simulation; +Keywords=game;minecraft;mc; +StartupWMClass=ModrinthApp +Version=1.4 diff --git a/distribution/com.modrinth.ModrinthApp.metainfo.xml b/distribution/com.modrinth.ModrinthApp.metainfo.xml new file mode 100644 index 000000000..f288df78c --- /dev/null +++ b/distribution/com.modrinth.ModrinthApp.metainfo.xml @@ -0,0 +1,21 @@ + + + com.modrinth.ModrinthApp + com.modrinth.ModrinthApp.desktop + Modrinth App + Modrinth + Modrinth's game launcher for creating and playing Modrinth projects + CC0-1.0 + GPL-3.0-only + + + + + +

Modrinth's game launcher for creating and playing Modrinth projects

+
+ + moderate + intense + +
diff --git a/distribution/com.modrinth.ModrinthApp.yml b/distribution/com.modrinth.ModrinthApp.yml new file mode 100644 index 000000000..96c43a131 --- /dev/null +++ b/distribution/com.modrinth.ModrinthApp.yml @@ -0,0 +1,81 @@ +id: com.modrinth.ModrinthApp +runtime: org.gnome.Platform +runtime-version: "42" +sdk: org.gnome.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.rust-stable + - org.freedesktop.Sdk.Extension.node18 + +command: modrinth-app +finish-args: + - --filesystem=xdg-run/app/com.discordapp.Discord:create # allows for discord rpc + - --device=all + - --share=ipc + - --share=network + - --socket=pulseaudio + - --socket=x11 + - --socket=wayland + +build-options: + append-path: "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/node18/bin" + + build-args: + - --share=network + +modules: + - shared-modules/libappindicator/libappindicator-gtk3-12.10.json + + # for some controller mods (see https://github.com/isXander/Controlify/issues/31) + - shared-modules/libusb/libusb.json + + - name: flite + buildsystem: autotools + config-opts: + - --enable-shared + - --with-audio=pulseaudio + sources: + - type: archive + url: https://github.com/festvox/flite/archive/refs/tags/v2.2.tar.gz + sha512: 1ca2f4145651490ef8405fdb830a3b42e885020a7603d965f6a5581b01bed41047d396b38c2ceab138fc0b28d28078db17acd2b5a84c6444cb99d65c581afa72 + cleanup: + - '/lib/libflite*.a' + + - name: modrinth-app + buildsystem: simple + build-options: + append-path: /run/build/modrinth-app/pnpm + build-commands: + - pnpm config set store-dir .pnpm-store + - cd theseus/theseus_gui && pnpm install + - cd theseus/theseus_gui && pnpm build + - cd theseus && cargo fetch --locked --manifest-path Cargo.toml + - cd theseus && cargo build --locked --release + + - install -Dm755 theseus/target/release/theseus_gui /app/bin/modrinth-app + + - mkdir -p /app/share/{icons/hicolor/256x256/apps,applications,metainfo} + + - cp theseus/theseus_gui/src-tauri/icons/Square284x284Logo.png /app/share/icons/hicolor/256x256/apps/com.modrinth.ModrinthApp.png + - install -Dm644 com.modrinth.ModrinthApp.metainfo.xml /app/share/metainfo/com.modrinth.ModrinthApp.metainfo.xml + - install -Dm644 com.modrinth.ModrinthApp.desktop /app/share/applications/com.modrinth.ModrinthApp.desktop + + sources: + - type: archive + url: https://registry.npmjs.org/@pnpm/linux-x64/-/linux-x64-7.33.5.tgz + sha512: d594a9e505b33a5a7b8684645ca762a2c24c6b3e1e477afe8f412d0dd5c8b1b9b9e636e3a19ae0ceeed603d8507f84b081ed12b283ac543bc4bf26d591cab4c5 + dest: pnpm + + - type: shell + commands: + - chmod +x pnpm + dest: pnpm + + - type: dir + path: ../ + dest: theseus + + - type: file + path: com.modrinth.ModrinthApp.metainfo.xml + + - type: file + path: com.modrinth.ModrinthApp.desktop diff --git a/distribution/shared-modules b/distribution/shared-modules new file mode 160000 index 000000000..e4f3df962 --- /dev/null +++ b/distribution/shared-modules @@ -0,0 +1 @@ +Subproject commit e4f3df96210901b81b594777a09768506358ebf0