]> code.ossystems Code Review - openembedded-core.git/commitdiff
libucontext: Switch to meson build system
authorKhem Raj <raj.khem@gmail.com>
Sun, 30 May 2021 15:57:34 +0000 (08:57 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 31 May 2021 13:29:40 +0000 (14:29 +0100)
cross compiling with meson is easier than the plain makefile build
method that libucontext has, there were bunch of problems passing
compiler and make variables, compounded by the fact that makefile
decided on some compiler flags internally and thought that cflags are
synthesized completely in makefile and not passed from environment like
OE is doing. As a result some features were not being compiled in e.g.
function name aliases were missing

meson, on the other hand is cleaner and we have to add a patch to
support cpu architecture on meson cmdline, everything else pretty much
works out of box

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch [new file with mode: 0644]
meta/recipes-core/musl/libucontext_git.bb

diff --git a/meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch b/meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch
new file mode 100644 (file)
index 0000000..1fdc9f7
--- /dev/null
@@ -0,0 +1,49 @@
+From a530eed9e7e6872e10fe92efaf1e9739471c30ca Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 30 May 2021 08:30:28 -0700
+Subject: [PATCH] meson: Add option to pass cpu
+
+This helps with cross compile setups, where host_cpu != target_cpu
+therefore detecting it on the fly will end up with wrong cpu to build
+for
+
+Upstream-Status: Submitted [https://github.com/kaniini/libucontext/pull/28]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ meson.build       | 6 +++++-
+ meson_options.txt | 4 +++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index e863780..2b4bdbd 100644
+--- a/meson.build
++++ b/meson.build
+@@ -6,7 +6,11 @@ project(
+   version : run_command('head', files('VERSION')).stdout()
+ )
+-cpu = host_machine.cpu_family()
++cpu = get_option('cpu')
++if cpu == ''
++  cpu = host_machine.cpu_family()
++endif
++
+ if cpu == 'sh4'
+   cpu = 'sh'
+ endif
+diff --git a/meson_options.txt b/meson_options.txt
+index d4201d1..864d83c 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -1,4 +1,6 @@
+ option('freestanding', type : 'boolean', value : false,
+        description: 'Do not use system headers')
+ option('export_unprefixed', type : 'boolean', value : true,
+-       description: 'Export POSIX 2004 ucontext names as alises')
+\ No newline at end of file
++       description: 'Export POSIX 2004 ucontext names as alises')
++option('cpu', type : 'string', value : '',
++       description: 'Target CPU architecture for cross compile')
+-- 
+2.31.1
+
index 0b64867ce0a5e2371fd7de3936eea3627ec8bfc5..d8ae8242c5b078ee91367cca2ecb5c24b7da1795 100644 (file)
@@ -11,7 +11,8 @@ DEPENDS = ""
 PV = "1.1+${SRCPV}"
 SRCREV = "335ee864ef6f4a5d4b525453fd9dbfb3507cfecc"
 SRC_URI = "git://github.com/kaniini/libucontext \
-"
+           file://0001-meson-Add-option-to-pass-cpu.patch \
+           "
 
 S = "${WORKDIR}/git"
 
@@ -49,16 +50,5 @@ def map_kernel_arch(a, d):
             return a
         bb.error("cannot map '%s' to a linux kernel architecture" % a)
 
-export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
-
-CFLAGS += "-Iarch/${ARCH} -Iarch/common"
-
-EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' LIBDIR='${base_libdir}'"
-
-do_compile() {
-    oe_runmake ARCH=${ARCH}
-}
-
-do_install() {
-    oe_runmake ARCH="${ARCH}" DESTDIR="${D}" install
-}
+EXTRA_OEMESON = "-Dcpu=${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
+inherit meson