I also intend to add another wrapper script generation function for
running executables while changing the root directory.
Signed-off-by: James Le Cuirot <
[email protected]>
---
eclass/sysroot.eclass | 85 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 eclass/sysroot.eclass
diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass
new file mode 100644
index 0000000000000..14f1d251b773d
--- /dev/null
+++ b/eclass/sysroot.eclass
@@ -0,0 +1,85 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: sysroot.eclass
+# @MAINTAINER:
+#
[email protected]
+# @AUTHOR:
+# James Le Cuirot <
[email protected]>
+# @SUPPORTED_EAPIS: 7 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 given target or CHOST. This name is
+# used in qemu-user binary filenames, e.g. qemu-ppc64le.
+qemu_arch() {
+ local target=${1:-${CHOST}}
+ case ${target} in
+ a