views:

285

answers:

5

I have a game that currently runs under Windows and Mac OS X and I'd like to make it available under Linux. The porting should be fairly easy since it's a Java based game and uses portable libraries that are available on all 3 platforms.

The hard part and the reason for this question is packaging it so that it works on as many modern Linux distributions as possible. The primary target will be Ubuntu 9.

Webstart is not an acceptable way, .tar.gz is the last resort. I would stronly prefer a package that has correctly defined dependencies (such as Java) and installs easily.

I also need to be able to build the package under a Windows environment since some tools in my build chain are Windows-only.

+1  A: 

You can use the deb system for Ubuntu. It'll help you to mark correctly dependencies.

A guide for packaging is available here.

Valentin Rocher
+5  A: 

Start by looking how a similar project has achieved this. One that springs to mind is Freecol, a cross platform Java based game. Their download page has fairly clear information on installing it on a number of platforms. They also have packages available at sites such as GetDEB for Ubuntu and PackMan for OpenSuse.

Generally, if you want to hit as many distributions as possible, the formats you should consider are (in rough order of importance):

  1. Ubuntu .deb (also create a repository if you can)
  2. OpenSUSE .rpm or .ypm (1 click install)
  3. Fedora .rpm
  4. .tar.gz pre-compiled package

Then a build from source option, or a best effort binary installer. Finally, look at other popular distros such as Debian, Mandriva, and BSDs

Once a package exists for a specific platform, you may wish to consider getting it accepting into that distribution. This will make it easier for users to find and acquire. Information on the process for ubuntu can be found here:

(EDIT: Better list, thanks to Jonik's suggestion.)

Colin Pickard
For ubuntu, you can use launchpad to build packages and create easily a repository.
Valentin Rocher
I would add zip/gzip/bzip2 precompiled package (not an installer, mind you, just a plain archive to be extracted) on the list, at least higher than "build from source" option. (FreeCol is indeed a good example, and they do just this, even offering both zip and gzip flavours.) Other than that, I like this answer.
Jonik
+1  A: 

Good question - I don't know the answer (and I guess there isn't an easy, all-encompassing solution), but here are some points to consider, from a Linux user's point of view.

I think .tar.gz (or .tar.bz2) is not necessarily that bad. Linux users are used to it, and e.g. many commercial software packages are distributed that way. It often beats a graphical Windows-style installer if the main point is to just extract files at some location.

Some (perhaps many?) users have JRE installed outside the package management system, so offering only RPM or deb (which depends on having JRE installed as RPM or deb) may be problematic. (Personally I prefer to have several JRE versions (JDK actually) installed under /usr/local/java.) So at least consider offering a zip/gz/bz2 package along with other options.

Also, to learn about creating RPM packages of Java software, take a look at JPackage.

Jonik
+1  A: 

Each distro may have it's own conventions of where common files go.
In Ubuntu, common java jars go into /usr/share/java. Things like commons-cli and liblog4j exists. If you use any of these, make sure your deb depends on the appropriate package. If the library is of use outisde your application, but not in the Ubuntu repos, consider putting it in its own deb and depending on that. You will need to create a folder for your specific games jars in /usr/share/[name]/ and then create a shell script to launch the game. This script should be placed in /usr/bin (or /usr/games) and be executable.

Don't forget to depend on an appropriate java package either (I suggest the sun-java#-jre packages 'cause gjc is crap and open-jdk isn't 100% there yet (At least the METAL LaF is fubar, I don't know about anything else yet.)

KitsuneYMG
+2  A: 

Have a look at Zero Install (http://0install.net/).

  • Anyone can install software

You don't have to be the administrator just to install a word-processor [ more ]

  • Anyone can distribute software

You don't need to be blessed by a distribution (or anyone else) to be part of Zero Install; The system is completely decentralised [ more ]

  • Automatic updates

When updates are available, Zero Install will notify you[ more ]

  • Security

If one user downloads a malicious program, other users aren't affected; Users can share downloads without having to trust each other; Installation does not execute any of the downloaded code; Digital signatures are always checked before new software is r

Thorbjørn Ravn Andersen