Skip to content

Conversation

@cjmayo
Copy link
Contributor

@cjmayo cjmayo commented Oct 26, 2025

If the dependency version contains a space:
dependency('glib-2.0', version: '>= 2.40.0')

Then the --target-glib version has a space:
--target-glib ' 2.40.0'

If the dependency version contains a space:
dependency('glib-2.0', version: '>= 2.40.0')

Then the --target-glib version has a space:
--target-glib ' 2.40.0'
@cjmayo cjmayo requested a review from jpakkane as a code owner October 26, 2025 19:20
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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants