dpkg-buildpackage.1 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. .TH dpkg\-buildpackage 1 "2009-06-13" "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. If a specific target has been selected with the \fB-T\fP or \fB--target\fP
  21. option, it calls that target and stops here. Otherwise it calls
  22. \fBfakeroot debian/rules clean\fP to clean the build-tree (unless
  23. \fB\-nc\fP is specified).
  24. .IP \fB4.\fP 3
  25. It calls \fBdpkg-source\fP to generate the source package (unless
  26. a binary-only build has been requested with \fB\-b\fP, \fB\-B\fP or
  27. \fB\-A\fP).
  28. .IP \fB5.\fP 3
  29. It calls \fBdebian/rules\fP \fBbuild\fP followed by
  30. \fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
  31. build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
  32. either \fBbinary\fP (default case, or if \fB\-b\fP is specified)
  33. or \fBbinary-arch\fP (if \fB\-B\fP is specified) or \fBbinary-indep\fP
  34. (if \fB\-A\fP is specified).
  35. .IP \fB6.\fP 3
  36. It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
  37. \fB\-us\fP is specified).
  38. .IP \fB7.\fP 3
  39. It calls \fBdpkg-genchanges\fP to generate a \fB.changes\fP file.
  40. Many \fBdpkg-buildpackage\fP options are forwarded to
  41. \fBdpkg-genchanges\fP.
  42. .IP \fB8.\fP 3
  43. It calls \fBgpg\fP to sign the \fB.changes\fP file (unless \fB\-uc\fP
  44. is specified).
  45. .IP \fB9.\fP 3
  46. If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
  47. again.
  48. .
  49. .SH OPTIONS
  50. .TP
  51. .B \-b
  52. Specifies a binary-only build, no source files are to be built and/or
  53. distributed. Passed to \fBdpkg-genchanges\fP.
  54. .TP
  55. .B \-B
  56. Specifies a binary-only build, limited to architecture dependent packages.
  57. Passed to \fBdpkg-genchanges\fP.
  58. .TP
  59. .B \-A
  60. Specifies a binary-only build, limited to architecture independent
  61. packages. Passed to \fBdpkg-genchanges\fP.
  62. .TP
  63. .B \-S
  64. Specifies a source-only build, no binary packages need to be made.
  65. Passed to \fBdpkg-genchanges\fP.
  66. .P
  67. .BI \-\-target= target
  68. .br
  69. .BI "\-\-target " target
  70. .br
  71. .BI \-T target
  72. .RS
  73. Calls \fBdebian/rules\fP \fItarget\fP after having setup the build
  74. environment and stops the package build process here. If
  75. \fB\-\-as\-root\fP is also given, then the command is executed
  76. as root (see \fB\-r\fP). Note that official targets that are required to
  77. be run as root by the Debian policy do not need this option.
  78. .RE
  79. .TP
  80. .B \-\-as\-root
  81. Only meaningful together with \fB\-\-target\fP. Requires that the target be
  82. run with root rights.
  83. .P
  84. .B \-si
  85. .br
  86. .B \-sa
  87. .br
  88. .B \-sd
  89. .br
  90. .BI \-v version
  91. .br
  92. .BI \-C changesdescription
  93. .br
  94. .BI \-m maintaineraddress
  95. .br
  96. .BI \-e maintaineraddress
  97. .RS
  98. Passed unchanged to \fBdpkg-genchanges\fP. See its manual page.
  99. .RE
  100. .TP
  101. .BI \-a architecture
  102. Specify the Debian architecture we build for. The architecture of the
  103. machine we build on is determined automatically, and is also the default
  104. for the host machine.
  105. If the host architecture differs from the build architecture (as is the
  106. case for a cross-compilation), and if the environment variable
  107. \fBPKG_CONFIG_LIBDIR\fP is not set, then it is set to a value suitable for
  108. cross-compilation
  109. ("/usr/\fIgnu-system-type\fP/lib/pkgconfig/:/usr/share/pkgconfig").
  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. .P
  210. .BI \-\-admindir= dir
  211. .br
  212. .BI "\-\-admindir " dir
  213. .RS
  214. Change the location of the \fBdpkg\fR database. The default location is
  215. \fI/var/lib/dpkg\fP.
  216. .RE
  217. .TP
  218. .BR \-h ", " \-\-help
  219. Show the usage message and exit.
  220. .TP
  221. .BR \-\-version
  222. Show the version and exit.
  223. .
  224. .SH ENVIRONMENT VARIABLES
  225. .SS Variables set by dpkg-architecture
  226. \fBdpkg\-architecture\fP is called with the \fB\-a\fP and \fB\-t\fP
  227. parameters forwarded. Any variable that is output by its \fB\-s\fP
  228. option is integrated in the build environment.
  229. .SS Compiler flags
  230. Some environment variables defining compiler and linker options are
  231. set to default values unless already present in the environment. Note that
  232. this mechanism was only introduced in version 1.14.17 of dpkg-dev and
  233. not all \fIrules\fP files and build tools will honour these variables,
  234. yet.
  235. .TP
  236. .B CFLAGS
  237. Optimization options which are passed to the Debian build system and
  238. can/should be overriden by the package build if needed (default value:
  239. .BR "\-g \-O2" ,
  240. or
  241. .BR \-g\ \-O0
  242. if
  243. .BR noopt
  244. is specified in DEB_BUILD_OPTIONS). Overriding options can be
  245. used to explicitely set a
  246. higher optimization level, or work around compiler bugs, which only
  247. can be seen with some optimization levels (the last opt level "wins").
  248. .TP
  249. .B CFLAGS_APPEND
  250. Optimization options appended to the compiler flags, which must not be
  251. overwritten by the package (mostly used to for test builds). Default
  252. value: empty.
  253. .TP
  254. .B CXXFLAGS
  255. Same as
  256. .B CFLAGS
  257. for C++ sources.
  258. .TP
  259. .B CXXFLAGS_APPEND
  260. Same as
  261. .B CFLAGS_APPEND
  262. for C++ sources.
  263. .TP
  264. .B FFLAGS
  265. Same as
  266. .B CFLAGS
  267. for Fortran sources.
  268. .TP
  269. .B FFLAGS_APPEND
  270. Same as
  271. .B CFLAGS_APPEND
  272. for Fortran sources.
  273. .TP
  274. .B CPPFLAGS
  275. Preprocessor flags which are passed to the Debian build system and
  276. can/should be overriden by the package build if needed (default:
  277. empty). This macro is seldom used (most build systems just use
  278. .B CFLAGS
  279. instead of
  280. .BR CPPFLAGS ).
  281. .TP
  282. .B CPPFLAGS_APPEND
  283. Preprocessor flags appended to the preprocessor flags, which must not
  284. be overwritten by the package (mostly used to for test
  285. builds). Default value: empty.
  286. .TP
  287. .B LDFLAGS
  288. Options passed to the compiler when linking executables or shared
  289. objects (if the linker is called directly, then
  290. .B -Wl
  291. and
  292. .B ,
  293. have to be stripped from these options). Default value: empty.
  294. .TP
  295. .B LDFLAGS_APPEND
  296. Optimization options appended to the compiler flags when linking code,
  297. which must not be overwritten by the package (mostly used to for test
  298. builds). Default value: empty.
  299. .
  300. .SH BUGS
  301. It should be possible to specify spaces and shell metacharacters in
  302. and initial arguments for
  303. .IR gain-root-command " and " sign-command .
  304. .
  305. .SH "SEE ALSO"
  306. .BR dpkg\-source (1),
  307. .BR dpkg\-architecture (1),
  308. .BR dpkg\-genchanges (1),
  309. .BR fakeroot (1),
  310. .BR gpg (1).
  311. .
  312. .SH AUTHORS
  313. Copyright \(co 1995-1996 Ian Jackson
  314. .br
  315. Copyright \(co 2000 Wichert Akkerman
  316. .br
  317. Copyright \(co 2007 Frank Lichtenheld
  318. .br
  319. Copyright \(co 2008 Rapha\[:e]l Hertzog
  320. .sp
  321. This is free software; see the GNU General Public Licence version 2 or later
  322. for copying conditions. There is NO WARRANTY.