.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "dpkg-architecture 1" .TH dpkg-architecture 1 2024-01-19 1.22.3 "dpkg suite" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME dpkg\-architecture \- set and determine the architecture for package building .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fBdpkg-architecture\fR [\fIoption\fR...] [\fIcommand\fR] .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBdpkg-architecture\fR provides a facility to determine and set the build and host architecture for package building. .PP The build architecture is always determined by either the \fBDEB_BUILD_ARCH\fR variable if set (and \fB\-\-force\fR not being specified) or by an external call to \&\fBdpkg\fR\|(1), and cannot be set at the command line. .PP You can specify the host architecture by providing one or both of the options \&\fB\-\-host\-arch\fR and \fB\-\-host\-type\fR, otherwise the \fBDEB_HOST_ARCH\fR variable is used if set (and \fB\-\-force\fR not being specified). The default is determined by an external call to \fBgcc\fR\|(1), or the same as the build architecture if \fBCC\fR or gcc are both not available. One out of \fB\-\-host\-arch\fR and \fB\-\-host\-type\fR is sufficient, the value of the other will be set to a usable default. Indeed, it is often better to only specify one, because \fBdpkg-architecture\fR will warn you if your choice does not match the default. .SH COMMANDS .IX Header "COMMANDS" .IP "\fB\-l\fR, \fB\-\-list\fR" 4 .IX Item "-l, --list" Print the environment variables, one each line, in the format \&\fIVARIABLE=value\fR. This is the default action. .IP "\fB\-e\fR, \fB\-\-equal\fR \fIarchitecture\fR" 4 .IX Item "-e, --equal architecture" Check for equality of architecture (since dpkg 1.13.13). It compares the current or specified Debian host architecture against \&\fIarchitecture\fR, to check if they are equal. This action will not expand the architecture wildcards. Command finishes with an exit status of 0 if matched, 1 if not matched. .IP "\fB\-i\fR, \fB\-\-is\fR \fIarchitecture-wildcard\fR" 4 .IX Item "-i, --is architecture-wildcard" Check for identity of architecture (since dpkg 1.13.13). It compares the current or specified Debian host architecture against \&\fIarchitecture-wildcard\fR after having expanded it as an architecture wildcard, to check if they match. Command finishes with an exit status of 0 if matched, 1 if not matched. .IP "\fB\-q\fR, \fB\-\-query\fR \fIvariable-name\fR" 4 .IX Item "-q, --query variable-name" Print the value of a single variable. .IP "\fB\-s\fR, \fB\-\-print\-set\fR" 4 .IX Item "-s, --print-set" Print an export command. This can be used to set the environment variables using the POSIX shell or make \fBeval\fR, depending on the output format. .IP "\fB\-u\fR, \fB\-\-print\-unset\fR" 4 .IX Item "-u, --print-unset" Print a similar command to \fB\-\-print\-set\fR but to unset all variables. .IP "\fB\-c\fR, \fB\-\-command\fR \fIcommand-string\fR" 4 .IX Item "-c, --command command-string" Execute a \fIcommand-string\fR in an environment which has all variables set to the determined value. .Sp If the \fIcommand-string\fR contains shell metacharacters, then it will be invoked through the system bourne shell. .IP "\fB\-L\fR, \fB\-\-list\-known\fR" 4 .IX Item "-L, --list-known" Print a list of valid architecture names. Possibly restricted by one or more of the matching options \&\fB\-\-match\-wildcard\fR, \fB\-\-match\-bits\fR or \fB\-\-match\-endian\fR (since dpkg 1.17.14). .IP "\fB\-?\fR, \fB\-\-help\fR" 4 .IX Item "-?, --help" Show the usage message and exit. .IP \fB\-\-version\fR 4 .IX Item "--version" Show the version and exit. .SH OPTIONS .IX Header "OPTIONS" .IP "\fB\-a\fR, \fB\-\-host\-arch\fR \fIarchitecture\fR" 4 .IX Item "-a, --host-arch architecture" Set the host Debian architecture. .IP "\fB\-t\fR, \fB\-\-host\-type\fR \fIgnu-system-type\fR" 4 .IX Item "-t, --host-type gnu-system-type" Set the host GNU system type. .IP "\fB\-A\fR, \fB\-\-target\-arch\fR \fIarchitecture\fR" 4 .IX Item "-A, --target-arch architecture" Set the target Debian architecture (since dpkg 1.17.14). .IP "\fB\-T\fR, \fB\-\-target\-type\fR \fIgnu-system-type\fR" 4 .IX Item "-T, --target-type gnu-system-type" Set the target GNU system type (since dpkg 1.17.14). .IP "\fB\-W\fR, \fB\-\-match\-wildcard\fR \fIarchitecture-wildcard\fR" 4 .IX Item "-W, --match-wildcard architecture-wildcard" Restrict the architectures listed by \fB\-\-list\-known\fR to ones matching the specified architecture wildcard (since dpkg 1.17.14). .IP "\fB\-B\fR, \fB\-\-match\-bits\fR \fIarchitecture-bits\fR" 4 .IX Item "-B, --match-bits architecture-bits" Restrict the architectures listed by \fB\-\-list\-known\fR to ones with the specified CPU bits (since dpkg 1.17.14). Either \fB32\fR or \fB64\fR. .IP "\fB\-E\fR, \fB\-\-match\-endian\fR \fIarchitecture-endianness\fR" 4 .IX Item "-E, --match-endian architecture-endianness" Restrict the architectures listed by \fB\-\-list\-known\fR to ones with the specified endianness (since dpkg 1.17.14). Either \fBlittle\fR or \fBbig\fR. .IP "\fB\-\-print\-format\fR \fIformat\fR" 4 .IX Item "--print-format format" Sets the output format for \fB\-\-print\-set\fR and \fB\-\-print\-unset\fR (since dpkg 1.20.6), to either \fBshell\fR (default) or \fBmake\fR. .IP "\fB\-f\fR, \fB\-\-force\fR" 4 .IX Item "-f, --force" Values set by existing environment variables with the same name as used by the scripts are honored (i.e. used by \fBdpkg-architecture\fR), except if this force flag is present. This allows the user to override a value even when the call to \fBdpkg-architecture\fR is buried in some other script (for example \fBdpkg\-buildpackage\fR\|(1)). .SH TERMS .IX Header "TERMS" .IP "build machine" 4 .IX Item "build machine" The machine the package is built on. .IP "host machine" 4 .IX Item "host machine" The machine the package is built for. .IP "target machine" 4 .IX Item "target machine" The machine the compiler is building for, or the emulator will run code for. This is only needed when building a cross-toolchain (or emulator), one that will be built on the build architecture, to be run on the host architecture, and to build (or run emulated) code for the target architecture. .IP "Debian architecture" 4 .IX Item "Debian architecture" The Debian architecture string, which specifies the binary tree in the FTP archive. Examples: i386, sparc, hurd\-i386. .IP "Debian architecture tuple" 4 .IX Item "Debian architecture tuple" A Debian architecture tuple is the fully qualified architecture with all its components spelled out. This differs with Debian architectures in that at least the \fIcpu\fR component does not embed the \fIabi\fR. The current tuple has the form \fIabi\fR\-\fIlibc\fR\-\fIos\fR\-\fIcpu\fR. Examples: base\-gnu\-linux\-amd64, eabihf-musl-linux-arm. .IP "Debian architecture wildcard" 4 .IX Item "Debian architecture wildcard" A Debian architecture wildcard is a special architecture string that will match any real architecture being part of it. The general form is a Debian architecture tuple with four or less elements, and with at least one of them being \fBany\fR. Missing elements of the tuple are prefixed implicitly as \fBany\fR, and thus the following pairs are equivalent: .RS 4 .IP "\fBany\fR\-\fBany\fR\-\fBany\fR\-\fBany\fR = \fBany\fR" 4 .IX Item "any-any-any-any = any" .PD 0 .IP "\fBany\fR\-\fBany\fR\-\fIos\fR\-\fBany\fR = \fIos\fR\-\fBany\fR" 4 .IX Item "any-any-os-any = os-any" .IP "\fBany\fR\-\fIlibc\fR\-\fBany\fR\-\fBany\fR = \fIlibc\fR\-\fBany\fR\-\fBany\fR" 4 .IX Item "any-libc-any-any = libc-any-any" .RE .RS 4 .PD .Sp Examples: linux-any, any\-i386, hurd-any, eabi-any-any-arm, musl-any-any. .RE .IP "GNU system type" 4 .IX Item "GNU system type" An architecture specification string consisting of two parts separated by a hyphen: cpu and system. Examples: i586\-linux\-gnu, sparc-linux-gnu, i686\-gnu, x86_64\-netbsd. .IP "multiarch triplet" 4 .IX Item "multiarch triplet" The clarified GNU system type, used for filesystem paths. This triplet does not change even when the baseline ISA gets bumped, so that the resulting paths are stable over time. The only current difference with the GNU system type is that the CPU part for i386 based systems is always i386. Examples: i386\-linux\-gnu, x86_64\-linux\-gnu. Example paths: /lib/powerpc64le\-linux\-gnu/, /usr/lib/i386\-kfreebsd\-gnu/. .SH VARIABLES .IX Header "VARIABLES" The following variables are read from the environment (unless \fB\-\-force\fR has been specified) and set by \fBdpkg-architecture\fR (see the \fBTERMS\fR section for a description of the naming scheme): .IP \fBDEB_BUILD_ARCH\fR 4 .IX Item "DEB_BUILD_ARCH" The Debian architecture of the build machine. .IP \fBDEB_BUILD_ARCH_ABI\fR 4 .IX Item "DEB_BUILD_ARCH_ABI" The Debian ABI name of the build machine (since dpkg 1.18.11). .IP \fBDEB_BUILD_ARCH_LIBC\fR 4 .IX Item "DEB_BUILD_ARCH_LIBC" The Debian libc name of the build machine (since dpkg 1.18.11). .IP \fBDEB_BUILD_ARCH_OS\fR 4 .IX Item "DEB_BUILD_ARCH_OS" The Debian system name of the build machine (since dpkg 1.13.2). .IP \fBDEB_BUILD_ARCH_CPU\fR 4 .IX Item "DEB_BUILD_ARCH_CPU" The Debian CPU name of the build machine (since dpkg 1.13.2). .IP \fBDEB_BUILD_ARCH_BITS\fR 4 .IX Item "DEB_BUILD_ARCH_BITS" The pointer size of the build machine (in bits; since dpkg 1.15.4). .IP \fBDEB_BUILD_ARCH_ENDIAN\fR 4 .IX Item "DEB_BUILD_ARCH_ENDIAN" The endianness of the build machine (little / big; since dpkg 1.15.4). .IP \fBDEB_BUILD_GNU_CPU\fR 4 .IX Item "DEB_BUILD_GNU_CPU" The GNU CPU part of \fBDEB_BUILD_GNU_TYPE\fR. .IP \fBDEB_BUILD_GNU_SYSTEM\fR 4 .IX Item "DEB_BUILD_GNU_SYSTEM" The GNU system part of \fBDEB_BUILD_GNU_TYPE\fR. .IP \fBDEB_BUILD_GNU_TYPE\fR 4 .IX Item "DEB_BUILD_GNU_TYPE" The GNU system type of the build machine. .IP \fBDEB_BUILD_MULTIARCH\fR 4 .IX Item "DEB_BUILD_MULTIARCH" The clarified GNU system type of the build machine, used for filesystem paths (since dpkg 1.16.0). .IP \fBDEB_HOST_ARCH\fR 4 .IX Item "DEB_HOST_ARCH" The Debian architecture of the host machine. .IP \fBDEB_HOST_ARCH_ABI\fR 4 .IX Item "DEB_HOST_ARCH_ABI" The Debian ABI name of the host machine (since dpkg 1.18.11). .IP \fBDEB_HOST_ARCH_LIBC\fR 4 .IX Item "DEB_HOST_ARCH_LIBC" The Debian libc name of the host machine (since dpkg 1.18.11). .IP \fBDEB_HOST_ARCH_OS\fR 4 .IX Item "DEB_HOST_ARCH_OS" The Debian system name of the host machine (since dpkg 1.13.2). .IP \fBDEB_HOST_ARCH_CPU\fR 4 .IX Item "DEB_HOST_ARCH_CPU" The Debian CPU name of the host machine (since dpkg 1.13.2). .IP \fBDEB_HOST_ARCH_BITS\fR 4 .IX Item "DEB_HOST_ARCH_BITS" The pointer size of the host machine (in bits; since dpkg 1.15.4). .IP \fBDEB_HOST_ARCH_ENDIAN\fR 4 .IX Item "DEB_HOST_ARCH_ENDIAN" The endianness of the host machine (little / big; since dpkg 1.15.4). .IP \fBDEB_HOST_GNU_CPU\fR 4 .IX Item "DEB_HOST_GNU_CPU" The GNU CPU part of \fBDEB_HOST_GNU_TYPE\fR. .IP \fBDEB_HOST_GNU_SYSTEM\fR 4 .IX Item "DEB_HOST_GNU_SYSTEM" The GNU system part of \fBDEB_HOST_GNU_TYPE\fR. .IP \fBDEB_HOST_GNU_TYPE\fR 4 .IX Item "DEB_HOST_GNU_TYPE" The GNU system type of the host machine. .IP \fBDEB_HOST_MULTIARCH\fR 4 .IX Item "DEB_HOST_MULTIARCH" The clarified GNU system type of the host machine, used for filesystem paths (since dpkg 1.16.0). .IP \fBDEB_TARGET_ARCH\fR 4 .IX Item "DEB_TARGET_ARCH" The Debian architecture of the target machine (since dpkg 1.17.14). .IP \fBDEB_TARGET_ARCH_ABI\fR 4 .IX Item "DEB_TARGET_ARCH_ABI" The Debian ABI name of the target machine (since dpkg 1.18.11). .IP \fBDEB_TARGET_ARCH_LIBC\fR 4 .IX Item "DEB_TARGET_ARCH_LIBC" The Debian libc name of the target machine (since dpkg 1.18.11). .IP \fBDEB_TARGET_ARCH_OS\fR 4 .IX Item "DEB_TARGET_ARCH_OS" The Debian system name of the target machine (since dpkg 1.17.14). .IP \fBDEB_TARGET_ARCH_CPU\fR 4 .IX Item "DEB_TARGET_ARCH_CPU" The Debian CPU name of the target machine (since dpkg 1.17.14). .IP \fBDEB_TARGET_ARCH_BITS\fR 4 .IX Item "DEB_TARGET_ARCH_BITS" The pointer size of the target machine (in bits; since dpkg 1.17.14). .IP \fBDEB_TARGET_ARCH_ENDIAN\fR 4 .IX Item "DEB_TARGET_ARCH_ENDIAN" The endianness of the target machine (little / big; since dpkg 1.17.14). .IP \fBDEB_TARGET_GNU_CPU\fR 4 .IX Item "DEB_TARGET_GNU_CPU" The GNU CPU part of \fBDEB_TARGET_GNU_TYPE\fR (since dpkg 1.17.14). .IP \fBDEB_TARGET_GNU_SYSTEM\fR 4 .IX Item "DEB_TARGET_GNU_SYSTEM" The GNU system part of \fBDEB_TARGET_GNU_TYPE\fR (since dpkg 1.17.14). .IP \fBDEB_TARGET_GNU_TYPE\fR 4 .IX Item "DEB_TARGET_GNU_TYPE" The GNU system type of the target machine (since dpkg 1.17.14). .IP \fBDEB_TARGET_MULTIARCH\fR 4 .IX Item "DEB_TARGET_MULTIARCH" The clarified GNU system type of the target machine, used for filesystem paths (since dpkg 1.17.14). .SH FILES .IX Header "FILES" .SS "Architecture tables" .IX Subsection "Architecture tables" All these files have to be present for \fBdpkg-architecture\fR to work. Their location can be overridden at runtime with the environment variable \fBDPKG_DATADIR\fR. These tables contain a format \fBVersion\fR pseudo-field on their first line to mark their format, so that parsers can check if they understand it, such as "# Version=1.0". .IP \fI/usr/share/dpkg/cputable\fR 4 .IX Item "/usr/share/dpkg/cputable" Table of known CPU names and mapping to their GNU name. Format version 1.0 (since dpkg 1.13.2). .IP \fI/usr/share/dpkg/ostable\fR 4 .IX Item "/usr/share/dpkg/ostable" Table of known operating system names and mapping to their GNU name. Format version 2.0 (since dpkg 1.18.11). .IP \fI/usr/share/dpkg/tupletable\fR 4 .IX Item "/usr/share/dpkg/tupletable" Mapping between Debian architecture tuples and Debian architecture names. Format version 1.0 (since dpkg 1.18.11). .IP \fI/usr/share/dpkg/abitable\fR 4 .IX Item "/usr/share/dpkg/abitable" Table of Debian architecture ABI attribute overrides. Format version 2.0 (since dpkg 1.18.11). .SS "Packaging support" .IX Subsection "Packaging support" .IP \fI/usr/share/dpkg/architecture.mk\fR 4 .IX Item "/usr/share/dpkg/architecture.mk" Makefile snippet that properly sets and exports all the variables that \&\fBdpkg-architecture\fR outputs (since dpkg 1.16.1). .SH EXAMPLES .IX Header "EXAMPLES" \&\fBdpkg-buildpackage\fR accepts the \fB\-a\fR option and passes it to \&\fBdpkg-architecture\fR. Other examples: .Sp .Vb 1 \& CC=i386\-gnu\-gcc dpkg\-architecture \-c debian/rules build \& \& eval $(dpkg\-architecture \-u) .Ve .PP Check if the current or specified host architecture is equal to an architecture: .Sp .Vb 1 \& dpkg\-architecture \-elinux\-alpha \& \& dpkg\-architecture \-amips \-elinux\-mips .Ve .PP Check if the current or specified host architecture is a Linux system: .Sp .Vb 1 \& dpkg\-architecture \-ilinux\-any \& \& dpkg\-architecture \-ai386 \-ilinux\-any .Ve .SS "Usage in debian/rules" .IX Subsection "Usage in debian/rules" The environment variables set by \fBdpkg-architecture\fR are passed to \&\fIdebian/rules\fR as make variables (see make documentation). However, you should not rely on them, as this breaks manual invocation of the script. Instead, you should always initialize them using \&\fBdpkg-architecture\fR with the \fB\-q\fR option. Here are some examples, which also show how you can improve the cross compilation support in your package: .PP Retrieving the GNU system type and forwarding it to ./configure: .Sp .Vb 11 \& DEB_BUILD_GNU_TYPE ?= $(shell dpkg\-architecture \-qDEB_BUILD_GNU_TYPE) \& DEB_HOST_GNU_TYPE ?= $(shell dpkg\-architecture \-qDEB_HOST_GNU_TYPE) \& [...] \& ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) \& confflags += \-\-build=$(DEB_HOST_GNU_TYPE) \& else \& confflags += \-\-build=$(DEB_BUILD_GNU_TYPE) \e \& \-\-host=$(DEB_HOST_GNU_TYPE) \& endif \& [...] \& ./configure $(confflags) .Ve .PP Doing something only for a specific architecture: .Sp .Vb 1 \& DEB_HOST_ARCH ?= $(shell dpkg\-architecture \-qDEB_HOST_ARCH) \& \& ifeq ($(DEB_HOST_ARCH),alpha) \& [...] \& endif .Ve .PP or if you only need to check the CPU or OS type, use the \&\fBDEB_HOST_ARCH_CPU\fR or \fBDEB_HOST_ARCH_OS\fR variables. .PP Note that you can also rely on an external Makefile snippet to properly set all the variables that \fBdpkg-architecture\fR can provide: .Sp .Vb 1 \& include /usr/share/dpkg/architecture.mk \& \& ifeq ($(DEB_HOST_ARCH),alpha) \& [...] \& endif .Ve .PP In any case, you should never use \fBdpkg \-\-print\-architecture\fR to get architecture information during a package build. .SH ENVIRONMENT .IX Header "ENVIRONMENT" .IP \fBDPKG_DATADIR\fR 4 .IX Item "DPKG_DATADIR" If set, it will be used as the \fBdpkg\fR data directory, where the architecture tables are located (since dpkg 1.14.17). Defaults to \(Fo/usr/share/dpkg\(Fc. .IP \fBDPKG_COLORS\fR 4 .IX Item "DPKG_COLORS" Sets the color mode (since dpkg 1.18.5). The currently accepted values are: \fBauto\fR (default), \fBalways\fR and \&\fBnever\fR. .IP \fBDPKG_NLS\fR 4 .IX Item "DPKG_NLS" If set, it will be used to decide whether to activate Native Language Support, also known as internationalization (or i18n) support (since dpkg 1.19.0). The accepted values are: \fB0\fR and \fB1\fR (default). .SH NOTES .IX Header "NOTES" All long command and option names available only since dpkg 1.17.17. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBdpkg\-buildpackage\fR\|(1).