Vendoring system dependencies using meson

I'm able to use bindgen to build playerctl-sys on my system, but the crate fails to build whenever the required system libraries (libplayerctl, libglib-2.0) aren't present. I attempted to clone the sources of these libraries to my repository so I could build them in

Playerctl builds using meson, but just like playerctl and glib-2.0, I can't expect meson to already be present. I would have to store the sources of meson, glib-2.0, and playerctl in my repository, in addition to having to build them in series.

This brings me past's time limit for building my crate, so it isn't an option. I need to find a solution that would allow me to

  • check if the two system libraries are already present, and if not,
  • build them in

How should I go about doing this?

glib is part of GTK, and compiling a private copy of GTK for a crate is probably going too far. This is typically a system-wide dependency. is not supposed to modify the system.

Meson should know what it's doing, so if you're already relying on it, I don't think you can do anything else about missing dependencies, other than documenting the dependencies well and providing installation instructions.

Alternatively in playerctl-sys you could get rid of meson, and use the cc crate to compile files yourself, and pkg-config to find dependencies. It will at least remove the meson dependency.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.