From 51593136be774563ec57407df751b2fc8b311f0c Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:25:45 +0200 Subject: [PATCH 01/11] New build-helper: qemu --- Manual.md | 5 +++++ common/build-helper/qemu.sh | 6 ++++++ common/build-style/cmake.sh | 5 +---- common/build-style/meson.sh | 5 +---- 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 common/build-helper/qemu.sh diff --git a/Manual.md b/Manual.md index d29afbd2cce..1fb2a592db9 100644 --- a/Manual.md +++ b/Manual.md @@ -944,6 +944,11 @@ additional paths to be searched when linking target binaries to be introspected. `qemu--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--static` + ### Functions diff --git a/common/build-helper/qemu.sh b/common/build-helper/qemu.sh new file mode 100644 index 00000000000..f7a1839cc3e --- /dev/null +++ b/common/build-helper/qemu.sh @@ -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 diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh index 083a3bf5ff0..233551b35c3 100644 --- a/common/build-style/cmake.sh +++ b/common/build-style/cmake.sh @@ -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} diff --git a/common/build-style/meson.sh b/common/build-style/meson.sh index d318978ea59..73d4fd6ab54 100644 --- a/common/build-style/meson.sh +++ b/common/build-style/meson.sh @@ -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} } From 29a14385f2cc75e527d44aec2c7927161695f0aa Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:26:32 +0200 Subject: [PATCH 02/11] PrusaSlicer: change to qemu build helper --- srcpkgs/PrusaSlicer/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/PrusaSlicer/template b/srcpkgs/PrusaSlicer/template index 12eb7ff742b..b517d825b4f 100644 --- a/srcpkgs/PrusaSlicer/template +++ b/srcpkgs/PrusaSlicer/template @@ -4,6 +4,7 @@ version=2.0.0 revision=2 wrksrc="PrusaSlicer-version_${version}" build_style=cmake +build_helper="qemu" configure_args="-DSLIC3R_WX_STABLE=1 -DSLIC3R_FHS=1" hostmakedepends="pkg-config" makedepends="boost-devel tbb-devel libcurl-devel nlopt-devel gtest-devel @@ -15,10 +16,6 @@ homepage="https://www.prusa3d.com/prusaslicer/" distfiles="https://github.com/prusa3d/Prusaslicer/archive/version_${version}.tar.gz" checksum=5d3c7fd745f2875be55f316cd779805ce1b6ce38634f0f4b0ccd01884da731b3 -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - Slic3rPE_package() { build_style=meta depends="${sourcepkg}>=${version}_${revision}" From ca541344febe13f9abbc9f25a75c36c4101c82ed Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:26:48 +0200 Subject: [PATCH 03/11] awesome: change to qemu build helper --- srcpkgs/awesome/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/awesome/template b/srcpkgs/awesome/template index 3436157728a..3f559ea1f87 100644 --- a/srcpkgs/awesome/template +++ b/srcpkgs/awesome/template @@ -3,6 +3,7 @@ pkgname=awesome version=4.3 revision=4 build_style=cmake +build_helper="qemu" configure_args="-DSYSCONFDIR=/etc" conf_files="/etc/xdg/awesome/rc.lua" hostmakedepends="ruby-asciidoctor ImageMagick lgi lua pkg-config xmlto" @@ -18,10 +19,6 @@ homepage="http://awesomewm.org" distfiles="https://github.com/awesomeWM/awesome/releases/download/v${version}/awesome-${version}.tar.xz" checksum=78264d6f012350b371e339127aca485260bc0aa935eff578ba75ce1a00e11753 -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - pre_configure() { # Russian manpages fail to build. vsed -i -e "s|es fr de ru|es fr de|g" CMakeLists.txt From 036f6a95e721b5a4ff9b97ba2169d5163903ce5a Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:27:06 +0200 Subject: [PATCH 04/11] ckmame: change to qemu build helper --- srcpkgs/ckmame/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/ckmame/template b/srcpkgs/ckmame/template index 5c34fd395dc..1a035556223 100644 --- a/srcpkgs/ckmame/template +++ b/srcpkgs/ckmame/template @@ -4,6 +4,7 @@ version=1.0 revision=1 wrksrc=${pkgname}-rel-${version//./-} build_style=cmake +build_helper=qemu hostmakedepends="pkg-config" makedepends="libxml2-devel libzip-devel sqlite-devel" short_desc="Program to check ROM sets for MAME" @@ -13,10 +14,6 @@ homepage="https://nih.at/ckmame/" distfiles="https://github.com/nih-at/ckmame/archive/rel-${version//./-}.tar.gz>${pkgname}-${version}.tar.gz" checksum=9fc5dcf1d2dd75351b2cdf43ce10fecda7d97c8c1a8dd0fe1f653229bb316130 -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - post_install() { vlicense ${wrksrc}/LICENSE } From 4c5f2e72c7a36918b5f53c604b51a0cd157b78e9 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:27:30 +0200 Subject: [PATCH 05/11] gnome-todo: change to qemu build helper --- srcpkgs/gnome-todo/template | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/srcpkgs/gnome-todo/template b/srcpkgs/gnome-todo/template index 1ab0a81432d..fb7d71b9359 100644 --- a/srcpkgs/gnome-todo/template +++ b/srcpkgs/gnome-todo/template @@ -3,7 +3,7 @@ pkgname=gnome-todo version=3.28.1 revision=5 build_style=meson -build_helper="gir" +build_helper="gir qemu" configure_args="-Dintrospection=$(vopt_if gir true false)" hostmakedepends="glib-devel intltool itstool pkg-config $(vopt_if gir 'gobject-introspection')" @@ -16,9 +16,5 @@ distfiles="${GNOME_SITE}/${pkgname}/${version%.*}/${pkgname}-${version}.tar.xz" checksum=c7571fc040d8901dd0e528282ef0655687f23f29d304057c72548ab3e2c2cf23 patch_args="-Np1" -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - build_options="gir" build_options_default="gir" From cd91f5a2fe09fa8469e13e619666a83b640b371a Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:27:55 +0200 Subject: [PATCH 06/11] icinga2: change to qemu build helper --- srcpkgs/icinga2/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/icinga2/template b/srcpkgs/icinga2/template index d985d3b8f87..37a60afbb1a 100644 --- a/srcpkgs/icinga2/template +++ b/srcpkgs/icinga2/template @@ -3,6 +3,7 @@ pkgname=icinga2 version=2.9.3 revision=1 build_style=cmake +build_helper="qemu" configure_args="-DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_INSTALL_LOCALSTATEDIR=/var -DICINGA2_RUNDIR=/run -DICINGA2_PLUGINDIR=/usr/lib/monitoring-plugins/" @@ -24,10 +25,6 @@ system_accounts="icinga" system_groups="icingacmd" icinga_groups="icingacmd" -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - post_install() { vsv icinga2 # remove useless files From a2f79091a6811deda438a10815253068f6dbb8cd Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:28:13 +0200 Subject: [PATCH 07/11] neovim: change to qemu build helper --- srcpkgs/neovim/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/neovim/template b/srcpkgs/neovim/template index 8022cf1f218..ec178497e0b 100644 --- a/srcpkgs/neovim/template +++ b/srcpkgs/neovim/template @@ -3,6 +3,7 @@ pkgname=neovim version=0.4.2 revision=1 build_style=cmake +build_helper="qemu" hostmakedepends="pkg-config gperf LuaJIT lua51-lpeg lua51-mpack" makedepends="libtermkey-devel libuv-devel libvterm-devel msgpack-devel LuaJIT-devel libluv-devel" @@ -22,10 +23,6 @@ alternatives=" vim:vim:/usr/bin/nvim vim:vim.1:/usr/share/man/man1/nvim.1" -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - pre_configure() { vsed -i runtime/CMakeLists.txt \ -e "s|\".*/bin/nvim|\${CMAKE_CROSSCOMPILING_EMULATOR} &|g" From 04dd0d0b2e7f9a1990ef006fbac4300fa009183b Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:28:28 +0200 Subject: [PATCH 08/11] swi-prolog: change to qemu build helper --- srcpkgs/swi-prolog/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/swi-prolog/template b/srcpkgs/swi-prolog/template index 3f410aa1a5b..b2e2dabf9cf 100644 --- a/srcpkgs/swi-prolog/template +++ b/srcpkgs/swi-prolog/template @@ -4,6 +4,7 @@ version=8.0.3 revision=1 wrksrc="swipl-${version}" build_style=cmake +build_helper="qemu" configure_args="-DBUILD_TESTING=OFF" hostmakedepends="pkg-config" makedepends="gmp-devel libXft-devel libXinerama-devel libXpm-devel libXt-devel @@ -20,7 +21,3 @@ checksum=cee59c0a477c8166d722703f6e52f962028f3ac43a5f41240ecb45dbdbe2d6ae case "$XBPS_TARGET_MACHINE" in armv*) broken="https://travis-ci.org/void-linux/void-packages/jobs/510224384";; esac - -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi From 04c34aa3abf8cd99bab3ab450c07685ce1005a1a Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:28:47 +0200 Subject: [PATCH 09/11] zynaddsubfx: change to qemu build helper --- srcpkgs/zynaddsubfx/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/zynaddsubfx/template b/srcpkgs/zynaddsubfx/template index 9b6a264d10e..7e2da76b39b 100644 --- a/srcpkgs/zynaddsubfx/template +++ b/srcpkgs/zynaddsubfx/template @@ -3,6 +3,7 @@ pkgname=zynaddsubfx version=3.0.5 revision=1 build_style=cmake +build_helper=qemu configure_args="-DDefaultOutput=jack -DDefaultInput=jack -DGuiModule=fltk" hostmakedepends="doxygen fltk pkg-config" makedepends="fltk-devel fftw-devel liblo-devel libXpm-devel mxml-devel @@ -15,10 +16,6 @@ homepage="http://zynaddsubfx.sourceforge.net/" distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}/${version}/${pkgname}-${version}.tar.bz2" checksum=7447322268114a1e0ac5f281ac37a09a78e761a7be61999caf79100049789f63 -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - pre_configure() { # The x86 assembler check is broken for cross compiling case "$XBPS_TARGET_MACHINE" in From 1344f69893b1da4141d30aaf1b648134ede449c1 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 15:29:09 +0200 Subject: [PATCH 10/11] osg: change to qemu build helper [ci skip] --- srcpkgs/osg/template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/srcpkgs/osg/template b/srcpkgs/osg/template index 77b630d37fd..50e72276d94 100644 --- a/srcpkgs/osg/template +++ b/srcpkgs/osg/template @@ -5,6 +5,7 @@ version=3.4.1 revision=10 wrksrc=OpenSceneGraph-OpenSceneGraph-${version} build_style=cmake +build_helper="qemu" # don't use /usr/lib64 on 64bit platforms configure_args="-DLIB_POSTFIX= $(vopt_if qt '-DOSG_USE_QT=1' '-DOSG_USE_QT=0')" hostmakedepends="pkg-config unzip xrandr" @@ -23,10 +24,6 @@ homepage="http://www.openscenegraph.org" distfiles="https://github.com/openscenegraph/OpenSceneGraph/archive/OpenSceneGraph-${version}.tar.gz" checksum=930eb46f05781a76883ec16c5f49cfb29a059421db131005d75bec4d78401fd5 -if [ "$CROSS_BUILD" ]; then - hostmakedepends+=" qemu-user-static" -fi - # Append CFLAGS and CXXFLAGS to set work around code which gcc6 would # otherwise regard as out-of-specification and allow it to produce a # working program. From 2e7127a43ca5f61a32810db92797f35acbf7c801 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 19 Oct 2019 17:12:39 +0200 Subject: [PATCH 11/11] fixup! New build-helper: qemu --- Manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Manual.md b/Manual.md index 1fb2a592db9..f8928ed6851 100644 --- a/Manual.md +++ b/Manual.md @@ -947,7 +947,7 @@ 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` +to `qemu--static` and `QEMU_LD_PREFIX` to `XBPS_CROSS_BASE` ### Functions