waf supports executing binaries via a wrapper for cross-compiling. This
may already be handled by a QEMU outside this environment if binfmt_misc
has been used with the F flag, and we cannot add a cross-only dependency
on QEMU. For these reasons, this sets the prefix using QEMU_LD_PREFIX
rather adding QEMU's -L arg to the --cross-execute option, and it checks whether QEMU is present before trying to use it.
I have used this to cross-compile Samba and its waf-based dependencies.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
On Fri, 09 May 2025, James Le Cuirot wrote:
--- /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
+}
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 18:01:25 |
Calls: | 9,487 |
Calls today: | 6 |
Files: | 13,617 |
Messages: | 6,121,091 |