Version 4 (modified by 15 years ago) ( diff ) | ,
---|
What is
CDBS is the most easy tool in debian to create debian packages, you will need just 2-3 lines of code so that you will create your own debian packages
On this howto I will explain the basic steps to do this, but cdbs is a lot more powerful (hooks in pre-config, post-config, pre-compile, post-compile, etc etc), so for more information just follow the documented PDF as, of course, /usr/share/doc/cdbs
Dependencies
You basically only need the package cdbs, but is recommended also to install these packages: dpkg-dev devscripts
Hands on !
On this example we will create a debian package for enna, first of all, create the directory debian (if is already created and has files mean that is already ready for create debian packages, or supposed to... in any case, if is created, just remove it in order to follow this howto).
On it, you need to have 2 files, control.in and rules
In the debian/control.in file has the description of the package, we can fill up with something like:
Source: enna Section: enlightenment Priority: optional Maintainer: yourname <youremail@email.com> Build-Depends: @cdbs@, libplayer, gettext, libsqlite3-dev Package: enna Architecture: any Depends: libcddb2, libcurl3, libdbus-1-3, libexif12, libhal-storage1, libhal1, libplayer, libsqlite3-0, libxml2, lightmediascanner, libxrandr2 Description: enna media player This is the enna media player using EFL
The first block is for the source packages (so that you can apt-get source enna in the future in order to recompile it), it also contains the information about which dependencies you need to have in order to compile it. The second block is for the binary end package.
In the debian/rules file, you need to fill up with something like:
#!/usr/bin/make -f DEB_AUTO_UPDATE_DEBIAN_CONTROL := yes include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/autotools.mk DEB_CONFIGURE_EXTRA_FLAGS := --disable-browser-netstreams --enable-libcddb --disable-browser-lms
The first line means that the control file will be updated automatically (it was really needed to explain this point ? anyways...), the next lines means which pieces of cdbs we want to have, like a dependency, if we don't include them, we don't have its support, like, debhelper contains all the needed things for build the package, autotools contains the needed things for compile a simple C/C++ program that has its makefiles structure and such... so, the basic needed ones. The final line includes the option of compilation.
Note: You need to made the rules file executable, so run: chmod +x debian/rules
You are almost ready, altough these are the only real needed files, you need a few last tricks... but they are almost automatic:
You need the changelog file, since we are lazy, we use the tool debchange to create/update it, see that there's a warning saying that there's no any changelog found and so on we need to use the option ---create for create a new one, so, from the directory of the source code (out of the debian dir), run: debchange --create
WARNING: It is very important that the changelog will have the CORRECT information or you can have problems by compiling the package, for example your PACKAGENAME needs to NOT be uppercase, etc, you can see examples in ls /usr/share/doc/*/changelog.Debian.gz
Also, you need the real control file, control.in is a kind of base, for generate the real control file we just run fakeroot debian/rules clean and we have it :)
Your debian directory is ready, you can add a lot more of options and tricks for your package but for that, just follow the official documentation at /usr/share/doc/cdbs, im not going to write all the features because im lazy too :)
Time to build the package !
Since we are a user and no root, some commands needs to be prepend with the command fakeroot:
Before to compile you need to see if you have all the dependencies for the compilation, for that, just run the command dpkg-checkbuilddeps
When you have installed all the needed dependencies, run the command fakeroot dpkg-buildpackage
Note: A good combo of command to do tests trying to build the package between you edit the control.in file is: fakeroot debian/rules clean ; dpkg-checkbuilddeps && fakeroot dpkg-buildpackage -b
You have it !
Final points
You are free to edit this document in order to fix any thing, making it better, or to add a few nice tricks to know, for that just fill up a collaborator thingy at http://www.elivecd.org/Help/Collaborate
You can see some nice and small examples of CDBS in the EFL svn, for example in evas, it use it for build the packages (at least to the date of today)
This Howto is tested step by step on a clean Elive system, live mode, version (1.9.29), the package builds without problems :)