Created a DEB package for openra-20100907-1

Discussion about the game and its default mods.
Post Reply
Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Created a DEB package for openra-20100907-1

Post by Iran »

http://hotfile.com/dl/68224571/34eca2c/ ... 1.deb.html

This package is based off the RPM, I manually did the control files (in the DEBIAN folder). Additionally, I created .desktop files for the start menu of the window manager and the (simple) scripts to add them to the menu on installation and remove them after installation. I also added icons in differing sizes, which are needed for a few things, like start menu icon. This icon is the soviet-logo.png in the /web folder of the game source dir.

I've also added the ~20 MB MIX files for the CNC & RA mod.

The following is missing, as the RPM package don't include them:
  • manpage(s)
  • The map editor
To get the source of this deb file, execute the following commands:

Code: Select all

$ dpkg-deb -e archive [directory]
$ dpkg-deb -x archive directory
It will extract a DEBIAN folder and the file system of the package. the DEBIAN folder contains the control files. I've added my personal information (name and email) as contact information, but you guys are free to change that.

To assemble the extracted folder into a .deb package, you'll need to create a new directory and place the file system of the extracted package and the DEBIAN folder in it. Afterwards, execute the following command in the folder to build the package:

Code: Select all

$ dpkg-deb -b . openra
A file named 'openra' should have been created now. It is recommended that you append a '-' and version number. Don't forget the .deb extension either.

Image

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

Adding menu entries (and icons) with the package is slightly complicated. Here's how to do so. First of all we'll need to add two files to the DEBIAN folder to tell the system to update the menu after installation and removal of our package.

Create a file named 'postrm' and paste this into it:

Code: Select all

#!/bin/sh
set -e
# Automatically added by dh_installmenu
if [ -x "`which update-menus 2>/dev/null`" ]; then update-menus ; fi
# End automatically added section
Then create a file with the name 'postinst' with the content:

Code: Select all

#!/bin/sh
set -e
# Automatically added by dh_installmenu
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
	update-menus
fi
# End automatically added section
Now we're gonna start adding the .desktop files. Create the folder '/usr/share/applications' in the file system of our package. Then create a file named 'openra.desktop', with the following content:

Code: Select all

[Desktop Entry]
Type=Application
Version=20100907-1
Name=OpenRA - Red Alert
Comment=The OpenRA RTS engine running Red Alert
Icon=openra
Exec=/usr/bin/openra-ra
Terminal=false
Categories=Game;
This should be relative straightforward, we'll get to the "Icon" part later so don't worry about it.

We're also gonna add an almost straight clone of this with the name 'openra-cnc.desktop', this is how it looks like:

Code: Select all

[Desktop Entry]
Type=Application
Version=20100907-1
Name=OpenRA - Command & Conquer
Comment=The OpenRA RTS engine running Command & Conquer
Icon=openra
Exec=/usr/bin/openra-cnc
Terminal=false
Categories=Game;
So we only had to change the name and the command that will be executed.

We're now gonna add the menu entries. Create a folder '/usr/share/menu' under the file system of the package, and add a text file called 'openra', that looks like this:

Code: Select all

?package(openra):needs="X11" section="Games/Simulation" title="OpenRA - Red Alert"\
command="/usr/bin/openra" icon="/usr/share/pixmaps/openra.32.xpm"
Then create another one called 'openra-cnc' for the C&C mod. Yet again, the only difference is the command that's executed and the title:

Code: Select all

?package(openra):needs="X11" section="Games/Simulation" title="OpenRA - Command & Conquer"\
command="/usr/bin/openra-cnc" icon="/usr/share/pixmaps/openra.32.xpm"
Now we only need to do the icons for them. All Unix systems which adhere to the freedesktop.org standard have a "system icon cache" which it collects from multiple folders. The following folders in our package with the following content should be fine:
  • /usr/share/pixmaps with a 32x32 XPM file called 'openra.32.xpm' (you can save to XPM with the GIMP)
  • /usr/share/icons/hicolor/128x128/apps with a 128x128 PNG file called 'openra.png'
  • /usr/share/icons/hicolor/64x64/apps with a 64x64 PNG file called 'openra.png'
  • /usr/share/icons/hicolor/48x48/apps with a 48x48 PNG file called 'openra.png'
  • /usr/share/icons/hicolor/32x32/apps with a 32x32 PNG file called 'openra.png'
  • /usr/share/icons/hicolor/16x16/apps with a 16x16 PNG file called 'openra.png'
And then you're done.

beedee
Posts: 94
Joined: Mon Sep 06, 2010 5:02 am
Location: Wellington
Contact:

Post by beedee »

Thanks for this. I've been looking in to building a debian package for a while but trying to read the documentation on packaging guidelines was a nightmare. It'll still take a lot of work before we can deploy them with the other packages as I'll have to build an automated system to generate them. For now I'm going to continue recommending people use alien to install it using the rpm.

I should also note that we can't distribute the mix files with the package as if EA puts any legal pressure on us we'll need to quickly switch to extracting them from a CD. It also reduces the uploading we have to do with new builds.

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

The menu & .desktop file thing should also work under RPM-based systems and Arch Linux. I can understand the legal issues with EA and the size concerns. If you guys need free and fast web hosting, Zunnie wants to host files for you. He has 3-4 100 Mbit servers in the USA and Europe and his community has been online fore at least 5 years and still healthy as ever.

Do you need info on what requires changing version numbers? You'll also need to change changelog which acts quite weird, the dpkg-deb program requires that you format the changelog file per line, so you'll have what will be formatted into countless lines in 1 line.

How does RPM handle changelog? I can't see if I did it properly on my package (the dpkg-deb program gave a warning about improper formatting on the changelog), because the changelog is only shown during updates in the package manager.

Which also bring me to the question whether you guys want create a PPA for it, so it can be updated with the update manager and hosted on Launchpad.

I'll be glad to help you, I'm not that great with sh scripts, but then again I figured out to and created this package within a few hours.

EDIT: I just read the scripts, and the post-install shell script executed after installing the RPM can be done in the 'postinst' file I mentioned in the menu and .desktop guide. I'm not sure what the exact steps are you guys use to automate building the RPM but I guess I could make one for deb within a few hours at maximum.

Also, you guys could ask the EA community manager whether you're allowed to include the MIX files in the packages/installer(s). They allowed the C&C Renegade mod A Path Beyond (which sets the game in the RA1 universe) to be standalone, even before they released even C&C1 as freeware. So they're quite generous.

beedee
Posts: 94
Joined: Mon Sep 06, 2010 5:02 am
Location: Wellington
Contact:

Post by beedee »

We're currently fine as far as mirrors go, though chrisf might disagree with me there. I'll certainly keep the offer in mind if the need arises in the future.

We don't currently do anything with a changelog, we haven't had the need so far as prior to a few days ago, us devs were pretty much the only ones downloading releases. That has obviously changed recently so I'll see what we can do about that.

I'm not entirely sure how PPAs work but the way we are doing things currently might make things a bit hairy.

I might email the EA community manager later but we still won't be bundling the mix files with the packages until we get a build server that isn't hosted on someone's residential connection which has a fairly low data cap.

EDIT: We also have to still iron out the 64bit issues tao has before trying to put packages in any distributions.

Iran
Posts: 92
Joined: Wed Sep 08, 2010 3:16 pm

Post by Iran »

Packages with PPA are done by having people add their PPA to their repository list, which have to be done by hand. It's stand-alone from the the official Ubuntu repositories.

Like how it's done with Wine: http://www.winehq.org/download/deb

I understand the issues with Tao and 64-bit, I heard one of the developers mention a 32-bit chroot environment but from what I read on it, it's a bit complicated to set that up and people need to be aware of this work-around.

Post Reply