1debhelper(7) Debhelper debhelper(7)
2
3
4
6 debhelper - the debhelper tool suite
7
9 dh_* [-v] [-a] [-i] [--no-act] [-ppackage] [-Npackage] [-Ptmpdir]
10
12 Debhelper is used to help you build a Debian package. The philosophy
13 behind debhelper is to provide a collection of small, simple, and
14 easily understood tools that are used in debian/rules to automate
15 various common aspects of building a package. This means less work for
16 you, the packager. It also, to some degree means that these tools can
17 be changed if Debian policy changes, and packages that use them will
18 require only a rebuild to comply with the new policy.
19
20 A typical debian/rules file that uses debhelper will call several
21 debhelper commands in sequence, or use dh(1) to automate this process.
22 Examples of rules files that use debhelper are in
23 /usr/share/doc/debhelper/examples/
24
25 To create a new Debian package using debhelper, you can just copy one
26 of the sample rules files and edit it by hand. Or you can try the dh-
27 make package, which contains a dh_make command that partially automates
28 the process. For a more gentle introduction, the maint-guide Debian
29 package contains a tutorial about making your first package using
30 debhelper.
31
32 Except where the tool explicitly denotes otherwise, all of the
33 debhelper tools assume that they run from the root directory of an
34 unpacked source package. This is so they can locate find files like
35 debian/control when needed.
36
38 Here is the list of debhelper commands you can use. See their man pages
39 for additional documentation.
40
41 dh_assistant(1)
42 tool for supporting debhelper tools and provide introspection
43
44 dh_auto_build(1)
45 automatically builds a package
46
47 dh_auto_clean(1)
48 automatically cleans up after a build
49
50 dh_auto_configure(1)
51 automatically configure a package prior to building
52
53 dh_auto_install(1)
54 automatically runs make install or similar
55
56 dh_auto_test(1)
57 automatically runs a package's test suites
58
59 dh_bugfiles(1)
60 install bug reporting customization files into package build
61 directories
62
63 dh_builddeb(1)
64 build Debian binary packages
65
66 dh_clean(1)
67 clean up package build directories
68
69 dh_compress(1)
70 compress files and fix symlinks in package build directories
71
72 dh_dwz(1)
73 optimize DWARF debug information in ELF binaries via dwz
74
75 dh_fixperms(1)
76 fix permissions of files in package build directories
77
78 dh_gencontrol(1)
79 generate and install control file
80
81 dh_icons(1)
82 Update caches of Freedesktop icons
83
84 dh_install(1)
85 install files into package build directories
86
87 dh_installalternatives(1)
88 install declarative alternative rules
89
90 dh_installcatalogs(1)
91 install and register SGML Catalogs
92
93 dh_installchangelogs(1)
94 install changelogs into package build directories
95
96 dh_installcron(1)
97 install cron scripts into etc/cron.*
98
99 dh_installdeb(1)
100 install files into the DEBIAN directory
101
102 dh_installdebconf(1)
103 install files used by debconf in package build directories
104
105 dh_installdirs(1)
106 create subdirectories in package build directories
107
108 dh_installdocs(1)
109 install documentation into package build directories
110
111 dh_installemacsen(1)
112 register an Emacs add on package
113
114 dh_installexamples(1)
115 install example files into package build directories
116
117 dh_installgsettings(1)
118 install GSettings overrides and set dependencies
119
120 dh_installifupdown(1)
121 install if-up and if-down hooks
122
123 dh_installinfo(1)
124 install info files
125
126 dh_installinit(1)
127 install service init files into package build directories
128
129 dh_installinitramfs(1)
130 install initramfs hooks and setup maintscripts
131
132 dh_installlogcheck(1)
133 install logcheck rulefiles into etc/logcheck/
134
135 dh_installlogrotate(1)
136 install logrotate config files
137
138 dh_installman(1)
139 install man pages into package build directories
140
141 dh_installmenu(1)
142 install Debian menu files into package build directories
143
144 dh_installmime(1)
145 install mime files into package build directories
146
147 dh_installmodules(1)
148 register kernel modules
149
150 dh_installpam(1)
151 install pam support files
152
153 dh_installppp(1)
154 install ppp ip-up and ip-down files
155
156 dh_installsystemd(1)
157 install systemd unit files
158
159 dh_installsystemduser(1)
160 install systemd unit files
161
162 dh_installsysusers(1)
163 install and integrates systemd sysusers files
164
165 dh_installtmpfiles(1)
166 install tmpfiles.d configuration files
167
168 dh_installudev(1)
169 install udev rules files
170
171 dh_installwm(1)
172 register a window manager
173
174 dh_installxfonts(1)
175 register X fonts
176
177 dh_link(1)
178 create symlinks in package build directories
179
180 dh_lintian(1)
181 install lintian override files into package build directories
182
183 dh_listpackages(1)
184 list binary packages debhelper will act on
185
186 dh_makeshlibs(1)
187 automatically create shlibs file and call dpkg-gensymbols
188
189 dh_md5sums(1)
190 generate DEBIAN/md5sums file
191
192 dh_missing(1)
193 check for missing files
194
195 dh_movefiles(1)
196 move files out of debian/tmp into subpackages
197
198 dh_perl(1)
199 calculates Perl dependencies and cleans up after MakeMaker
200
201 dh_prep(1)
202 perform cleanups in preparation for building a binary package
203
204 dh_shlibdeps(1)
205 calculate shared library dependencies
206
207 dh_strip(1)
208 strip executables, shared libraries, and some static libraries
209
210 dh_systemd_enable(1)
211 enable/disable systemd unit files
212
213 dh_systemd_start(1)
214 start/stop/restart systemd unit files
215
216 dh_testdir(1)
217 test directory before building Debian package
218
219 dh_testroot(1)
220 ensure that a package is built with necessary level of root
221 permissions
222
223 dh_ucf(1)
224 register configuration files with ucf
225
226 dh_update_autotools_config(1)
227 Update autotools config files
228
229 dh_usrlocal(1)
230 migrate usr/local directories to maintainer scripts
231
232 Deprecated Commands
233 A few debhelper commands are deprecated and should not be used.
234
235 dh_installmanpages(1)
236 old-style man page installer (deprecated)
237
238 Other Commands
239 If a program's name starts with dh_, and the program is not on the
240 above lists, then it is not part of the debhelper package, but it
241 should still work like the other programs described on this page.
242
244 Many debhelper commands make use of files in debian/ to control what
245 they do. Besides the common debian/changelog and debian/control, which
246 are in all packages, not just those using debhelper, some additional
247 files can be used to configure the behavior of specific debhelper
248 commands. These files are typically named debian/package.foo (where
249 package of course, is replaced with the package that is being acted
250 on).
251
252 For example, dh_installdocs uses files named debian/package.docs to
253 list the documentation files it will install. See the man pages of
254 individual commands for details about the names and formats of the
255 files they use. Generally, these files will list files to act on, one
256 file per line. Some programs in debhelper use pairs of files and
257 destinations or slightly more complicated formats.
258
259 Note for the first (or only) binary package listed in debian/control,
260 debhelper will use debian/foo when there's no debian/package.foo file.
261 However, it is often a good idea to keep the package. prefix as it is
262 more explicit. The primary exception to this are files that debhelper
263 by default installs in every binary package when it does not have a
264 package prefix (such as debian/copyright or debian/changelog).
265
266 In some rare cases, you may want to have different versions of these
267 files for different architectures or OSes. If files named
268 debian/package.foo.ARCH or debian/package.foo.OS exist, where ARCH and
269 OS are the same as the output of "dpkg-architecture -qDEB_HOST_ARCH" /
270 "dpkg-architecture -qDEB_HOST_ARCH_OS", then they will be used in
271 preference to other, more general files.
272
273 Mostly, these config files are used to specify lists of various types
274 of files. Documentation or example files to install, files to move, and
275 so on. When appropriate, in cases like these, you can use standard
276 shell wildcard characters (? and * and [..] character classes) in the
277 files. You can also put comments in these files; lines beginning with
278 # are ignored.
279
280 The syntax of these files is intentionally kept very simple to make
281 them easy to read, understand, and modify.
282
283 Substitutions in debhelper config files
284 In compatibility level 13 and later, it is possible to use simple
285 substitutions in debhelper config files for the following tools:
286
287 • dh_clean
288
289 • dh_install
290
291 • dh_installcatalogs
292
293 • dh_installdeb
294
295 • dh_installdirs
296
297 • dh_installdocs
298
299 • dh_installexamples
300
301 • dh_installinfo
302
303 • dh_installman
304
305 • dh_installwm
306
307 • dh_link
308
309 • dh_missing
310
311 • dh_ucf
312
313 All substitution variables are of the form ${foo} and the braces are
314 mandatory. Variable names are case-sensitive and consist of
315 alphanumerics (a-zA-Z0-9), hyphens (-), underscores (_), and colons
316 (:). The first character must be an alphanumeric.
317
318 If you need a literal dollar sign that cannot trigger a substitution,
319 you can either use the ${Dollar} substitution or the sequence ${}.
320
321 The following expansions are available:
322
323 DEB_HOST_*, DEB_BUILD_*, DEB_TARGET_*
324 Expands to the relevant dpkg-architecture(1) value (similar to
325 dpkg-architecture -qVARIABLE_HERE).
326
327 When in doubt, the DEB_HOST_* variant is the one that will work
328 both for native and cross builds.
329
330 For performance reasons, debhelper will attempt to resolve these
331 names from the environment first before consulting
332 dpkg-architecture(1). This is mostly mentioned for completeness as
333 it will not matter for most cases.
334
335 Dollar
336 Expands to a single literal $-symbol. This symbol will never be
337 considered part of a substitution variable. That is:
338
339 # Triggers an error
340 ${NO_SUCH_TOKEN}
341 # Expands to the literal value "${NO_SUCH_TOKEN}"
342 ${Dollar}{NO_SUCH_TOKEN}
343
344 This variable equivalent to the sequence ${} and the two can be
345 used interchangeably.
346
347 Newline, Space, Tab
348 Expands to a single ASCII newline, space and tab respectively.
349
350 This can be useful if you need to include a literal whitespace
351 character (e.g. space) where it would otherwise be stripped or used
352 as a separator.
353
354 env:NAME
355 Expands to the environment variable NAME. The environment variable
356 must be set (but can be set to the empty string).
357
358 Note that all variables must expand to a defined value. As an example,
359 if debhelper sees ${env:FOO}, then it will insist that the environment
360 variable FOO is set (it can be set to the empty string).
361
362 Substitution limits
363
364 To avoid infinite loops and resource exhaustion, debhelper will stop
365 with an error if the text contains many substitution variables (50) or
366 they expand beyond a certain size (4096 characters or 3x length of the
367 original input - whichever is bigger).
368
369 Executable debhelper config files
370 If you need additional flexibility, many of the debhelper tools (e.g.
371 dh_install(1)) support executing a config file as a script.
372
373 To use this feature, simply mark the config file as executable (e.g.
374 chmod +x debian/package.install) and the tool will attempt to execute
375 it and use the output of the script. In many cases, you can use
376 dh-exec(1) as interpreter of the config file to retain most of the
377 original syntax while getting the additional flexibility you need.
378
379 When using executable debhelper config files, please be aware of the
380 following:
381
382 • The executable config file must exit with success (i.e. its return
383 code should indicate success).
384
385 • In compatibility level 13+, the output will be subject to
386 substitutions (see "Substitutions in debhelper config files") where
387 the tool support these. Remember to be careful if your generator
388 also provides substitutions as this can cause unnecessary
389 confusion.
390
391 Otherwise, the output will be used exactly as-is. Notably,
392 debhelper will not expand wildcards or strip comments or strip
393 whitespace in the output.
394
395 If you need the package to build on a file system where you cannot
396 disable the executable bit, then you can use dh-exec(1) and its strip-
397 output script.
398
400 The following command line options are supported by all debhelper
401 programs.
402
403 -v, --verbose
404 Verbose mode: show all commands that modify the package build
405 directory.
406
407 --no-act
408 Do not really do anything. If used with -v, the result is that the
409 command will output what it would have done.
410
411 -a, --arch
412 Act on architecture dependent packages that should be built for the
413 DEB_HOST_ARCH architecture.
414
415 -i, --indep
416 Act on all architecture independent packages.
417
418 -ppackage, --package=package
419 Act on the package named package. This option may be specified
420 multiple times to make debhelper operate on a given set of
421 packages.
422
423 -s, --same-arch
424 Deprecated alias of -a.
425
426 This option is removed in compat 12.
427
428 -Npackage, --no-package=package
429 Do not act on the specified package even if an -a, -i, or -p option
430 lists the package as one that should be acted on.
431
432 --remaining-packages
433 Do not act on the packages which have already been acted on by this
434 debhelper command earlier (i.e. if the command is present in the
435 package debhelper log). For example, if you need to call the
436 command with special options only for a couple of binary packages,
437 pass this option to the last call of the command to process the
438 rest of packages with default settings.
439
440 -Ptmpdir, --tmpdir=tmpdir
441 Use tmpdir for package build directory. The default is
442 debian/package
443
444 --mainpackage=package
445 This little-used option changes the package which debhelper
446 considers the "main package", that is, the first one listed in
447 debian/control, and the one for which debian/foo files can be used
448 instead of the usual debian/package.foo files.
449
450 -O=option|bundle
451 This is used by dh(1) when passing user-specified options to all
452 the commands it runs. If the command supports the specified option
453 or option bundle, it will take effect. If the command does not
454 support the option (or any part of an option bundle), it will be
455 ignored.
456
458 The following command line options are supported by some debhelper
459 programs. See the man page of each program for a complete explanation
460 of what each option does.
461
462 -n Do not modify postinst, postrm, etc. scripts.
463
464 -Xitem, --exclude=item
465 Exclude an item from processing. This option may be used multiple
466 times, to exclude more than one thing. The item is typically part
467 of a filename, and any file containing the specified text will be
468 excluded.
469
470 -A, --all
471 Makes files or other items that are specified on the command line
472 take effect in ALL packages acted on, not just the first.
473
475 The following command line options are supported by all of the
476 dh_auto_* debhelper programs. These programs support a variety of build
477 systems, and normally heuristically determine which to use, and how to
478 use them. You can use these command line options to override the
479 default behavior. Typically these are passed to dh(1), which then
480 passes them to all the dh_auto_* programs.
481
482 -Sbuildsystem, --buildsystem=buildsystem
483 Force use of the specified buildsystem, instead of trying to auto-
484 select one which might be applicable for the package.
485
486 Pass none as buildsystem to disable auto-selection.
487
488 -Ddirectory, --sourcedir=directory, --sourcedirectory=directory
489 Assume that the original package source tree is at the specified
490 directory rather than the top level directory of the Debian source
491 package tree.
492
493 Warning: The --sourcedir variant matches a similar named option in
494 dh_install and dh_missing (etc.) for historical reasons. While
495 they have a similar name, they have very distinct purposes and in
496 some cases it can cause errors when this variant is passed to dh
497 (when then passes it on to all tools).
498
499 -B[directory], --builddir[=directory], --builddirectory[=directory]
500 Enable out of source building and use the specified directory as
501 the build directory. If directory parameter is omitted, a default
502 build directory will be chosen.
503
504 If this option is not specified, building will be done in source by
505 default unless the build system requires or prefers out of source
506 tree building. In such a case, the default build directory will be
507 used even if --builddirectory is not specified.
508
509 If the build system prefers out of source tree building but still
510 allows in source building, the latter can be re-enabled by passing
511 a build directory path that is the same as the source directory
512 path.
513
514 --parallel, --no-parallel
515 Control whether parallel builds should be used if underlying build
516 system supports them. The number of parallel jobs is controlled by
517 the DEB_BUILD_OPTIONS environment variable ("Debian Policy, section
518 4.9.1") at build time. It might also be subject to a build system
519 specific limit.
520
521 If neither option is specified, debhelper currently defaults to
522 --parallel in compat 10 (or later) and --no-parallel otherwise.
523
524 As an optimization, dh will try to avoid passing these options to
525 subprocesses, if they are unnecessary and the only options passed.
526 Notably this happens when DEB_BUILD_OPTIONS does not have a
527 parallel parameter (or its value is 1).
528
529 --max-parallel=maximum
530 This option implies --parallel and allows further limiting the
531 number of jobs that can be used in a parallel build. If the package
532 build is known to only work with certain levels of concurrency, you
533 can set this to the maximum level that is known to work, or that
534 you wish to support.
535
536 Notably, setting the maximum to 1 is effectively the same as using
537 --no-parallel.
538
539 --reload-all-buildenv-variables
540 By default, dh(1) will compute several environment (e.g. by using
541 dpkg-buildflags(1)) and cache them to avoid having all dh_auto_*
542 tool recompute them.
543
544 When passing this option, the concrete dh_auto_* tool will ignore
545 the cache from dh(1) and retrigger a rebuild of these variables.
546 This is useful in the very rare case where the package need to do
547 multiple builds but with different ...FLAGS options. A concrete
548 example would be needing to change the -O parameter in CFLAGS in
549 the second build:
550
551 export DEB_CFLAGS_MAINT_APPEND=-O3
552
553 %:
554 dh $@
555
556 override_dh_auto_configure:
557 dh_auto_configure -Bbuild-deb ...
558 DEB_CFLAGS_MAINT_APPEND=-Os dh_auto_configure \
559 --reload-all-buildenv-variables -Bbuild-udeb ...
560
561 Without --reload-all-buildenv-variables in the second call to
562 dh_auto_configure(1), the change in DEB_CFLAGS_MAINT_APPEND would
563 be ignored as dh_auto_configure(1) would use the cached value of
564 CFLAGS set by dh(1).
565
566 This option is only available with debhelper (>= 12.7~) when the
567 package uses compatibility level 9 or later.
568
569 --list, -l
570 List all build systems supported by debhelper on this system. The
571 list includes both default and third party build systems (marked as
572 such). Also shows which build system would be automatically
573 selected, or which one is manually specified with the --buildsystem
574 option.
575
577 From time to time, major non-backwards-compatible changes need to be
578 made to debhelper, to keep it clean and well-designed as needs change
579 and its author gains more experience. To prevent such major changes
580 from breaking existing packages, the concept of debhelper compatibility
581 levels was introduced. You must tell debhelper which compatibility
582 level it should use, and it modifies its behavior in various ways.
583
584 In current debhelper, you can specify the compatibility level in
585 debian/control by adding a Build-Depends on the debhelper-compat
586 package. For example, to use v13 mode, ensure debian/control has:
587
588 Build-Depends: debhelper-compat (= 13)
589
590 This also serves as an appropriate versioned build dependency on a
591 sufficient version of the debhelper package, so you do not need to
592 specify a separate versioned build dependency on the debhelper package
593 unless you need a specific point release of debhelper (such as for the
594 introduction of a new feature or bugfix within a compatibility level).
595
596 Note that debhelper does not provide debhelper-compat for experimental
597 or beta compatibility levels; packages experimenting with those
598 compatibility levels should use debian/compat (or, if only for selected
599 commands, DH_COMPAT).
600
601 Prior versions of debhelper required specifying the compatibility level
602 in the file debian/compat, and current debhelper still supports this
603 for backward compatibility. To use this method, the debian/compat file
604 should contain the compatibility level as a single number, and no other
605 content. If you specify the compatibility level by this method, your
606 package will also need a versioned build dependency on a version of the
607 debhelper package equal to (or greater than) the compatibility level
608 your package uses. So, if you specify compatibility level 13 in
609 debian/compat, ensure debian/control has:
610
611 Build-Depends: debhelper (>= 13~)
612
613 Note that you must use either the build-dependency on debhelper-compat
614 or the debian/compat file. Whenever possible, the debhelper-compat
615 build-dependency is recommended.
616
617 If needed be, the DH_COMPAT environment variable can be used to
618 override the compat level for a given command. The feature is mostly
619 useful for either temporarily upgrading a few commands to a new compat
620 level or keeping a few commands on a lower compat level. The feature
621 is best used sparingly as it effectively introduces special-cases into
622 the debian/rules file that may be surprising to maintainers or
623 reviewers (or, in the long term, to yourself).
624
625 Unless otherwise indicated, all debhelper documentation assumes that
626 you are using the most recent compatibility level, and in most cases
627 does not indicate if the behavior is different in an earlier
628 compatibility level, so if you are not using the most recent
629 compatibility level, you're advised to read below for notes about what
630 is different in earlier compatibility levels.
631
632 Supported compatibility levels
633 The list of supported compatibility levels and the related upgrade
634 check list has moved to debhelper-compat-list(7).
635
637 Multiple binary package support
638 If your source package generates more than one binary package,
639 debhelper programs will default to acting on all binary packages when
640 run. If your source package happens to generate one architecture
641 dependent package, and another architecture independent package, this
642 is not the correct behavior, because you need to generate the
643 architecture dependent packages in the binary-arch debian/rules target,
644 and the architecture independent packages in the binary-indep
645 debian/rules target.
646
647 To facilitate this, as well as give you more control over which
648 packages are acted on by debhelper programs, all debhelper programs
649 accept the -a, -i, -p, and -s parameters. These parameters are
650 cumulative. If none are given, debhelper programs default to acting on
651 all packages listed in the control file, with the exceptions below.
652
653 First, any package whose Architecture field in debian/control does not
654 match the DEB_HOST_ARCH architecture will be excluded ("Debian Policy,
655 section 5.6.8").
656
657 Also, some additional packages may be excluded based on the contents of
658 the DEB_BUILD_PROFILES environment variable and Build-Profiles fields
659 in binary package stanzas in debian/control, according to the draft
660 policy at <https://wiki.debian.org/BuildProfileSpec>.
661
662 Interaction between package selections and Build-Profiles
663
664 Build-Profiles affect which packages are included in the package
665 selections mechanisms in debhelper. Generally, the package selections
666 are described from the assumption that all packages are enabled. This
667 section describes how the selections react when a package is disabled
668 due to the active Build-Profiles (or lack of active Build-Profiles).
669
670 -a/--arch, -i/--indep OR no selection options (a raw "dh_X" call)
671 The package disabled by Build-Profiles is silently excluded from
672 the selection.
673
674 Note you will receive a warning if all packages related to these
675 selections are disabled. In that case, it generally does not make
676 sense to do the build in the first place.
677
678 -N package / --no-package package
679 The option is accepted and effectively does nothing.
680
681 -p package / --package package
682 The option is accepted, but debhelper will not act on the package.
683
684 Note that it does not matter whether a package is enabled or disabled
685 by default.
686
687 Automatic generation of Debian install scripts
688 Some debhelper commands will automatically generate parts of Debian
689 maintainer scripts. If you want these automatically generated things
690 included in your existing Debian maintainer scripts, then you need to
691 add #DEBHELPER# to your scripts, in the place the code should be added.
692 #DEBHELPER# will be replaced by any auto-generated code when you run
693 dh_installdeb.
694
695 If a script does not exist at all and debhelper needs to add something
696 to it, then debhelper will create the complete script.
697
698 All debhelper commands that automatically generate code in this way let
699 it be disabled by the -n parameter (see above).
700
701 Note that the inserted code will be shell code, so you cannot directly
702 use it in a Perl script. If you would like to embed it into a Perl
703 script, here is one way to do that (note that I made sure that $1, $2,
704 etc are set with the set command):
705
706 my $temp="set -e\nset -- @ARGV\n" . << 'EOF';
707 #DEBHELPER#
708 EOF
709 if (system($temp)) {
710 my $exit_code = ($? >> 8) & 0xff;
711 my $signal = $? & 0x7f;
712 if ($exit_code) {
713 die("The debhelper script failed with error code: ${exit_code}");
714 } else {
715 die("The debhelper script was killed by signal: ${signal}");
716 }
717 }
718
719 Automatic generation of miscellaneous dependencies.
720 Some debhelper commands may make the generated package need to depend
721 on some other packages. For example, if you use dh_installdebconf(1),
722 your package will generally need to depend on debconf. Or if you use
723 dh_installxfonts(1), your package will generally need to depend on a
724 particular version of xutils. Keeping track of these miscellaneous
725 dependencies can be annoying since they are dependent on how debhelper
726 does things, so debhelper offers a way to automate it.
727
728 All commands of this type, besides documenting what dependencies may be
729 needed on their man pages, will automatically generate a substvar
730 called ${misc:Depends}. If you put that token into your debian/control
731 file, it will be expanded to the dependencies debhelper figures you
732 need.
733
734 This is entirely independent of the standard ${shlibs:Depends}
735 generated by dh_makeshlibs(1), and the ${perl:Depends} generated by
736 dh_perl(1). You can choose not to use any of these, if debhelper's
737 guesses don't match reality.
738
739 Package build directories
740 By default, all debhelper programs assume that the temporary directory
741 used for assembling the tree of files in a package is debian/package.
742
743 Sometimes, you might want to use some other temporary directory. This
744 is supported by the -P flag. For example, "dh_installdocs
745 -Pdebian/tmp", will use debian/tmp as the temporary directory. Note
746 that if you use -P, the debhelper programs can only be acting on a
747 single package at a time. So if you have a package that builds many
748 binary packages, you will need to also use the -p flag to specify which
749 binary package the debhelper program will act on.
750
751 udebs
752 Debhelper includes support for udebs. To create a udeb with debhelper,
753 add "Package-Type: udeb" to the package's stanza in debian/control.
754 Debhelper will try to create udebs that comply with debian-installer
755 policy, by making the generated package files end in .udeb, not
756 installing any documentation into a udeb, skipping over preinst,
757 postrm, prerm, and config scripts, etc.
758
760 This section describes some of the environment variables that
761 influences the behaviour of debhelper or which debhelper interacts
762 with.
763
764 It is important to note that these must be actual environment variables
765 in order to affect the behaviour of debhelper (not simply Makefile
766 variables). To specify them properly in debian/rules, be sure to
767 "export" them. For example, "export DH_VERBOSE".
768
769 DH_VERBOSE
770 Set to 1 to enable verbose mode. Debhelper will output every
771 command it runs. Also enables verbose build logs for some build
772 systems like autoconf.
773
774 DH_QUIET
775 Set to 1 to enable quiet mode. Debhelper will not output commands
776 calling the upstream build system nor will dh print which
777 subcommands are called and depending on the upstream build system
778 might make that more quiet, too. This makes it easier to spot
779 important messages but makes the output quite useless as buildd
780 log. Ignored if DH_VERBOSE is also set.
781
782 DH_COMPAT
783 Temporarily specifies what compatibility level debhelper should run
784 at, overriding any value specified via Build-Depends on debhelper-
785 compat or via the debian/compat file.
786
787 DH_NO_ACT
788 Set to 1 to enable no-act mode.
789
790 DH_OPTIONS
791 All debhelper tools will parse command line arguments listed in
792 this variable before any command option (as if they had been
793 prepended to the command line arguments). Unfortunately, some
794 third-party provided tools may not support this variable and will
795 ignore these command line arguments.
796
797 When using dh(1), it can be passed options that will be passed on
798 to each debhelper command, which is generally better than using
799 DH_OPTIONS.
800
801 DH_ALWAYS_EXCLUDE
802 If set, this adds the value the variable is set to to the -X
803 options of all commands that support the -X option. Moreover,
804 dh_builddeb will rm -rf anything that matches the value in your
805 package build tree.
806
807 This can be useful if you are doing a build from a CVS source tree,
808 in which case setting DH_ALWAYS_EXCLUDE=CVS will prevent any CVS
809 directories from sneaking into the package you build. Or, if a
810 package has a source tarball that (unwisely) includes CVS
811 directories, you might want to export DH_ALWAYS_EXCLUDE=CVS in
812 debian/rules, to make it take effect wherever your package is
813 built.
814
815 Multiple things to exclude can be separated with colons, as in
816 DH_ALWAYS_EXCLUDE=CVS:.svn
817
818 DH_EXTRA_ADDONS
819 If set, this adds the specified dh addons to be run in the
820 appropriate places in the sequence of commands. This is equivalent
821 to specifying the addon to run with the --with flag in the
822 debian/rules file. Any --without calls specifying an addon in this
823 environment variable will not be run.
824
825 This is intended to be used by downstreams or specific local
826 configurations that require a debhelper addon to be run during
827 multiple builds without having to patch a large number of rules
828 file. If at all possible, this should be avoided in favor of a
829 --with flag in the rules file.
830
831 DH_COLORS, DPKG_COLORS
832 These variables can be used to control whether debhelper commands
833 should use colors in their textual output. Can be set to "always",
834 "auto" (the default), or "never".
835
836 Note that DPKG_COLOR also affects a number of dpkg related tools
837 and debhelper uses it on the assumption that you want the same
838 color setting for dpkg and debhelper. In the off-hand chance you
839 want different color setting for debhelper, you can use DH_COLORS
840 instead or in addition to DPKG_COLORS.
841
842 NO_COLOR
843 If no explicit request for color has been given (e.g. DH_COLORS and
844 DPKG_COLORS are both unset), the presence of this environment
845 variable cause the default color setting to be "never".
846
847 The variable is defined according to <https://no-color.org/>. In
848 this project, the environment variables (such as DH_COLORS) are
849 considered an explicit request for color.
850
851 CFLAGS, CPPFLAGS, CXXFLAGS, OBJCFLAGS, OBJCXXFLAGS, GCJFLAGS, FFLAGS,
852 FCFLAGS, LDFLAGS
853 By default (in any non-deprecated compat level), debhelper will
854 automatically set these flags by using dpkg-buildflags(1), when
855 they are unset. If you need to change the default flags, please
856 use the features from dpkg-buildflags(1) to do this (e.g.
857 DEB_BUILD_MAINT_OPTIONS=hardening=all or
858 DEB_CPPFLAGS_MAINT_APPEND=-DCUSTOM_MACRO=true) rather than setting
859 the concrete variable directly.
860
861 HOME, XDG_*
862 In compat 13 and later, these environment variables are reset
863 before invoking the upstream build system via the dh_auto_*
864 helpers. The variables HOME (all dh_auto_* helpers) and
865 XDG_RUNTIME_DIR (dh_auto_test only) will be set to a writable
866 directory. All remaining variables and XDG_RUNTIME_DIR (except for
867 during dh_auto_test) will be cleared.
868
869 The HOME directory will be created as an empty directory but it
870 will be reused between calls to dh_auto_*. Any content will
871 persist until explicitly deleted or dh_clean.
872
873 DEB_BUILD_OPTIONS
874 Please see "Supported flags in DEB_BUILD_OPTIONS" for this
875 environment variable.
876
877 Please note that this variable should not be altered by package
878 maintainers inside debian/rules to change the behaviour of
879 debhelper. Instead, where the package maintainer need these
880 features, they should look disabling the relevant feature directly
881 (e.g. by overriding the concrete tools).
882
883 DEB_BUILD_MAINT_OPTIONS
884 This is a dpkg specific environment variable (see e.g.
885 dpkg-buildflags(1)). The debhelper tool suite silently ignores it.
886
887 It is documented here because it has a similar name to
888 DEB_BUILD_OPTIONS, which make some people mistakenly assume that
889 debhelper will also react to this variable.
890
891 Supported flags in DEB_BUILD_OPTIONS
892 The debhelper tool suite reacts to the following flags in
893 DEB_BUILD_OPTIONS.
894
895 dherroron=obsolete-compat-levels
896 This is a debhelper specific value.
897
898 When dherroron is present and set to obsolete-compat-levels, then
899 debhelper tools will promote deprecation warnings for usage of old
900 soon to be removed compat levels into errors.
901
902 This is useful for automated checking for code relying on
903 deprecated compat levels that is scheduled for removal.
904
905 This option is intended for testing purposes; not production
906 builds.
907
908 nostrip
909 This value will change the content of the debs being built. The
910 .deb packages built when this is set is therefore not bit-for-bit
911 reproducible with a regular build in the general case.
912
913 This value will cause the official debhelper tools will skip
914 actions and helpers that either remove, detach or deduplicate
915 debugging symbols in ELF binaries.
916
917 This value affects dh_dwz(1) and dh_strip(1).
918
919 nocheck
920 This value will cause the official debhelper build systems to skip
921 runs of upstream test suites.
922
923 Package maintainers looking to avoid running the upstream tests
924 should not rely on this. Instead, they can add an empty override
925 target to skip dh_auto_test.
926
927 This value affects dh_auto_test(1).
928
929 nodoc
930 This value will change the content of the debs being built. The
931 .deb packages built when this is set is therefore not bit-for-bit
932 reproducible with a regular build in the general case.
933
934 This value will cause several debhelper tools to skip installation
935 of documentation such as manpages or upstream provided
936 documentation. Additionally, the tools will also ignore if
937 declared documentation is "missing" on the assumption that the
938 documentation has not been built.
939
940 This value effects tools like dh_installdocs(1), which knows it is
941 working with documentation.
942
943 noautodbgsym, noddebs
944 The official name is autodbgsym. The noddebs variant is accepted
945 for historical reasons.
946
947 This value causes debhelper to skip the generation of automatically
948 generated debug symbol packages.
949
950 This value affects dh_strip(1).
951
952 parallel=N
953 This value enables debhelper to use up to N threads or processes
954 (subject to parameters like --no-parallel and --max-parallel=M).
955 Not all debhelper tools work with parallel tasks and may silently
956 ignore the request.
957
958 This value affects many debhelper tools. Most notably dh_auto_*,
959 which will attempt to run the underlying upstream build system with
960 that number of threads.
961
962 terse
963 This value will cause the official debhelper build systems to
964 configure upstream builds to be terse (i.e. reduce verbosity in
965 their output). This is subject to the upstream and the debhelper
966 build system supporting such features.
967
968 This value affects most dh_auto_* tools.
969
970 Unknown flags are silently ignored.
971
972 Note third-party debhelper-like tools or third-party provided build
973 systems may or may not react to the above flags. This tends to depend
974 on implementation details of the tool.
975
977 debhelper-compat-upgrade-checklist(7)
978 List of supported compat levels and an upgrade checklist for each
979 of them.
980
981 /usr/share/doc/debhelper/examples/
982 A set of example debian/rules files that use debhelper.
983
984 <http://joeyh.name/code/debhelper/>
985 Debhelper web site.
986
988 Joey Hess <joeyh@debian.org>
989
990
991
99213.7.1 2022-04-22 debhelper(7)