]> git.donarmstrong.com Git - debhelper.git/blob - debhelper.1
d52c82a4544483ece823efe0267b978153dfcab5
[debhelper.git] / debhelper.1
1 .TH DEBHELPER 1 "" "Debhelper Commands" "Debhelper Commands"
2 .SH NAME
3 debhelper \- overview of the debhelper commands
4 .SH SYNOPSIS
5 .B dh_*
6 .I "[-v] [-a] [-i] [-s] [--no-act] [-ppackage] [-Npackage] [-Ptmpdir]"
7 .SH "DESCRIPTION"
8 Debhelper is used to help you build a debian package. The philospohy behind
9 debhelper is to provide a collection of small, simple, and easily
10 understood tools that are used in debian/rules to automate various common
11 aspects of building a package. This means less work for you, the packager.
12 It also, to some degree means that these tools can be changed if debian
13 policy changes, and packages that use them will require only a rebuild to
14 comply with the new policy.
15 .P
16 A typical debian/rules file that uses debhelper will call several debhelper
17 commands in sequence. Debhelper commands are all named with a "dh_" prefix.
18 Examples of rules files that use debhelper are in
19 /usr/share/doc/debhelper/examples/ .
20 .P
21 To create a new debian package using debhelper, you can just copy one of
22 the sample rules files and edit it by hand. Or you can try the dh-make
23 package, which contains a
24 .BR dh_make (1)
25 command that partially automates the process. For a more gentle
26 introduction, the maint-guide debian package contains a
27 tutorial about making your first package using debhelper.
28 .SH "DEBHELPER COMMANDS"
29 Here is the complete list of available debhelper commands. See their man
30 pages for additional documentation.
31 #LIST#
32 .SH "DEBHELPER CONFIG FILES"
33 Many debhelper commands make use of files in debian/ to control what they
34 do. Besides the common debian/changelog and debian/control, which are
35 in all packages, not just those using debhelper, some additional files can
36 be used to configure the behavior of specific debhelper commands. These
37 files are typically named debian/<package>.foo (where <package> of course,
38 is replaced with the package that is being acted on).
39 .P
40 For example,
41 dh_installdocs uses files named debian/<package>.docs to list the documentation
42 files it will install. See the man pages of individual commands for details
43 about the names and formats of the files they use.
44 .P
45 Note that if a package is the first (or only) binary package listed in
46 debian/control, debhelper will use debian/foo if no debian/<package>.foo
47 file can be found.
48 .P
49 In some rare cases, you may want to have different versions of these files
50 for different architectures. If files named debian/<package>.foo.<arch>
51 exist, where <arch> is the same as the output of "dpkg --print-architecture",
52 then they will be used in preference to other, more general files.
53 .SH "SHARED DEBHLPER OPTIONS"
54 The following command line options are supported by all debhelper programs.
55 .TP
56 .B \-v, \--verbose
57 Verbose mode: show all commands that modify the package build directory.
58 .TP
59 .B \--no-act
60 Do not really do anything. If used with -v, the result is that the command
61 will output a list of what it would have done.
62 .TP
63 .B \-a, \--arch
64 Act on all architecture dependent packages.
65 .TP
66 .B \-i, \--indep
67 Act on all architecture independent packages.
68 .TP
69 .B \-ppackage, \--package=package
70 Act on the package named "package".
71 .TP
72 .B \-s, \--same-arch
73 This is a smarter version of the -a flag, that is used in some rare
74 circumstances. It understands that if the control file lists "Architecture: i386"
75 for the package, the package should not be acted on on other architectures. So
76 this flag makes the command act on all "Architecture: any" packages, as well
77 as on any packages that have the current architecture explicitly specified.
78 Contrast to the -a flag, which makes the command work on all packages that
79 are not architecture independant.
80 .TP
81 .B \-Npackage, \--no-package=package
82 Do not act on the specified package even if an -a, -i, or -p option lists
83 the package as one that should be acted on.
84 .TP
85 .B \-Ptmpdir, \--tmpdir=tmpdir
86 Use "tmpdir" for package build directory. The default is debian/<package>
87 .SH "COMMON DEBHELPER OPTIONS"
88 The following command line options are supported by some debhelper programs.
89 See the man page of each program for a complete explanation of what the
90 option does.
91 .TP
92 .B \-n
93 Do not modify postinst/postrm/etc scripts.
94 .TP
95 .B \-Xitem, \--exclude=item
96 Exclude an item from processing. This option may be used multiple times,
97 to exclude more than one thing.
98 .TP
99 .B \-A, \-all
100 Makes files or other items that are specified on the command line take effect
101 in ALL packages acted on, not just the first.
102 .SH NOTES
103 .TP
104 .B Multiple binary package support
105 .RS
106 If your source package generates more than one binary package, debhelper
107 programs will default to acting on all binary packages when run. If your
108 source package happens to generate one architecture dependent package, and
109 another architecture independent package, this is not the correct behavior,
110 because you need to generate the architecture dependent packages in the
111 binary-arch debian/rules target, and the architecture independent packages
112 in the binary-indep debian/rules target.
113
114 To facilitate this, as well as give you more control over which packages
115 are acted on by debhelper programs, all debhelper programs accept the
116 .B -a
117 ,
118 .B -i
119 ,
120 .B -p
121 , and
122 .B -s
123 parameters. These parameters are cumulative. If none are given,
124 debhelper programs default to acting on all packages listed in the control
125 file.
126 .P
127 See
128 .BR /usr/share/doc/debhelper/examples/rules.multi
129 for an example of how to use this.
130 .RE
131 .TP
132 .B Automatic generation of debian install scripts
133 .RS
134 Some debhelper commands will automatically generate parts of debian install
135 scripts. If you want these automatically generated things included in your
136 debian install scripts, then you need to add "#DEBHELPER#" to your scripts,
137 in the place the code should be added. "#DEBHELPER#" will be replaced by
138 any auto-generated code when you run dh_installdeb.
139 .P
140 All scripts that automatically generate code in this way let it be disabled
141 by the -n parameter (see above).
142 .P
143 Note that the inserted code will be shell code, so you cannot directly use
144 it in a perl script. If you would like to embed it into a perl script, here
145 is one way to do that (note that I made sure that $1, $2, etc are set with
146 the set command):
147   my $temp="set -e\\nset -- @ARGV\\n" . << 'EOF';
148   #DEBHELPER#
149   EOF
150   system ($temp) / 256 == 0
151         or die "Problem with debhelper scripts: $!";
152 .RE
153 .TP
154 .B Package build directories
155 .RS
156 By default, all debhelper programs assume that the temporary directory used
157 for assembling the tree of files in a package is debian/<packagename>.
158 .P
159 Sometimes, you might want to use some other temporary directory. This is
160 supported by the
161 .B -P
162 flag. For example, "dh_installdocs -Pdebian/tmp", will use debian/tmp as the
163 temporary directory. Note that if you use -P, the debhelper programs can only
164 be acting on a single package at a time. So if you have a package that builds
165 many binary packages, you will need to use the -p flag to specify which
166 binary package the debhelper program will act on.
167 .RE
168 .TP
169 .B Debhelper compatability levels
170 .RS
171 From time to time, major non-backwards-compatabile changes need to be made
172 to debhelper, to keep it clean and well-designed as needs change and its
173 author gains more experience. To prevent such major changes from breaking
174 existing packages, the DH_COMPAT environment variable was introduced.
175 DH_COMPAT may be set to a number, to determine which major revision of
176 debhelper should be used. There are currently 3:
177 .TP
178 .B V1
179 Setting DH_COMPAT=1 (or leaving it unset) causes debhelper to act in
180 compatability mode. It will use debian/tmp as the package tree
181 directory for the first binary package listed in the control file, while using
182 debian/<package> for all other packages listed in the control file.
183 This mode is deprecated.
184 .TP
185 .B V2
186 Setting DH_COMPAT=2 causes debhelper to consitently use debian/<package>
187 as the package tree directory for every package that is built. This
188 mode is currently set by default in all the example rules files, and you
189 are encouraged to use it.
190 .TP
191 .B V3
192 Setting DH_COMPAT=3 will make debhelper start using new v3 features as
193 they are implemented. This will cause its behavior to change without
194 notice, and so may break packages that use it. See the file
195 "/usr/share/doc/debhelper/v3" for more information about planned
196 changes.
197 .RE
198 .TP
199 .B Other notes
200 .RS
201 In general, if any debhelper program needs a directory to exist under
202 debian/, it will create it. I haven't bothered to document this in all the
203 man pages, but for example, dh_installdeb knows to make debian/<foo>/DEBIAN/
204 before trying to put files there, dh_installmenu knows you need a
205 debian/<foo>/usr/lib/menu/ before installing the menu files, etc.
206 .P
207 Note that if you are generating a debian package that has arch-indep and
208 arch-dependent portions, and you are using dh_movefiles to move the
209 arch-indep files out of debian/tmp, you need to make sure that dh_movefiles
210 does this even if only the arch-dependent package is being built (for
211 ports to other architectures). I handle this in the example rules file
212 "rules.multi" by calling dh_movefiles in the install target.
213 .P
214 Once your package uses debhelper to build, be sure to add
215 debhelper to your Build-Depends line in debian/control.
216 .RE
217 .SH ENVIRONMENT
218 .TP
219 .I DH_VERBOSE
220 Enables verbose mode.
221 .TP
222 .I DH_COMPAT
223 Specifies what compatability level debhelper should run at. See above.
224 .TP
225 .I DH_NO_ACT
226 Enables no-act mode.
227 .TP
228 .I DH_OPTIONS
229 Anything in this variable will be prepended to the command line
230 arguments of all debhelper commands. This in useful in some situations,
231 for example, if you need to pass -p to all debhelper commands that will be
232 run. If you use DH_OPTIONS, be sure to use "dh_testversion 1.1.17" - older
233 debhelpers will ignore it and do things you don't want them to. One very
234 good way to set DH_OPTIONS is by using "Target-specific Variable Values" in
235 your debian/rules file. See the make documentation for details on doing this.
236 .SH "SEE ALSO"
237 .TP
238 .BR /usr/share/doc/debhelper/examples/
239 A set of example debian/rules files that use debhelper.
240 .TP
241 .BR http://kitenet.net/programs/debhelper/
242 Debhelper web site.
243 .SH AUTHOR
244 Joey Hess <joeyh@debian.org>