[Pkg-pascal-devel] Creating deb packages with Castle Game Engine build tool

Michalis Kamburelis michalis.kambi at gmail.com
Sat Mar 12 04:07:15 GMT 2022


Hi,

Yesterday I merged a PR to Castle Game Engine that allows to create a
deb package using the CGE build tool. The idea is that upstreams of
any game can now use just trivial command:

    castle-engine package --package-format=deb --fast

to create a deb with their game (as an alternative to the default
"castle-engine package" that results in tar.gz on Linux). It produces
a working deb file, that can be installed on latest Debian (tested
also on Ubuntu), so it gives an easy way to install the game for
Debian users.

I would very much welcome your feedback about it. Both from functional
perspective (I describe lots of details below) and an implementation.
Thank you in advance!

Details:

1. What it is NOT:

    It's not a feature trying to expose all possible deb options of
course :) It just addresses a most common case -- you have a game,
with single executable, using CGE conventions (in particular our
"data" directory). Some metadata is taken from
CastleEngineManifest.xml, some is hardcoded.

     It also doesn't try to follow the workflow of the Debian package
maintainer. That is, I know you have a number of tools (
https://www.debian.org/doc/manuals/maint-guide/ ) that manage the
Debian patches on top of upstream work, and allow to rebuild upstream
with Debian patches.

    Our tool works with simpler assumptions -- what we have is already
what we should package, unmodified. The application is built
beforehand, using existing build tool code ("castle-engine package"
executes "castle-engine compile" at the start). So the only job left
is to

    - put the existing executable + data directory into DEB,
    - add .desktop file to easily execute it,
    - add metadata and dependencies necessary to make the package useful.

2. Docs:

    A documentation of our build tool is on
https://castle-engine.io/build_tool . There's not much about Debian
packaging, just the existence of "--package-format=deb" is mentioned.

    The project manifest (CastleEngineManifest.xml) is documented on
https://castle-engine.io/project_manifest . In particular 4 options
that provide important metadata for Debian package are in
https://castle-engine.io/project_manifest#_debian_and_free_desktop_metadata
, shown along with a trivial example.

3. You can test it on any CGE example, really.

    In latest code https://github.com/castle-engine/castle-engine/ ,
100% of our examples are accompanied with CastleEngineManifest.xml and
as such you can just create a DEB package from them.

    Test e.g. "cd examples/platformer && castle-engine package
--package-format=deb --fast" to have a playable platformer game.

    You can also test on latest view3dscene, I added some metadata to
even make the package sensible (
https://github.com/castle-engine/view3dscene/blob/master/CastleEngineManifest.xml
). Though this is of course just a test, as we already have proper
view3dscene Debian package thanks to you :)

4. If you want to look at code, see
tools/build-tool/code/tooldebian.pas :
https://github.com/castle-engine/castle-engine/blob/master/tools/build-tool/code/tooldebian.pas

5. In Cc: Eugene Loza who implemented the majority of this, with my
great thanks (but then later I did some changes, so any bugs may go on
my head :) ). You can take a look at his games to see how it is used
in practice:

  https://decoherence.itch.io/kryftolike
  https://decoherence.itch.io/foxy-misfortunes

The point is that Eugene can just offer DEB downloads of the game, as
an alternative to tar.gz, to Linux users.

Best regards,
Michalis



More information about the Pkg-pascal-devel mailing list