]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
meson: don't look on the host for GTest when cross-compiling
authorRoss Burton <ross.burton@arm.com>
Thu, 21 Nov 2024 14:56:19 +0000 (14:56 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 22 Nov 2024 16:58:10 +0000 (16:58 +0000)
When cross-compiling prepend the sysroot to the hardcoded /usr/src paths
that Meson looks in for the GoogleTest sources.

[ YOCTO #13508 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
meta/recipes-devtools/meson/meson/0001-dependencies-dev-prepend-sysroot-when-searching-for-.patch [new file with mode: 0644]
meta/recipes-devtools/meson/meson_1.6.0.bb

diff --git a/meta/recipes-devtools/meson/meson/0001-dependencies-dev-prepend-sysroot-when-searching-for-.patch b/meta/recipes-devtools/meson/meson/0001-dependencies-dev-prepend-sysroot-when-searching-for-.patch
new file mode 100644 (file)
index 0000000..e4700bc
--- /dev/null
@@ -0,0 +1,36 @@
+From 6f33fb67097beeb17e2345aaec3bda4a57b0b138 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Wed, 20 Nov 2024 13:09:38 +0000
+Subject: [PATCH] dependencies/dev: prepend sysroot when searching for GTest
+ sources
+
+Don't hardcode paths in /usr when looking for the GTest sources, as in
+cross-compile or other builds with a sysroot this will find the host
+sources, not ones that we want to use in the sysroot.
+
+Closes #12690.
+
+Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/13934]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ mesonbuild/dependencies/dev.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py
+index 94f51ff69..cceb1756c 100644
+--- a/mesonbuild/dependencies/dev.py
++++ b/mesonbuild/dependencies/dev.py
+@@ -56,7 +56,9 @@ class GTestDependencySystem(SystemDependency):
+     def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
+         super().__init__(name, environment, kwargs, language='cpp')
+         self.main = kwargs.get('main', False)
+-        self.src_dirs = ['/usr/src/gtest/src', '/usr/src/googletest/googletest/src']
++
++        sysroot = environment.properties[self.for_machine].get_sys_root() or ""
++        self.src_dirs = [sysroot + '/usr/src/gtest/src', sysroot + '/usr/src/googletest/googletest/src']
+         if not self._add_sub_dependency(threads_factory(environment, self.for_machine, {})):
+             self.is_found = False
+             return
+-- 
+2.34.1
+
index 46127b7a9ba7288dec0f8dc2cfd0cfe77ab2f449..078e49e9735876de2f1abae3ce53d2d9f99773d2 100644 (file)
@@ -14,6 +14,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/meson-${PV}.tar.gz \
            file://0001-python-module-do-not-manipulate-the-environment-when.patch \
            file://0001-Make-CPU-family-warnings-fatal.patch \
            file://0002-Support-building-allarch-recipes-again.patch \
+           file://0001-dependencies-dev-prepend-sysroot-when-searching-for-.patch \
            "
 SRC_URI[sha256sum] = "999b65f21c03541cf11365489c1fad22e2418bb0c3d50ca61139f2eec09d5496"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)$"