Skip to content

Conversation

@dcbaker
Copy link
Member

@dcbaker dcbaker commented Jul 9, 2025

When compiling Vala we generating 2-3 files as side effects of the compilation. A C compatible header, a VAPI header, and possibly a GIR file. Currently, there is no good way to generate a dependency on those files.

With this PR that changes, as a build target has vala_header() vala_vapi() and vala_gir() method, each returning a File object pointing to their respective generated target. Calling these methods on a target that doesn't use Vala, or that doesn't generate a GIR file, will result in an error.

Copy link

@TheEvilSkeleton TheEvilSkeleton left a comment

Choose a reason for hiding this comment

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

I'm no meson maintainer, but I provided the required steps in elementary/granite#873 (comment), as it depends on this PR to work. I can confirm that it builds successfully and works without any problems, so you have my approval on the testing side of things.

@tintou
Copy link
Contributor

tintou commented Aug 1, 2025

@bonzini bonzini modified the milestones: 1.9, 1.10 Aug 1, 2025
@dcbaker dcbaker force-pushed the submit/vala-header-method branch 2 times, most recently from f7fd469 to b8ff6cf Compare October 7, 2025 16:10
@dcbaker dcbaker force-pushed the submit/vala-header-method branch from b8ff6cf to deb96df Compare October 7, 2025 16:17
@dcbaker dcbaker force-pushed the submit/vala-header-method branch from deb96df to 52912e3 Compare October 7, 2025 20:40
@dcbaker
Copy link
Member Author

dcbaker commented Oct 7, 2025

I've also updated the gir docs in this version to have instructions for both the new and old methods.

@dcbaker dcbaker force-pushed the submit/vala-header-method branch from 52912e3 to 733ff08 Compare October 7, 2025 20:58
@dcbaker
Copy link
Member Author

dcbaker commented Oct 7, 2025

And I updated the yaml part of the docs, which is used to generate the reference manual.

To then generate a typelib file use a custom target with the
`g-ir-compiler` program and a dependency on the library:

Since Meson 1.10, use the `.vala_gir()` method to get a handle to the generated `.gir` file:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should use asterisks like *Since 1.10*

@bonzini
Copy link
Collaborator

bonzini commented Oct 8, 2025

Looks good other than the nit in the documentation!

This allows targets that don't link with a vala target to rely on the
header generation.
@dcbaker dcbaker force-pushed the submit/vala-header-method branch from 733ff08 to a7a4843 Compare October 8, 2025 15:27
@dcbaker dcbaker force-pushed the submit/vala-header-method branch from a7a4843 to 7d51e0c Compare October 8, 2025 15:53
@bonzini
Copy link
Collaborator

bonzini commented Oct 8, 2025

Fixed by #15062. Wrong window sorry.

@bonzini bonzini closed this Oct 8, 2025
@bonzini bonzini reopened this Oct 8, 2025
@dcbaker dcbaker merged commit 2e63336 into mesonbuild:master Oct 8, 2025
41 of 62 checks passed
@dcbaker dcbaker deleted the submit/vala-header-method branch October 8, 2025 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants