robo9k / rust-magic-sys

Rust declarations crate for the `libmagic` C library
Apache License 2.0
10 stars 6 forks source link

Use pkg-config #1

Open robo9k opened 9 years ago

robo9k commented 9 years ago

Right now we unconditionally link with -l magic.

This behaviour should be changed to attempt using pkg-config first, then falling back to the hardlinked library name.

robo9k commented 9 years ago

It looks like the file package does not install a libmagic.pc, so pkg-config does not know about it. Since they're using the GNU autotools, adding support should not be difficult (needs an upstream ticket).

Getting a new file / libmagic package onto Travis CI might require using a PPA.

robo9k commented 3 years ago

Upstream issue 0000136 added a libmagic.pc for static linking, available since version 5.39

robo9k commented 1 year ago

While vcpkg includes the required libmagic.pc, it does not provide a pkg-config binary. It's possible to vcpkg install pkgconf for an alternate binary (see https://github.com/pkgconf/pkgconf ) that unfortunately doesn't become part of PATH. The pkg-config crate should work with either binary, but would need environment variables instead of mostly effortless cargo vcpkg build && cargo build.