rpmbuild 配置文件
以 .spec
作为扩展名的文件,通常是软件包的 rpmbuild 构建配置文件,又称 rpmspec 配置文件。 RPM 打包工具会读取并解析 rpmspec 配置文件,用于构建软件包。
根据 RPM: Architecture-specific Dependencies, rpmbuild 工具主要提供了以下形式的宏判断语句,用于区分不同目标架构下的构建配置:
%ifarch xxxx
%ifnarch xxxx
%if "%{_arch}" == "x86_64"
%if "%{_target_cpu}" == "x86_64"
%if "%{__isa_name}" == "x86"
# Since rpm 4.6.0
%if "%{?_isa}" == "(x86_64)"
同时,rpmspec 配置文件内嵌的一些 Shell 脚本,也会使用一些基于 uname
命令的目标架构判断语句:
# Bash script in rpmspec
if [ "`/bin/uname -m`" = "x86_64" ]; then
if [ `uname -p` == "i386" ]; then
if [ "$(uname -i)" = "i386" ]; then
if [[ "$(uname -a)" =~ "x86" ]]; then
若项目的 rpmspec 配置文件中存在上述形式的语句,一般可以认为软件初步支持了多架构。
上述形式的语句可进一步分为以下类别:
ifarch/ifnarch 语句
%ifarch
和 %ifnarch
语句是由 rpm 工具提供的架构判断分支语句。该语句可使用的目标架构条件值参见 此表 的【架构名称】列。
除直接使用精确的目标架构名称外,也可使用 此表 中由 RPM 提供的架构相关系列宏,快速匹配更宽泛的目标架构。
以下列举几种常见的基于 %ifarch
/ %ifnarch
判断语句实现多架构支持的形式。
根据目标架构应用 Patch
指根据目标架构类型有选择地应用 Patch 补丁文件。
示例:kamailio 项目中根据目标架构选择性应用 Patch
- 项目地址:https://github.com/tsudot/kamailio
- 项目版本:github-ddf83621413a04b3f4b8182fbe97f5f0be38f8f8
- 相关文件:ser.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于
%ifarch
宏判断语句选择性应用 Patch 文件的用法。
该项目的 /pkg/ser/opensuse/ser.spec
文件中,针对 x86_64 架构选择性应用 Patch 文件 Makefile.defs.patch
。
# ==============================================================================
# https://github.com/tsudot/kamailio/blob/ddf83621413a04b3f4b8182fbe97f5f0be38f8f8/pkg/ser/opensuse/ser.spec#L17-L19
# 在目标架构为 x86_64 时应用 Patch 文件 Makefile.defs.patch
# ==============================================================================
%ifarch x86_64
Patch: Makefile.defs.patch
%endif
# ==============================================================================
# https://github.com/tsudot/kamailio/blob/ddf83621413a04b3f4b8182fbe97f5f0be38f8f8/pkg/ser/opensuse/ser.spec#L70-L72
# 在目标架构为 x86_64 时应用 Patch 文件
# ==============================================================================
%ifarch x86_64
%patch
%endif
# ==============================================================================
根据目标架构合成编译参数
指根据目标架构类型合成不同的编译参数。
示例:K2PBCM 项目中根据目标架构合成编译参数
- 项目地址:https://github.com/Beibeixi/K2PBCM
- 项目版本:github-906e81024c9343849bcc293a3b16ef0b0cd63fe6
- 相关文件:freeradius.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于
%ifarch
宏判断语句合成特定架构编译参数的用法。
该项目的 release/src/router/freeradius-server-3.0.0/suse/freeradius.spec
文件中,针对特定目标架构合成 C/C++ 编译参数。
# ==============================================================================
# https://github.com/Beibeixi/K2PBCM/blob/906e81024c9343849bcc293a3b16ef0b0cd63fe6/release/src/router/freeradius-server-3.0.0/suse/freeradius.spec#L130-L133
# 针对特定目标架构合成 C/C++ 编译参数
# ==============================================================================
export CFLAGS="$RPM_OPT_FLAGS"
%ifarch x86_64 ppc ppc64 s390 s390x
export CFLAGS="$CFLAGS -fPIC -DPIC"
%endif
# ==============================================================================
根据目标架构自定义宏或全局变量
指根据目标架构类型自定义 rpmbuild 宏或全局变量,并在其它位置对应的构建过程中使用。
示例:go-rpms ponylang refind-efi 项目中根据目标架构自定义宏或全局变量
- 项目地址: go-rpms, ponylang, refind-efi
- 项目版本: go-rpms:388f10d, ponylang:138e0e0, refind-efi:79ed85b
- 相关文件: go-rpms/go.spec, ponylang/.packaging/rpm/ponyc.spec, refind-efi/refind-alt.spec
- 简介:在这些项目的 rpmspec 配置文件中,出现了基于
%ifarch
宏判断语句自定义宏或全局变量的用法。
# ==============================================================================
# https://github.com/skottler/go-rpms/blob/388f10d4f4b4cec4e93f8da3b5e0a0b496e0413f/go.spec#L18-L23
# 针对特定目标架构定义全局变量 GOARCH
# ==============================================================================
%ifarch %ix86
%global GOARCH 386
%endif
%ifarch x86_64
%global GOARCH amd64
%endif
# ==============================================================================
# https://github.com/glen77777/ponylang/blob/eb5efd383ddde2e7425267fe44ed51013aaa2f4b/.packaging/rpm/ponyc.spec#L4-L6
# 针对特定目标架构定义全局变量 arch_build_args
# ==============================================================================
%ifarch x86_64
%global arch_build_args arch=x86-64 tune=intel
%endif
# ==============================================================================
# https://github.com/harryyoud/refind-efi/blob/79ed85b4dee4e6d8bc4068e7b9730acdaa0ff52e/refind-alt.spec#L22-L27
# 针对特定目标架构定义宏 _efi_arch
# ==============================================================================
%ifarch x86_64
%define _efi_arch x64
%endif
%ifarch %ix86
%define _efi_arch ia32
%endif
# ==============================================================================
根据目标架构切换不同第三方库依赖及其版本
指根据目标架构类型更改 rpmbuild 中的 BuildRequires 字段内容, 以达到根据不同目标架构切换不同第三方库依赖及其版本的目的。
示例:ONE 项目中根据目标架构切换第三方库依赖及版本
- 项目地址:ONE
- 项目版本:ONE:56f2e5b
- 相关文件:nnfw.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于
%ifarch
宏判断语句切换构建依赖及版本的用法。
该项目的 nnfw.spec
文件中,针对特定目标架构添加了第三方依赖 python3
及 libarmcl-devel
,其中后者指定了版本 >= 21.02
。
# ==============================================================================
# https://github.com/Samsung/ONE/blob/56f2e5b84224adf2474d584779b234f0be006cce/packaging/nnfw.spec#L53-L57
# 针对特定目标架构切换第三方库依赖及版本
# ==============================================================================
%ifarch %{arm} aarch64
# Require python for acl-ex library build pre-process
BuildRequires: python3
BuildRequires: libarmcl-devel >= v21.02
%endif
# ==============================================================================
示例:kiwi 项目中根据目标架构与操作系统的混合条件调整依赖
- 项目地址:kiwi
- 项目版本:kiwi:71e47f2
- 相关文件:kiwi.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于
%ifarch
宏判断和操作系统版本判断语句调整依赖的用法。
该项目的 rpm/kiwi.spec
文件中,针对 x86 架构 1010 版本以上的 SUSE 系统添加了 squashfs
依赖。
# ==============================================================================
# https://github.com/BackupTheBerlios/kiwi/blob/71e47f2c2e9184d28777d6a72ee2852fd3b6b509/rpm/kiwi.spec#L49-L53
# 针对特定目标架构和操作系统版本调整依赖
# ==============================================================================
%ifarch %ix86 x86_64
%if %{suse_version} > 1010
Requires: squashfs
%endif
%endif
# ==============================================================================
根据目标架构推荐弹性依赖
指根据目标架构类型修改 rpmbuild 配置的 Recommends 字段,以实现不同架构下推荐弹性依赖。
示例:livecd-tools 项目中根据目标架构推荐弹性依赖
- 项目地址:livecd-tools
- 项目版本:livecd-tools:71e47f2
- 相关文件:livecd-tools.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于
%ifarch
宏判断调整依赖的用法。
该项目的 rpm/livecd-tools.spec
文件中,针对 x86、ppc 架构推荐了弹性依赖 hfsplus-tools
。
# ==============================================================================
# https://github.com/OpenMandrivaAssociation/livecd-tools/blob/e6b660c4fc35234345e1386bdae8a1d02e0dcf49/livecd-tools.spec#L50-L52
# 针对特定目标架构推荐弹性依赖
# ==============================================================================
%ifarch %{ix86} %{x86_64} ppc ppc64
Recommends: hfsplus-tools
%endif
# ==============================================================================
rpm 工具架构相关内置宏
rpm 工具内置宏中,有一些是与目标平台架构相关的宏。
_arch
:目标架构名称,具体值参见 此表_target_cpu
:目标 CPU 类型,可选的返回值与uname -m
命令一致,具体值参见 此表_isa
:目标指令集架构,自 RPM 4.6.0 版本起引入,由 架构通用名称 (__isa_name
) 和 架构位数 (__isa_bits
) 两部分构成。_isa
宏将上述两者格式化为(arch-bits)
的形式。具体值参见 此表__isa_name
:目标指令集架构通用名称,具体值参见 此表
判断架构相关内置宏取值并执行不同操作
通过 %if
结构与 rpm 工具架构相关内置宏的结合,可以实现在不同目标架构下执行不同的构建操作。 以下分别给出了 4 种架构相关内置宏作为判断条件的用法。
示例:git-lfs 项目中使用 _arch
宏判断目标架构
- 项目地址:git-lfs
- 项目版本:git-lfs:4226abf
- 相关文件:git-lfs.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于 RPM 工具内置宏
_arch
判断目标架构的用法。
该项目的 rpm/SPECS/git-lfs.spec
文件中,通过 RPM 工具内置宏 _arch
判断目标架构,定义不同值的全局变量并执行 make 命令。
# ==============================================================================
# https://github.com/git-lfs/git-lfs/blob/4226abf8dc234c6f440c25d8d2f65449adf42b2b/rpm/SPECS/git-lfs.spec#L36-L40
# 通过 RPM 工具内置宏 _arch 判断目标架构,定义不同值的全局变量 GOARCH 并执行 make 命令
# ==============================================================================
%if "%{_arch}" == "i386"
GOARCH=386 FORCE_LOCALIZE=true make
%else
GOARCH=amd64 FORCE_LOCALIZE=true make
%endif
# ==============================================================================
示例:MEGAsync 项目中使用 _target_cpu
宏判断目标架构
- 项目地址:MEGAsync
- 项目版本:MEGAsync:b3be8ce
- 相关文件:megasync.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于 RPM 工具内置宏
_target_cpu
判断目标架构的用法。
该项目的 build/templates/MEGAsync/megasync.spec
文件中,通过 RPM 工具内置宏 _target_cpu
判断目标架构,定义不同值的全局变量并执行 make 命令。
# ==============================================================================
# https://github.com/meganz/MEGAsync/blob/b3be8ce21b733d9fc27b6b3da76dfbc3a41e5c85/build/templates/MEGAsync/megasync.spec#L141-L144
# 通过 RPM 工具内置宏 _target_cpu 判断目标架构,仅在 64 位架构下引入 pdfium-mega 依赖
# ==============================================================================
#Pdfium: required for 64 bits only
%if "%{_target_cpu}" != "i586" && "%{_target_cpu}" != "i686"
BuildRequires: pdfium-mega
%endif
# ==============================================================================
示例:yumda 项目中使用 _isa
宏判断目标架构
- 项目地址:yumda
- 项目版本:yumda:be448d7
- 相关文件:libjpeg-turbo.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于 RPM 工具内置宏
_isa
判断目标架构的用法。
该项目的 amazon-linux-2/build/specs/amzn2/libjpeg-turbo.spec
文件中,通过 RPM 工具内置宏 _isa
获取目标架构,若值不为空则生成额外的带目标指令集名称后缀的软件包。
# ==============================================================================
# https://github.com/lambci/yumda/blob/be448d790ced7777c31003797ebd08b3ada384a9/amazon-linux-2/build/specs/amzn2/libjpeg-turbo.spec#L27-L29
# 通过 RPM 工具内置宏 `_isa` 获取目标架构,若值不为空则生成额外的带目标指令集名称后缀的软件包
# ==============================================================================
%if "%{?_isa}" != ""
Provides: libjpeg%{_isa} = 6b-47%{?dist}
%endif
# ==============================================================================
示例:openSUSE 项目中使用 __isa_name
宏判断目标架构
- 项目地址:openSUSE
- 项目版本:openSUSE:faed089
- 相关文件:python38.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于 RPM 工具内置宏
_isa
判断目标架构的用法。
该项目的 packages/p/python38/python38.spec
文件中,通过 RPM 工具内置宏 __isa_name
获取目标指令集名称,若为 ppc 则特殊处理全局变量 archname 的值。
# ==============================================================================
# https://github.com/bmwiedemann/openSUSE/blob/faed089248bae5849f085cde719a1b8ee9a9a9a5/packages/p/python38/python38.spec#L72-L77
# 通过 RPM 工具内置宏 `__isa_name` 获取目标指令集名称,若为 ppc 则特殊处理全局变量 archname 的值
# ==============================================================================
# rpm and python have different ideas about what is an arch-dependent name, so:
%if "%{__isa_name}" == "ppc"
%define archname %(echo %{_arch} | sed s/ppc/powerpc/)
%else
%define archname %{_arch}
%endif
# ==============================================================================
根据架构相关内置宏取值引入不同版本依赖
在 rpmspec 配置文件的依赖和产出相关字段 (Requires
、BuildRequires
、Recommends
和 Provides
)中, 可以使用架构相关内置宏实现特定架构版本依赖的引入。
示例:yumda 项目中使用 _isa 宏引入 libicu 依赖
- 项目地址:yumda
- 项目版本:yumda:4823440
- 相关文件:icu.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于 RPM 工具内置宏
_isa
取值引入不同版本依赖的用法。
该项目的 amazon-linux-2/build/specs/lambda2/icu.spec
文件中,通过 RPM 工具内置宏 _isa
获取目标指令集名称,引入特定版本的 libicu 依赖。
# ==============================================================================
# https://github.com/lambci/yumda/blob/482344079fd925c39fd72027f63e8ad3218c7174/amazon-linux-2/build/specs/lambda2/icu.spec#L1-L2
# 指定主包名和版本
# ==============================================================================
Name: icu
Version: 50.2
# ==============================================================================
# https://github.com/lambci/yumda/blob/482344079fd925c39fd72027f63e8ad3218c7174/amazon-linux-2/build/specs/lambda2/icu.spec#L18
# 根据主包名、目标指令集名称和主包版本引入对应依赖 (libicu)
# ==============================================================================
Requires: lib%{name}%{?_isa} >= %{version}
# ==============================================================================
示例:systemtap 项目中使用 __isa_name 宏引入 glibc-devel 依赖
- 项目地址:systemtap
- 项目版本:systemtap:d6d8634
- 相关文件:systemtap.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于 RPM 工具内置宏
__isa_name
取值引入不同版本依赖的用法。
该项目的 systemtap.spec
文件中,通过 RPM 工具内置宏 __isa_name
获取目标指令集名称,引入特定版本的 glibc-devel 依赖。
# ==============================================================================
# https://github.com/jav/systemtap/blob/d6d8634e46c520ecdf5675f0590963497c206d4f/systemtap.spec#L219-L221
# 通过 __isa_name 宏引入对应指令集下的 glibc-devel 32 位版本依赖
# ==============================================================================
%if %{_arch} == x86_64
Requires: glibc-devel(%{__isa_name}-32)
%endif
# ==============================================================================
内嵌 Shell 脚本
rpmspec 配置文件中,可以内嵌一些 Shell 脚本,由 rpm 工具按照需要代为执行。 Shell 脚本中可以获取并判断当前执行环境的架构,通常是采用 uname
命令完成的。 关于 uname
命令的具体细节,参见 通过系统命令 uname 获取主机架构信息
通过内嵌的 Shell 脚本,spec 文件可以在不同阶段执行相应的外部任务,任务类型主要可分为 构造编译参数 和 执行特定命令 两种。
根据目标架构构造编译参数
指通过内嵌 Shell 脚本获得的架构相关信息,针对目标架构构造特定编译参数。
示例:mupen64plus 项目中通过内嵌 Shell 脚本获取架构相关信息构造编译参数
- 项目地址:rpm-specs
- 项目版本:rpm-specs:7224a58
- 相关文件:mupen64plus.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于内嵌 Shell 脚本(
uname
命令)获取架构相关信息构造编译参数的用法。
该项目的 rpm-specs/mupen64plus.spec
文件中,通过 uname
命令获取的目标架构信息构造特定的编译参数。
# ==============================================================================
# https://github.com/hrnciar/rpm-specs/blob/7224a58f5ff3a0f6879313766965c49c91250010/rpm-specs/mupen64plus.spec#L66-L74
# 通过内嵌 uname 命令,针对特定目标架构构造编译参数
# ==============================================================================
# Architecture build flags
ADDITIONAL_FLAGS=""
if [[ "$(uname -m)" = arm* ]] ; then
ADDITIONAL_FLAGS="NEON=1 VFP_HARD=1 NO_SSE=1"
elif [[ "$(uname -m)" = aarch64 ]] ; then
ADDITIONAL_FLAGS="NO_SSE=1"
elif [[ "$(uname -m)" = ppc* ]] ; then
ADDITIONAL_FLAGS="NO_SSE=1"
fi
# ==============================================================================
根据目标架构执行特定命令
指通过内嵌 Shell 脚本获得的架构相关信息,针对目标架构执行特定命令。
示例:lafarga-subversion 项目中通过内嵌 Shell 脚本获取架构相关信息执行特定命令
- 项目地址:https://github.com/guifi/lafarga-subversion
- 项目版本:lafarga-subversion:808013e
- 相关文件:guifi-proxy-passwd.spec
- 简介:在该项目的 rpmspec 配置文件中,出现了基于
uname -i
命令的目标架构判断语句。
该项目的 /tools/packaging/redhat/rpmbuild/SPECS/guifi-proxy-passwd.spec
文件是一个 rpmspec 配置文件,其中出现了基于 uname -i
命令的目标架构判断语句。
# ==============================================================================
# https://github.com/guifi/lafarga-subversion/blob/808013eb543ca993e44803e3b3f98034b7dc853f/tools/packaging/redhat/rpmbuild/SPECS/guifi-proxy-passwd.spec#L44-L49
# 通过内嵌 uname 命令,针对特定目标架构执行特定命令
# ==============================================================================
if [ "$(uname -i)" = "i386" ]; then
ln -s %{buildroot}/usr/lib/squid/ncsa_auth %{buildroot}/usr/sbin/guifi_passwd_auth
fi
if [ "$(uname -i)" = "x86_64" ]; then
ln -s /usr/lib64/squid/ncsa_auth /usr/sbin/guifi_passwd_auth
fi
# ==============================================================================
附录:_arch 宏具体值与架构对应关系
本表数据提取自 rpm/rpmrc.in
架构名称 | _arch 宏对应值 | RPM 内部枚举值 |
---|---|---|
athlon | athlon | 1 |
geode | geode | |
pentium4 | pentium4 | |
pentium3 | pentium3 | |
i686 | i686 | |
i586 | i586 | |
i486 | i486 | |
i386 | i386 | |
x86_64 | x86_64 | |
amd64 | amd64 | |
ia32e | ia32e | |
em64t | em64t | |
alpha | alpha | 2 |
alphaev5 | alphaev5 | |
alphaev56 | alphaev56 | |
alphapca56 | alphapca56 | |
alphaev6 | alphaev6 | |
alphaev67 | alphaev67 | |
sparc64 | sparc64 | |
sun4u | ||
sparc64v | sparc64v | |
sparc | sparc | 3 |
sun4 | ||
sun4m | ||
sun4c | ||
sun4d | ||
sparcv8 | sparcv8 | |
sparcv9 | sparcv9 | |
sparcv9v | sparcv9v | |
mips | mips | 4 |
mipsel | mipsel | |
ppc | ppc | 5 |
ppc8260 | ppc8260 | |
ppc8560 | ppc8560 | |
ppc32dy4 | ppc32dy4 | |
ppciseries | ppciseries | |
ppcpseries | ppcpseries | |
m68k | m68k | 6 |
IP | sgi | 7 |
rs6000 | rs6000 | 8 |
ia64 | ia64 | 9 |
mips64 | mips64 | 11 |
mips64el | mips64el | |
armv3l | armv3l | 12 |
armv4b | armv4b | |
armv4l | armv4l | |
armv5tl | armv5tl | |
armv5tel | armv5tel | |
armv5tejl | armv5tejl | |
armv6l | armv6l | |
armv6hl | armv6hl | |
armv7l | armv7l | |
armv7hl | armv7hl | |
armv7hnl | armv7hnl | |
armv8l | armv8l | |
armv8hl | armv8hl | |
m68kmint | m68kmint | 13 |
atarist | ||
atariste | ||
ataritt | ||
falcon | ||
atariclone | ||
milan | ||
hades | ||
s390 | s390 | 14 |
i370 | i370 | |
s390x | s390x | 15 |
ppc64 | ppc64 | 16 |
ppc64le | ppc64le | |
ppc64pseries | ppc64pseries | |
ppc64iseries | ppc64iseries | |
ppc64p7 | ppc64p7 | |
sh | sh | 17 |
sh3 | sh3 | |
sh4 | sh4 | |
sh4a | sh4a | |
xtensa | xtensa | 18 |
aarch64 | aarch64 | 19 |
mipsr6 | mipsr6 | 20 |
mipsr6el | mipsr6el | |
mips64r6 | mips64r6 | 21 |
mips64r6el | mips64r6el | |
riscv | riscv64 | 22 |
riscv64 | ||
loongarch64 | loongarch64 | 23 |
附录:rpm 提供的其它架构相关宏
以下列举的是 RPM 工具提供的其它架构相关宏(arch macro)。这些宏将一些架构的子架构聚合在一起, 可用于在 %ifarch
和 %ifnarch
语句中判断更宽泛的目标架构。
本表数据提取自 rpm/macros.in
宏名称 | 展开后与 _arch 宏对应值 |
---|---|
%alpha | alpha , alphaev56 , alphaev6 , alphaev67 |
%arm | %{arm32} |
%arm32 | armv3l , armv4b , armv4l , armv4tl , armv5tl , armv5tel , armv5tejl , armv6l , armv6hl , armv7l , armv7hl , armv7hnl , armv8l , armv8hl , armv8hnl , armv8hcnl |
%arm64 | aarch64 |
%ix86 | i386 , i486 , i586 , i686 , pentium3 , pentium4 , athlon , geode |
%loongarch64 | loongarch64 |
%mips | %{mips32} , %{mips64} |
%mips32 | mips , mipsel , mipsr6 , mipsr6el |
%mips64 | mips64 , mips64el , mips64r6 , mips64r6el |
%mipseb | mips , mipsr6 , mips64 , mips64r6 |
%mipsel | mipsel , mipsr6el , mips64el , mips64r6el |
%power64 | ppc64 , ppc64p7 , ppc64le |
%riscv | %{riscv32} , %{riscv64} , %{riscv128} |
%riscv128 | riscv128 |
%riscv32 | riscv32 |
%riscv64 | riscv64 |
%sparc | sparc , sparcv8 , sparcv9 , sparcv9v , sparc64 , sparc64v |
附录:Linux Kernel 目前已支持的架构名
以下列举的是 Linux Kernel 主线版本已支持的硬件架构名称,这些名称为 uname -m
命令所有可选的返回值。
本表数据提取自 Linux Kernel 6.1-rc1
主架构名称 | uname -m 可选的返回值 |
---|---|
alpha | alpha |
arc | arc |
arm | arm |
arm64 | arm64 , aarch64 , aarch64_be , armv8b (compat) , armv8l (compat) |
csky | csky |
hexagon | hexagon |
ia64 | ia64 |
loongarch | loongarch , loongarch64 |
m68k | m68k |
microblaze | microblaze |
mips | mips , mips64 |
nios2 | nios2 |
openrisc | openrisc |
parisc | parisc , parisc64 |
powerpc | powerpc , ppc (compat) , ppcle (compat) |
riscv | riscv , riscv32 , riscv64 |
s390 | s390 , s390x |
sh | sh |
sparc | sparc , sparc64 |
um | um |
x86 | x86 , i386 , x86_64 , i686 (compat) |
xtensa | xtensa |
附录:RPM ISA 宏的可选值
以下列举的是 RPM 工具的内置宏 _isa
在各种架构下的可选值。_isa
宏遵循 (arch-bits)
的固定格式, 其中 arch
是指令集架构通用名称,可通过宏 __isa_name
的值获得; bits
是指令集架构位数,可通过宏 __isa_bits
的值获得。
本表数据提取自 rpm/installplatform
__isa_name 宏的可选值 | 对应 __isa_bits 宏的可选值 | 对应 _isa 宏的可选值 |
---|---|---|
aarch | 64 | (aarch-64) |
alpha | 64 | (alpha-64) |
armv7hl | 32 | (armv7hl-32) |
ia | 64 | (ia-64) |
loongarch64 | 64 | (loongarch64-64) |
m68k | 32 | (m68k-32) |
mips | 32 , 64 | (mips-32) , (mips-64) |
mipsr6 | 32 , 64 | (mipsr6-32) , (mipsr6-64) |
ppc | 32 , 64 | (ppc-32) , (ppc-64) |
riscv | 64 | (riscv-64) |
s390 | 32 , 64 | (s390-32) , (s390-64) |
sh | 32 | (sh-32) |
sparc | 32 , 64 | (sparc-32) , (sparc-64) |
x86 | 32 , 64 | (x86-32) , (x86-64) |