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.
This commit is contained in:
Érico Rolim 2020-06-13 19:00:05 -03:00 committed by Danh Doan
parent d5ca039278
commit 813d893710
2 changed files with 11 additions and 1 deletions

View file

@ -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 - `qemu` sets additional variables for the `cmake` and `meson` build styles to allow
executing cross-compiled binaries inside qemu. executing cross-compiled binaries inside qemu.
It sets `CMAKE_CROSSCOMPILING_EMULATOR` for cmake and `exe_wrapper` for meson It sets `CMAKE_CROSSCOMPILING_EMULATOR` for cmake and `exe_wrapper` for meson
to `qemu-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE` to `qemu-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE`.
It also creates the `vtargetrun` function to wrap commands in a call to
`qemu-<target_arch>-static` for the target architecture.
- `qmake` creates the `qt.conf` configuration file (cf. `qmake` `build_style`) - `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. needed for cross builds and a qmake-wrapper to make `qmake` use this configuration.

View file

@ -4,3 +4,11 @@ if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" qemu-user-static" hostmakedepends+=" qemu-user-static"
fi fi
fi fi
vtargetrun() {
if [ "$CROSS_BUILD" ]; then
"/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static" "$@"
else
"$@"
fi
}