12. September 2007
This post is for all people that need debian packages for their software but are far too lazy to really learn all this packaging from the beginning. But be aware that it is really easy to build broken packages. I will not explain how to build packages for simple applications since this is explained quite good in the Debian packaging guide. Anyway, it does not explain library-packaging at all.
Packaging a library is not really difficult most of the time. Given that most GNOME libraries share a very common build system layout it would be a waste of time to start from scratch. So we search for a library the seems to be a good starting point for our own package. In my case, packaging libnotifymm, this was obviously glibmm. So first step, get the sources of that package:
apt-get source libglibmm-2.4-dev
Next step, copy the debian directory over to your project, not very tricky either, and delete the useless changelog:
cp -r glibmm-2.4-2.13.3/debian libnotifymm
Now, you end up with some files in the debian directory:
- copyright: Check the license, put your name in, etc
- control: The most important file. Replace the name of the library you took as sample with the name of your actual library, take care of the versions and update the dependencies. With an appropriate sample file the format is quite obvious.
- *.dirs, *.install: These file show where the library gets installed on the system. Normally you should not have to change much here apart from renaming the files from oldlib.dirs to newlib.dirs. But always take a look a the files as there is probably mentioning the old package somewhere and you want to change that.
- rules: Do not touch for now. Hopefully it will just work, otherwise you will notice that later
In the end, create a changelog using this command which will ensure you have the correct format:
Now, let’s give it a go:
If you are (too) lucky, you will have fresh debian packages now. If not, it’s time to check the rules file for stupid shell scripting. The error messages normally give you some indication what could have been wrong. You may need some tries before everything works smoothly.
When you have finished, check if the packages install cleanly on your system and explore them with file-roller to see if they really install all the files needed.
As said before, this is really not the greatest way to create packages and you will do better if you read all the documentation about building packages. But often you get the idea from looking at other packages.