]> git.donarmstrong.com Git - debhelper.git/blob - debhelper.pod
r1596: * Remove duplicate packages from DOPACKAGES after argument processing.
[debhelper.git] / debhelper.pod
1 =head1 NAME
2
3 debhelper - the debhelper tool suite
4
5 =head1 SYNOPSIS
6
7 B<dh_>I<*> [B<-v>] [B<-a>] [B<-i>] [B<-s>] [B<--no-act>] [B<-ppackage>] [B<-Npackage] [-Ptmpdir>]
8
9 =head1 DESCRIPTION
10
11 Debhelper is used to help you build a debian package. The philosophy behind
12 debhelper is to provide a collection of small, simple, and easily
13 understood tools that are used in debian/rules to automate various common
14 aspects of building a package. This means less work for you, the packager.
15 It also, to some degree means that these tools can be changed if debian
16 policy changes, and packages that use them will require only a rebuild to
17 comply with the new policy.
18
19 A typical debian/rules file that uses debhelper will call several debhelper
20 commands in sequence. Debhelper commands are all named with a "dh_" prefix.
21 Examples of rules files that use debhelper are in
22 F</usr/share/doc/debhelper/examples/>
23
24 To create a new debian package using debhelper, you can just copy one of
25 the sample rules files and edit it by hand. Or you can try the dh-make
26 package, which contains a L<dh_make|dh_make(1)> command that partially
27 automates the process. For a more gentle introduction, the maint-guide debian
28 package contains a tutorial about making your first package using debhelper.
29
30 =head1 DEBHELPER COMMANDS
31
32 Here is the complete list of available debhelper commands. See their man
33 pages for additional documentation.
34
35 =over 4
36
37 #LIST#
38
39 =back
40
41 If a program's name starts with "dh_", and the program is not on the above
42 list, then it is not part of the debhelper package, but it should still
43 work like the other programs described on this page.
44
45 =head1 DEBHELPER CONFIG FILES
46
47 Many debhelper commands make use of files in F<debian/> to control what they
48 do. Besides the common F<debian/changelog> and F<debian/control>, which are
49 in all packages, not just those using debhelper, some additional files can
50 be used to configure the behavior of specific debhelper commands. These
51 files are typically named debian/package.foo (where "package" of course,
52 is replaced with the package that is being acted on).
53
54 For example, dh_installdocs uses files named debian/package.docs to list
55 the documentation files it will install. See the man pages of individual
56 commands for details about the names and formats of the files they use.
57 Generally, these files will list files to act on, one file per line. Some
58 programs in debhelper use pairs of files and destinations or slightly more
59 complicated formats.
60
61 Note that if a package is the first (or only) binary package listed in
62 debian/control, debhelper will use debian/foo if no debian/package.foo
63 file can be found.
64
65 In some rare cases, you may want to have different versions of these files
66 for different architectures. If files named debian/package.foo.arch
67 exist, where "arch" is the same as the output of "dpkg --print-architecture",
68 then they will be used in preference to other, more general files.
69
70 In many cases, these config files are used to specify various types of
71 files. Documentation or example files to install, files to move, and so on.
72 When appropriate, in cases like these, you can use standard shell wildcard
73 characters ('?' and '*' and '[..]' character classes) in the files.
74
75 =head1 SHARED DEBHELPER OPTIONS
76
77 The following command line options are supported by all debhelper programs.
78
79 =over 4
80
81 =item B<-v>, B<--verbose>
82
83 Verbose mode: show all commands that modify the package build directory.
84
85 =item B<--no-act>
86
87 Do not really do anything. If used with -v, the result is that the command
88 will output what it would have done.
89
90 =item B<-a>, B<--arch>
91
92 Act on all architecture dependent packages.
93
94 =item B<-i>, B<--indep>
95
96 Act on all architecture independent packages.
97
98 =item B<->I<ppackage>, B<--package=>I<package>
99
100 Act on the package named "package". This option may be specified multiple
101 times to make debhelper operate on a given set of packages.
102
103 =item B<-s>, B<--same-arch>
104
105 This is a smarter version of the -a flag, that is used in some rare
106 circumstances. It understands that if the control file lists "Architecture: i386"
107 for the package, the package should not be acted on on other architectures. So
108 this flag makes the command act on all "Architecture: any" packages, as well
109 as on any packages that have the current architecture explicitly specified.
110 Contrast to the -a flag, which makes the command work on all packages that
111 are not architecture independant.
112
113 =item B<-N>I<package>, B<--no-package=>I<package>
114
115 Do not act on the specified package even if an -a, -i, or -p option lists
116 the package as one that should be acted on.
117
118 =item B<-P>I<tmpdir>, B<--tmpdir=>I<tmpdir>
119
120 Use "tmpdir" for package build directory. The default is debian/<package>
121
122 =item B<--mainpackage=>I<package>
123
124 This little-used option changes the package which debhelper considers the
125 "main package", that is, the first one listed in debian/control, and the
126 one for which debian/foo files can be used instead of the usual
127 debian/package.foo files.
128
129 =back
130
131 =head1 COMMON DEBHELPER OPTIONS
132
133 The following command line options are supported by some debhelper programs.
134 See the man page of each program for a complete explanation of what each
135 option does.
136
137 =over 4
138
139 =item B<-n>
140
141 Do not modify postinst/postrm/etc scripts.
142
143 =item B<-X>I<item>, B<--exclude=>I<item>
144
145 Exclude an item from processing. This option may be used multiple times,
146 to exclude more than one thing.
147
148 =item B<-A>, B<-all>
149
150 Makes files or other items that are specified on the command line take effect
151 in ALL packages acted on, not just the first.
152
153 =back
154
155 =head1 NOTES
156
157 =head2 Multiple binary package support
158
159 If your source package generates more than one binary package, debhelper
160 programs will default to acting on all binary packages when run. If your
161 source package happens to generate one architecture dependent package, and
162 another architecture independent package, this is not the correct behavior,
163 because you need to generate the architecture dependent packages in the
164 binary-arch debian/rules target, and the architecture independent packages
165 in the binary-indep debian/rules target.
166
167 To facilitate this, as well as give you more control over which packages
168 are acted on by debhelper programs, all debhelper programs accept the
169 B<-a>, B<-i>, B<-p>, and B<-s> parameters. These parameters are cumulative. 
170 If none are given, debhelper programs default to acting on all packages listed
171 in the control file.
172
173 See F</usr/share/doc/debhelper/examples/rules.multi> for an example of how to
174 use this in a package that generates multiple binary packages.
175
176 =head2 Automatic generation of debian install scripts
177
178 Some debhelper commands will automatically generate parts of debian
179 maintainer scripts. If you want these automatically generated things
180 included in your existing debian maintainer scripts, then you need to add
181 "#DEBHELPER#" to your scripts, in the place the code should be added.
182 "#DEBHELPER#" will be replaced by any auto-generated code when you run
183 dh_installdeb. 
184
185 If a script does not exist at all and debhelper needs to add something to
186 it, then debhelper will create the complete script.
187
188 All debhelper commands that automatically generate code in this way let it
189 be disabled by the -n parameter (see above).
190
191 Note that the inserted code will be shell code, so you cannot directly use
192 it in a perl script. If you would like to embed it into a perl script, here
193 is one way to do that (note that I made sure that $1, $2, etc are set with
194 the set command):
195
196   my $temp="set -e\nset -- @ARGV\n" . << 'EOF';
197   #DEBHELPER#
198   EOF
199   system ($temp) / 256 == 0
200         or die "Problem with debhelper scripts: $!";
201
202 =head2 Automatic generation of miscellaneous dependencies.
203
204 Some debhelper commands may make the generated package need to depend on
205 some other packages. For example, if you use L<dh_installdebconf(1)>, your
206 package will generally need to depend on debconf. Or if you use
207 L<dh_installxfonts(1)>, your package will generally need to depend on a
208 particular version of xutils. Keeping track of these miscellaneous
209 dependencies can be annoying since they are dependant on how debhelper does
210 things, so debhelper offers a way to automate it.
211
212 All commands of this type, besides documenting what dependencies may be
213 needed on their man pages, will automatically generate a substvar called
214 ${misc:Depends}. If you put that token into your debian/control file, it
215 will be expanded to the dependencies debhelper figures you need. 
216
217 This is entirely independent of the standard ${shlibs:Depends} generated by
218 L<dh_makeshlibs(1)>, and the ${perl:Depends} generated by L<dh_perl(1)>.
219 You can choose not to use any of these, if debhelper's guesses don't match
220 reality.
221
222 =head2 Package build directories
223
224 By default, all debhelper programs assume that the temporary directory used
225 for assembling the tree of files in a package is debian/<package>.
226
227 Sometimes, you might want to use some other temporary directory. This is
228 supported by the -P flag. For example, "dh_installdocs -Pdebian/tmp", will
229 use debian/tmp as the temporary directory. Note that if you use -P, the 
230 debhelper programs can only be acting on a single package at a time. So if 
231 you have a package that builds many binary packages, you will need to also 
232 use the -p flag to specify which binary package the debhelper program will
233 act on.
234
235 =head2 Debhelper compatibility levels
236
237 From time to time, major non-backwards-compatible changes need to be made
238 to debhelper, to keep it clean and well-designed as needs change and its
239 author gains more experience. To prevent such major changes from breaking
240 existing packages, the concept of debhelper compatability levels was 
241 introduced. You tell debhelper which compatability level it should use, and
242 it modifies its behavior in various ways.
243
244 You tell debhelper what compatability level to use by writing a number to
245 debian/compat. For example, to turn on V4 mode:
246
247   % echo 4 > debian/compat
248
249 These are the available compatablity levels:
250
251 =over 4
252
253 =item V1
254
255 This is the original debhelper compatability level, and so it is the default
256 one. In this mode, debhelper will use debian/tmp as the package tree
257 directory for the first binary package listed in the control file, while using
258 debian/<package> for all other packages listed in the control file.
259 This mode is deprecated.
260
261 =item V2
262
263 In this mode, debhelper will consistently use debian/<package>
264 as the package tree directory for every package that is built.
265
266 =item V3
267
268 This mode works like V2, with the following additions:
269
270 =over 8
271
272 =item -
273
274 Debhelper config files support globbing via * and ?, when appropriate. To
275 turn this off and use those characters raw, just prefix with a backslash.
276
277 =item -
278
279 dh_makeshlibs makes the postinst and postrm scripts call ldconfig.
280
281 =item -
282
283 Every file in etc/ is automatically flagged as a conffile by dh_installdeb.
284
285 =back
286
287 =item V4
288
289 This is the reccommended mode of operation. It does everything V3 does,
290 plus:
291
292 =over 8
293
294 =item -
295
296 dh_makeshlibs -V will not include the debian part of the version number in
297 the generated dependancy line in the shlibs file.
298
299 =item -
300
301 You are encouraged to put the new ${misc:Depends} into debian/control to
302 suppliment the ${shlibs:Depends} field.
303
304 =item -
305
306 dh_fixperms will make all files in bin/ directories and in etc/init.d 
307 executable.
308
309 =item -
310
311 dh_link will correct existing links to conform with policy.
312
313 =back
314
315 =back
316
317 =head2 Doc directory symlinks
318
319 Sometimes it is useful to make a package not contain a /usr/share/doc/package
320 directory at all, instead placing just a dangling symlink in the binary
321 package, that points to some other doc directory. Policy says this is ok if
322 your package depends on the package whose doc directory it uses. To
323 accomplish this, just don't tell debhelper to install any documentation
324 files into the package, and use dh_link to set up the symlink (or do it by
325 hand), and debhelper should do the right thing: notice it is a dangling
326 symlink and not try to install a copyright file or changelog.
327
328 =head2 Other notes
329
330 In general, if any debhelper program needs a directory to exist under
331 debian/, it will create it. I haven't bothered to document this in all the
332 man pages, but for example, dh_installdeb knows to make debian/<package>/DEBIAN/
333 before trying to put files there, dh_installmenu knows you need a
334 debian/<package>/usr/lib/menu/ before installing the menu files, etc.
335
336 Once your package uses debhelper to build, be sure to add
337 debhelper to your Build-Depends line in debian/control. You should
338 build-depend on a verson of debhelper equal to (or greater than) the
339 debhelper compatability level your package uses. So if your package used
340 compatability level 4:
341
342   Build-Depends: debhelper (>= 4)
343
344 =head1 ENVIRONMENT
345
346 =over 4
347
348 =item DH_VERBOSE
349
350 Set to 1 to enable verbose mode. Debhelper will output every command it runs
351 that modifies files on the build system.
352
353 =item DH_COMPAT
354
355 Temporarily specifies what compatibility level debhelper should run at,
356 overriding any value in debian/compat.
357
358 =item DH_NO_ACT
359
360 Set to 1 to enable no-act mode.
361
362 =item DH_OPTIONS
363
364 Anything in this variable will be prepended to the command line arguments
365 of all debhelper commands. This is useful in some situations, for example,
366 if you need to pass -p to all debhelper commands that will be run. One good
367 way to set DH_OPTIONS is by using "Target-specific Variable Values" in your
368 debian/rules file. See the make documentation for details on doing this.
369
370 =item DH_ALWAYS_EXCLUDE
371
372 If set, this adds the value the variable is set to to the -X options of all
373 commands that support the -X option. Moreover, dh_builddeb will rm -rf
374 anything that matches the value in your package build tree.
375
376 This can be useful if you are doing a build from a CVS source tree, in
377 which case setting DH_ALWAYS_EXCLUDE=CVS will prevent any CVS directories
378 from sneaking into the package you build. Or, if a package has a source
379 tarball that (unwisely) includes CVS directories, you might want to export
380 DH_ALWAYS_EXCLUDE=CVS in debian/rules, to make it take effect wherever
381 your package is built.
382
383 Multiple things to exclude can be separated with colons, as in
384 DH_ALWAYS_EXCLUDE=CVS:.svn
385
386 =back
387
388 =head1 SEE ALSO
389
390 =over 4
391
392 =item F</usr/share/doc/debhelper/examples/>
393
394 A set of example debian/rules files that use debhelper.
395
396 =item L<http://kitenet.net/programs/debhelper/>
397
398 Debhelper web site.
399
400 =back
401
402 =head1 AUTHOR
403
404 Joey Hess <joeyh@debian.org>
405
406 =cut