• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/workflows/H03-May-2022-4238

src/H03-May-2022-801582

tests/H03-May-2022-354317

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197094 66

.gitignoreH A D29-Nov-197332 54

CHANGELOG.mdH A D29-Nov-19733.3 KiB13986

Cargo.tomlH A D01-Jan-1970977 2624

Cargo.toml.orig-cargoH A D29-Nov-1973514 2117

LICENSE-APACHEH A D29-Nov-197310.6 KiB202169

LICENSE-MITH A D29-Nov-19731 KiB2622

README.mdH A D29-Nov-19732.8 KiB8054

README.md

1# pkg-config-rs
2
3[![Build Status](https://github.com/rust-lang/pkg-config-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-lang/pkg-config-rs/actions)
4[![Rust](https://img.shields.io/badge/rust-1.30%2B-blue.svg?maxAge=3600)](https://github.com/rust-lang/pkg-config-rs/)
5
6[Documentation](https://docs.rs/pkg-config)
7
8A simple library meant to be used as a build dependency with Cargo packages in
9order to use the system `pkg-config` tool (if available) to determine where a
10library is located.
11
12You can use this crate directly to probe for specific libraries, or use
13[system-deps](https://github.com/gdesmott/system-deps) to declare all your
14`pkg-config` dependencies in `Cargo.toml`.
15
16This library requires Rust 1.30+.
17
18# Example
19
20Find the system library named `foo`, with minimum version 1.2.3:
21
22```rust
23extern crate pkg_config;
24
25fn main() {
26    pkg_config::Config::new().atleast_version("1.2.3").probe("foo").unwrap();
27}
28```
29
30Find the system library named `foo`, with no version requirement (not
31recommended):
32
33```rust
34extern crate pkg_config;
35
36fn main() {
37    pkg_config::probe_library("foo").unwrap();
38}
39```
40
41# External configuration via target-scoped environment variables
42
43In cross-compilation context, it is useful to manage separately `PKG_CONFIG_PATH`
44and a few other variables for the `host` and the `target` platform.
45
46The supported variables are: `PKG_CONFIG_PATH`, `PKG_CONFIG_LIBDIR`, and
47`PKG_CONFIG_SYSROOT_DIR`.
48
49Each of these variables can also be supplied with certain prefixes and suffixes, in the following prioritized order:
50
511. `<var>_<target>` - for example, `PKG_CONFIG_PATH_x86_64-unknown-linux-gnu`
522. `<var>_<target_with_underscores>` - for example, `PKG_CONFIG_PATH_x86_64_unknown_linux_gnu`
533. `<build-kind>_<var>` - for example, `HOST_PKG_CONFIG_PATH` or `TARGET_PKG_CONFIG_PATH`
544. `<var>` - a plain `PKG_CONFIG_PATH`
55
56This crate will allow `pkg-config` to be used in cross-compilation
57if `PKG_CONFIG_SYSROOT_DIR` or `PKG_CONFIG` is set. You can set `PKG_CONFIG_ALLOW_CROSS=1`
58to bypass the compatibility check, but please note that enabling use of `pkg-config` in
59cross-compilation without appropriate sysroot and search paths set is likely to break builds.
60
61Some Rust sys crates support building vendored libraries from source, which may be a work
62around for lack of cross-compilation support in `pkg-config`.
63
64# License
65
66This project is licensed under either of
67
68 * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
69   https://www.apache.org/licenses/LICENSE-2.0)
70 * MIT license ([LICENSE-MIT](LICENSE-MIT) or
71   https://opensource.org/licenses/MIT)
72
73at your option.
74
75### Contribution
76
77Unless you explicitly state otherwise, any contribution intentionally submitted
78for inclusion in pkg-config-rs by you, as defined in the Apache-2.0 license, shall be
79dual licensed as above, without any additional terms or conditions.
80