Creating Debian packages on your own
|
Everything New
Unfortunately, the ffDiaporama version 1.3 I used here to create an Ubuntu 12.04 package is not the latest release. However, the Debian build system helps Ubuntu maintainers keep thousands of packages current and can quickly update a packaged program to its newest version. From the program home page, download the ffDiaporama 1.5 sources [4] into the same directory as the version 1.3 sources.
In the debian/ folder, you will find the patches/ subdirectory. You can delete the fixes contained in patches/ because they don't work (and are often unnecessary). How to push a new version upstream is described in the "Debian New Maintainers' Guide" [5]. Next, you can run the following command from ffdiaporama-1.3/:
$ uupdate -v 1.5 ../ffdiaporama_1.5.tar.gz
Change to the ../ffdiaporama-1.5/ directory that the update process creates. This is where you'll find the sources for ffDiaporama 1.5 as well as the debian/ subdirectory in ffdiaporama-1.3/.
If nothing changed significantly in the build process from version 1.3 to 1.5, dpkg-buildpackage -uc -us should run smoothly and build a package for ffDiaporama 1.5.
Things didn't run quite so smoothly in practice, however. The compile broke with the message ../engine/cDeviceModelDef.h:48:38: fatal error: libavdevice/avdevice.h: file or directory not found. If the compiler can't find a header file (with the .h extension), this means that the required development package is missing. Luckily, you can easily find out which one it is.
Install apt-file (if you don't already have it) and, by using apt-file update with root, bring the database to its newest state. Then, use apt-file search libavdevice/avdevice.h to find the package with the missing header file. In this example, it happens to be libavdevice-dev.
Until compiling works, you may find yourself trying to compile and then having to install more and more development library files. In this case, I was lucky and only had to install libavfilter-dev and libqimageblitz-dev. The build package then built a functioning ffDiaporama 1.5 package (Figure 2).
The missing dev packages were created because uupdate took over for package building (the Build-Depends) from version 1.3. A powerful build system like Automake (known from ./configure; make; make install) or Cmake would have intercepted any errors before compiling with understandable messages, such as Could NOT find <package> or configure: error: Package requirements (<package> >= <version>) were not met. ffDiaporama uses the simpler Qmake instead.
To make sense of the incomprehensible console window gibberish from other errors not specifically related to missing dependencies, it's recommended to search for the first occurrence of the word error. Because other users have likely already run into the same problem, an Internet search for the error message is often helpful.
From Scratch
So far, I've depended on the helper scripts (Figure 3) that characterize the Debian build system: Dpkg-source to unpack the source tarball and dpkg-buildpackage to compile and automate the packaging.
The powerful dh_make helper aids in "Debianizing" the source code of software, in generating the control files in the debian/ subdirectory that automate compiling, and in creating packages. I will soon be testing it on ffDiaporama 1.5 – although I have already arrived at the current version with help by updating an outdated one. It shows how package creation works without much preparation.
To do this, unpack the upstream source code. The files should end up in a subdirectory named <program_name>_<xx>.<yy>. Its name must be lowercase with the underscore between name and version. From this directory – ffdiaporama_1.5/, in this case – the following command creates a control folder:
$ dh_make -p <Name>_<Version> --createorig
The dpkg_buildpackage command, with no or just minimal ado, runs through this folder. Then, dh_make asks what kind of package type it should prepare for the Debian folder. Almost always the s ("single-binary package") option is the right choice; the others are more geared to experienced maintainers.
After calling dh-make, you need to add descriptions for the package in places marked with square brackets in the control file. You should also enter comments for the current version of the package in the changelog. Because even a wrongly placed space character in changelog can bring the package build process to a halt, you should call up the dch tool from the source folder. Like visudo, it encapsulates the EDITOR command-line editor as an environmental variable and checks the syntax before saving. Both uupdate and dh_make add a changelog entry that you just need to expand.
Buy this article as PDF
Pages: 6
(incl. VAT)