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.
fpm
: github.com/jordansissel/fpm - works like a charm for a decent subset of the systems you cite (builds RPMs and debs). Agree with @goldilocks, though; the starting point would be the good ole' autotools-based source tarball.deb
,rpm
and Slackware packages from a source-based install is usingcheckinstall
(but the Open Build Service could be handy here, too, as it gets you packages for variousrpm
-based distributions and Debian)