diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-05-30 08:57:34 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-05-31 14:31:02 +0100 |
commit | 21a919c821ad7c7e5dc29d4e8d4b9f9ca95c75bb (patch) | |
tree | 88e9d9c6dde989ed51dada58fe45b92c3be68f3b | |
parent | aa0f01f1cde42b2e65bfa9b34981860fc135f0d6 (diff) | |
download | poky-21a919c821ad7c7e5dc29d4e8d4b9f9ca95c75bb.tar.gz |
libucontext: Switch to meson build system
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
(From OE-Core rev: 6e186e75d62e1afabd19a339924b66eac1418274)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch | 49 | ||||
-rw-r--r-- | meta/recipes-core/musl/libucontext_git.bb | 18 |
2 files changed, 53 insertions, 14 deletions
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 index 0000000000..1fdc9f739d --- /dev/null +++ b/meta/recipes-core/musl/libucontext/0001-meson-Add-option-to-pass-cpu.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From a530eed9e7e6872e10fe92efaf1e9739471c30ca Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 30 May 2021 08:30:28 -0700 | ||
4 | Subject: [PATCH] meson: Add option to pass cpu | ||
5 | |||
6 | This helps with cross compile setups, where host_cpu != target_cpu | ||
7 | therefore detecting it on the fly will end up with wrong cpu to build | ||
8 | for | ||
9 | |||
10 | Upstream-Status: Submitted [https://github.com/kaniini/libucontext/pull/28] | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | meson.build | 6 +++++- | ||
14 | meson_options.txt | 4 +++- | ||
15 | 2 files changed, 8 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/meson.build b/meson.build | ||
18 | index e863780..2b4bdbd 100644 | ||
19 | --- a/meson.build | ||
20 | +++ b/meson.build | ||
21 | @@ -6,7 +6,11 @@ project( | ||
22 | version : run_command('head', files('VERSION')).stdout() | ||
23 | ) | ||
24 | |||
25 | -cpu = host_machine.cpu_family() | ||
26 | +cpu = get_option('cpu') | ||
27 | +if cpu == '' | ||
28 | + cpu = host_machine.cpu_family() | ||
29 | +endif | ||
30 | + | ||
31 | if cpu == 'sh4' | ||
32 | cpu = 'sh' | ||
33 | endif | ||
34 | diff --git a/meson_options.txt b/meson_options.txt | ||
35 | index d4201d1..864d83c 100644 | ||
36 | --- a/meson_options.txt | ||
37 | +++ b/meson_options.txt | ||
38 | @@ -1,4 +1,6 @@ | ||
39 | option('freestanding', type : 'boolean', value : false, | ||
40 | description: 'Do not use system headers') | ||
41 | option('export_unprefixed', type : 'boolean', value : true, | ||
42 | - description: 'Export POSIX 2004 ucontext names as alises') | ||
43 | \ No newline at end of file | ||
44 | + description: 'Export POSIX 2004 ucontext names as alises') | ||
45 | +option('cpu', type : 'string', value : '', | ||
46 | + description: 'Target CPU architecture for cross compile') | ||
47 | -- | ||
48 | 2.31.1 | ||
49 | |||
diff --git a/meta/recipes-core/musl/libucontext_git.bb b/meta/recipes-core/musl/libucontext_git.bb index 0b64867ce0..d8ae8242c5 100644 --- a/meta/recipes-core/musl/libucontext_git.bb +++ b/meta/recipes-core/musl/libucontext_git.bb | |||
@@ -11,7 +11,8 @@ DEPENDS = "" | |||
11 | PV = "1.1+${SRCPV}" | 11 | PV = "1.1+${SRCPV}" |
12 | SRCREV = "335ee864ef6f4a5d4b525453fd9dbfb3507cfecc" | 12 | SRCREV = "335ee864ef6f4a5d4b525453fd9dbfb3507cfecc" |
13 | SRC_URI = "git://github.com/kaniini/libucontext \ | 13 | SRC_URI = "git://github.com/kaniini/libucontext \ |
14 | " | 14 | file://0001-meson-Add-option-to-pass-cpu.patch \ |
15 | " | ||
15 | 16 | ||
16 | S = "${WORKDIR}/git" | 17 | S = "${WORKDIR}/git" |
17 | 18 | ||
@@ -49,16 +50,5 @@ def map_kernel_arch(a, d): | |||
49 | return a | 50 | return a |
50 | bb.error("cannot map '%s' to a linux kernel architecture" % a) | 51 | bb.error("cannot map '%s' to a linux kernel architecture" % a) |
51 | 52 | ||
52 | export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}" | 53 | EXTRA_OEMESON = "-Dcpu=${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}" |
53 | 54 | inherit meson | |
54 | CFLAGS += "-Iarch/${ARCH} -Iarch/common" | ||
55 | |||
56 | EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' LIBDIR='${base_libdir}'" | ||
57 | |||
58 | do_compile() { | ||
59 | oe_runmake ARCH=${ARCH} | ||
60 | } | ||
61 | |||
62 | do_install() { | ||
63 | oe_runmake ARCH="${ARCH}" DESTDIR="${D}" install | ||
64 | } | ||