rust-lang / libz-sys

Rust crate package to link to a system libz (zlib)
Apache License 2.0
110 stars 73 forks source link

Also emit DEP_Z_INCLUDE when using pkg-config #188

Closed sfackler closed 3 months ago

sfackler commented 3 months ago

Downstream build scripts use DEP_Z_INCLUDE to configure the builds of other native libraries (for example in libgit2-sys). Previously, if libz was found via pkg-config and didn't have a system-default include directory those builds would fail.

sfackler commented 3 months ago

Yep, I validated it with [patch.crates-io] on an internal thing that was previously failing to build libgit2.

Will follow up with a version bump PR.

weihanglo commented 2 months ago

Would it be better using std::env::join_paths instead of commas to maximize the compatibility?

Byron commented 2 months ago

This could be a great catch!

cargo:include is seemingly unlisted in the docs, maybe I am not looking in the right place though. With the docs it should be clear what separators can be used - it's surprising that , is support if : or ; would be supported as well. But then again, everything is possible if it's documented somewhere.

sfackler commented 2 months ago

It is the old syntax for

cargo::metadata=KEY=VALUE — Metadata, used by links scripts.

weihanglo commented 2 months ago

cargo:include is arbitrary user-defined cargo:KEY=VALUE, which is superseded by cargo::metadata=KEY=VALUE to have a better extensibility. I am looking at other -sys crate and some of them have the same (not ideal?) pattern.