How to have Debian packaging generate two packages given an upstream source archive?

5,697

This is a place where I've always found the documentation lacking. I pretty much only learned how this works by looking at how it is done in other packages. As with most things in Debian packaging, there are a few ways to do this. I find the simplest way is to use debian/package.install files. Here's an example of a package I've worked on, imagination (bzr branch).

First, we need to create the package in debian/control. There are three stanzas now. One for the source package and one for each binary package. Note that the foo-data package should be Architecture: all. Also note that imagination Depends on imagination-common (= ${source:Version}).

Next, we create a debian/imagination.install file. This contains the specific files or paths which we want to end up in the imagination package. For this package we want all the architecture dependent files. The desktop file is included as it needs to say with the binary that it calls in its Exec: line.

usr/bin/
usr/lib/
/usr/share/applications/imagination.desktop

We need to create a debian/imagination-common.install file. This will contain all of the architecture independent files, images, translations, docs, and the like.

/usr/share/doc/
/usr/share/icons/
/usr/share/imagination/
/usr/share/locale/

man dh_install describes what's actually going on here:

maybe you have a large package that builds multiple binary packages. You can use the upstream Makefile to install it all into debian/tmp, and then use dh_install to copy directories and files from there into the proper package build directories.

What it means by "the proper package build directories" is that by the end of the build process, everything that will be in the resulting foo.deb will be found in src/debian/foo. The files that will end up in foo-data.deb will be found in src/debian/foo-data. As debian/rules is essentially just a Makefile, you can begin to imagine so other ways of getting the same result.

Share:
5,697

Related videos on Youtube

Nathan Osman
Author by

Nathan Osman

Email: [email protected] I am both an Ubuntu user and Ubuntu member. By profession, I am a software developer and I work with C++, Python, and (more recently) Go. I enjoy tinkering with different things like motion tracking in Blender, creating an Android app for time-lapse photography, or writing Linux kernel modules. - 2buntu - community blog that I sometimes contribute to - NitroShare - a cross-platform network file transfer utility - REST Easy - Firefox add-on for analyzing HTTP responses

Updated on September 17, 2022

Comments

  • Nathan Osman
    Nathan Osman over 1 year

    I am packaging something for my PPA. The upstream source is a .tar.gz archive which is Makefile-based.

    Since this package has a significant amount of architecture-independent data, it would be wise to have the build scripts generate two packages:

    • package
    • package-data

    How can I set this up? I've edited my Debian control file to generate two packages, but I have no idea how to get the right files to the right package.

    Since the data files are currently all installed via the Makefile, I am kind of lost here.

  • Nathan Osman
    Nathan Osman over 13 years
    Thank you so much! Very clear explanation and works perfectly.