Scroll to navigation

dpkg-architecture(1) Dpkg-sviten dpkg-architecture(1)

NAMN

dpkg-architecture - ställ in och bestäm arkitektur för paket som byggs

SYNOPS

dpkg-architecture [flagga...] [åtgärd]

BESKRIVNING

dpkg-architecture innehåller en funktion för att bestämma och ställa in bygg- och värdarkitekturerna för att bygga paket.

Byggarkitekturen bestäms alltid av ett externt anrop till dpkg(1) och kan inte ställas in på kommandoraden.

Du kan ange värdarkitektur genom att ange en av, eller båda, flaggorna --host-arch och --host-type. Förvalet bestäms av ett externt anrop till gcc(1), eller är detsamma som byggarkitekturen varken CC eller gcc är tillgängliga. Det räcker att ange en av --host-arch och -host-type, värdet på den andra kommer ställas in till ett fungerande förval. Det är faktiskt oftast bättre att bara ange den ena eftersom dpkg-architecture kommer varna dig om ditt val inte överensstämmer med förvalet.

KOMMANDON

-l, --list
Skriv miljövariabler, en per rad, på formatet VARIABEL=värde. Detta är förvald åtgärd.
-e, --equal arkitektur
Kontrollera arkitektur för likhet (sedan dpkg 1.13.13). Det jämför den aktuella eller angivna Debian-värdarkitekturen mot arkitektur, för att se om de är lika. Åtgärden expanderar inte jokertecken i arkitekturer. Kommandot avslutar med status 0 om det är en träff, 1 om det inte är en träff.

-i, --is arkitektur-jokertecken
Kontrollera arkitekturens identitet (sedan dpkg 1.13.13). Det jämför den aktuella eller angivna Debian-värdarkitekturen mot arkitektur-jokertecken efter att ha expanderat det som ett arkitektur-jokertecken, för att se om de är lika. Kommandot avslutar med status 0 om det är en träff, 1 om det inte är en träff.
-q, --query variabelnamn
Skriv värdet på en enkel variabel.
-s, --print-set
Visar ett exportkommando. Detta kan användas för att sätta miljövariabler med eval.
-u, --print-unset
Visar ett kommando liknande --print-unset men för att ta bort värdet för alla variabler.
-c, --command kommando
Exekvera ett kommando i en miljö som har alla variabler satta till det bestämda värdet.
-L, --list-known
Visar en lista över giltiga arkitekturnamn. Möjligen begränsad av en eller flera av träffvalen --match-wildcard, --match-bits eller --match-endian (sedan dpkg 1.17.14).
-?, --help
Visar hjälpskärm och avslutar.
--version
Visar version och avslutar.

FLAGGOR

-a, --host-arch arkitektur
Sätter värd-Debianarkitekturen.
-t, --host-type gnu-system-typ
Sätter värd-GNU-systemtypen.
-A, --target-arch arkitektur
Set the target Debian architecture (since dpkg 1.17.14).
-T, --target-type gnu-system-typ
Set the target GNU system type (since dpkg 1.17.14).
-W, --match-wildcard arkitektur-jokertecken
Begränsa arkitekturerna som visas med --list-known till en som motsvarar det angivna arkitektur-jokertecknet (sedan dpkg 1.17.14).
-B, --match-bits arkitektur-bitar
Begränsa arkitekturerna som visas med --list-known till en med angivet antal CPU-bitar (sedan dpkg 1.17.14). Antingen 32 eller 64.
-E, --match-endian architecture-endian
Begränsa arkitekturerna som visas med --list-known till en som har angiven endian (sedan dpkg 1.17.14). Antingen little (liten endian) eller big (stor endian).
-f, --force
Värden som sätts av befintliga miljövariabler med samma namn som de som används av skriptet används (t.ex av dpkg-architecture), såvida inte denna tvingande flagga anges. Det gör det möjligt för användaren att överstyra ett värde även om anropet till dpkg-architecture är begravt djupt inuti ett annat skript (till exempel dpkg-buildpackage(1)).

TERMINOLOGI

byggmaskin
Maskinen paketet byggs på.
värdmaskin
Maskinen paketet byggs för.
målmaskin
The machine the compiler is building for. This is only needed when building a cross-toolchain, one that will be built on the build architecture, to be run on the host architecture, and to build code for the target architecture.
Debianarkitektur
Debianarkitektursträngen, vilken anger binärträdet i FTP-arkivet. Exempel: i386, sparc, hurd-i386.
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 cpu component does not embed the abi. The current tuple has the form abi-libc-os-cpu. Examples: base-gnu-linux-amd64, eabihf-musl-linux-arm.
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 any. Missing elements of the tuple are prefixed implicitly as any, and thus the following pairs are equivalent:
    any-any-any-any = any
    any-any-os-any = os-any
    any-libc-any-any = libc-any-any
    
Examples: linux-any, any-i386, hurd-any, eabi-any-any-arm, musl-any-any.
GNU-systemtyp
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.
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/.

VARIABLER

Följande variabler sätts av dpkg-architecture:
DEB_BUILD_ARCH
Debianarkitekturen för byggmaskinen.
DEB_BUILD_ARCH_ABI
The Debian abi name of the build machine (since dpkg 1.18.11).
DEB_BUILD_ARCH_LIBC
The Debian libc name of the build machine (since dpkg 1.18.11).
DEB_BUILD_ARCH_OS
Debiansystemnamnet på byggmaskinen (sedan dpkg 1.13.2).
DEB_BUILD_ARCH_CPU
Debian-processornamnet för byggmaskinen (sedan dpkg 1.13.).
DEB_BUILD_ARCH_BITS
Pekarstorleken för byggmaskinen (i bitar; sedan dpkg 1.15.4).
DEB_BUILD_ARCH_ENDIAN
Endian för byggmaskinen (little / big; sedan dpkg 1.15.4).
DEB_BUILD_GNU_CPU
CPU-delen av DEB_BUILD_GNU_TYPE.
DEB_BUILD_GNU_SYSTEM
Systemdelen av DEB_BUILD_GNU_TYPE.
DEB_BUILD_GNU_TYPE
GNU-systemtypen för byggmaskinen.
DEB_BUILD_MULTIARCH
Den förtydligade GNU-systemtypen för byggmaskinen, används för sökvägar i filsystemet.
DEB_HOST_ARCH
Debianarkitekturen för värdmaskinen.
DEB_HOST_ARCH_ABI
The Debian abi name of the host machine (since dpkg 1.18.11).
DEB_HOST_ARCH_LIBC
The Debian libc name of the host machine (since dpkg 1.18.11).
DEB_HOST_ARCH_OS
Debiansystemnamnet för värdmaskinen (sedan dpkg 1.13.2).
DEB_HOST_ARCH_CPU
Debian-processornamnet för värdmaskinen (sedan dpkg 1.13.2).
DEB_HOST_ARCH_BITS
Pekarstorleken för värdmaskinen (i bitar; sedan dpkg 1.15.4).
DEB_HOST_ARCH_ENDIAN
Endian för värdmaskinen (little / big; sedan dpkg 1.15.4).
DEB_HOST_GNU_CPU
CPU-delen av DEB_HOST_GNU_TYPE.
DEB_HOST_GNU_SYSTEM
Systemdelen av DEB_HOST_GNU_TYPE.
DEB_HOST_GNU_TYPE
GNU-systemtypen för värdmaskinen.
DEB_HOST_MULTIARCH
Den förtydligade GNU-systemtypen för värdmaskinen, används för sökvägar i filsystemet.
DEB_TARGET_ARCH
Debianarkitekturen för målmaskinen (sedan dpkg 1.17.14).
DEB_TARGET_ARCH_ABI
The Debian abi name of the target machine (since dpkg 1.18.11).
DEB_TARGET_ARCH_LIBC
The Debian libc name of the target machine (since dpkg 1.18.11).
DEB_TARGET_ARCH_OS
Debiansystemnamnet för målmaskinen (sedan dpkg 1.17.14).
DEB_TARGET_ARCH_CPU
Debian-processornamnet för målmaskinen (sedan dpkg 1.17.14).
DEB_TARGET_ARCH_BITS
Pekarstorleken för målmaskinen (i bitar; sedan dpkg 1.17.14).
DEB_TARGET_ARCH_ENDIAN
Endian för målmaskinen (little / big; sedan dpkg 1.17.14).
DEB_TARGET_GNU_CPU
CPU-delen av DEB_TARGET_GNU_TYPE (sedan dpkg 1.17.14).
DEB_TARGET_GNU_SYSTEM
Systemdelen av DEB_TARGET_GNU_TYPE (sedan dpkg 1.17.14).
DEB_TARGET_GNU_TYPE
GNU-systemnamnet för målmaskinen (sedan dpkg 1.17.14).
DEB_TARGET_MULTIARCH
Den förtydligade GNU-systemtypen för målmaskinen, används för sökvägar i filsystemet (sedan dpkg 1.17.14).

FILER

Arkitekturtabeller

All these files have to be present for dpkg-architecture to work. Their location can be overridden at runtime with the environment variable DPKG_DATADIR. These tables contain a format Version pseudo-field on their first line to mark their format, so that parsers can check if they understand it, such as "# Version=1.0".
/usr/share/dpkg/cputable
Table of known CPU names and mapping to their GNU name. Format version 1.0 (since dpkg 1.13.2).
/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).
/usr/share/dpkg/tupletable
Mapping between Debian architecture tuples and Debian architecture names. Format version 1.0 (since dpkg 1.18.11).
/usr/share/dpkg/abitable
Table of Debian architecture ABI attribute overrides. Format version 2.0 (since dpkg 1.18.11).

Paketeringsstöd

/usr/share/dpkg/architecture.mk
Makefile-utklipp som sätter alla variabler dpkg-architecture skriver (sedan dpkg 1.16.1):

EXEMPEL

dpkg-architecture godtar flaggan -a och sänder den vidare till dpkg-architecture. Andra exempel:
CC=i386-gnu-gcc dpkg-architecture -c debian/rules build
eval `dpkg-architecture -u`

Kontrollera om aktuell eller angiven arkitektur är samma en arkitektur:

dpkg-architecture -elinux-alpha
dpkg-architecture -amips -elinux-mips

Se om den aktuella eller angivna arkitekturen är ett Linuxsystem:

dpkg-architecture -ilinux-any
dpkg-architecture -ai386 -ilinux-any

Använda i debian/rules

Miljövariablerna som sätts av dpkg-architecture sänds till debian/rules som make-variabler (se dokumentationen för make). Du bör dock inte bero på dem eftersom detta förhindrar manuella anrop till skriptet. Du bör istället alltid initiera dem med dpkg-architecture med -q-flaggan. Här är några exempel, vilka även visar hur du kan förbättra stödet för korskompilering i ditt paket:

Hämta GNU-systemtypen och vidaresänd den till ./configure:

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) \
               --host=$(DEB_HOST_GNU_TYPE)
endif
[...]
./configure $(confflags)

Gör något endast för en specifik arkitektur:

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifeq ($(DEB_HOST_ARCH),alpha)
  [...]
endif

eller, om du bara vill testa på processor- eller OS-typ, använd variablerna DEB_HOST_ARCH_CPU eller DEB_HOST_ARCH_OS.

Observera att du även kan bero på att ett externt Makefile-utklipp sätter alla variabler dpkg-architecture kan tillhandahålla:

include /usr/share/dpkg/architecture.mk
ifeq ($(DEB_HOST_ARCH),alpha)
  [...]
endif

Oavsett bör du aldrig använda dpkg --print-architecture för att hämta arkitekturinformation när paketet byggs.

MILJÖVARIABLER

DPKG_DATADIR
If set, it will be used as the dpkg data directory, where the architecture tables are located (since dpkg 1.14.17). Defaults to «/usr/share/dpkg».

ANTECKNINGAR

De långa kommando- och flaggnamn är endast tillgängliga sedan dpkg 1.17.17.

SE ÄVEN

dpkg-buildpackage(1), dpkg-cross(1).

ÖVERSÄTTNING

Peter Krefting och Daniel Nylander.
2018-06-26 1.18.25