Cross-distribution/OS packaging

packaging

Fedora, FreeBSD, OS X (Homebrew, MacPorts), Ubuntu, Debian, and others all use different packaging systems for binary and source distribution.

When I develop a new application I want to make it available to as many users as possible right out of the gate. But learning all the different packaging tools and conventions is a lot of work. I can manage, but there has to be an easier way.

Is there a super-tool that I should be aware of that can be used to ease the overhead of maintaining and learning all these packaging systems?

Best Answer

The easy way is to provide a source archive and let distribution maintainers make packages for their own distribution.

You can easily make a plain binary archive (.tar.gz) and convert it to a .deb and to a .rpm, which will cover most Linux users, but it won't be as useful as a properly-made package. Getting the binary archive in the right format is only the tip of the iceberg. Making a good package requires, among others:

  • Placing the files in the appropriate directories. While the FHS attempts to unify the Linux directory structure, there is still variation between distributions.
  • Compiling against the right versions of libraries. How difficult this is depends on whether your program depends on libraries whose ABI evolves quickly. Different releases of the same distribution may require different packages because they ship with different library versions.
  • Declaring dependencies with the right package names.
  • Declaring menu entries, MIME handlers, documentation, startup scripts, …

It's generally easier to let someone who is familiar with each distribution make a package. Often you'll be able to gather these contributions into a single source package (containing a debian directory, a .spec file for rpm, …), and distribute source archives, then let people who run each distribution make a package for their distribution. Unless you've made major changes to your program, it's likely that once you get a particular distribution working, newer versions will just work with the same build scripts.

Some distributions have automated mechanisms to build and distribute packages. For example, you can make an Ubuntu PPA and have it automatically built against all supported Ubuntu releases, even if you aren't running Ubuntu.

Related Question