public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/2] sysroot.eclass: New eclass for using a different sysroot
@ 2025-05-09 17:31 James Le Cuirot
  2025-05-09 17:31 ` [gentoo-dev] [PATCH 2/2] waf-utils.eclass: Set up QEMU when cross-compiling James Le Cuirot
  2025-05-09 18:29 ` [gentoo-dev] [PATCH 1/2] sysroot.eclass: New eclass for using a different sysroot Ulrich Müller
  0 siblings, 2 replies; 4+ messages in thread
From: James Le Cuirot @ 2025-05-09 17:31 UTC (permalink / raw
  To: gentoo-dev; +Cc: James Le Cuirot

This only has one function for now, but I intend to add a general
purpose sysroot wrapper script for use with Meson, Perl, and more. It
just needs longer in the oven.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/sysroot.eclass | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 eclass/sysroot.eclass

diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass
new file mode 100644
index 000000000000..73722154564a
--- /dev/null
+++ b/eclass/sysroot.eclass
@@ -0,0 +1,34 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: sysroot.eclass
+# @MAINTAINER:
+# cross@gentoo.org
+# @AUTHOR:
+# James Le Cuirot <chewi@gentoo.org>
+# @SUPPORTED_EAPIS: 8
+# @BLURB: Common functions for using a different sysroot (e.g. cross-compiling)
+
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+# @FUNCTION: qemu_arch
+# @DESCRIPTION:
+# Return the QEMU architecture name for the current CHOST. This name is used in
+# qemu-user binary filenames, e.g. qemu-ppc64le.
+qemu_arch() {
+	case "${CHOST}" in
+		armeb*) echo armeb ;;
+		arm*) echo arm ;;
+		hppa*) echo hppa ;;
+		i?86*) echo i386 ;;
+		mips64el*) [[ ${ABI} == n32 ]] && echo mipsn32el || echo mips64el ;;
+		mips64*) [[ ${ABI} == n32 ]] && echo mipsn32 || echo mips64 ;;
+		powerpc64le*) echo ppc64le ;;
+		powerpc64*) echo ppc64 ;;
+		powerpc*) echo ppc ;;
+		*) echo "${CHOST%%-*}" ;;
+	esac
+}
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-09 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09 17:31 [gentoo-dev] [PATCH 1/2] sysroot.eclass: New eclass for using a different sysroot James Le Cuirot
2025-05-09 17:31 ` [gentoo-dev] [PATCH 2/2] waf-utils.eclass: Set up QEMU when cross-compiling James Le Cuirot
2025-05-09 18:23   ` James Le Cuirot
2025-05-09 18:29 ` [gentoo-dev] [PATCH 1/2] sysroot.eclass: New eclass for using a different sysroot Ulrich Müller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox