mesonbuild / wrapdb

New wrap requests
https://mesonbuild.com/Adding-new-projects-to-wrapdb.html
MIT License
76 stars 193 forks source link

libgpiod: Build definition fixes #1564

Closed amboar closed 3 months ago

amboar commented 3 months ago

Disambiguate the path to the configuration header and configure the C++ bindings to target the host environment. In the process, address some technical debt in the CI configuration for libgpiod to enable the C++ binding.

benoit-pierre commented 3 months ago

The confusingly named build_on does not mean that the CI should attempt or not to build for that particular platform, but that the build is expected to work (true) or fail with a specific error (false). See liburing for example.

amboar commented 3 months ago

Yeah I just discovered that. I was considering adding the following:

diff --git a/subprojects/packagefiles/libgpiod/meson.build b/subprojects/packagefiles/libgpiod/meson.build
index 2faf13315c04..74d14ff14126 100644
--- a/subprojects/packagefiles/libgpiod/meson.build
+++ b/subprojects/packagefiles/libgpiod/meson.build
@@ -10,6 +10,11 @@ project('libgpiod', 'c',
         license: 'LGPL-2.1-or-later',
         meson_version: '>=0.56.0')

+host_system = host_machine.system()
+if host_system != 'linux'
+    error('libgpiod is not supported on @0@'.format(host_system))
+endif
+
 add_project_arguments('-D_GNU_SOURCE', language: 'c')

 pkg = import('pkgconfig')

... and it looks like that's what liburing is doing as well. Nice.

amboar commented 3 months ago

@benoit-pierre There's a bit of messing around with add_languages() (and I removed the language from the project() invocation) to avoid MSVC barfing about c_std=gnu99 before we could error out about the system type. Anyway, looks like it's passing now.

benoit-pierre commented 3 months ago

IMHO it would better to add back c_std=gnu99 to the project(…) call and just disable fatal warnings on the CI, rather than complexify the port.

And maybe fatal warnings should automatically be disabled for platforms where build_on is false:

--- i/tools/sanity_checks.py
+++ w/tools/sanity_checks.py
@@ -353,7 +353,7 @@ class TestReleases(unittest.TestCase):
         options = ['-Dpython.install_env=auto', f'-Dwraps={name}']
         options.append('-Ddepnames={}'.format(','.join(deps or [])))
         options.append('-Dprognames={}'.format(','.join(progs or [])))
-        if ci.get('fatal_warnings', True) and self.fatal_warnings:
+        if ci.get('fatal_warnings', expect_working) and self.fatal_warnings:
             options.append('--fatal-meson-warnings')
         options += [f'-D{o}' for o in ci.get('build_options', [])]
         if Path(builddir, 'meson-private', 'cmd_line.txt').exists():