Github messages for voidlinux
 help / color / mirror / Atom feed
From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] New build-helper: qemu
Date: Sat, 19 Oct 2019 18:53:37 +0200	[thread overview]
Message-ID: <20191019165337.ziG10ww9k-lWdvCOJ5nUWj8sXURyhXaM3E5Vvz5OG0c@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-15622@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

There is an updated pull request by Johnnynator against master on the void-packages repository

https://github.com/Johnnynator/void-packages build_helper_qemu
https://github.com/void-linux/void-packages/pull/15622

New build-helper: qemu


A patch file from https://github.com/void-linux/void-packages/pull/15622.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-build_helper_qemu-15622.patch --]
[-- Type: text/x-diff, Size: 13689 bytes --]

From c7756e80ebbb458d7426470527045dbc8bb27a7f Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:25:45 +0200
Subject: [PATCH 01/10] 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..f8928ed6851 100644
--- a/Manual.md
+++ b/Manual.md
@@ -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
 
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 a69f1631057ab322efda177e4d2954c7991aa538 Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:26:32 +0200
Subject: [PATCH 02/10] 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 6345f2b8d7b23a048893e07d4d53e8f3b58fc069 Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:26:48 +0200
Subject: [PATCH 03/10] 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 1287800f342d0aea7680b4a2e2022d1baf755e7a Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:27:06 +0200
Subject: [PATCH 04/10] 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 9bc52685e8c10597d894d8e7852c75dc31b194f5 Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:27:30 +0200
Subject: [PATCH 05/10] 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 d81330072a4b35c3bcb8d6e49abef205a3051f3b Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:27:55 +0200
Subject: [PATCH 06/10] 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 03409d471c31b49382cf4a79da5c59c1f08fc362 Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:28:13 +0200
Subject: [PATCH 07/10] 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 9b72ccae8986264bc63849a8fb17ce64a3500def Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:28:28 +0200
Subject: [PATCH 08/10] 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 fbbded2ff365620bbb33124ace77e080c0f21761 Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:28:47 +0200
Subject: [PATCH 09/10] 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 b3822dab3a7f89ca11fe5e6386528c92ef6640da Mon Sep 17 00:00:00 2001
From: John <johnz@posteo.net>
Date: Sat, 19 Oct 2019 15:29:09 +0200
Subject: [PATCH 10/10] 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.

  parent reply	other threads:[~2019-10-19 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-19 15:14 [PR PATCH] " voidlinux-github
2019-10-19 16:53 ` [PR PATCH] [Updated] " voidlinux-github
2019-10-19 16:53 ` voidlinux-github [this message]
2019-10-25 22:43 ` voidlinux-github
2019-10-25 22:59 ` [PR PATCH] [Merged]: " voidlinux-github

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191019165337.ziG10ww9k-lWdvCOJ5nUWj8sXURyhXaM3E5Vvz5OG0c@z \
    --to=voidlinux-github@inbox.vuxu.org \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).