-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to override find_program [skip ci] #3218
Conversation
I'm really glad you posted this! Just yesterday I was building gstreamer on Windows to prepare for the 1.14 release and it was too difficult to do that without this feature.
These are strict requirements, but I can see why they exist. I think it's good to start with these and relax them if/when we find reliable ways to do that.
Build-time targets do need a bit of extra work, but I think we can have Without that, it's actually really hard to build anything that uses the GNOME module using subprojects. For instance, if you want to build gstreamer on Windows, you need the glib subproject which provides glib-tools. The most common ones are It's the same if you want to build anything that uses introspection on Windows, since the gobject-introspection project provides PS: |
Actually, supporting the |
For distro overrides it would be super convenient to have some flag or option to override specific programs without |
That would be #3001 again. |
Looking forward a bit i would like to have this flexible enough to be able to use this for say qt or other situation where the tools are actual compiled programs as well. From irc, it seems that this could be extended to exectuables, but that using them at meson.build evaluation time would have to be a hard error. That seems like a strange special case for find_program, but maybe that is ok? Or maybe we would want to make this more explicit with some kwarg or an different method than find_program? |
mesonbuild/interpreter.py
Outdated
exe = exe.held_object | ||
if isinstance(exe, mesonlib.File): | ||
abspath = exe.absolute_path(self.interpreter.environment.source_dir, | ||
self.interpreter.environment.build_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Flake8]
[E127] continuation line over-indented for visual indent
Now works with |
So, I found that one particular workflow didn't work: checking if a tool is provided by the system, and taking some action to 'provide' (override) it if it isn't. This has two use-cases:
I added a WIP commit for that, but this does change the semantics of the system, since now Alternatively, we can go with this and say that people should override their programs as soon as possible. |
FWIW, with the commit I pushed, I have gst-build building with just a compiler + meson + ninja on Windows \o/ |
Documentation updated. This should be ready for final review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is my WIP commit still in the list on purpose?
|
||
```meson | ||
prog = find_program('my_custom_script') | ||
meson.override_find_program('mycodegen', prog) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs an example for configure_file()
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should probably go to actual documentation, people on average don't read old release notes for stuff. That would require writing a proper page for that, though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should start linking to the release notes for each feature; the (added in v0.xx.y)
text is a good candidate for that.
The patches from the following PR (or 0.46.0, not released yet) are needed: mesonbuild/meson#3218
I made all the changes I mentioned, +1 from me now! |
Would be great to have this in 0.46! |
I just realized that a nicer name for this is |
Several of our tools are installed and are used by other projects to generate code. However, there is no 'install' when projects use glib as a subproject, so we needed some way for glib to 'provide' these tools. Starting from Meson 0.46, this can be done with the meson.override_find_program() function. This also means that we can use these tools ourselves via the GNOME module and don't need to manually create command-lines. WIP because it requires mesonbuild/meson#3218
Otherwise we can't do the following workflow: if not find_program('foo', required : false).found() subproject('provides-foo') endif Where 'provides-foo' has a meson.override_find_program() on a configure_file() or similar.
Also link to the release notes snippet from the Reference manual
Several of our tools are installed and are used by other projects to generate code. However, there is no 'install' when projects use glib as a subproject, so we needed some way for glib to 'provide' these tools. Starting from Meson 0.46, this can be done with the meson.override_find_program() function. This also means that we can use these tools ourselves via the GNOME module and don't need to manually create command-lines. WIP because it requires mesonbuild/meson#3218
The user doesn't need to know whether or not the program was found, especially not when it's spammed for every gnome.foo() function
The patches from the following PR (or 0.46.0, not released yet) are needed: mesonbuild/meson#3218
I prefer override_find_program because the name is very explicit in what it does, moreso than provides_program. Also if we get the generic overrider functionality it would be nice to consistently use "override" to mean "change the default behaviour of some feature". |
👍 |
The patches from the following PR (or 0.46.0, not released yet) are needed: mesonbuild/meson#3218
This is not yet finished, hence the CI skipping.
The point of this PR is that you can do
meson.override_find_program('progname', [program object])
which causes allfind_program
s forprograme
to use the given program object instead.ExternalProgram
objects but could in theory be expanded to doExecutable
as well but that has more corner casesThe point of this is to gather comments to see whether this is a usable approach. With this it should be possible to both bootstrap
glib
by itself and also to make it usable as a subproject on platforms where it is not available.