Skip to content

Distributing Launchpad on Debian

Jarl Gullberg edited this page Aug 18, 2019 · 12 revisions

Distributing Launchpad on Debian is most easily done through a .deb package. When creating such a package, there are a few important points you should be aware of.

This article is written and intended for novice users who have no experience with packaging applications for Debian. If you are an experienced user, you can just read the summary.

Throughout this article, you will encounter some tags where I intend you to replace it with something else. Please, don't leave any of them unchanged. It'll break stuff!

<GameName> - The name of your game as you would usually capitalize it.
<gamename> - The name of your game in lower case.
<launchpadversion> - The version of Launchpad that you're distributing in the package.
<GameDescription> - A description of your game.
<GameDescriptionShort> - A short (single sentence) description of your game.
<CompanyName> - Your company's name, or your name if you don't have one.
<GameSite> - The URL of your game's homepage, if there is one. If you do not have one, you can use the link to Launchpad's GitHub repository.
<ContactEmail> - An email address where customers can receive support from you.

Summary

Your package should be constructed as a normal C# mono package, with an execution script in /usr/bin and the actual binaries in /usr/lib/<GameName>/. You must, unconditionally, include the *.dll.config files generated when building in Debug mode - without them, Launchpad can't find the proper local .so files.

Launchpad depends on the following packages:

  • mono-complete
  • libwebkitgtk-dev
  • libwebkit-cil-dev
  • libnotify-cil-dev

Add any dependencies that you may have added if you're distributing a custom build of Launchpad.

Creating a .deb package

Files

First of all, you're going to need a complete and configured build of Launchpad. You should, at this point, have downloaded or built it from source and filled out the launcher's config.

Additionally, you should have an icon which represents your game handy - we'll need it later. It's not mandatory, but it will make your game distinguishable from any others that may be using Launchpad to distribute them.

A short intro to Debian package files - Debian packages are, essentially, archives that contain a copy of the file system. Inside the archive, you'll find an exact copy of the folder structure which your package will apply over the existing one. Let's take an example:

Your package contains this folder structure:

/usr/lib/<GameName>/
/usr/bin/<gamename>
/usr/share/applications/<gamename>.desktop
/usr/share/pixmaps/<gamename>_Icon.ico

If you were to install this package, those exact files and folders would be copied over to the root filesystem. There, they will merge with already existing files and folders, placing your game exactly where you want it. It's very simple, and very clever.

Now, in order to create a package for your game, create a new folder where you'd like to work. I'm going to do this on my desktop. Name the folder according to the following specification:

<gamename>-<launchpadversion>-all

Since I'm going to be creating a package for the example game that comes along with Launchpad, mine will look like this:

Package Folder

Inside the folder, create two new directories:

Package Folder Inside

Naming is very important here, so make sure you match the case exactly. Linux is case-sensitive, which is something often overlooked.

The DEBIAN folder will contain the metadata for our package - the maintainer, the dependencies, description etc. We'll deal with that one last. Next, you'll need to create the following folders in your main package folder:

/usr/lib/<GameName>
/usr/bin/
/usr/share/applications
/usr/share/pixmaps

Place your compiled and configured build of Launchpad into /usr/lib/<GameName> so that Launchpad.exe is on its root level.

Package Tree

Now, move to /usr/bin and create an empty document named "<gamename>" - it should have no extension. Open its properties and make sure it's set as executable - file permissions carry over when installing packages, and this will be the script that starts up Launchpad.

Open up the file and enter this simple bash script:

#!/bin/sh
cd /usr/lib/<GameName>/
exec /usr/lib/<GameName>/Launchpad.exe

This script, when executed, will move to the folder where Launchpad is installed and start it. Of course, if you've changed the name of the assembly, you'll need to edit that as well. After this, save and close the file.

Moving on, we need to create a desktop item for your game. If we don't, it'll only be executable as a console command which is rarely desirable for a video game. If you have a nice icon for your game, head over to /usr/share/pixmaps and drop it there. For simplicity's sake, name it "<gamename>_Icon.ico". Having an ico is not mandatory - PNG files work as well, but can sometimes have scaling issues.

Now, go to /usr/share/applications and create a new empty document. Name it "<gamename>.desktop" and open it. This is where we will define some information about the game for the operating system, such as name, icon, category and what to execute.

Place this into the file:

[Desktop Entry]
Name=<GameName>
Comment=<GameDescriptionShort>
Exec=/usr/bin/<gamename>
Icon=/usr/share/pixmaps/<gamename>_icon.png
Terminal=false
Type=Application
Categories=GNOME;GTK;Game

While I won't go over all of the options here, there are a few of these that you may want to extend or edit. You can read the entire specification for the desktop file here: Gnome Desktop Entry Specification

First and foremost, you'll want to enter the name of your game and a nice one-liner for the description. The rest of them should be filled out to the letter, making sure that you are matching the filenames exactly.

Once done, save and close the file.

The control file

Finally, we've come to the most important part of the entire package (save for your launcher binaries, of course!) - the control file. Here, we give the package all of the information it needs to function properly. We're going to create a very basic control file which will suffice for our needs.

Go into the DEBIAN folder that you created earlier, and create a new empty file. Name it "control".

Open the file. Inside it, enter this:

package: <gamename>
version: <launchpadversion>
architecture: all
depends: libnotify-cil-dev, libwebkitgtk-dev, libwebkit-cil-dev, mono-complete
maintainer: <CompanyName> <<ContactEmail>>
homepage: <GameSite>
section: game
priority: optional
installed-size: 2
description: <GameDescription>

Fill out all of the information pertaining to your game. If you want any empty lines in your description, you must begin a new line, hit space, type a full stop, and hit space again. More information about this file can be found here: Debian Policy Manual - Chapter 5: Control files and their fields

Description Line 1
 . 
Description Line 3

When you're done, save and close the file. Your package is now ready to be built!

Building your .deb file

Building your package is very simple. Open the terminal and navigate to the same level as your main package folder. Once there, execute the following command.

dpkg -b <gamename>-<launchpadversion>-all

You should get an output similar to this:

Package Output

If you get an error, verify that your control file is properly formatted. If everything went well, you've successfully packaged your file! You can now distribute the resulting file to your users as you see fit. The launcher will keep itself and your game updated.

Packaging Success