gdesmott / system-deps

Run pkg-config from declarative dependencies in Cargo.toml
Apache License 2.0
89 stars 21 forks source link

Drive `system-deps` as a standard for managing system dependencies #97

Open weihanglo opened 4 months ago

weihanglo commented 4 months ago

Thank you for maintaining this awesome package!

The value of a declarative interface for system dependencies is something the community already knew but never thought deeply about. It benefits everyone without writing imperative build scripts. I really love the idea, and wish it becomes more mainstream, or even built-in in Cargo.

The elephant(s) in the room

I see some issues that the community currently has around system dependencies:

A practical(?) plan

As the first step, we tried to make our own system-deps, and then came across this repository. I believe there is room for us to collaborate to push this as a de facto way to declare system dependencies, and then become official (i.e., https://github.com/rust-lang/cargo/issues/12432).

There are some tasks waiting for us to make the adoption rate better:


Thanks for reading this lengthy issue. This is a long-term fight, and I believe by tackling the top 10s, we can make the adoption of system-deps more widespread.

gdesmott commented 4 months ago

Hi @weihanglo

I'd be really happy to see system-deps more widely used and become the defacto standard for managing system libraries. We started it as a fork of metadeps to fit our (the gtk-rs community) needs but tried to keep it generic enough so it can be useful for, ideally, any sys crate.

Your plan looks great to me, but unfortunately I don't have much time to actively work on system-deps these days. It does the work just fine for the crates I'm using so the maintenance work has been mostly reviewing MR and pushing releases. So I'm happy to keep doing that but won't have the time to personally drive forward such plan. I'd also be happy to have a co-maintainer joining me if they have more resources they could spend on system-deps.

  • If we could lower the MSRV to some extent, it would be easier to convince those *-sys crate authors to buy into the idea.

So far I've valued ease to maintain the code over MSRV. I wouldn't mind reducing the MSRV if that doesn't greatly increase the amount of code to maintain.

  • Developers should have the final say on whether a *-sys is vendored or not.

That was the point of the internal build API but, AFAIK, it has never been really used so they are probably loads of rooms for improvements here.

sdroege commented 4 months ago

That was the point of the internal build API but, AFAIK, it has never been really used

IIRC dav1d-sys is using that

weihanglo commented 4 months ago

That was the point of the internal build API

Nice! I missed the important part 😆.

To make it more realistic, we may want to expose a TOML config interface for people to set the default mode auto|always|never. That could make it easier to align with the current behavior for most crates.

Anyway, thanks for your replies people. I'd love to start from potential ways to lower MSRV. Will post update when I have a concrete design.

Kixunil commented 4 months ago

I had similar thoughts about this, would love to see this adopted by Cargo giving us more flexibility and remove build scripts. One interesting situation that'd be nice to support is having a vendored library that renames symbols to not collide with other builds. We do this in secp256k1 but then some people need the symbols to not be renamed. Another more weird thing is there's a library that forks secp256k1 and adds more stuff to it. Sadly, this interferes with Rust bindings because while they share the same symbols their internal representation might not be the same so you can't mix them but also having both of them linked sucks.