]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
meson: Backport patches to support dependencies on header-only Boost libs
authorPeter Kjellerstedt <pkj@axis.com>
Wed, 10 Sep 2025 13:24:52 +0000 (15:24 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 15 Sep 2025 16:52:52 +0000 (17:52 +0100)
With Boost 1.89.0, the Boost.System library was made header-only. Since
this is a frequent library to have as dependency in meson.build files,
this resulted in build failures.

Backport two patches so that Boost dependencies on header-only libraries
work as expected.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/meson/meson/0001-Check-for-header-only-Boost-libraries.patch [new file with mode: 0644]
meta/recipes-devtools/meson/meson/0002-Boost-python-must-have-a-library-component.patch [new file with mode: 0644]
meta/recipes-devtools/meson/meson_1.9.0.bb

diff --git a/meta/recipes-devtools/meson/meson/0001-Check-for-header-only-Boost-libraries.patch b/meta/recipes-devtools/meson/meson/0001-Check-for-header-only-Boost-libraries.patch
new file mode 100644 (file)
index 0000000..3d2810a
--- /dev/null
@@ -0,0 +1,58 @@
+From f16897135c394d36656da0078613864076300e07 Mon Sep 17 00:00:00 2001
+From: Jussi Pakkanen <jussi.pakkanen@mailbox.org>
+Date: Fri, 29 Aug 2025 14:57:06 +0300
+Subject: [PATCH] Check for header only Boost libraries.
+
+Upstream-Status: Backport [https://github.com/mesonbuild/meson/commit/6a9a81619c139d0f6ae3d265f7366e61615d92a1]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ mesonbuild/dependencies/boost.py | 22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py
+index 662f985..e153e8f 100644
+--- a/mesonbuild/dependencies/boost.py
++++ b/mesonbuild/dependencies/boost.py
+@@ -452,6 +452,10 @@ class BoostDependency(SystemDependency):
+                 break
+         libs = sorted(set(libs))
++        any_libs_found = len(libs) > 0
++        if not any_libs_found:
++            return False
++
+         modules = ['boost_' + x for x in self.modules]
+         for inc in inc_dirs:
+             mlog.debug(f'  - found boost {inc.version} include dir: {inc.path}')
+@@ -462,7 +466,7 @@ class BoostDependency(SystemDependency):
+                 mlog.debug(f'    - {j}')
+             #   3. Select the libraries matching the requested modules
+-            not_found: T.List[str] = []
++            not_found_as_libs: T.List[str] = []
+             selected_modules: T.List[BoostLibraryFile] = []
+             for mod in modules:
+                 found = False
+@@ -472,7 +476,21 @@ class BoostDependency(SystemDependency):
+                         found = True
+                         break
+                 if not found:
+-                    not_found += [mod]
++                    not_found_as_libs += [mod]
++
++            # If a lib is not found, but an include directory exists,
++            # assume it is a header only module.
++            not_found: T.List[str] = []
++            for boost_modulename in not_found_as_libs:
++                assert boost_modulename.startswith('boost_')
++                include_subdir = boost_modulename.replace('boost_', 'boost/', 1)
++                headerdir_found = False
++                for inc_dir in inc_dirs:
++                    if (inc_dir.path / include_subdir).is_dir():
++                        headerdir_found = True
++                        break
++                if not headerdir_found:
++                    not_found.append(boost_modulename)
+             # log the result
+             mlog.debug('  - found:')
diff --git a/meta/recipes-devtools/meson/meson/0002-Boost-python-must-have-a-library-component.patch b/meta/recipes-devtools/meson/meson/0002-Boost-python-must-have-a-library-component.patch
new file mode 100644 (file)
index 0000000..c03c475
--- /dev/null
@@ -0,0 +1,34 @@
+From d0644d543f4df39cf2ba14337000ee019cb20b6d Mon Sep 17 00:00:00 2001
+From: Jussi Pakkanen <jussi.pakkanen@mailbox.org>
+Date: Fri, 29 Aug 2025 22:51:48 +0300
+Subject: [PATCH] Boost python must have a library component.
+
+Upstream-Status: Backport [https://github.com/mesonbuild/meson/commit/80917ca8c1a5af499cc6e004ad5d5a050da9045e]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ mesonbuild/dependencies/boost.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py
+index e153e8f..fdb35d4 100644
+--- a/mesonbuild/dependencies/boost.py
++++ b/mesonbuild/dependencies/boost.py
+@@ -440,6 +440,8 @@ class BoostDependency(SystemDependency):
+         mlog.debug('  - potential library dirs: {}'.format([x.as_posix() for x in lib_dirs]))
+         mlog.debug('  - potential include dirs: {}'.format([x.path.as_posix() for x in inc_dirs]))
++        must_have_library = ['boost_python']
++
+         #   2. Find all boost libraries
+         libs: T.List[BoostLibraryFile] = []
+         for i in lib_dirs:
+@@ -483,6 +485,9 @@ class BoostDependency(SystemDependency):
+             not_found: T.List[str] = []
+             for boost_modulename in not_found_as_libs:
+                 assert boost_modulename.startswith('boost_')
++                if boost_modulename in must_have_library:
++                    not_found.append(boost_modulename)
++                    continue
+                 include_subdir = boost_modulename.replace('boost_', 'boost/', 1)
+                 headerdir_found = False
+                 for inc_dir in inc_dirs:
index 6f5a623dc77acd9614de72e9785d56b15d8f957c..10ac7d9697e8a5461e53b4e3af0c5b1dd1aec366 100644 (file)
@@ -14,6 +14,8 @@ 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-Check-for-header-only-Boost-libraries.patch \
+           file://0002-Boost-python-must-have-a-library-component.patch \
            "
 SRC_URI[sha256sum] = "cd27277649b5ed50d19875031de516e270b22e890d9db65ed9af57d18ebc498d"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)$"