There is the real way, and the easy quick and (very?) dirty way. For the latter you should have an Ubuntu GNU/Linux machine at hand. A WSL is enough. However, having a full VM will allow you to test the installation of the deb itself and the graphical part of your package once it is installed. Ie does the game appear in the list of apps when users press the logo key or click on the "application launcher" in the lower left corner of the screen ? VM snapshots make it easy to restore the VM in a known state and to try the installation again. So maybe, you should use WSL to do the packaging, and run a full VM to test the installation on a vanilla Ubuntu Desktop system.
First install fakeroot on your linux machine.
sudo apt-get update && sudo apt-get install fakeroot
Then you won't need sudo anymore. With your ordinary linux account create a directory named packaging-your-game
and inside this directory create the file tree structure shown below. Also remember any text file you create MUST be utf-8 encoded, MUST use a unix end of line (a single newline char \n
) and MUST NOT have a BOM. Linux text editors are fine, but if you're using a windows editor, check the settings.
packaging-your-game
├── DEBIAN
│ └── control
├── opt
│ └── your-game
│ ├── bin
│ │ └── your-game-launcher
│ ├── lib
│ │ ├── lib-foobar.so
│ │ ├── lib-your-game.so
│ │ └── your-game.x86_64
│ └── share
│ └── icon
│ ├── your-game.png
│ └── your-game.svg
└── usr
└── local
└── share
└── applications
└── your-game.desktop
The control file should look like something like this
Package: yourgame
Version: 2.0-1
Section: game
Priority: optional
Architecture: amd64
Maintainer: your name <email@example.com>
Description: Monster killer FPS.
This is a very spiffy FPS game in wich you
must kill zombies and other monsters coming
form everywhere at an increasing rate.
.
This game requires a very fast CPU, something like
the latest i7 or ryzen 7000 CPU and at least 3 graphic
cards. If not, your experience of the game will
be disappointing
.
Please note that this game is not suited for children
under 20 as the monsters are very scary. Also the
flashing lights could permanently damage your brain,
whatever your age.
Depends: libgl, libx11-foobar, other, package, names, with, optional, version (>4.5), for, example
The version : 2.0
is the version of the game itself. 1
is the version of the package. If your published package has a flaw, you may need to publish the same version of the game in a newer package. In this case, you'll just change the package version and the Version
field will be 2.0-2
. On the other hand, whenever the version of the game changes, change the version and reset the package version to one. eg 2.0.1-1
, 3.0-1
etc...
The Depends fields : you'll have to find a list of package names that are required. Have a look at similar packages, or have a look at the /var/lib/dpkg/status
file (it lists all installed packages). Be wise in choosing the dependencies, it must reflect the needed graphic/sound/joystick/whatever libraries, but you mustn't impose your own choices. Let's say the libGraphicFoo is provided by package libgraphicfoo-gnu and libgraphicfoo-nongnu, your package should not depend on one particular implementation, unless of course it only works with one of the 2. In the case of multiple implementations of the libgraphicfoo library, there probably exists a virtual package named libgraphicfoo upon which your package can depend. Users will have installed either libgraphicfoo-gnu or libgraphicfoo-nongnu.
You may also simply remove this field, wait for people to report the game will not work and publish newer version of the package with a corrected list of dependencies. ;-)
The yourgame.desktop file will look like the following. This is not tested, so try, test, adapt:
[Desktop Entry]
Type=Application
Name=yourgame
GenericName=Your Game
GenericName[fr]=Ton jeu
GenericName[he]το παιχνίδι σου
Comment=longer but short description of your game
Comment[fr]=Description plus longue mais courte
Comment[he]=Μεγαλύτερη αλλά συντομότερη περιγραφή
Exec=/opt/your-game/bin/your-game-launcher
Terminal=false
Icon=/opt/your-game/share/icon/your-game.svg
NoDisplay=false
StartupNotify=true
/opt/your-game/bin/your-game-launcher could be as simple as
#! /bin/sh
exec /opt/your-game/lib/your-game.x86_64
or something more elaborated (also untested)
#! /bin/bash
export LD_LIBRARY_PATH=/opt/your-game/lib
logfile=/tmp/your-game-log-file-$(id -u).log
exec /opt/your-game/lib/your-game.x86_64 --debug 2>"$logfile"
Once this is done, create your deb package. Simply cd to the directory containing the packaging-your-game
directory and run this command:
fakeroot dpkg -b pacakging-your-game
This will create packaging-your-game.deb. Simply rename the file your-game.deb
and publish this deb file.