summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2019-11-05 23:08:31 +0100
committerArmin Kuster <akuster808@gmail.com>2019-11-10 14:46:34 -0800
commit1913e688ad95d465e9b9d16ad57f2bdef2b50d93 (patch)
treeea811072b7fd8ffe14d263294b07c877b258a42b
parent03b303dbc92521606ff4051bd253f8acc01fd9e5 (diff)
downloadopenembedded-core-contrib-1913e688ad95d465e9b9d16ad57f2bdef2b50d93.tar.gz
meson: Backport patch to handle strings in cross file args
This allows <language>_args and <language>_link_args properties, e.g., c_link_args, in meson.cross to be specified as either a string or a list. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/recipes-devtools/meson/meson.inc1
-rw-r--r--meta/recipes-devtools/meson/meson/0001-Handle-strings-in-cross-file-args.-Closes-4671.patch87
2 files changed, 88 insertions, 0 deletions
diff --git a/meta/recipes-devtools/meson/meson.inc b/meta/recipes-devtools/meson/meson.inc
index bfe9851e94..ef26848498 100644
--- a/meta/recipes-devtools/meson/meson.inc
+++ b/meta/recipes-devtools/meson/meson.inc
@@ -17,6 +17,7 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
file://many-cross.patch \
file://cross-libdir.patch \
file://0001-Fix-missing-return-statements-that-are-seen-with-Wer.patch \
+ file://0001-Handle-strings-in-cross-file-args.-Closes-4671.patch \
"
SRC_URI[sha256sum] = "ef9f14326ec1e30d3ba1a26df0f92826ede5a79255ad723af78a2691c37109fd"
SRC_URI[md5sum] = "0267b0871266056184c484792572c682"
diff --git a/meta/recipes-devtools/meson/meson/0001-Handle-strings-in-cross-file-args.-Closes-4671.patch b/meta/recipes-devtools/meson/meson/0001-Handle-strings-in-cross-file-args.-Closes-4671.patch
new file mode 100644
index 0000000000..1b1668e4ce
--- /dev/null
+++ b/meta/recipes-devtools/meson/meson/0001-Handle-strings-in-cross-file-args.-Closes-4671.patch
@@ -0,0 +1,87 @@
+From 4818b27894c828a50befc94f1bc9062e89a544ea Mon Sep 17 00:00:00 2001
+From: Jussi Pakkanen <jpakkane@gmail.com>
+Date: Sat, 29 Dec 2018 18:23:36 +0200
+Subject: [PATCH] Handle strings in cross file args. Closes #4671.
+
+Upstream-Status: Backport [6c76ac80173bdc40d35e2d6b802f7950646781dc]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+
+---
+
+Note that the change to ninjabackend.py does not come from commit
+6c76ac80, as it was not corrected until commit 2b22576f. However,
+since that commit is huge and changes a lot of unrelated stuff, it was
+easier to include the relevant part here.
+
+ cross/ubuntu-armhf.txt | 2 +-
+ mesonbuild/backend/ninjabackend.py | 2 +-
+ mesonbuild/compilers/compilers.py | 4 ++--
+ test cases/common/137 get define/meson.build | 12 +++---------
+ 4 files changed, 7 insertions(+), 13 deletions(-)
+
+diff --git a/cross/ubuntu-armhf.txt b/cross/ubuntu-armhf.txt
+index fec8ce7..a6e1f15 100644
+--- a/cross/ubuntu-armhf.txt
++++ b/cross/ubuntu-armhf.txt
+@@ -12,7 +12,7 @@ pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
+ root = '/usr/arm-linux-gnueabihf'
+ # Used in unit test '140 get define'
+ c_args = ['-DMESON_TEST_ISSUE_1665=1']
+-cpp_args = ['-DMESON_TEST_ISSUE_1665=1']
++cpp_args = '-DMESON_TEST_ISSUE_1665=1'
+
+ has_function_printf = true
+ has_function_hfkerhisadf = false
+diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
+index 3739c0a..2cebeef 100644
+--- a/mesonbuild/backend/ninjabackend.py
++++ b/mesonbuild/backend/ninjabackend.py
+@@ -1400,7 +1400,7 @@ int dummy;
+ if is_cross:
+ crstr = '_CROSS'
+ try:
+- cross_args = self.environment.cross_info.config['properties'][langname + '_link_args']
++ cross_args = mesonlib.stringlistify(self.environment.cross_info.config['properties'][langname + '_link_args'])
+ except KeyError:
+ pass
+ rule = 'rule %s%s_LINKER\n' % (langname, crstr)
+diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
+index e27ae2b..a5b9e91 100644
+--- a/mesonbuild/compilers/compilers.py
++++ b/mesonbuild/compilers/compilers.py
+@@ -1048,10 +1048,10 @@ class Compiler:
+ if 'properties' in environment.cross_info.config:
+ props = environment.cross_info.config['properties']
+ lang_args_key = self.language + '_args'
+- extra_flags += props.get(lang_args_key, [])
++ extra_flags += mesonlib.stringlistify(props.get(lang_args_key, []))
+ lang_link_args_key = self.language + '_link_args'
+ if link:
+- extra_flags += props.get(lang_link_args_key, [])
++ extra_flags += mesonlib.stringlistify(props.get(lang_link_args_key, []))
+ return extra_flags
+
+ def _get_compile_output(self, dirname, mode):
+diff --git a/test cases/common/137 get define/meson.build b/test cases/common/137 get define/meson.build
+index 109f628..1647e22 100644
+--- a/test cases/common/137 get define/meson.build
++++ b/test cases/common/137 get define/meson.build
+@@ -67,15 +67,9 @@ foreach lang : ['c', 'cpp']
+
+ run_1665_test = false
+ if meson.is_cross_build()
+- # Can't use an empty array as a fallback here because of
+- # https://github.com/mesonbuild/meson/issues/1481
+- lang_args = meson.get_cross_property(lang + '_args', [])
+- if lang_args.length() != 0
+- foreach lang_arg : lang_args
+- if lang_arg.contains('MESON_TEST_ISSUE_1665')
+- run_1665_test = true
+- endif
+- endforeach
++ lang_arg = meson.get_cross_property(lang + '_args', '')
++ if lang_arg == '-DMESON_TEST_ISSUE_1665=1'
++ run_1665_test = true
+ endif
+ endif
+