diff --git a/.gitignore b/.gitignore index a666135..008bea8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ bin/ lib/ obj/ +# Flatpak +.flatpak-builder/ + # Prerequisites *.d diff --git a/AGENTS.md b/AGENTS.md index 26f56bb..0b0b4a9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,6 +30,8 @@ meson compile -C build - Version `1.0.0` is stamped in FOUR places: `meson.build`, `flake.nix`, `default.nix`, and the `` entry in `resources/io.github.bemagri.nomines.metainfo.xml`. Bump all four together. - Release sanity: `nix build .` (validates the flake), `desktop-file-validate` + `appstreamcli validate --no-net` on the resources (wired up as meson tests). - The metainfo screenshot URL points at `raw.githubusercontent.com/bemagri/nomines/main/...` — it 404s until the repo is published; replace if the repo moves. +- Flatpak: `io.github.bemagri.nomines.yml` builds libsigc++/glibmm/cairomm/pangomm/gtkmm from tarballs against the GNOME 46 runtime (matches the gtkmm 4.14/glib 2.80 stack we develop against), then the app from the `v1.0.0` git tag. The pinned `commit:` must match the pushed tag. The leaderboard needs the `--filesystem=xdg-config/nomines:create` finish-arg — don't drop it. Local builds land in `.flatpak-builder/` (gitignored); `flatpak-builder --user --install --force-clean build-flatpak io.github.bemagri.nomines.yml`. +- Flatpak module version traps (all verified by building): gtkmm 4.14 needs pangomm >= 2.50 (which still installs `pangomm-2.48.pc`; 2.48.x is too old), and cairomm tarballs live on `cairographics.org/releases`, not download.gnome.org. `appstream-compose: false` is set in the manifest because flatpak-builder's compose fetches the (still-404) metainfo screenshot URL — remove it once the repo is public. Flatpak's icon validation can't decode SVGs, so PNG icons (128/512) are installed under the app-id name and the svg is cleanup-removed; keep that convention. ## Gotchas diff --git a/README.md b/README.md index 2c09fe5..617e6ff 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,20 @@ The Nix flake also provides a development shell with all dependencies: nix develop ``` +## Building a Flatpak + +NoMines ships a Flatpak manifest (`io.github.bemagri.nomines.yml`) that builds +the gtkmm stack (libsigc++, glibmm, gtkmm) against the GNOME 46 runtime: + +```bash +flatpak install -y flathub org.gnome.Platform//46 org.gnome.Sdk//46 +flatpak-builder --user --install --force-clean build-flatpak io.github.bemagri.nomines.yml +flatpak run io.github.bemagri.nomines +``` + +Note: the manifest's `commit` must match the pushed `v1.0.0` tag (update it if +the history is rebased before pushing). + ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. diff --git a/io.github.bemagri.nomines.yml b/io.github.bemagri.nomines.yml new file mode 100644 index 0000000..7362284 --- /dev/null +++ b/io.github.bemagri.nomines.yml @@ -0,0 +1,112 @@ +# Flatpak manifest for NoMines. +# +# The GNOME runtime pins the exact gtk4/glib versions the gtkmm stack is +# built against: 46 = gtk 4.14 + glib 2.80, matching gtkmm 4.14/glibmm 2.80. +# +# Build locally: +# flatpak install -y flathub org.gnome.Platform//46 org.gnome.Sdk//46 +# flatpak-builder --user --install --force-clean build-flatpak io.github.bemagri.nomines.yml +# flatpak run io.github.bemagri.nomines + +app-id: io.github.bemagri.nomines +runtime: org.gnome.Platform +runtime-version: '46' +sdk: org.gnome.Sdk +command: nomines + +# flatpak-builder's appstreamcli compose fetches the metainfo screenshot URL; +# it 404s until the repo is published. Remove this line once the repo is +# public (Flathub CI runs its own compose/validation anyway). +appstream-compose: false + +finish-args: + - --share=ipc + - --socket=fallback-x11 + - --socket=wayland + - --device=dri + # Leaderboard persistence (~/.config/nomines/leaderboard.ini) + - --filesystem=xdg-config/nomines:create + +build-options: + no-debuginfo: true + +cleanup: + - /include + - /lib/pkgconfig + - /lib/cmake + - /lib/girepository-1.0 + - /lib/*.a + - /lib/*.la + - /share/aclocal + - /share/doc + - /share/gir-1.0 + - /share/gtk-doc + - /share/pkgconfig + # flatpak's icon validation can't decode SVGs; the PNGs suffice + - /share/icons/hicolor/scalable/apps/*.svg + +modules: + - name: libsigc++ + buildsystem: meson + config-opts: + - -Dbuild-tests=false + - -Dbuild-examples=false + sources: + - type: archive + url: https://download.gnome.org/sources/libsigc++/3.6/libsigc++-3.6.0.tar.xz + sha256: c3d23b37dfd6e39f2e09f091b77b1541fbfa17c4f0b6bf5c89baef7229080e17 + + - name: glibmm + buildsystem: meson + config-opts: + - -Dmaintainer-mode=false + - -Dbuild-documentation=false + - -Dbuild-examples=false + sources: + - type: archive + url: https://download.gnome.org/sources/glibmm/2.80/glibmm-2.80.0.tar.xz + sha256: 539b0a29e15a96676c4f0594541250566c5ca44da5d4d87a3732fa2d07909e4a + + - name: cairomm + buildsystem: meson + config-opts: + - -Dmaintainer-mode=false + - -Dbuild-documentation=false + - -Dbuild-examples=false + - -Dbuild-tests=false + sources: + - type: archive + url: https://www.cairographics.org/releases/cairomm-1.16.2.tar.xz + sha256: 6a63bf98a97dda2b0f55e34d1b5f3fb909ef8b70f9b8d382cb1ff3978e7dc13f + + - name: pangomm + buildsystem: meson + config-opts: + - -Dmaintainer-mode=false + - -Dbuild-documentation=false + sources: + - type: archive + # gtkmm 4.14 needs pangomm >= 2.50.0 (which still installs the + # pangomm-2.48.pc name). 2.48.x is too old. + url: https://download.gnome.org/sources/pangomm/2.50/pangomm-2.50.2.tar.xz + sha256: 1bc5ab4ea3280442580d68318226dab36ceedfc3288f9d83711cf7cfab50a9fb + + - name: gtkmm + buildsystem: meson + config-opts: + - -Dmaintainer-mode=false + - -Dbuild-documentation=false + - -Dbuild-demos=false + - -Dbuild-tests=false + sources: + - type: archive + url: https://download.gnome.org/sources/gtkmm/4.14/gtkmm-4.14.0.tar.xz + sha256: 9350a0444b744ca3dc69586ebd1b6707520922b6d9f4f232103ce603a271ecda + + - name: nomines + buildsystem: meson + sources: + - type: git + url: https://github.com/bemagri/nomines + tag: v1.0.0 + commit: 2dbf64a2e8c9bf828d69a4fc27f2af1bbfa780f2 diff --git a/meson.build b/meson.build index e86beea..030954d 100644 --- a/meson.build +++ b/meson.build @@ -37,10 +37,22 @@ executable('nomines', install : true ) -# Install icon +# Install icon (named after the app id so flatpak export picks it up; +# PNG sizes are required by flatpak/flathub icon validation) install_data( 'resources/nomines.svg', - install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps') + install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps'), + rename: 'io.github.bemagri.nomines.svg' +) +install_data( + 'resources/nomines-128.png', + install_dir: join_paths(get_option('datadir'), 'icons/hicolor/128x128/apps'), + rename: 'io.github.bemagri.nomines.png' +) +install_data( + 'resources/nomines-512.png', + install_dir: join_paths(get_option('datadir'), 'icons/hicolor/512x512/apps'), + rename: 'io.github.bemagri.nomines.png' ) # Install desktop file diff --git a/resources/io.github.bemagri.nomines.desktop b/resources/io.github.bemagri.nomines.desktop index 4cb4394..f33e95d 100644 --- a/resources/io.github.bemagri.nomines.desktop +++ b/resources/io.github.bemagri.nomines.desktop @@ -4,7 +4,7 @@ GenericName=Minesweeper Game Comment=Classic minesweeper game with modern GTK UI Keywords=game;puzzle;mine; Exec=nomines -Icon=nomines +Icon=io.github.bemagri.nomines Terminal=false Type=Application Categories=Game;LogicGame; diff --git a/resources/nomines-128.png b/resources/nomines-128.png new file mode 100644 index 0000000..c2f2488 Binary files /dev/null and b/resources/nomines-128.png differ diff --git a/resources/nomines-512.png b/resources/nomines-512.png new file mode 100644 index 0000000..5f89294 Binary files /dev/null and b/resources/nomines-512.png differ