Skip to content

Bring the snap packaging up to a base that can compile it - #35

Merged
gitosaurus merged 2 commits into
mainfrom
feat/snap-core24
Aug 6, 2026
Merged

Bring the snap packaging up to a base that can compile it#35
gitosaurus merged 2 commits into
mainfrom
feat/snap-core24

Conversation

@gitosaurus

Copy link
Copy Markdown
Owner

The snap packaging had not been touched since January 2021 and could not have
built the current interpreter for two independent reasons.

It was in a place snapcraft does not look. Snapcraft searches exactly four
paths — snapcraft.yaml, snap/snapcraft.yaml, build-aux/snap/snapcraft.yaml,
.snapcraft.yaml. The file was moved from snap/ to drivers/snap/ in e22fc85
(2022-04-07), collateral from an unrelated Boost/GCP restructure, and has been
undiscoverable ever since. Moved back.

Its base predates the language the interpreter is written in. core18 is
Ubuntu 18.04, whose g++ is 7 — nowhere near C++20. core24 brings g++ 13. The
part also still described a make build from before the move to CMake, and
declared version: '2.0' against an interpreter that reports 3.0.

What the rewritten file does:

  • plugin: cmake with source-subdir: src, where the CMakeLists.txt lives.
    src/CMakeLists.txt already has an install() rule, so the binary stages
    without an override-build.
  • adopt-info reads the version out of src/main.cc at pull time rather than
    repeating it, which is how the old file came to sit five years behind.
  • Strict confinement now names its interfaces. A game is a file the player names
    on the command line and a save is written next to it, which is the home plug
    (auto-connected from the store). removable-media is there for games kept on a
    stick and needs snap connect by hand. Classic confinement would have meant
    manual store review for no benefit.
  • The three games from the browser build ship pre-compiled, plus the library
    sources — standard.arch and friends — so an author's own game can
    include "standard" by pointing --include at $SNAP/usr/share/archetype/games.
    Compiling a game means running an interpreter, so that part is after: the
    native one, which also makes it the step that cannot be cross-compiled.

The second commit adds a CI job, because snapcraft does not run on macOS and
there was otherwise no way to learn the packaging was broken short of publishing
it. It builds the snap, installs it, and plays a turn of The Gorreven Papers out
of the bundled .acx — the install-and-play half is what checks that the paths
promised in the snap's own description are real. It runs only on changes under
snap/, plus workflow_dispatch; a snap build is minutes in an LXD container,
and a C++ change that will not compile has already failed in CI.

Test plan

Verified locally on macOS as far as macOS allows — snapcraft itself is Linux-only,
so the CI job on this PR is the real test:

  • Both YAML files parse.
  • The adopt-info extraction returns 3.0 against the real src/main.cc.
  • The exact compile loop from override-build run by hand against ./build/archetype:
    gorreven 69,784 bytes, starship 55,703, animal 1,108.
  • The CI smoke-test invocation, archetype --perform=…/gorreven.acx, plays a turn.

Not done here

  • Publishing. Releasing on tag needs snapcore/action-publish and a
    SNAPCRAFT_STORE_CREDENTIALS secret, and the archetype name registered in the
    store. Worth a follow-up once this builds green.
  • --include ergonomics. The interpreter reads no environment variable, so a
    bundled game means typing $SNAP/usr/share/archetype/games. Teaching main.cc
    to honour something like ARCHETYPE_INCLUDE would let the snap set it in
    apps.archetype.environment and make the whole thing a one-word command.

🤖 Generated with Claude Code

https://claude.ai/code/session_019g4fqvhoV5MtLJJXM7uFLZ

gitosaurus and others added 2 commits August 6, 2026 08:57
The snapcraft.yaml had not been touched since 2021 and could not have built
anything since the move to C++20.  core18 is Ubuntu 18.04, whose g++ is 7;
the part also still described a make build, from before the interpreter was
built with CMake, and claimed version 2.0.

core24 brings g++ 13.  The part is now the cmake plugin pointed at src/,
which already has an install() rule, so the binary stages without help.  The
version is read out of main.cc at pull time via adopt-info rather than
repeated here, which is how the old file came to sit five years behind.

Moved back to snap/snapcraft.yaml.  Snapcraft looks in snapcraft.yaml,
snap/, build-aux/snap/ and .snapcraft.yaml, and nowhere else -- so the move
to drivers/snap/ in e22fc85, collateral from an unrelated restructure, left
the file somewhere the tool would never find.  Four years unbuildable for two
separate reasons is enough.

Strict confinement now names the interfaces it actually needs.  A game is a
file the player names on the command line and a save is written next to it,
which is the 'home' plug; 'removable-media' is there for anyone keeping games
on a stick, and needs connecting by hand.

The three games from the browser build ship compiled, along with the library
sources an author's own game includes.  Compiling a game means running an
interpreter, so that part waits for the native one to stage -- which also
makes it the step that cannot be cross-compiled.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019g4fqvhoV5MtLJJXM7uFLZ
Nothing else in this repository proves the packaging works, and snapcraft
does not run on the machine the interpreter is developed on, so until now the
only way to find out was to publish and hear about it.

Building proves it packages.  Installing the result and playing a turn proves
the binary runs under confinement and that the bundled games are where the
snap's own description promises they are -- which is the part most likely to
rot, since it is prose about paths.

Restricted to changes under snap/, plus workflow_dispatch.  A snap build
compiles the whole interpreter in an LXD container, minutes against the
seconds CI takes, and a C++ change that will not compile has already failed
in CI before it could fail here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019g4fqvhoV5MtLJJXM7uFLZ
@gitosaurus
gitosaurus merged commit 65d9287 into main Aug 6, 2026
3 of 8 checks passed
@gitosaurus
gitosaurus deleted the feat/snap-core24 branch August 6, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant