Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def generate_basic_compiler_args(self, target: build.BuildTarget, compiler: 'Com
if dep.version_reqs is not None:
for req in dep.version_reqs:
if req.startswith(('>=', '==')):
commands += ['--target-glib', req[2:]]
commands += ['--target-glib', req[2:].strip()]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would make it easy for people to write meson.build files that only work with the latest version of meson, by accident, because they don't realize that they are passing badly formatted values to vala?

The general solution for this is to use a FeatureNew if you detect that this condition was relevant at runtime, for example if stripping produces a different string value.

Copy link
Contributor Author

@cjmayo cjmayo Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not one nice simple example, but it seems to be just a cosmetic fix. Using meson's test cases/vala/14 target glib version and gresources

valac-0.56 test.vala --pkg gtk+-3.0 --gresources gres/test-resources.xml --target-glib <x>

warnings when:

x=2.40
x = ' 2.40'

no warnings when:

x=auto
x=2.70
x=' 2.70'

fails with

error: Only a stable version of GLib can be targeted, use MAJOR.MINOR format with MINOR as an even number
error: This version of valac only supports GLib 2

when x=' xxxx'

break
elif isinstance(dep, dependencies.InternalDependency) and dep.version is not None:
glib_version = dep.version.split('.')
Expand Down
Loading