wiki:Linux/Ubuntu/Packages/CDBSCustomRules

CDBS Custom Rules

CDBS (Common Debian Build System) simplifies debian/rules tremendously, in many cases a simple minimal configuration is sufficient:

#!/usr/bin/make -f
  
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/simple-patchsys.mk

However, there comes a time when the package needs to run custom tasks at certain points during the build process. These require CDBS custom rules (hooks). Unfortunately  the CDBS documentation is vague on what hooks are available.

An example (from r5u870-dkms):

binary-install/r5u870-dkms::
	cp $(CURDIR)/debian/dkms.conf $(CURDIR)/debian/$(cdbs_curpkg)/usr/src/r5u870-$(SRC_VERSION)

The part before the slash (/) is the hook, the part after is the binary package name to apply it to (remember that one source package can and often does contain multiple binary packages).

The hooks can be found in

/usr/share/cdbs/1/rules/buildcore.mk
/usr/share/cdbs/1/rules/debhelper.mk

Custom Hooks

This is a list in the order they appear in the CDBS debhelper scripts.

makebuilddir/%

cleanbuilddir/%

configure/%

build/%

install/%

binary/%

binary-install/%

binary-post-install/%

binary-strip/%

binary-fixup/%

binary-predeb/%

binary-makedeb/%

binary-makedeb-IMPL/%