Creating packages for other distributions - ArchWiki

# Creating packages for other distributions

Related articles

- Creating packages

Arch is the best. But you may still want to package for other distributions.

## General

- Virtualization is an obvious way, but requires maintaining additional system(s).
- Use distribution-specific packaging tools. Examples: dh-make, dpkg (Debian), rpm-org (Fedora). Shortcuts such as dpkg-deb or checkinstall may be suited for less complex tasks.
- Chroot to create a base system inside (yet separate from) Arch. Examples: debootstrap (Debian), febootstrap (Fedora). This has the added benefit of building in a minimal, clean environment.
- Use chroot with packaging tools in an an automated fashion. Examples: pbuilder-ubuntu (Debian), mock-git (Fedora).
- A different way to handle (possibly incompatible) depends is static linking. Please note that most distributions frown on this practice.
- Common practice applies regardless of distribution used. For example, do not build packages as root.

## Debian

The Debian Packaging Tutorial explains the groundwork. It describes use of the following tools (most available in the AUR):

cowdancer — Copy-on-write wrapper for pbuilder

  https://packages.debian.org/sid/cowdancer || cowdancer

debootstrap — A tool used to create a Debian base system from scratch, without requiring the availability of dpkg or apt.

  https://packages.debian.org/sid/debootstrap || debootstrap

devscripts — Scripts to make the life of a Debian Package maintainer easier

  https://packages.debian.org/sid/devscripts || devscripts

dh-autoreconf — Debhelper add-on to call autoreconf and clean up after the build

  https://packages.debian.org/sid/dh-autoreconf || dh-autoreconf

dh-make — Tool that converts source archives into Debian package source

  https://packages.debian.org/sid/dh-make || dh-make

dpkg — The Debian Package Manager

  https://packages.debian.org/sid/dpkg || dpkg

dput — Debian package upload tool

  https://packages.debian.org/sid/dput || dput

git-buildpackage — Tools from Debian to integrate the package build system with Git

  https://honk.sigxcpu.org/piki/projects/git-buildpackage/ || git-buildpackage

pbuilder-ubuntu — Chroot environment for building Debian packages

  https://launchpad.net/ubuntu/+source/pbuilder || pbuilder-ubuntu

quilt — Manage a series of patches by keeping track of the changes each patch makes

  http://savannah.nongnu.org/projects/quilt || quilt

Note: Missing tools: lintian, reprepo, equivs, cdbs, svn-buildpackage, javahelper

### Tips and Tricks

#### Override dependency handling

dpkg does not recognize dependencies installed by pacman. This means `dpkg-buildpackage` will generally fail with errors such as:

    dpkg-checkbuilddeps: Unmet build dependencies: build-essential:native debhelper (>= 8.0.0)
    dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting

To override this, use the -d flag:

    $ dpkg-buildpackage -d -us -uc

You may also need to override `dh_shlibdeps` by adding the following lines to `debian/rules`:

    override_dh_shlibdeps:
       dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

Note: Any run-time dependencies (and matching version numbers) should be added manually to `debian/control`, where `${shlibs:Depends}` now has no meaning.
Warning: Even if you manage to successfully build a package this way, it is strongly recommended to build in a clean environment (such as chroot) to prevent any incompatibilities.

#### Set up a chroot

See the Pbuilder How-To for an introduction to pbuilder-ubuntu. Using cowdancer in addition is recommended as copy-on-write offers a significant performance benefit.

- debian-archive-keyring, ubuntu-keyring and gnupg1 from the AUR are required.
- eatmydata is available as libeatmydata and lib32-libeatmydata in the AUR. To prevent `LD_PRELOAD` errors, it must be installed both inside and outside the chroot. As the paths are different in Arch and Debian, create the following symbolic links:

    # ln -s /usr/lib/libeatmydata.so.1.1.1 /usr/lib/libeatmydata/libeatmydata.so
    # ln -s /usr/lib/libeatmydata.so.1.1.1 /usr/lib/libeatmydata/libeatmydata.so.1

- Sample pbuilderrc
- To create a source package for pbuilder to handle:

    $ dpkg-buildpackage -d -us -uc -S

### See also

- Debian Policy
- New Maintainers' Guide
- Quilt in Debian packaging

## Fedora

This article or section needs expansion.

Reason: (Discuss)

How to create an RPM package

rpm-org — RPM.org fork, used in major RPM distros

  http://www.rpm.org/ || rpm-org

mock — Takes Source RPMs and builds RPMs from them in a chroot

  http://fedoraproject.org/wiki/Projects/Mock || mock-git

### See also

- Projects/Mock

## openSUSE

This article or section needs expansion.

Reason: (Discuss)

- openSUSE Portal:Packaging
- Open Build Service - a generic system to build and distribute packages from sources in an automatic, consistent and reproducible way.
- openSUSE packaging guidelines

## See also

- BBS - PKGBUILD equivalents for other distros
- BBS - Original discussion

Category:

- Package development