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
Support using generate_gir from gobject-introspection #11327
base: master
Are you sure you want to change the base?
Conversation
mesonbuild/modules/gnome.py
Outdated
self.giscanner = state.find_tool('g-ir-scanner', 'gobject-introspection-1.0', 'g_ir_scanner') | ||
self.gicompiler = state.find_tool('g-ir-compiler', 'gobject-introspection-1.0', 'g_ir_compiler') | ||
if not self.gir_dep or not self.gir_dep.found(): | ||
for (dep, req) in [('gobject-introspection-no-typelibs-1.0', False), ('gobject-introspection-1.0', True)]: |
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.
I think it is a bit more complicated because after g-i is done we want to switch to gobject-introspection-1.0
. That way subprojects coming after g-i will have typelibs dependencies.
That means you should invert the order and check for gobject-introspection-1.0
first. If it is -no-typelib that has been found you should remember that and re-check for gobject-introspection-1.0
next time.
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.
Another possibility is to do something like dep_name = 'gobject-introspection-no-typelibs-1.0' if state.subproject == 'gobject-introspection' else 'gobject-introspection-1.0' ... self.gir_dep = state.dependency(dep_name)
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.
@ylatuya I think the new version of your patch still have the same issue because it re-check the dependency only if not self.gir_dep:
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.
Yes, I pushed it before reading your comments.
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 be handled correctly now
464ad70
to
1fd86e8
Compare
From gobject-introspection itself the use of gnome.generate_gir is not possible leading to several hacks that are hard to maintain in order to support building gobject-introspection with submodules. This change in combination with https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/380 uses a new `gobject-introspection-no-typelibs` dependency to allow defining dependency to allow using the GI dependency prior to having the typelibs generated.
Source for the gir_dep should be added to the GirTarget inputs instead of the dependencies. Traceback (most recent call last): File "/Users/andoni/git/meson/mesonbuild/mesonmain.py", line 193, in run return options.run_func(options) File "/Users/andoni/git/meson/mesonbuild/msetup.py", line 309, in run app.generate() File "/Users/andoni/git/meson/mesonbuild/msetup.py", line 186, in generate self._generate(env) File "/Users/andoni/git/meson/mesonbuild/msetup.py", line 250, in _generate intr.backend.generate() File "/Users/andoni/git/meson/mesonbuild/backend/ninjabackend.py", line 614, in generate self.generate_target(t) File "/Users/andoni/git/meson/mesonbuild/backend/ninjabackend.py", line 801, in generate_target self.generate_custom_target(target) File "/Users/andoni/git/meson/mesonbuild/backend/ninjabackend.py", line 1104, in generate_custom_target for output in d.get_outputs(): AttributeError: 'File' object has no attribute 'get_outputs'
This allows adding a link_with to the gir_rep depedency that is defined for internall use in gobject-introspection so it depends on the giscanner python module target ``` girepo_no_typelibs_dep = declare_dependency( dependencies: [girepo_dep], link_with: gir_giscanner_pymod, sources: gir_giscanner_built_files, variables: { 'girdir': meson.current_build_dir() / 'gir', }, ) ```
Codecov Report
@@ Coverage Diff @@
## master #11327 +/- ##
==========================================
- Coverage 68.85% 65.25% -3.60%
==========================================
Files 414 207 -207
Lines 90284 45150 -45134
Branches 20709 10713 -9996
==========================================
- Hits 62163 29462 -32701
+ Misses 23434 13425 -10009
+ Partials 4687 2263 -2424
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@ylatuya IIRC you said elsewhere that this does not work because we would need generate_gir() to also work with a lib coming from pkgconfig instead of from library(), right? Is that something we could fix easily, or are you abandoning this PR? |
From gobject-introspection itself the use of gnome.generate_gir is not possible leading to several hacks that are hard to maintain in order to support building gobject-introspection with submodules.
This change in combination with https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/380 uses a new
gobject-introspection-no-typelibs-1.0
dependency to allow using the GI dependency prior to having the typelibs generated.