diff options
author | Matoro Mahri <matoro_gentoo@matoro.tk> | 2023-11-25 23:32:02 -0500 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-12-07 13:00:23 +0000 |
commit | aa19bed00fa0eb61339b16cf23ce060120fcafb2 (patch) | |
tree | 36eef94b5e282ae10ae7b5028048e87df2706413 /eclass | |
parent | sys-fs/bcachefs-tools: add 1.3.5 (diff) | |
download | gentoo-aa19bed00fa0eb61339b16cf23ce060120fcafb2.tar.gz gentoo-aa19bed00fa0eb61339b16cf23ce060120fcafb2.tar.bz2 gentoo-aa19bed00fa0eb61339b16cf23ce060120fcafb2.zip |
llvm.eclass: add tuple -> LLVM_TARGETS translate function
To be used in support of dev-lang/rust under crossdev. Cross-compiled
rust needs LLVM with support for both host and destination targets.
Bug: https://bugs.gentoo.org/680652
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Closes: https://github.com/gentoo/gentoo/pull/33996
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/llvm.eclass | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass index 57faa48819db..1f3ff1f61c2d 100644 --- a/eclass/llvm.eclass +++ b/eclass/llvm.eclass @@ -174,6 +174,37 @@ get_llvm_prefix() { echo "${prefix}/usr/lib/llvm/$(get_llvm_slot "${@}")" } +# @FUNCTION: llvm_tuple_to_target +# @USAGE: [<tuple>] +# @DESCRIPTION: +# Translate a tuple into a target suitable for LLVM_TARGETS. +# Defaults to ${CHOST} if not specified. +llvm_tuple_to_target() { + debug-print-function ${FUNCNAME} "${@}" + + case ${1:-${CHOST}} in + aarch64*) echo "AArch64";; + amdgcn*) echo "AMDGPU";; + arc*) echo "ARC";; + arm*) echo "ARM";; + avr*) echo "AVR";; + bpf*) echo "BPF";; + csky*) echo "CSKY";; + loong*) echo "LoongArch";; + m68k*) echo "M68k";; + mips*) echo "Mips";; + msp430*) echo "MSP430";; + nvptx*) echo "NVPTX";; + powerpc*) echo "PowerPC";; + riscv*) echo "RISCV";; + sparc*) echo "Sparc";; + s390*) echo "SystemZ";; + x86_64*|i?86*) echo "X86";; + xtensa*) echo "Xtensa";; + *) die "Unknown LLVM target for tuple ${1:-${CHOST}}" + esac +} + # @FUNCTION: llvm_fix_clang_version # @USAGE: <variable-name>... # @DESCRIPTION: |