From 813d893710fe6e9cad204611c7d5bec5378e9704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Sat, 13 Jun 2020 19:00:05 -0300 Subject: [PATCH] common/build-helper/qemu.sh: add vtargetrun function. It's a function to call the qemu executable for the target arch, or a noop if the build isn't a cross build. --- Manual.md | 4 +++- common/build-helper/qemu.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Manual.md b/Manual.md index a2e43334b9d..be28d89e566 100644 --- a/Manual.md +++ b/Manual.md @@ -970,7 +970,9 @@ additional paths to be searched when linking target binaries to be introspected. - `qemu` sets additional variables for the `cmake` and `meson` build styles to allow executing cross-compiled binaries inside qemu. It sets `CMAKE_CROSSCOMPILING_EMULATOR` for cmake and `exe_wrapper` for meson -to `qemu--static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE` +to `qemu--static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE`. +It also creates the `vtargetrun` function to wrap commands in a call to +`qemu--static` for the target architecture. - `qmake` creates the `qt.conf` configuration file (cf. `qmake` `build_style`) needed for cross builds and a qmake-wrapper to make `qmake` use this configuration. diff --git a/common/build-helper/qemu.sh b/common/build-helper/qemu.sh index f7a1839cc3e..d6a4342f5e8 100644 --- a/common/build-helper/qemu.sh +++ b/common/build-helper/qemu.sh @@ -4,3 +4,11 @@ if [ "$CROSS_BUILD" ]; then hostmakedepends+=" qemu-user-static" fi fi + +vtargetrun() { + if [ "$CROSS_BUILD" ]; then + "/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static" "$@" + else + "$@" + fi +}