|
6 | 6 | //! `Config` structure serves as a method of configuring how `pkg-config` is
|
7 | 7 | //! invoked in a builder style.
|
8 | 8 | //!
|
| 9 | +//! After running `pkg-config` all appropriate Cargo metadata will be printed on |
| 10 | +//! stdout if the search was successful. |
| 11 | +//! |
| 12 | +//! # Environment variables |
| 13 | +//! |
9 | 14 | //! A number of environment variables are available to globally configure how
|
10 | 15 | //! this crate will invoke `pkg-config`:
|
11 | 16 | //!
|
12 | 17 | //! * `FOO_NO_PKG_CONFIG` - if set, this will disable running `pkg-config` when
|
13 | 18 | //! probing for the library named `foo`.
|
14 | 19 | //!
|
15 |
| -//! * `PKG_CONFIG_ALLOW_CROSS` - The `pkg-config` command usually doesn't |
16 |
| -//! support cross-compilation, and this crate prevents it from selecting |
17 |
| -//! incompatible versions of libraries. |
18 |
| -//! Setting `PKG_CONFIG_ALLOW_CROSS=1` disables this protection, which is |
19 |
| -//! likely to cause linking errors, unless `pkg-config` has been configured |
20 |
| -//! to use appropriate sysroot and search paths for the target platform. |
| 20 | +//! ### Linking |
21 | 21 | //!
|
22 | 22 | //! There are also a number of environment variables which can configure how a
|
23 | 23 | //! library is linked to (dynamically vs statically). These variables control
|
|
30 | 30 | //! * `PKG_CONFIG_ALL_STATIC` - pass `--static` for all libraries
|
31 | 31 | //! * `PKG_CONFIG_ALL_DYNAMIC` - do not pass `--static` for all libraries
|
32 | 32 | //!
|
33 |
| -//! After running `pkg-config` all appropriate Cargo metadata will be printed on |
34 |
| -//! stdout if the search was successful. |
| 33 | +//! ### Cross-compilation |
| 34 | +//! |
| 35 | +//! In cross-compilation context, it is useful to manage separately |
| 36 | +//! `PKG_CONFIG_PATH` and a few other variables for the `host` and the `target` |
| 37 | +//! platform. |
| 38 | +//! |
| 39 | +//! The supported variables are: `PKG_CONFIG_PATH`, `PKG_CONFIG_LIBDIR`, and |
| 40 | +//! `PKG_CONFIG_SYSROOT_DIR`. |
| 41 | +//! |
| 42 | +//! Each of these variables can also be supplied with certain prefixes and |
| 43 | +//! suffixes, in the following prioritized order: |
| 44 | +//! |
| 45 | +//! 1. `<var>_<target>` - for example, `PKG_CONFIG_PATH_x86_64-unknown-linux-gnu` |
| 46 | +//! 2. `<var>_<target_with_underscores>` - for example, |
| 47 | +//! `PKG_CONFIG_PATH_x86_64_unknown_linux_gnu` |
| 48 | +//! 3. `<build-kind>_<var>` - for example, `HOST_PKG_CONFIG_PATH` or |
| 49 | +//! `TARGET_PKG_CONFIG_PATH` |
| 50 | +//! 4. `<var>` - a plain `PKG_CONFIG_PATH` |
| 51 | +//! |
| 52 | +//! This crate will allow `pkg-config` to be used in cross-compilation |
| 53 | +//! if `PKG_CONFIG_SYSROOT_DIR` or `PKG_CONFIG` is set. You can set |
| 54 | +//! `PKG_CONFIG_ALLOW_CROSS=1` to bypass the compatibility check, but please |
| 55 | +//! note that enabling use of `pkg-config` in cross-compilation without |
| 56 | +//! appropriate sysroot and search paths set is likely to break builds. |
35 | 57 | //!
|
36 | 58 | //! # Example
|
37 | 59 | //!
|
|
0 commit comments