New build-helper: qemu
This commit is contained in:
parent
387cf14520
commit
f4273541b8
|
@ -944,6 +944,11 @@ additional paths to be searched when linking target binaries to be introspected.
|
|||
`qemu-<target_arch>-static` when running the target binary. You can for example specify
|
||||
`GIR_EXTRA_OPTIONS="-strace"` to see a trace of what happens when running that binary.
|
||||
|
||||
- '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-<target_arch>-static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE`
|
||||
|
||||
<a id="functions"></a>
|
||||
### Functions
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
if [ "$CROSS_BUILD" ]; then
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
if [[ $hostmakedepends != *"qemu-user-static"* ]]; then
|
||||
hostmakedepends+=" qemu-user-static"
|
||||
fi
|
||||
fi
|
|
@ -2,7 +2,6 @@
|
|||
# This helper is for templates using cmake.
|
||||
#
|
||||
do_configure() {
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
local cmake_args=
|
||||
[ ! -d ${cmake_builddir:=build} ] && mkdir -p ${cmake_builddir}
|
||||
cd ${cmake_builddir}
|
||||
|
@ -51,7 +50,7 @@ _EOF
|
|||
cmake_args+=" -DCMAKE_INSTALL_LIBDIR=lib"
|
||||
fi
|
||||
|
||||
if [ "${hostmakedepends}" != "${hostmakedepends/qemu-user-static/}" ]; then
|
||||
if [[ $build_helper = *"qemu"* ]]; then
|
||||
echo "SET(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static)" \
|
||||
>> cross_${XBPS_CROSS_TRIPLET}.cmake
|
||||
fi
|
||||
|
@ -66,7 +65,6 @@ _EOF
|
|||
}
|
||||
|
||||
do_build() {
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
: ${make_cmd:=make}
|
||||
|
||||
cd ${cmake_builddir:=build}
|
||||
|
@ -94,7 +92,6 @@ do_check() {
|
|||
}
|
||||
|
||||
do_install() {
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
: ${make_cmd:=make}
|
||||
: ${make_install_target:=install}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ cpu_family = '${_MESON_CPU_FAMILY}'
|
|||
cpu = '${_MESON_TARGET_CPU}'
|
||||
endian = '${_MESON_TARGET_ENDIAN}'
|
||||
EOF
|
||||
if [ "${hostmakedepends}" != "${hostmakedepends/qemu-user-static/}" ]; then
|
||||
if [[ $build_helper = *"qemu"* ]]; then
|
||||
sed -e "/\[binaries\]/ a exe_wrapper = '/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static'" \
|
||||
-i ${meson_crossfile}
|
||||
fi
|
||||
|
@ -82,7 +82,6 @@ do_configure() {
|
|||
: ${meson_cmd:=meson}
|
||||
: ${meson_builddir:=build}
|
||||
: ${meson_crossfile:=xbps_meson.cross}
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
configure_args+=" --cross-file=${meson_crossfile}"
|
||||
|
@ -135,7 +134,6 @@ do_build() {
|
|||
: ${make_cmd:=ninja}
|
||||
: ${make_build_target:=all}
|
||||
: ${meson_builddir:=build}
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
|
||||
${make_cmd} -C ${meson_builddir} ${makejobs} ${make_build_args} ${make_build_target}
|
||||
}
|
||||
|
@ -152,7 +150,6 @@ do_install() {
|
|||
: ${make_cmd:=ninja}
|
||||
: ${make_install_target:=install}
|
||||
: ${meson_builddir:=build}
|
||||
export QEMU_LD_PREFIX=${XBPS_CROSS_BASE}
|
||||
|
||||
DESTDIR=${DESTDIR} ${make_cmd} -C ${meson_builddir} ${make_install_args} ${make_install_target}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue