Penguin
Blame: dpkg-architecture(1)
EditPageHistoryDiffInfoLikePages
Annotated edit history of dpkg-architecture(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 DPKG-ARCHITECTURE
2 !!!DPKG-ARCHITECTURE
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 OVERVIEW
7 TERMS
8 EXAMPLES
9 VARIABLES
10 DEBIAN/RULES
11 BACKWARD COMPATIBILITY
12 SEE ALSO
13 CONTACT
14 ----
15 !!NAME
16
17
18 dpkg-architecture - set and determine the architecture for package building
19 !!SYNOPSIS
20
21
22 dpkg-architecture [[options] [[action]
23
24
25 Valid options: __-a__Debian-Architecture
26 __-t__Gnu-System-Type __-f__
27
28
29 Valid actions: __-l__, __-q__Variable-Name, __-s__,
30 __-u__, __-c__ Command
31 !!DESCRIPTION
32
33
34 dpkg-architecture does provide a facility to determine and
35 set the build and host architecture for package
36 building.
37 !!OVERVIEW
38
39
40 The build architecture is always determined by an external
41 call to dpkg, and can not be set at the command
42 line.
43
44
45 You can specify the host architecture by providing one or
46 both of the options __-a__ and __-t__. The default is
47 determined by an external call to gcc, or the same as the
48 build architecture if CC or gcc are both not
49 available. One out of __-a__ and __-t__ is sufficient,
50 the value of the other will be set to a usable default.
51 Indeed, it is often better to only specify one, because
52 dpkg-architecture will warn you if your choice doesn't match
53 the default.
54
55
56 The default action is __-l__, which prints the
57 environment variales, one each line, in the format
58 VARIABLE=value. If you are only interested in the value of a
59 single variable, you can use __-q__. If you specify
60 __-s__, it will output an export command. This can be
61 used to set the environment variables using eval. __-u__
62 does return a similar command to unset all variables.
63 __-c__ does execute a command in an environment which has
64 all variables set to the determined value.
65
66
67 Existing environment variables with the same name as used by
68 the scripts are not overwritten, except if the __-f__
69 force flag is present. This allows the user to override a
70 value even when the call to dpkg-architecture is buried in
71 some other script (for example
72 dpkg-buildpackage).
73 !!TERMS
74
75
76 build machine
77
78
79 The machine the package is build on.
80
81
82 host machine
83
84
85 The machine the package is build for.
86
87
88 Debian Architecture
89
90
91 The Debian archietcture string, which specifies the binary
92 tree in the FTP archive. Examples: i386,
93 sparc, hurd-i386.
94
95
96 GNU System Type
97
98
99 An architecture specification string consisting of two or
100 three parts, cpu-system or cpu-vendor-system. Examples:
101 i386-linux, sparc-linux, i386-gnu.
102 !!EXAMPLES
103
104
105 dpkg-buildpackage accepts the __-a__ option and passes it
106 to dpkg-architecture. Other examples:
107
108
109 CC=i386-gnu-gcc dpkg-architecture -c debian/rules
110 build
111
112
113 eval `dpkg-architecture -u`
114 !!VARIABLES
115
116
117 The following variables are set by
118 dpkg-architecture:
119
120
121 DEB_BUILD_ARCH
122
123
124 The Debian architecture of the build machine.
125
126
127 DEB_BUILD_GNU_TYPE
128
129
130 The GNU system type of the build
131 machine.
132
133
134 DEB_BUILD_GNU_CPU
135
136
137 The CPU part of
138 DEB_BUILD_GNU_TYPE
139
140
141 DEB_BUILD_GNU_SYSTEM
142
143
144 The System part of
145 DEB_BUILD_GNU_TYPE
146
147
148 DEB_HOST_ARCH
149
150
151 The Debian architecture of the host machine.
152
153
154 DEB_HOST_GNU_TYPE
155
156
157 The GNU system type of the host
158 machine.
159
160
161 DEB_HOST_GNU_CPU
162
163
164 The CPU part of
165 DEB_HOST_GNU_TYPE
166
167
168 DEB_HOST_GNU_SYSTEM
169
170
171 The System part of
172 DEB_HOST_GNU_TYPE
173 !!DEBIAN/RULES
174
175
176 The environment variables set by dpkg-architecture are
177 passed to debian/rules as make variables (see make
178 documentation). You can and should use them in the build
179 process as needed. Here are some examples, which also show
180 how you can improve the cross compilation support in your
181 package:
182
183
184 Instead:
185
186
187 ARCH=`dpkg --print-architecture` configure $(
188 ARCH )-linux
189
190
191 please use the following:
192
193
194 B_ARCH=$( DEB_BUILD_GNU_TYPE ) H_ARCH=$(
195 DEB_HOST_GNU_TYPE ) configure
196 --build=$(B_ARCH) --host=$(H_ARCH)
197
198
199 Instead:
200
201
202 ARCH=`dpkg --print-architecture` ifeq ($(
203 ARCH ),alpha) ... endif
204
205
206 please use:
207
208
209 ARCH=$( DEB_HOST_ARCH ) ifeq ($(
210 ARCH ),alpha) ... endif
211
212
213 In general, calling dpkg in the rules file to get
214 architecture information is deprecated (until you want to
215 provide backward compatibility, see below). Especially the
216 --print-architecture option is unreliable since we have
217 Debian architectures which don't equal a processor
218 name.
219 !!BACKWARD COMPATIBILITY
220
221
222 When providing a new facility, it is always a good idea to
223 stay compatible with old versions of the programs. Note that
224 dpkg-architecture does not affect old debian/rules files, so
225 the only thing to consider is using old building scripts
226 with new debian/rules files. The following does the
227 job:
228
229
230 DEB_BUILD_ARCH := $(shell dpkg
231 --print-installation-architecture)
232 DEB_BUILD_GNU_CPU := $(patsubst hurd-%,%,$(
233 DEB_BUILD_ARCH )) ifeq ($(filter-out
234 hurd-%,$( DEB_BUILD_ARCH )),)
235 DEB_BUILD_GNU_SYSTEM := gnu else
236 DEB_BUILD_GNU_SYSTEM := linux endif
237 DEB_BUILD_GNU_TYPE=$( DEB_BUILD_GNU_CPU )-$(
238 DEB_BUILD_GNU_SYSTEM )
239
240
241 DEB_HOST_ARCH=$( DEB_BUILD_ARCH )
242 DEB_HOST_GNU_CPU=$( DEB_BUILD_GNU_CPU )
243 DEB_HOST_GNU_SYSTEM=$( DEB_BUILD_GNU_SYSTEM )
244 DEB_HOST_GNU_TYPE=$( DEB_BUILD_GNU_TYPE
245 )
246
247
248 Put a subset of these lines at the top of your debian/rules
249 file; these default values will be overwritten if
250 dpkg-architecture is used.
251
252
253 You don't need the full set. Choose a consistent set which
254 contains the values you use in the rules file. For example,
255 if you only need the host Debian architecture,
256 `DEB_HOST_ARCH=`dpkg --print-installation-architecture` is
257 sufficient (this is indeed the Debian architecture of the
258 build machine, but remember that we are only trying to be
259 backward compatible with native compilation).
260
261
262 You may not want to care about old build packages (for
263 example, if you have sufficient source dependencies declared
264 anyway). But you should at least support the traditional way
265 to build packages by calling `debian/rules build' directly,
266 without setting environment variables. To do this, use the
267 __-q__ option to query suitable default
268 values:
269
270
271 DEB_BUILD_ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
272 DEB_BUILD_GNU=`dpkg-architecture
273 -qDEB_BUILD_GNU`
274
275
276 etc. You get the idea. This way, you can ensure that the
277 variables are never undeclared. Note that this breaks
278 backwards compatibility with old build scripts, and you
279 should only do that if source dependencies are implemented
280 and declared accordingly.
281 !!SEE ALSO
282
283
284 dpkg-buildpackage dpkg-cross
285 !!CONTACT
286
287
288 If you have questions about the usage of the make variables
289 in your rules files, or about cross compilation support in
290 your packages, please email me. The address is Marcus
291 Brinkmann
292 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.