1 Debhelper is a collection of programs that can be used in debian/rules files
2 to automate common tasks. For further documentation, see the man pages for
5 To help you get started, I've included examples of debian/rules files
6 that use debhelper commands extensively. See /usr/doc/debhelper/examples/ .
7 These files are also useful as they give one good order you can run the
8 various debhelper scripts in (though other variations are possible).
11 Converting from debstd to debhelper:
12 -----------------------------------
14 Debhelper is designed to be mostly backwards compatible to debstd. I say
15 mostly because I haven't made debhelper handle everything that debstd does
16 yet, and in a few cases, it does things differently (and I hope, better).
18 In general, you can switch over to using debhelper as follows. In your
19 debian/rules, where you used to have some lines that read something like:
21 debstd CHANGES TODO README
23 dpkg --build debian/tmp ..
25 Remove that and replace it with something like:
27 dh_installdocs TODO README
32 dh_installchangelogs CHANGES
45 Notice that the parameters sent to debstd get split up among the dh_*
46 programs. The upstream changelog is passed to dh_installchangelogs, and the
47 docs are passed to dh_installdocs.
49 Debstd has many switches, that turn off different parts of it. So if you
50 were using debstd -m to tell it not to automatically install manpages,
51 for example, you can just comment out the dh_installmanpages line.
53 Finally, debstd automatically modified postinst, postrm, etc scripts. Some
54 of the dehelper apps do that too, but they do it differently. Debstd just
55 appends its commands to the end of the script. Debhelper requires that you
56 insert a tag into your scripts, that will tell debhelper where to insert
57 commands. So if you have postinst, postrm, etc scripts, add a line reading
58 "#DEBHELPER#" to the end of them.
60 Once you think it's all set up properly, do a test build of your package. If
61 it works ok, I recommend that you compare the new package and the old
62 debstd-generated package very closely. Pay special attention to the postint,
66 Automatic generation of debian install scripts:
67 ----------------------------------------------
69 Some debhelper commands will automatically generate parts of debian install
70 scripts. If you want these automatically generated things included in your
71 debian install scripts, then you need to add "#DEBHELPER#" to your scripts,
72 in the place the code should be added. "#DEBHELPER#" will be replaced by any
73 autogenerated code when you run dh_installdeb.
75 All scripts that automatically generate code in this way let it be disabled
78 Note that it will be shell code, so you cannot directly use it in a perl
79 script. If you would like to embed it into a perl script, here is one way to
87 Notes on multiple binary packages:
88 ---------------------------------
90 If your source package generates more than one binary package, debhelper
91 programs will default to acting on all binary packages when run. If your
92 source package happens to generate one architecture dependent package, and
93 another architecture independent package, this is not the correct behavior,
94 because you need to generate the architecture dependent packages in the
95 binary-arch debian/rules target, and the architecture independent packages
96 in the binary-indep debian/rules target.
98 To facilitate this, as well as give you more control over which packages
99 are acted on by debhelper programs, all debhelper programs accept the
100 following parameters:
102 -a Act on architecture dependent packages
103 -i Act on architecture independent packages
104 -ppackage Act on the package named "package" (may be repeated multiple
107 These parameters are cumulative. If none are given, the tools default to
108 affecting all packages.
110 See examples/rules.multi for an example of how to use this.
113 Package build directories -- debian/tmp, etc:
114 --------------------------------------------
116 By default, all debhelper programs assume that the temporary directory used
117 for assembling the tree of files in a package is debian/tmp for the first
118 package listed in debian/control, and debian/<packagename> for each
121 Sometimes, you might want to use some other temporary directory. This is
122 supported by the -P flag. The directory to use is specified after -P, for
123 example, "dh_installdocs -Pdebian/tmp", will use debian/tmp as the temporary
124 directory. Note that if you use -P, the debhelper programs can only be
125 acting on a single package at a time. So if you have a package that builds
126 many binary packages, you will need to use the -p flag to specify which
127 binary package the debhelper program will act on. For example:
129 dh_installdocs -pfoolib1 -Pdebian/tmp-foolib1
130 dh_installdocs -pfoolib1-dev -Pdebian/tmp-foolib1-dev
131 dh_installdocs -pfoolib-bin -Pdebian/tmp-foolib-bin
133 This uses debian/tmp-<package> as the package build directory.
136 -- Joey Hess <joeyh@master.debian.org>