dpkg-buildpackage.1 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. .TH dpkg\-buildpackage 1 "2011-08-14" "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 [ option ...]
  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\fP) and calls \fBdpkg\-source
  16. \-\-before\-build\fP (unless \fB\-T\fP or \fB\-\-target\fP has been used).
  17. .IP \fB2.\fP 3
  18. It checks that the build-dependencies and build-conflicts
  19. are satisfied (unless \fB\-d\fP is specified).
  20. .IP \fB3.\fP 3
  21. If a specific target has been selected with the \fB\-T\fP or \fB\-\-target\fP
  22. option, it calls that target and stops here. Otherwise it calls
  23. \fBfakeroot debian/rules clean\fP to clean the build-tree (unless
  24. \fB\-nc\fP is specified).
  25. .IP \fB4.\fP 3
  26. It calls \fBdpkg\-source \-b\fP to generate the source package (unless
  27. a binary\-only build has been requested with \fB\-b\fP, \fB\-B\fP or
  28. \fB\-A\fP).
  29. .IP \fB5.\fP 3
  30. It calls \fBdebian/rules\fP \fBbuild\fP followed by
  31. \fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
  32. build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
  33. either \fBbinary\fP (default case, or if \fB\-b\fP is specified)
  34. or \fBbinary\-arch\fP (if \fB\-B\fP is specified) or \fBbinary\-indep\fP
  35. (if \fB\-A\fP is specified).
  36. .IP \fB6.\fP 3
  37. It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
  38. \fB\-us\fP is specified).
  39. .IP \fB7.\fP 3
  40. It calls \fBdpkg\-genchanges\fP to generate a \fB.changes\fP file.
  41. Many \fBdpkg\-buildpackage\fP options are forwarded to
  42. \fBdpkg\-genchanges\fP.
  43. .IP \fB8.\fP 3
  44. It calls \fBgpg\fP to sign the \fB.changes\fP file (unless \fB\-uc\fP
  45. is specified).
  46. .IP \fB9.\fP 3
  47. If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
  48. again. Finally it calls \fBdpkg\-source \-\-after\-build\fP.
  49. .
  50. .SH OPTIONS
  51. .TP
  52. .B \-b
  53. Specifies a binary-only build, no source files are to be built and/or
  54. distributed. Passed to \fBdpkg\-genchanges\fP.
  55. .TP
  56. .B \-B
  57. Specifies a binary-only build, limited to architecture dependent packages.
  58. Passed to \fBdpkg\-genchanges\fP.
  59. .TP
  60. .B \-A
  61. Specifies a binary-only build, limited to architecture independent
  62. packages. Passed to \fBdpkg\-genchanges\fP.
  63. .TP
  64. .B \-S
  65. Specifies a source-only build, no binary packages need to be made.
  66. Passed to \fBdpkg\-genchanges\fP.
  67. .TP
  68. .B \-F
  69. Specifies a normal full build, binary and source packages will be built.
  70. This is the same as the default case when no build option is specified.
  71. .P
  72. .BI \-\-target= target
  73. .br
  74. .BI "\-\-target " target
  75. .br
  76. .BI \-T target
  77. .RS
  78. Calls \fBdebian/rules\fP \fItarget\fP after having setup the build
  79. environment and stops the package build process here. If
  80. \fB\-\-as\-root\fP is also given, then the command is executed
  81. as root (see \fB\-r\fP). Note that official targets that are required to
  82. be run as root by the Debian policy do not need this option.
  83. .RE
  84. .TP
  85. .B \-\-as\-root
  86. Only meaningful together with \fB\-\-target\fP. Requires that the target be
  87. run with root rights.
  88. .P
  89. .B \-si
  90. .br
  91. .B \-sa
  92. .br
  93. .B \-sd
  94. .br
  95. .BI \-v version
  96. .br
  97. .BI \-C changesdescription
  98. .br
  99. .BI \-m maintaineraddress
  100. .br
  101. .BI \-e maintaineraddress
  102. .RS
  103. Passed unchanged to \fBdpkg\-genchanges\fP. See its manual page.
  104. .RE
  105. .TP
  106. .BI \-a architecture
  107. Specify the Debian architecture we build for. The architecture of the
  108. machine we build on is determined automatically, and is also the default
  109. for the host machine.
  110. .TP
  111. .BI \-t gnu-system-type
  112. Specify the GNU system type we build for. It can be used in place
  113. of \-a or as a complement to override the default GNU system type
  114. of the target Debian architecture.
  115. .TP
  116. .BI \-j jobs
  117. Number of jobs allowed to be run simultaneously, equivalent to the
  118. .BR make (1)
  119. option of the same name. Will add itself to the MAKEFLAGS
  120. environment variable, which should cause all subsequent make
  121. invocations to inherit the option. Also adds \fBparallel=\fP\fIjobs\fP
  122. to the DEB_BUILD_OPTIONS environment variable which allows
  123. debian/rules files to use this information for their own purposes.
  124. The \fBparallel=\fP\fIjobs\fP in DEB_BUILD_OPTIONS environment variable
  125. will override the \fB\-j\fP value if this option is given.
  126. .TP
  127. .B \-D
  128. Check build dependencies and conflicts; abort if unsatisfied. This is the
  129. default behavior.
  130. .TP
  131. .B \-d
  132. Do not check build dependencies and conflicts.
  133. .TP
  134. .B \-nc
  135. Do not clean the source tree (implies \fB\-b\fP if nothing else has been
  136. selected among \fB\-B\fP, \fB\-A\fP or \fB\-S\fP).
  137. .TP
  138. .B \-tc
  139. Clean the source tree (using
  140. .I gain-root-command
  141. .BR "debian/rules clean" )
  142. after the package has been built.
  143. .TP
  144. .BI \-r gain-root-command
  145. When
  146. .B dpkg\-buildpackage
  147. needs to execute part of the build process as root, it prefixes the
  148. command it executes with
  149. .I gain-root-command
  150. if one has been specified. Otherwise, if none has been specified,
  151. \fBfakeroot\fP will be used by default, if the command is present.
  152. .I gain-root-command
  153. should start with the name of a program on the
  154. .B PATH
  155. and will get as arguments the name of the real command to run and the
  156. arguments it should take.
  157. .I gain-root-command
  158. can include parameters (they must be space-separated) but no shell
  159. metacharacters.
  160. .I gain-root-command
  161. might typically be
  162. .BR fakeroot ", " sudo ", " super " or " really .
  163. .B su
  164. is not suitable, since it can only invoke the user's shell with
  165. .B \-c
  166. instead of passing arguments individually to the command to be run.
  167. .TP
  168. .BI \-R rules-file
  169. Building a Debian package usually involves invoking
  170. .B debian/rules
  171. as a command with several standard parameters. With this option it's
  172. possible to use another program invocation to build the package (it can
  173. include space separated parameters).
  174. Alternatively it can be used to execute the standard rules file with
  175. another make program (for example by using
  176. .B /usr/local/bin/make \-f debian/rules
  177. as \fIrules-file\fR).
  178. .TP
  179. .BI \-p sign-command
  180. When \fBdpkg\-buildpackage\fP needs to execute GPG or PGP to sign a source
  181. control (\fB.dsc\fP) file or a \fB.changes\fP file it will run
  182. \fIsign-command\fP (searching the \fBPATH\fP if necessary) instead of
  183. \fBgpg\fP. \fIsign-command\fP will get all the arguments that
  184. \fBpgp\fP would have gotten. If \fIsign-command\fP
  185. takes its arguments in GPG rather than PGP style, you should give
  186. the \fB\-sgpg\fP option. \fIsign-command\fP
  187. should not contain spaces or any other shell metacharacters.
  188. .TP
  189. .BI \-k key-id
  190. Specify a key-ID to use when signing packages.
  191. .TP
  192. .BR \-us
  193. Do not sign the source package.
  194. .TP
  195. .BR \-uc
  196. Do not sign the \fB.changes\fP file.
  197. .P
  198. .BR \-i [\fIregexp\fP]
  199. .br
  200. .BI \-I [\fIpattern\fP]
  201. .br
  202. .BR \-s [ nsAkurKUR ]
  203. .br
  204. .BR \-z ", " \-Z
  205. .br
  206. .RS
  207. Passed unchanged to \fBdpkg\-source\fP. See its manual page.
  208. .RE
  209. .TP
  210. .BI \-\-source\-option= opt
  211. Pass option \fIopt\fP to \fBdpkg\-source\fP.
  212. .TP
  213. .BI \-\-changes\-option= opt
  214. Pass option \fIopt\fP to \fBdpkg\-genchanges\fP.
  215. .P
  216. .BI \-\-admindir= dir
  217. .br
  218. .BI "\-\-admindir " dir
  219. .RS
  220. Change the location of the \fBdpkg\fR database. The default location is
  221. \fI/var/lib/dpkg\fP.
  222. .RE
  223. .TP
  224. .BR \-h ", " \-\-help
  225. Show the usage message and exit.
  226. .TP
  227. .BR \-\-version
  228. Show the version and exit.
  229. .
  230. .SH ENVIRONMENT
  231. Even if \fBdpkg\-buildpackage\fP exports some variables, \fBdebian/rules\fP
  232. should not rely on their presence and should instead use the
  233. respective interface to retrieve the needed values.
  234. .SS Variables set by dpkg\-architecture
  235. \fBdpkg\-architecture\fP is called with the \fB\-a\fP and \fB\-t\fP
  236. parameters forwarded. Any variable that is output by its \fB\-s\fP
  237. option is integrated in the build environment.
  238. .SS Compiler flags are no longer exported
  239. Between versions 1.14.17 and 1.16.1, \fBdpkg\-buildpackage\fP
  240. exported compiler flags (\fBCFLAGS\fP, \fBCXXFLAGS\fP, \fBFFLAGS\fP,
  241. \fBCPPFLAGS\fP and \fBLDFLAGS\fP) with values as returned
  242. by \fBdpkg\-buildflags\fP. This is no longer the case.
  243. .
  244. .SH BUGS
  245. It should be possible to specify spaces and shell metacharacters in
  246. and initial arguments for
  247. .IR gain-root-command " and " sign-command .
  248. .
  249. .SH "SEE ALSO"
  250. .BR dpkg\-source (1),
  251. .BR dpkg\-architecture (1),
  252. .BR dpkg\-buildflags (1),
  253. .BR dpkg\-genchanges (1),
  254. .BR fakeroot (1),
  255. .BR gpg (1).
  256. .
  257. .SH AUTHORS
  258. Copyright \(co 1995-1996 Ian Jackson
  259. .br
  260. Copyright \(co 2000 Wichert Akkerman
  261. .br
  262. Copyright \(co 2007 Frank Lichtenheld
  263. .br
  264. Copyright \(co 2008-2010 Rapha\[:e]l Hertzog
  265. .sp
  266. This is free software; see the GNU General Public Licence version 2 or later
  267. for copying conditions. There is NO WARRANTY.