Allow linking against system-provided libjq
Distributions that provide jq typically also offer development packages that can be discovered by using pkg-config. Adding optional pkg-config configuration to j9-sys would be a welcome step towards easier packaging of jnv without having to build a vendored libjq version.
I've drafted the necessary changes to make this happen, I can make a PR if you are interested: https://github.com/tranzystorekk/j9/commit/1d760e48bbaae717e7a95196418787f04bcfaa6c
@tranzystorekk Wow, thanks for your suggestions. Please let me ask.
- Is this a mechanism that allows skipping the build of libjq by referring to an already installed libjq?
- Is the choice between using it or not controlled by the LIBJQ_NO_VENDOR environment variable?
- Is this a mechanism that allows skipping the build of libjq by referring to an already installed libjq?
Yes, as long as pkg-config is installed (so only on unix platforms) and the jq installation contains the libjq.pc configuration file (typically provided on distros by development subpackages like jq-devel).
- Is the choice between using it or not controlled by the LIBJQ_NO_VENDOR environment variable?
LIBJQ_NO_VENDOR=1 forces j9-sys to use the system version or fail to build otherwise, this is useful for distro packages that need to ensure they're using the system provided version. With LIBJQ_NO_VENDOR=0 or unset, we try to grab the system version first, and fallback to vendored if not found (or if pkg-config is unavailable).
Typically similar -sys crates also expose a vendored feature that if enabled always select the vendored version even if system is available, but I wanted to make a minimal proposal first.
The pkg-config crate also has its own set of config variables to control its behavior: https://docs.rs/pkg-config/latest/pkg_config/#environment-variables
Closing as jnv has picked the jaq route instead.