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.