mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.33k stars 1.53k forks source link

gnome.generate_gir never becomes stale #13118

Open sophie-h opened 1 month ago

sophie-h commented 1 month ago

I'm generating a C library via Rust cargo. The header file is written manually and it also contains all the gir annotations.

To run gnome.generate_gir, I need a library object. I found that this one works for gir

libglycin = library(
    'glycin-1',
    'include/glycin.h',
    dependencies: libglycin_deps,
)

libglycin_gir = gnome.generate_gir(
    libglycin,
    sources: ['include/glycin.h'],
    nsversion: '1',
    namespace: 'Gly',
    symbol_prefix: 'gly',
    link_with: libglycin,
    includes: ['Gio-2.0', 'Gtk-4.0'],
    header: 'glycin.h',
    install: true,
)

However neither the library nor generate_gir ever become stale when 'include/glycin.h' changes. The only way I found to regenerate the gir part is via deleting the generated .gir file. Since both have the header defined as a source, I wonder if at least one of the targets should become stale.

sophie-h commented 1 month ago

Somewhat fixed by adding the header to link_depends in the library. However, In my concrete case this causes gir to be regenerated each time after the header has been changed once.

Would it be possible for gnome.generate_gir to check if the .so-file of the library and the sources have changed?

tristan957 commented 1 month ago

I think it would help to enumerate the multitude of issues that exist here:

  1. Can't pass a file to gnome.generate_gir(). Does the regular command line accept a file?
  2. The generated target, doesn't depend on the symlinked .so, only the versioned one?