1dpkg-architecture(1)              dpkg suite              dpkg-architecture(1)
2
3
4

NAME

6       dpkg-architecture  -  set  and  determine  the architecture for package
7       building
8

SYNOPSIS

10       dpkg-architecture [option...] [command]
11

DESCRIPTION

13       dpkg-architecture provides a facility to determine and  set  the  build
14       and host architecture for package building.
15
16       The  build  architecture  is  always  determined by an external call to
17       dpkg(1), and cannot be set at the command line.
18
19       You can specify the host architecture by providing one or both  of  the
20       options  --host-arch  and  --host-type. The default is determined by an
21       external call to gcc(1), or the same as the build architecture if CC or
22       gcc  are  both not available. One out of --host-arch and --host-type is
23       sufficient, the value of the other will be set  to  a  usable  default.
24       Indeed,   it   is   often   better   to   only   specify  one,  because
25       dpkg-architecture will warn you if  your  choice  does  not  match  the
26       default.
27

COMMANDS

29       -l, --list
30              Print  the  environment  variables, one each line, in the format
31              VARIABLE=value. This is the default action.
32
33       -e, --equal architecture
34              Check for equality of architecture  (since  dpkg  1.13.13).   It
35              compares  the  current  or  specified  Debian  host architecture
36              against architecture, to check if they are equal.   This  action
37              will  not  expand  the architecture wildcards.  Command finishes
38              with an exit status of 0 if matched, 1 if not matched.
39
40
41       -i, --is architecture-wildcard
42              Check for identity of architecture  (since  dpkg  1.13.13).   It
43              compares  the  current  or  specified  Debian  host architecture
44              against architecture-wildcard after having  expanded  it  as  an
45              architecture wildcard, to check if they match.  Command finishes
46              with an exit status of 0 if matched, 1 if not matched.
47
48       -q, --query variable-name
49              Print the value of a single variable.
50
51       -s, --print-set
52              Print an export command. This can be used to set the environment
53              variables using eval.
54
55       -u, --print-unset
56              Print  a  similar  command  to  --print-unset  but  to unset all
57              variables.
58
59       -c, --command command-string
60              Execute  a  command-string  in  an  environment  which  has  all
61              variables set to the determined value.
62
63       -L, --list-known
64              Print  a  list of valid architecture names.  Possibly restricted
65              by  one  or  more  of  the  matching  options  --match-wildcard,
66              --match-bits or --match-endian (since dpkg 1.17.14).
67
68       -?, --help
69              Show the usage message and exit.
70
71       --version
72              Show the version and exit.
73

OPTIONS

75       -a, --host-arch architecture
76              Set the host Debian architecture.
77
78       -t, --host-type gnu-system-type
79              Set the host GNU system type.
80
81       -A, --target-arch architecture
82              Set the target Debian architecture (since dpkg 1.17.14).
83
84       -T, --target-type gnu-system-type
85              Set the target GNU system type (since dpkg 1.17.14).
86
87       -W, --match-wildcard architecture-wildcard
88              Restrict  the  architectures  listed  by  --list-known  to  ones
89              matching  the  specified  architecture  wildcard   (since   dpkg
90              1.17.14).
91
92       -B, --match-bits architecture-bits
93              Restrict  the  architectures listed by --list-known to ones with
94              the specified CPU bits (since dpkg 1.17.14). Either 32 or 64.
95
96       -E, --match-endian architecture-endianness
97              Restrict the architectures listed by --list-known to  ones  with
98              the  specified endianness (since dpkg 1.17.14). Either little or
99              big.
100
101       -f, --force
102              Values set by existing environment variables with the same  name
103              as   used   by   the   scripts   are   honored   (i.e.  used  by
104              dpkg-architecture), except if this force flag is  present.  This
105              allows  the  user  to  override  a  value  even when the call to
106              dpkg-architecture is buried in some other  script  (for  example
107              dpkg-buildpackage(1)).
108

TERMS

110       build machine
111           The machine the package is built on.
112
113       host machine
114           The machine the package is built for.
115
116       target machine
117           The machine the compiler is building for.  This is only needed when
118           building a cross-toolchain, one that will be  built  on  the  build
119           architecture, to be run on the host architecture, and to build code
120           for the target architecture.
121
122       Debian architecture
123           The Debian architecture string, which specifies the binary tree  in
124           the FTP archive. Examples: i386, sparc, hurd-i386.
125
126       Debian architecture tuple
127           A  Debian  architecture  tuple  is the fully qualified architecture
128           with all its components spelled  out.   This  differs  with  Debian
129           architectures in that at least the cpu component does not embed the
130           abi.  The current tuple has the  form  abi-libc-os-cpu.   Examples:
131           base-gnu-linux-amd64, eabihf-musl-linux-arm.
132
133       Debian architecture wildcard
134           A  Debian  architecture  wildcard  is a special architecture string
135           that will match any  real  architecture  being  part  of  it.   The
136           general  form  is  a  Debian  architecture  tuple with four or less
137           elements, and with  at  least  one  of  them  being  any.   Missing
138           elements  of the tuple are prefixed implicitly as any, and thus the
139           following pairs are equivalent:
140               any-any-any-any = any
141               any-any-os-any = os-any
142               any-libc-any-any = libc-any-any
143           Examples:   linux-any,   any-i386,   hurd-any,    eabi-any-any-arm,
144           musl-any-any.
145
146       GNU system type
147           An  architecture  specification  string  consisting  of  two  parts
148           separated by a hyphen: cpu and system.   Examples:  i586-linux-gnu,
149           sparc-linux-gnu, i686-gnu, x86_64-netbsd.
150
151       multiarch triplet
152           The  clarified  GNU  system  type, used for filesystem paths.  This
153           triplet does not change even when the baseline ISA gets bumped,  so
154           that  the  resulting  paths are stable over time.  The only current
155           difference with the GNU system type is that the CPU part  for  i386
156           based   systems   is   always   i386.    Examples:  i386-linux-gnu,
157           x86_64-linux-gnu.   Example   paths:   /lib/powerpc64le-linux-gnu/,
158           /usr/lib/i386-kfreebsd-gnu/.
159

VARIABLES

161       The  following  variables  are  set by dpkg-architecture (see the TERMS
162       section for a description of the naming scheme):
163
164       DEB_BUILD_ARCH
165           The Debian architecture of the build machine.
166
167       DEB_BUILD_ARCH_ABI
168           The Debian abi name of the build machine (since dpkg 1.18.11).
169
170       DEB_BUILD_ARCH_LIBC
171           The Debian libc name of the build machine (since dpkg 1.18.11).
172
173       DEB_BUILD_ARCH_OS
174           The Debian system name of the build machine (since dpkg 1.13.2).
175
176       DEB_BUILD_ARCH_CPU
177           The Debian cpu name of the build machine (since dpkg 1.13.2).
178
179       DEB_BUILD_ARCH_BITS
180           The pointer size of the build machine (in bits; since dpkg 1.15.4).
181
182       DEB_BUILD_ARCH_ENDIAN
183           The endianness of the build  machine  (little  /  big;  since  dpkg
184           1.15.4).
185
186       DEB_BUILD_GNU_CPU
187           The CPU part of DEB_BUILD_GNU_TYPE.
188
189       DEB_BUILD_GNU_SYSTEM
190           The System part of DEB_BUILD_GNU_TYPE.
191
192       DEB_BUILD_GNU_TYPE
193           The GNU system type of the build machine.
194
195       DEB_BUILD_MULTIARCH
196           The  clarified  GNU  system  type  of  the  build machine, used for
197           filesystem paths (since dpkg 1.16.0).
198
199       DEB_HOST_ARCH
200           The Debian architecture of the host machine.
201
202       DEB_HOST_ARCH_ABI
203           The Debian abi name of the host machine (since dpkg 1.18.11).
204
205       DEB_HOST_ARCH_LIBC
206           The Debian libc name of the host machine (since dpkg 1.18.11).
207
208       DEB_HOST_ARCH_OS
209           The Debian system name of the host machine (since dpkg 1.13.2).
210
211       DEB_HOST_ARCH_CPU
212           The Debian cpu name of the host machine (since dpkg 1.13.2).
213
214       DEB_HOST_ARCH_BITS
215           The pointer size of the host machine (in bits; since dpkg 1.15.4).
216
217       DEB_HOST_ARCH_ENDIAN
218           The endianness of the  host  machine  (little  /  big;  since  dpkg
219           1.15.4).
220
221       DEB_HOST_GNU_CPU
222           The CPU part of DEB_HOST_GNU_TYPE.
223
224       DEB_HOST_GNU_SYSTEM
225           The System part of DEB_HOST_GNU_TYPE.
226
227       DEB_HOST_GNU_TYPE
228           The GNU system type of the host machine.
229
230       DEB_HOST_MULTIARCH
231           The  clarified  GNU  system  type  of  the  host  machine, used for
232           filesystem paths (since dpkg 1.16.0).
233
234       DEB_TARGET_ARCH
235           The Debian architecture of the target machine (since dpkg 1.17.14).
236
237       DEB_TARGET_ARCH_ABI
238           The Debian abi name of the target machine (since dpkg 1.18.11).
239
240       DEB_TARGET_ARCH_LIBC
241           The Debian libc name of the target machine (since dpkg 1.18.11).
242
243       DEB_TARGET_ARCH_OS
244           The Debian system name of the target machine (since dpkg 1.17.14).
245
246       DEB_TARGET_ARCH_CPU
247           The Debian cpu name of the target machine (since dpkg 1.17.14).
248
249       DEB_TARGET_ARCH_BITS
250           The pointer size  of  the  target  machine  (in  bits;  since  dpkg
251           1.17.14).
252
253       DEB_TARGET_ARCH_ENDIAN
254           The  endianness  of  the  target  machine (little / big; since dpkg
255           1.17.14).
256
257       DEB_TARGET_GNU_CPU
258           The CPU part of DEB_TARGET_GNU_TYPE (since dpkg 1.17.14).
259
260       DEB_TARGET_GNU_SYSTEM
261           The System part of DEB_TARGET_GNU_TYPE (since dpkg 1.17.14).
262
263       DEB_TARGET_GNU_TYPE
264           The GNU system type of the target machine (since dpkg 1.17.14).
265
266       DEB_TARGET_MULTIARCH
267           The clarified GNU system type  of  the  target  machine,  used  for
268           filesystem paths (since dpkg 1.17.14).
269

FILES

271   Architecture tables
272       All these files have to be present for dpkg-architecture to work. Their
273       location can be overridden at runtime  with  the  environment  variable
274       DPKG_DATADIR.   These  tables  contain a format Version pseudo-field on
275       their first line to mark their format, so that  parsers  can  check  if
276       they understand it, such as "# Version=1.0".
277
278       /usr/share/dpkg/cputable
279              Table  of known CPU names and mapping to their GNU name.  Format
280              version 1.0 (since dpkg 1.13.2).
281
282       /usr/share/dpkg/ostable
283              Table of known operating system names and mapping to  their  GNU
284              name.  Format version 2.0 (since dpkg 1.18.11).
285
286       /usr/share/dpkg/tupletable
287              Mapping   between   Debian   architecture   tuples   and  Debian
288              architecture names.  Format version 1.0 (since dpkg 1.18.11).
289
290       /usr/share/dpkg/abitable
291              Table of Debian architecture ABI  attribute  overrides.   Format
292              version 2.0 (since dpkg 1.18.11).
293
294   Packaging support
295       /usr/share/dpkg/architecture.mk
296              Makefile   snippet  that  properly  sets  and  exports  all  the
297              variables that dpkg-architecture outputs (since dpkg 1.16.1).
298

EXAMPLES

300       dpkg-buildpackage  accepts   the   -a   option   and   passes   it   to
301       dpkg-architecture. Other examples:
302
303              CC=i386-gnu-gcc dpkg-architecture -c debian/rules build
304
305              eval `dpkg-architecture -u`
306
307       Check  if  the  current  or  specified host architecture is equal to an
308       architecture:
309
310              dpkg-architecture -elinux-alpha
311
312              dpkg-architecture -amips -elinux-mips
313
314       Check if the current or specified host architecture is a Linux system:
315
316              dpkg-architecture -ilinux-any
317
318              dpkg-architecture -ai386 -ilinux-any
319
320   Usage in debian/rules
321       The environment  variables  set  by  dpkg-architecture  are  passed  to
322       debian/rules  as  make variables (see make documentation). However, you
323       should not rely on them,  as  this  breaks  manual  invocation  of  the
324       script.    Instead,   you   should   always   initialize   them   using
325       dpkg-architecture with the -q option. Here  are  some  examples,  which
326       also  show  how  you  can improve the cross compilation support in your
327       package:
328
329       Retrieving the GNU system type and forwarding it to ./configure:
330
331           DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
332           DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
333           [...]
334           ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
335             confflags += --build=$(DEB_HOST_GNU_TYPE)
336           else
337             confflags += --build=$(DEB_BUILD_GNU_TYPE) \
338                          --host=$(DEB_HOST_GNU_TYPE)
339           endif
340           [...]
341           ./configure $(confflags)
342
343       Doing something only for a specific architecture:
344
345           DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
346
347           ifeq ($(DEB_HOST_ARCH),alpha)
348             [...]
349           endif
350
351       or  if  you  only  need  to  check  the  CPU  or  OS  type,   use   the
352       DEB_HOST_ARCH_CPU or DEB_HOST_ARCH_OS variables.
353
354       Note that you can also rely on an external Makefile snippet to properly
355       set all the variables that dpkg-architecture can provide:
356
357           include /usr/share/dpkg/architecture.mk
358
359           ifeq ($(DEB_HOST_ARCH),alpha)
360             [...]
361           endif
362
363       In any case, you should never  use  dpkg  --print-architecture  to  get
364       architecture information during a package build.
365

ENVIRONMENT

367       DPKG_DATADIR
368              If  set,  it  will be used as the dpkg data directory, where the
369              architecture tables are located (since dpkg 1.14.17).   Defaults
370              to «/usr/share/dpkg».
371
372       DPKG_COLORS
373              Sets the color mode (since dpkg 1.18.5).  The currently accepted
374              values are: auto (default), always and never.
375
376       DPKG_NLS
377              If set, it will be used to decide  whether  to  activate  Native
378              Language  Support,  also known as internationalization (or i18n)
379              support (since dpkg 1.19.0).  The accepted values are: 0  and  1
380              (default).
381

NOTES

383       All long command and option names available only since dpkg 1.17.17.
384

SEE ALSO

386       dpkg-buildpackage(1).
387
388
389
3901.19.7                            2019-06-03              dpkg-architecture(1)
Impressum