dpkg-buildpackage.1 8.1 KB

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