dpkg-architecture.1 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. .rn '' }`
  2. ''' $RCSfile: dpkg-architecture.1,v $$Revision: 1.4 $$Date: 1999/09/27 01:37:25 $
  3. '''
  4. ''' $Log: dpkg-architecture.1,v $
  5. ''' Revision 1.4 1999/09/27 01:37:25 wakkerma
  6. ''' Updated to dpkg 1.4.1.11
  7. '''
  8. '''
  9. .de Sh
  10. .br
  11. .if t .Sp
  12. .ne 5
  13. .PP
  14. \fB\\$1\fR
  15. .PP
  16. ..
  17. .de Sp
  18. .if t .sp .5v
  19. .if n .sp
  20. ..
  21. .de Ip
  22. .br
  23. .ie \\n(.$>=3 .ne \\$3
  24. .el .ne 3
  25. .IP "\\$1" \\$2
  26. ..
  27. .de Vb
  28. .ft CW
  29. .nf
  30. .ne \\$1
  31. ..
  32. .de Ve
  33. .ft R
  34. .fi
  35. ..
  36. '''
  37. '''
  38. ''' Set up \*(-- to give an unbreakable dash;
  39. ''' string Tr holds user defined translation string.
  40. ''' Bell System Logo is used as a dummy character.
  41. '''
  42. .tr \(*W-|\(bv\*(Tr
  43. .ie n \{\
  44. .ds -- \(*W-
  45. .ds PI pi
  46. .if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  47. .if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  48. .ds L" ""
  49. .ds R" ""
  50. ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of
  51. ''' \*(L" and \*(R", except that they are used on ".xx" lines,
  52. ''' such as .IP and .SH, which do another additional levels of
  53. ''' double-quote interpretation
  54. .ds M" """
  55. .ds S" """
  56. .ds N" """""
  57. .ds T" """""
  58. .ds L' '
  59. .ds R' '
  60. .ds M' '
  61. .ds S' '
  62. .ds N' '
  63. .ds T' '
  64. 'br\}
  65. .el\{\
  66. .ds -- \(em\|
  67. .tr \*(Tr
  68. .ds L" ``
  69. .ds R" ''
  70. .ds M" ``
  71. .ds S" ''
  72. .ds N" ``
  73. .ds T" ''
  74. .ds L' `
  75. .ds R' '
  76. .ds M' `
  77. .ds S' '
  78. .ds N' `
  79. .ds T' '
  80. .ds PI \(*p
  81. 'br\}
  82. .\" If the F register is turned on, we'll generate
  83. .\" index entries out stderr for the following things:
  84. .\" TH Title
  85. .\" SH Header
  86. .\" Sh Subsection
  87. .\" Ip Item
  88. .\" X<> Xref (embedded
  89. .\" Of course, you have to process the output yourself
  90. .\" in some meaninful fashion.
  91. .if \nF \{
  92. .de IX
  93. .tm Index:\\$1\t\\n%\t"\\$2"
  94. ..
  95. .nr % 0
  96. .rr F
  97. .\}
  98. .TH DPKG-ARCHITECTURE 1 "perl 5.004, patch 04" "24/Jul/99" "User Contributed Perl Documentation"
  99. .UC
  100. .if n .hy 0
  101. .if n .na
  102. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  103. .de CQ \" put $1 in typewriter font
  104. .ft CW
  105. 'if n "\c
  106. 'if t \\&\\$1\c
  107. 'if n \\&\\$1\c
  108. 'if n \&"
  109. \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
  110. '.ft R
  111. ..
  112. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
  113. . \" AM - accent mark definitions
  114. .bd B 3
  115. . \" fudge factors for nroff and troff
  116. .if n \{\
  117. . ds #H 0
  118. . ds #V .8m
  119. . ds #F .3m
  120. . ds #[ \f1
  121. . ds #] \fP
  122. .\}
  123. .if t \{\
  124. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  125. . ds #V .6m
  126. . ds #F 0
  127. . ds #[ \&
  128. . ds #] \&
  129. .\}
  130. . \" simple accents for nroff and troff
  131. .if n \{\
  132. . ds ' \&
  133. . ds ` \&
  134. . ds ^ \&
  135. . ds , \&
  136. . ds ~ ~
  137. . ds ? ?
  138. . ds ! !
  139. . ds /
  140. . ds q
  141. .\}
  142. .if t \{\
  143. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  144. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  145. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  146. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  147. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  148. . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
  149. . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
  150. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  151. . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
  152. .\}
  153. . \" troff and (daisy-wheel) nroff accents
  154. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  155. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  156. .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
  157. .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
  158. .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
  159. .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
  160. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  161. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  162. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  163. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  164. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  165. .ds ae a\h'-(\w'a'u*4/10)'e
  166. .ds Ae A\h'-(\w'A'u*4/10)'E
  167. .ds oe o\h'-(\w'o'u*4/10)'e
  168. .ds Oe O\h'-(\w'O'u*4/10)'E
  169. . \" corrections for vroff
  170. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  171. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  172. . \" for low resolution devices (crt and lpr)
  173. .if \n(.H>23 .if \n(.V>19 \
  174. \{\
  175. . ds : e
  176. . ds 8 ss
  177. . ds v \h'-1'\o'\(aa\(ga'
  178. . ds _ \h'-1'^
  179. . ds . \h'-1'.
  180. . ds 3 3
  181. . ds o a
  182. . ds d- d\h'-1'\(ga
  183. . ds D- D\h'-1'\(hy
  184. . ds th \o'bp'
  185. . ds Th \o'LP'
  186. . ds ae ae
  187. . ds Ae AE
  188. . ds oe oe
  189. . ds Oe OE
  190. .\}
  191. .rm #[ #] #H #V #F C
  192. .SH "NAME"
  193. dpkg-architecture \- set and determine the architecture for package building
  194. .SH "SYNOPSIS"
  195. dpkg-architecture [options] [action]
  196. .PP
  197. Valid options:
  198. \fB\-a\fRDebian-Architecture
  199. \fB\-t\fRGnu-System-Type
  200. \fB\-f\fR
  201. .PP
  202. Valid actions:
  203. \fB\-l\fR, \fB\-q\fRVariable-Name, \fB\-s\fR, \fB\-u\fR, \fB\-c\fR Command
  204. .SH "DESCRIPTION"
  205. dpkg-architecture does provide a facility to determine and set the build and
  206. host architecture for package building.
  207. .SH "OVERVIEW"
  208. The build architecture is always determined by an external call to dpkg, and
  209. can not be set at the command line.
  210. .PP
  211. You can specify the host architecture by providing one or both of the options \fB\-a\fR
  212. and \fB\-t\fR. The default is determined by an external call to gcc, or the same as
  213. the build architecture if CC or gcc are both not available. One out of \fB\-a\fR and \fB\-t\fR
  214. is sufficient, the value of the other will be set to a usable default.
  215. Indeed, it is often better to only specify one, because dpkg-architecture
  216. will warn you if your choice doesn't match the default.
  217. .PP
  218. The default action is \fB\-l\fR, which prints the environment variales, one each line,
  219. in the format VARIABLE=value. If you are only interested in the value of a
  220. single variable, you can use \fB\-q\fR. If you specify \fB\-s\fR, it will output an export
  221. command. This can be used to set the environment variables using eval. \fB\-u\fR
  222. does return a similar command to unset all variables. \fB\-c\fR does execute a
  223. command in an environment which has all variables set to the determined
  224. value.
  225. .PP
  226. Existing environment variables with the same name as used by the scripts are
  227. not overwritten, except if the \fB\-f\fR force flag is present. This allows the user
  228. to override a value even when the call to dpkg-architecture is buried in
  229. some other script (for example dpkg-buildpackage). The \fB\-q\fR query option
  230. implies \fB\-f\fR, and is therefore not affected by existing environment settings.
  231. .SH "TERMS"
  232. .Ip "build machine" 4
  233. The machine the package is build on.
  234. .Ip "host machine" 4
  235. The machine the package is build for.
  236. .Ip "Debian Architecture" 4
  237. The Debian archietcture string, which specifies the binary tree in the \s-1FTP\s0
  238. archive. Examples: i386, sparc, hurd-i386.
  239. .Ip "\s-1GNU\s0 System Type" 4
  240. An architecture specification string consisting of two or three parts,
  241. cpu-system or cpu-vendor-system. Examples: i386-linux, sparc-linux, i386-gnu.
  242. .SH "EXAMPLES"
  243. dpkg-buildpackage accepts the \fB\-a\fR option and passes it to dpkg-architecture.
  244. Other examples:
  245. .PP
  246. CC=i386-gnu-gcc dpkg-architecture \f(CW-c\fR debian/rules build
  247. .PP
  248. eval `dpkg-architecture \f(CW-u\fR`
  249. .SH "VARIABLES"
  250. The following variables are set by dpkg-architecture:
  251. .Ip "\s-1DEB_BUILD_ARCH\s0" 4
  252. The Debian architecture of the build machine.
  253. .Ip "\s-1DEB_BUILD_GNU_TYPE\s0" 4
  254. The \s-1GNU\s0 system type of the build machine.
  255. .Ip "\s-1DEB_BUILD_GNU_CPU\s0" 4
  256. The \s-1CPU\s0 part of \s-1DEB_BUILD_GNU_TYPE\s0
  257. .Ip "\s-1DEB_BUILD_GNU_SYSTEM\s0" 4
  258. The System part of \s-1DEB_BUILD_GNU_TYPE\s0
  259. .Ip "\s-1DEB_HOST_ARCH\s0" 4
  260. The Debian architecture of the host machine.
  261. .Ip "\s-1DEB_HOST_GNU_TYPE\s0" 4
  262. The \s-1GNU\s0 system type of the host machine.
  263. .Ip "\s-1DEB_HOST_GNU_CPU\s0" 4
  264. The \s-1CPU\s0 part of \s-1DEB_HOST_GNU_TYPE\s0
  265. .Ip "\s-1DEB_HOST_GNU_SYSTEM\s0" 4
  266. The System part of \s-1DEB_HOST_GNU_TYPE\s0
  267. .SH "DEBIAN/RULES"
  268. The environment variables set by dpkg-architecture are passed to
  269. debian/rules as make variables (see make documentation). You can and should
  270. use them in the build process as needed. Here are some examples, which also
  271. show how you can improve the cross compilation support in your package:
  272. .PP
  273. Instead:
  274. .PP
  275. ARCH=`dpkg --print-architecture`
  276. configure $(ARCH)\-linux
  277. .PP
  278. please use the following:
  279. .PP
  280. B_ARCH=$(DEB_BUILD_GNU_TYPE)
  281. H_ARCH=$(DEB_HOST_GNU_TYPE)
  282. configure --build=$(B_ARCH) --host=$(H_ARCH)
  283. .PP
  284. Instead:
  285. .PP
  286. ARCH=`dpkg --print-architecture`
  287. ifeq ($(ARCH),alpha)
  288. ...
  289. endif
  290. .PP
  291. please use:
  292. .PP
  293. ARCH=$(DEB_HOST_ARCH)
  294. ifeq ($(ARCH),alpha)
  295. ...
  296. endif
  297. .PP
  298. In general, calling dpkg in the rules file to get architecture information
  299. is deprecated (until you want to provide backward compatibility, see below).
  300. Especially the --print-architecture option is unreliable since we have
  301. Debian architectures which don't equal a processor name.
  302. .SH "BACKWARD COMPATIBILITY"
  303. When providing a new facility, it is always a good idea to stay compatible with old
  304. versions of the programs. Note that dpkg-architecture does not affect old
  305. debian/rules files, so the only thing to consider is using old building
  306. scripts with new debian/rules files. The following does the job:
  307. .PP
  308. DEB_BUILD_ARCH := $(shell dpkg --print-installation-architecture)
  309. DEB_BUILD_GNU_CPU := $(patsubst hurd-%,%,$(DEB_BUILD_ARCH))
  310. ifeq ($(filter-out hurd-%,$(DEB_BUILD_ARCH)),)
  311. DEB_BUILD_GNU_SYSTEM := gnu
  312. else
  313. DEB_BUILD_GNU_SYSTEM := linux
  314. endif
  315. DEB_BUILD_GNU_TYPE=$(DEB_BUILD_GNU_CPU)\-$(DEB_BUILD_GNU_SYSTEM)
  316. .PP
  317. DEB_HOST_ARCH=$(DEB_BUILD_ARCH)
  318. DEB_HOST_GNU_CPU=$(DEB_BUILD_GNU_CPU)
  319. DEB_HOST_GNU_SYSTEM=$(DEB_BUILD_GNU_SYSTEM)
  320. DEB_HOST_GNU_TYPE=$(DEB_BUILD_GNU_TYPE)
  321. .PP
  322. Put a subset of these lines at the top of your debian/rules file; these
  323. default values will be overwritten if dpkg-architecture is used.
  324. .PP
  325. You don't need the full set. Choose a consistent set which contains the
  326. values you use in the rules file. For example, if you only need the host
  327. Debian architecture, `DEB_HOST_ARCH=`dpkg --print-installation-architecture`
  328. is sufficient (this is indeed the Debian architecture of the build machine,
  329. but remember that we are only trying to be backward compatible with native
  330. compilation).
  331. .PP
  332. You may not want to care about old build packages (for example, if you have
  333. sufficient source dependencies declared anyway). But you should at least
  334. support the traditional way to build packages by calling `debian/rules
  335. build\*(R' directly, without setting environment variables. To do this, use the
  336. \fB\-q\fR option to query suitable default values:
  337. .PP
  338. DEB_BUILD_ARCH=`dpkg-architecture \-qDEB_BUILD_ARCH`
  339. DEB_BUILD_GNU=`dpkg-architecture \-qDEB_BUILD_GNU`
  340. .PP
  341. etc. You get the idea. This way, you can ensure that the variables are never
  342. undeclared. Note that this breaks backwards compatibility with old build
  343. scripts, and you should only do that if source dependencies are implemented
  344. and declared accordingly.
  345. .SH "SEE ALSO"
  346. dpkg-buildpackage
  347. dpkg-cross
  348. .SH "CONTACT"
  349. If you have questions about the usage of the make variables in your rules
  350. files, or about cross compilation support in your packages, please email me.
  351. The addresse is Marcus Brinkmann <brinkmd@debian.org>.
  352. .rn }` ''
  353. .IX Title "DPKG-ARCHITECTURE 1"
  354. .IX Name "dpkg-architecture - set and determine the architecture for package building"
  355. .IX Header "NAME"
  356. .IX Header "SYNOPSIS"
  357. .IX Header "DESCRIPTION"
  358. .IX Header "OVERVIEW"
  359. .IX Header "TERMS"
  360. .IX Item "build machine"
  361. .IX Item "host machine"
  362. .IX Item "Debian Architecture"
  363. .IX Item "\s-1GNU\s0 System Type"
  364. .IX Header "EXAMPLES"
  365. .IX Header "VARIABLES"
  366. .IX Item "\s-1DEB_BUILD_ARCH\s0"
  367. .IX Item "\s-1DEB_BUILD_GNU_TYPE\s0"
  368. .IX Item "\s-1DEB_BUILD_GNU_CPU\s0"
  369. .IX Item "\s-1DEB_BUILD_GNU_SYSTEM\s0"
  370. .IX Item "\s-1DEB_HOST_ARCH\s0"
  371. .IX Item "\s-1DEB_HOST_GNU_TYPE\s0"
  372. .IX Item "\s-1DEB_HOST_GNU_CPU\s0"
  373. .IX Item "\s-1DEB_HOST_GNU_SYSTEM\s0"
  374. .IX Header "DEBIAN/RULES"
  375. .IX Header "BACKWARD COMPATIBILITY"
  376. .IX Header "SEE ALSO"
  377. .IX Header "CONTACT"