public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: matoro <matoro_mailinglist_gentoo-dev@matoro.tk>
To: Gentoo Dev <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] [PATCH v2] llvm.eclass: add tuple -> LLVM_TARGETS translate function
Date: Sun, 26 Nov 2023 12:42:01 -0500	[thread overview]
Message-ID: <c91e835f05cb079d7530ed34467ed946@matoro.tk> (raw)

https://github.com/gentoo/gentoo/pull/33996

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>
---
  eclass/llvm.eclass | 31 +++++++++++++++++++++++++++++++
  1 file changed, 31 insertions(+)

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:
-- 
2.42.1



                 reply	other threads:[~2023-11-26 17:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c91e835f05cb079d7530ed34467ed946@matoro.tk \
    --to=matoro_mailinglist_gentoo-dev@matoro.tk \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox