In cases where you need a special-case handling for a package+platform combination, there can be two approaches:
- Either a -sys crate provides support for all platforms (horizontally cutting box in the image), or
- A platform provides support for all packages (vertically cutting box in the image).
So in case of Debian, they worry about all packages conforming to Debian’s requirements and working together. Debian even insists on being the exclusive provider of “hacks” for all their packages.
In case of Cargo, we have each package worry about all platforms it supports. So the build.rs is a spaghetti code of all hacks for all platforms.
In case of systems that do their own packaging, “hey, let’s have it declarative” is much simpler and quite desirable, because you align Cargo with what’s already provided by the system (you take that green box in the image above).
But then there’s Windows, where vcpkg barely exists, there’s no real standard, and all libraries are a wild west. There’s nothing that Cargo could align itself with. Cargo would have to be the provider of all hacks for all libraries.
MacOS is somewhere in between, where Homebrew provides a lot of packages and gives some uniformity, but it’s not the same as Linux distros. For example, binaries dynamically linked with Homebrew libraries are not redistributable (i.e. they crash if run on another machine). Homebrew also tries to balance use of their own packages and Apple-provided libraries, which is another source of quirks and exceptions for everything that Apple has touched.