106
108
The machine the package is built for.
107
109
.IP "Debian architecture" 4
108
110
The Debian architecture string, which specifies the binary tree in the
109
\s-1FTP\s0 archive. Examples: i386, sparc, hurd\-i386.
111
FTP archive. Examples: i386, sparc, hurd\-i386.
110
112
.IP "architecture wildcard" 4
111
113
An architecture wildcard is a special architecture string that will match
112
114
any real architecture being part of it. The general form is <kernel>\-<cpu>.
113
115
Examples: linux\-any, any\-i386, hurd\-any.
114
.IP "\s-1GNU\s0 system type" 4
116
.IP "GNU system type" 4
115
117
An architecture specification string consisting of two parts separated by
116
118
a dash: cpu and system. Examples: i386\-linux\-gnu, sparc\-linux\-gnu,
117
119
i386\-gnu, x86_64\-netbsd.
120
122
The following variables are set by \fBdpkg\-architecture\fP:
121
.IP "\s-1DEB_BUILD_ARCH\s0" 4
123
.IP "\fBDEB_BUILD_ARCH\fP" 4
122
124
The Debian architecture of the build machine.
123
.IP "\s-1DEB_BUILD_ARCH_OS\s0" 4
124
The Debian system name of the build machine.
125
.IP "\s-1DEB_BUILD_ARCH_CPU\s0" 4
126
The Debian cpu name of the build machine.
127
.IP "\s-1DEB_BUILD_ARCH_BITS\s0" 4
128
The pointer size of the build machine (in bits).
129
.IP "\s-1DEB_BUILD_ARCH_ENDIAN\s0" 4
130
The endianness of the build machine (little / big).
131
.IP "\s-1DEB_BUILD_GNU_CPU\s0" 4
132
The \s-1CPU\s0 part of \s-1DEB_BUILD_GNU_TYPE\s0.
133
.IP "\s-1DEB_BUILD_GNU_SYSTEM\s0" 4
134
The System part of \s-1DEB_BUILD_GNU_TYPE\s0.
135
.IP "\s-1DEB_BUILD_GNU_TYPE\s0" 4
136
The \s-1GNU\s0 system type of the build machine.
137
.IP "\s-1DEB_BUILD_MULTIARCH\s0" 4
138
The clarified \s-1GNU\s0 system type of the build machine, used for filesystem
140
.IP "\s-1DEB_HOST_ARCH\s0" 4
125
.IP "\fBDEB_BUILD_ARCH_OS\fP" 4
126
The Debian system name of the build machine (since dpkg 1.13.2).
127
.IP "\fBDEB_BUILD_ARCH_CPU\fP" 4
128
The Debian cpu name of the build machine (since dpkg 1.13.2).
129
.IP "\fBDEB_BUILD_ARCH_BITS\fP" 4
130
The pointer size of the build machine (in bits; since dpkg 1.15.4).
131
.IP "\fBDEB_BUILD_ARCH_ENDIAN\fP" 4
132
The endianness of the build machine (little / big; since dpkg 1.15.4).
133
.IP "\fBDEB_BUILD_GNU_CPU\fP" 4
134
The CPU part of \fBDEB_BUILD_GNU_TYPE\fP.
135
.IP "\fBDEB_BUILD_GNU_SYSTEM\fP" 4
136
The System part of \fBDEB_BUILD_GNU_TYPE\fP.
137
.IP "\fBDEB_BUILD_GNU_TYPE\fP" 4
138
The GNU system type of the build machine.
139
.IP "\fBDEB_BUILD_MULTIARCH\fP" 4
140
The clarified GNU system type of the build machine, used for filesystem
141
paths (since dpkg 1.16.0).
142
.IP "\fBDEB_HOST_ARCH\fP" 4
141
143
The Debian architecture of the host machine.
142
.IP "\s-1DEB_HOST_ARCH_OS\s0" 4
143
The Debian system name of the host machine.
144
.IP "\s-1DEB_HOST_ARCH_CPU\s0" 4
145
The Debian cpu name of the host machine.
146
.IP "\s-1DEB_HOST_ARCH_BITS\s0" 4
147
The pointer size of the host machine (in bits).
148
.IP "\s-1DEB_HOST_ARCH_ENDIAN\s0" 4
149
The endianness of the host machine (little / big).
150
.IP "\s-1DEB_HOST_GNU_CPU\s0" 4
151
The \s-1CPU\s0 part of \s-1DEB_HOST_GNU_TYPE\s0.
152
.IP "\s-1DEB_HOST_GNU_SYSTEM\s0" 4
153
The System part of \s-1DEB_HOST_GNU_TYPE\s0.
154
.IP "\s-1DEB_HOST_GNU_TYPE\s0" 4
155
The \s-1GNU\s0 system type of the host machine.
156
.IP "\s-1DEB_HOST_MULTIARCH\s0" 4
157
The clarified \s-1GNU\s0 system type of the host machine, used for filesystem
144
.IP "\fBDEB_HOST_ARCH_OS\fP" 4
145
The Debian system name of the host machine (since dpkg 1.13.2).
146
.IP "\fBDEB_HOST_ARCH_CPU\fP" 4
147
The Debian cpu name of the host machine (since dpkg 1.13.2).
148
.IP "\fBDEB_HOST_ARCH_BITS\fP" 4
149
The pointer size of the host machine (in bits; since dpkg 1.15.4).
150
.IP "\fBDEB_HOST_ARCH_ENDIAN\fP" 4
151
The endianness of the host machine (little / big; since dpkg 1.15.4).
152
.IP "\fBDEB_HOST_GNU_CPU\fP" 4
153
The CPU part of \fBDEB_HOST_GNU_TYPE\fP.
154
.IP "\fBDEB_HOST_GNU_SYSTEM\fP" 4
155
The System part of \fBDEB_HOST_GNU_TYPE\fP.
156
.IP "\fBDEB_HOST_GNU_TYPE\fP" 4
157
The GNU system type of the host machine.
158
.IP "\fBDEB_HOST_MULTIARCH\fP" 4
159
The clarified GNU system type of the host machine, used for filesystem
160
paths (since dpkg 1.16.0).
163
.SS Architecture tables
164
All these files have to be present for \fBdpkg\-architecture\fP to
165
work. Their location can be overridden at runtime with the environment
166
variable \fBDPKG_DATADIR\fP.
168
.I /usr/share/dpkg/cputable
169
Table of known CPU names and mapping to their GNU name.
171
.I /usr/share/dpkg/ostable
172
Table of known operating system names and mapping to their GNU name.
174
.I /usr/share/dpkg/triplettable
175
Mapping between Debian architecture triplets and Debian architecture
177
.SS Packaging support
179
.I /usr/share/dpkg/architecture.mk
180
Makefile snippet that properly sets and exports all the variables that
181
\fBdpkg\-architecture\fP outputs (since dpkg 1.16.1).
184
\fBdpkg\-buildpackage\fP accepts the \fB\-a\fR option and passes it to
185
\fBdpkg\-architecture\fP. Other examples:
187
CC=i386\-gnu\-gcc dpkg\-architecture \-c debian/rules build
189
eval \`dpkg\-architecture \-u\`
191
Check if an architecture is equal to the current architecture or a given
194
dpkg\-architecture \-elinux\-alpha
196
dpkg\-architecture \-amips \-elinux\-mips
198
Check if the current architecture or an architecture provided with \fB\-a\fP
201
dpkg\-architecture \-ilinux\-any
203
dpkg\-architecture \-ai386 \-ilinux\-any
205
.SS Usage in debian/rules
161
206
The environment variables set by \fBdpkg\-architecture\fP are passed to
162
207
\fIdebian/rules\fP as make variables (see make documentation). However,
163
208
you should not rely on them, as this breaks manual invocation of the
164
209
script. Instead, you should always initialize them using
165
\fBdpkg\-architecture\fP with the \-q option. Here are some examples,
210
\fBdpkg\-architecture\fP with the \fB\-q\fP option. Here are some examples,
166
211
which also show how you can improve the cross compilation support in your
170
214
Retrieving the GNU system type and forwarding it to ./configure:
173
\&\s-1DEB_BUILD_GNU_TYPE\s0 := $(shell dpkg\-architecture \-qDEB_BUILD_GNU_TYPE)
174
\&\s-1DEB_HOST_GNU_TYPE\s0 := $(shell dpkg\-architecture \-qDEB_HOST_GNU_TYPE)
176
configure \-\-build=$(\s-1DEB_BUILD_GNU_TYPE\s0) \-\-host=$(\s-1DEB_HOST_GNU_TYPE\s0)
218
DEB_BUILD_GNU_TYPE ?= $(shell dpkg\-architecture \-qDEB_BUILD_GNU_TYPE)
219
DEB_HOST_GNU_TYPE ?= $(shell dpkg\-architecture \-qDEB_HOST_GNU_TYPE)
221
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
222
confflags += \-\-build=$(DEB_HOST_GNU_TYPE)
224
confflags += \-\-build=$(DEB_BUILD_GNU_TYPE) \\
225
\-\-host=$(DEB_HOST_GNU_TYPE)
228
\&./configure $(confflags)
180
232
Doing something only for a specific architecture:
183
\&\s-1DEB_HOST_ARCH\s0 := $(shell dpkg\-architecture \-qDEB_HOST_ARCH)
236
DEB_HOST_ARCH ?= $(shell dpkg\-architecture \-qDEB_HOST_ARCH)
185
ifeq ($(\s-1DEB_HOST_ARCH\s0),alpha)
238
ifeq ($(DEB_HOST_ARCH),alpha)
190
or if you only need to check the CPU or OS type, use the DEB_HOST_ARCH_CPU
191
or DEB_HOST_ARCH_OS variables.
244
or if you only need to check the CPU or OS type, use the
245
\fBDEB_HOST_ARCH_CPU\fP or \fBDEB_HOST_ARCH_OS\fP variables.
193
247
Note that you can also rely on an external Makefile snippet to properly
194
248
set all the variables that \fBdpkg\-architecture\fP can provide:
197
252
include /usr/share/dpkg/architecture.mk
199
ifeq ($(\s-1DEB_HOST_ARCH\s0),alpha)
254
ifeq ($(DEB_HOST_ARCH),alpha)
204
260
In any case, you should never use \fBdpkg \-\-print\-architecture\fP to get
205
261
architecture information during a package build.
207
.SH "BACKWARD COMPATIBILITY"
208
The /usr/share/dpkg/architecture.mk Makefile snippet is provided by
209
dpkg\-dev since version 1.16.1.
211
The DEB_*_ARCH_BITS and DEB_*_ARCH_ENDIAN variables were introduced
212
in dpkg\-dev 1.15.4. Using them in \fIdebian/rules\fR thus requires a
213
build-dependency on dpkg\-dev (>= 1.15.4).
215
The DEB_HOST_ARCH_CPU and DEB_HOST_ARCH_OS variables were introduced
218
The \fB\-e\fP and \fB\-i\fP options were only introduced in relatively recent
219
versions of \fBdpkg\-architecture\fR (since dpkg 1.13.13).
222
\fBdpkg\-buildpackage\fP accepts the \fB\-a\fR option and passes it to
223
\fBdpkg\-architecture\fP. Other examples:
225
CC=i386\-gnu\-gcc dpkg\-architecture \-c debian/rules build
227
eval \`dpkg\-architecture \-u\`
229
Check if an architecture is equal to the current architecture or a given
232
dpkg\-architecture \-elinux\-alpha
234
dpkg\-architecture \-amips \-elinux\-mips
236
Check if the current architecture or an architecture provided with \-a are
239
dpkg\-architecture \-ilinux\-any
241
dpkg\-architecture \-ai386 \-ilinux\-any
244
All these files have to be present for \fBdpkg\-architecture\fP to
245
work. Their location can be overridden at runtime with the environment
246
variable \fBDPKG_DATADIR\fP.
248
.I /usr/share/dpkg/cputable
249
Table of known CPU names and mapping to their GNU name.
251
.I /usr/share/dpkg/ostable
252
Table of known operating system names and mapping to their GNU name.
254
.I /usr/share/dpkg/triplettable
255
Mapping between Debian architecture triplets and Debian architecture
259
264
.BR dpkg\-buildpackage (1),
260
265
.BR dpkg\-cross (1).