dpkg-buildpackage.1 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. .TH dpkg\-buildpackage 1 "2008-08-18" "Debian Project" "dpkg utilities"
  2. .SH NAME
  3. dpkg\-buildpackage \- build binary or source packages from sources
  4. .
  5. .SH SYNOPSIS
  6. .B dpkg\-buildpackage
  7. .RI [ options ]
  8. .
  9. .SH DESCRIPTION
  10. .B dpkg\-buildpackage
  11. is a program that automates the process of building a Debian package. It
  12. consists of the following steps:
  13. .IP \fB1.\fP 3
  14. It prepares the build environment by setting various environment
  15. variables (see \fBENVIRONMENT VARIABLES\fP).
  16. .IP \fB2.\fP 3
  17. It checks that the build-dependencies and build-conflicts
  18. are satisfied (unless \fB\-d\fP is specified).
  19. .IP \fB3.\fP 3
  20. It calls \fBfakeroot debian/rules clean\fP to clean the build-tree (unless
  21. \fB\-nc\fP is specified).
  22. .IP \fB4.\fP 3
  23. It calls \fBdpkg-source\fP to generate the source package (unless
  24. a binary-only build has been requested with \fB\-b\fP, \fB\-B\fP or
  25. \fB\-A\fP).
  26. .IP \fB5.\fP 3
  27. It calls \fBdebian/rules\fP \fBbuild\fP followed by
  28. \fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
  29. build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
  30. either \fBbuild\fP (default case, or if \fB\-b\fP is specified)
  31. or \fBbinary-arch\fP (if \fB\-B\fP is specified) or \fBbinary-indep\fP
  32. (if \fB\-A\fP is specified).
  33. .IP \fB6.\fP 3
  34. It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
  35. \fB\-us\fP is specified).
  36. .IP \fB7.\fP 3
  37. It calls \fBdpkg-genchanges\fP to generate a \fB.changes\fP file.
  38. Many \fBdpkg-buildpackage\fP options are forwarded to
  39. \fBdpkg-genchanges\fP.
  40. .IP \fB8.\fP 3
  41. It calls \fBgpg\fP to sign the \fB.changes\fP file (unless \fB\-uc\fP
  42. is specified).
  43. .IP \fB9.\fP 3
  44. If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
  45. again.
  46. .
  47. .SH OPTIONS
  48. .TP
  49. .B \-b
  50. Specifies a binary-only build, no source files are to be built and/or
  51. distributed. Passed to \fBdpkg-genchanges\fP.
  52. .TP
  53. .B \-B
  54. Specifies a binary-only build, limited to architecture dependent packages.
  55. Passed to \fBdpkg-genchanges\fP.
  56. .TP
  57. .B \-A
  58. Specifies a binary-only build, limited to architecture independent
  59. packages. Passed to \fBdpkg-genchanges\fP.
  60. .TP
  61. .B \-S
  62. Specifies a source-only build, no binary packages need to be made.
  63. Passed to \fBdpkg-genchanges\fP.
  64. .P
  65. .B \-si
  66. .br
  67. .B \-sa
  68. .br
  69. .B \-sd
  70. .br
  71. .BI \-v version
  72. .br
  73. .BI \-C changesdescription
  74. .br
  75. .BI \-m maintaineraddress
  76. .br
  77. .BI \-e maintaineraddress
  78. .RS
  79. Passed unchanged to \fBdpkg-genchanges\fP. See its manual page.
  80. .RE
  81. .TP
  82. .BI \-a architecture
  83. Specify the Debian architecture we build for. The architecture of the
  84. machine we build on is determined automatically, and is also the default
  85. for the host machine.
  86. If the host architecture differs from the build architecture (as is the
  87. case for a cross-compilation), and if the environment variable
  88. \fBPKG_CONFIG_LIBDIR\fP is not set, then it is set to a value suitable for
  89. cross-compilation
  90. ("/usr/\fIgnu-system-type\fP/lib/pkgconfig/:/usr/share/pkgconfig").
  91. .TP
  92. .BI \-t gnu-system-type
  93. Specify the GNU system type we build for. It can be used in place
  94. of \-a or as a complement to override the default GNU system type
  95. of the target Debian architecture.
  96. .TP
  97. .BI \-j jobs
  98. Number of jobs allowed to be run simultaneously, equivalent to the
  99. .BR make (1)
  100. option of the same name. Will add itself to the MAKEFLAGS
  101. environment variable, which should cause all subsequent make
  102. invocations to inherit the option. Also adds \fBparallel=\fP\fIjobs\fP
  103. to the DEB_BUILD_OPTIONS environment variable which allows
  104. debian/rules files to use this information for their own purposes.
  105. The \fBparallel=\fP\fIjobs\fP in DEB_BUILD_OPTIONS environment variable
  106. will override the \fB-j\fP value if this option is given.
  107. .B \-D
  108. Check build dependencies and conflicts; abort if unsatisfied. This is the
  109. default behavior.
  110. .TP
  111. .B \-d
  112. Do not check build dependencies and conflicts.
  113. .TP
  114. .B \-nc
  115. Do not clean the source tree (implies \fB\-b\fP).
  116. .TP
  117. .B \-tc
  118. Clean the source tree (using
  119. .I gain-root-command
  120. .BR "debian/rules clean" )
  121. after the package has been built.
  122. .TP
  123. .BI \-r gain-root-command
  124. When
  125. .B dpkg\-buildpackage
  126. needs to execute part of the build process as root, it prefixes the
  127. command it executes with
  128. .I gain-root-command
  129. if one has been specified. Otherwise, if none has been specified,
  130. \fBfakeroot\fP will be used by default, if the command is present.
  131. .I gain-root-command
  132. should start with the name of a program on the
  133. .B PATH
  134. and will get as arguments the name of the real command to run and the
  135. arguments it should take.
  136. .I gain-root-command
  137. can include parameters (they must be space-separated) but no shell
  138. metacharacters.
  139. .I gain-root-command
  140. might typically be
  141. .BR fakeroot ", " sudo ", " super " or " really .
  142. .B su
  143. is not suitable, since it can only invoke the user's shell with
  144. .B \-c
  145. instead of passing arguments individually to the command to be run.
  146. .TP
  147. .BI \-R rules-file
  148. Building a Debian package usually involves invoking
  149. .B debian/rules
  150. as a command with several standard parameters. With this option it's
  151. possible to use another program invocation to build the package (it can
  152. include space separated parameters).
  153. Alternatively it can be used to execute the standard rules file with
  154. another make program (for example by using
  155. .B /usr/local/bin/make -f debian/rules
  156. as \fIrules-file\fR).
  157. .TP
  158. .BI \-p sign-command
  159. When \fBdpkg\-buildpackage\fP needs to execute GPG or PGP to sign a source
  160. control (\fB.dsc\fP) file or a \fB.changes\fP file it will run
  161. \fIsign-command\fP (searching the \fBPATH\fP if necessary) instead of
  162. \fBgpg\fP. \fIsign-command\fP will get all the arguments that
  163. \fBpgp\fP would have gotten. If \fIsign-command\fP
  164. takes its arguments in GPG rather than PGP style, you should give
  165. the \fB\-sgpg\fP option. \fIsign-command\fP
  166. should not contain spaces or any other shell metacharacters.
  167. .TP
  168. .BI \-k key-id
  169. Specify a key-ID to use when signing packages.
  170. .TP
  171. .BR \-us
  172. Do not sign the source package.
  173. .TP
  174. .BR \-uc
  175. Do not sign the \fB.changes\fP file.
  176. .P
  177. .BR \-i [\fIregexp\fP]
  178. .br
  179. .BI \-I [\fIpattern\fP]
  180. .br
  181. .BR \-s [ nsAkurKUR ]
  182. .br
  183. .BR \-z ", " \-Z
  184. .br
  185. .RS
  186. Passed unchanged to \fBdpkg\-source\fP. See its manual page.
  187. .RE
  188. .TP
  189. .BI \-\-admindir= dir
  190. Change the location of the \fBdpkg\fR database. The default location is
  191. \fI/var/lib/dpkg\fP.
  192. .TP
  193. .BR \-h ", " \-\-help
  194. Show the usage message and exit.
  195. .TP
  196. .BR \-\-version
  197. Show the version and exit.
  198. .
  199. .SH ENVIRONMENT VARIABLES
  200. .SS Vendor identification
  201. The variable \fBDEB_VENDOR\fR will be set to the name of the current vendor
  202. if \fI/etc/dpkg/origins/default\fR exists and can be used to look up the vendor
  203. name. If the variable already exists, and contains the name of an existing
  204. vendor in \fI/etc/dpkg/origins\fR, it will be kept; otherwise the variable is
  205. unset.
  206. .SS Variables set by dpkg-architecture
  207. \fBdpkg\-architecture\fP is called with the \fB\-a\fP and \fB\-t\fP
  208. parameters forwarded. Any variable that is output by its \fB\-s\fP
  209. option is integrated in the build environment.
  210. .SS Compiler flags
  211. Some environment variables defining compiler and linker options are
  212. set to default values unless already present in the environment. Note that
  213. this mechanism was only introduced in version 1.14.17 of dpkg-dev and
  214. not all \fIrules\fP files and build tools will honour these variables,
  215. yet.
  216. .TP
  217. .B CFLAGS
  218. Optimization options which are passed to the Debian build system and
  219. can/should be overriden by the package build if needed (default value:
  220. .BR "\-g \-O2" ,
  221. or
  222. .BR \-g\ \-O0
  223. if
  224. .BR noopt
  225. is specified in DEB_BUILD_OPTIONS). Overriding options can be
  226. used to explicitely set a
  227. higher optimization level, or work around compiler bugs, which only
  228. can be seen with some optimization levels (the last opt level "wins").
  229. .TP
  230. .B CFLAGS_APPEND
  231. Optimization options appended to the compiler flags, which must not be
  232. overwritten by the package (mostly used to for test builds). Default
  233. value: empty.
  234. .TP
  235. .B CXXFLAGS
  236. Same as
  237. .B CFLAGS
  238. for C++ sources.
  239. .TP
  240. .B CXXFLAGS_APPEND
  241. Same as
  242. .B CFLAGS_APPEND
  243. for C++ sources.
  244. .TP
  245. .B FFLAGS
  246. Same as
  247. .B CFLAGS
  248. for Fortran sources.
  249. .TP
  250. .B FFLAGS_APPEND
  251. Same as
  252. .B CFLAGS_APPEND
  253. for Fortran sources.
  254. .TP
  255. .B CPPFLAGS
  256. Preprocessor flags which are passed to the Debian build system and
  257. can/should be overriden by the package build if needed (default:
  258. empty). This macro is seldom used (most build systems just use
  259. .B CFLAGS
  260. instead of
  261. .BR CPPFLAGS ).
  262. .TP
  263. .B CPPFLAGS_APPEND
  264. Preprocessor flags appended to the preprocessor flags, which must not
  265. be overwritten by the package (mostly used to for test
  266. builds). Default value: empty.
  267. .TP
  268. .B LDFLAGS
  269. Options passed to the compiler when linking executables or shared
  270. objects (if the linker is called directly, then
  271. .B -Wl
  272. and
  273. .B ,
  274. have to be stripped from these options). Default value: empty.
  275. .TP
  276. .B LDFLAGS_APPEND
  277. Optimization options appended to the compiler flags when linking code,
  278. which must not be overwritten by the package (mostly used to for test
  279. builds). Default value: empty.
  280. .
  281. .SH BUGS
  282. It should be possible to specify spaces and shell metacharacters in
  283. and initial arguments for
  284. .IR gain-root-command " and " sign-command .
  285. .
  286. .SH "SEE ALSO"
  287. .BR dpkg\-source (1),
  288. .BR dpkg\-architecture (1),
  289. .BR dpkg\-genchanges (1),
  290. .BR fakeroot (1),
  291. .BR gpg (1).
  292. .
  293. .SH AUTHORS
  294. Copyright \(co 1995-1996 Ian Jackson
  295. .br
  296. Copyright \(co 2000 Wichert Akkerman
  297. .br
  298. Copyright \(co 2007 Frank Lichtenheld
  299. .br
  300. Copyright \(co 2008 Rapha\[:e]l Hertzog
  301. .sp
  302. This is free software; see the GNU General Public Licence version 2 or later
  303. for copying conditions. There is NO WARRANTY.