|
5 | 5 | //! declarative, so other tools can read them as well.
|
6 | 6 | //!
|
7 | 7 | //! # Usage
|
| 8 | +//! |
8 | 9 | //! In your `Cargo.toml`:
|
9 | 10 | //!
|
10 | 11 | //! ```toml
|
|
78 | 79 | //! ```
|
79 | 80 | //!
|
80 | 81 | //! # Fallback library names
|
| 82 | +//! |
81 | 83 | //! Some libraries may be available under different names on different platforms or distributions.
|
82 | 84 | //! To allow for this, you can define fallback names to search for if the main library name does not work.
|
83 | 85 | //!
|
|
88 | 90 | //!
|
89 | 91 | //! You may also specify different fallback names for different versions:
|
90 | 92 | //!
|
| 93 | +//! ```toml |
91 | 94 | //! [package.metadata.system-deps.libfoo]
|
92 | 95 | //! version = "0.1"
|
93 | 96 | //! fallback-names = ["libfoo-0.1"]
|
94 | 97 | //! v1 = { version = "1.0", fallback-names = ["libfoo1"] }
|
95 | 98 | //! v2 = { version = "2.0", fallback-names = ["libfoo2"] }
|
| 99 | +//! ``` |
96 | 100 | //!
|
97 | 101 | //! # Feature versions
|
| 102 | +//! |
98 | 103 | //! `-sys` crates willing to support various versions of their underlying system libraries
|
99 | 104 | //! can use features to control the version of the dependency required.
|
100 | 105 | //! `system-deps` will pick the highest version among enabled features.
|
|
149 | 154 | //! - `unix` and `windows`
|
150 | 155 | //!
|
151 | 156 | //! # Overriding build flags
|
| 157 | +//! |
152 | 158 | //! By default `system-deps` automatically defines the required build flags for each dependency using the information fetched from `pkg-config`.
|
153 | 159 | //! These flags can be overridden using environment variables if needed:
|
| 160 | +//! |
154 | 161 | //! - `SYSTEM_DEPS_$NAME_SEARCH_NATIVE` to override the [`cargo:rustc-link-search=native`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-searchkindpath) flag;
|
155 | 162 | //! - `SYSTEM_DEPS_$NAME_SEARCH_FRAMEWORK` to override the [`cargo:rustc-link-search=framework`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-searchkindpath) flag;
|
156 | 163 | //! - `SYSTEM_DEPS_$NAME_LIB` to override the [`cargo:rustc-link-lib`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib) flag;
|
|
167 | 174 | //!
|
168 | 175 | //! `-sys` crates can provide support for building and statically link their underlying system library as part of their build process.
|
169 | 176 | //! Here is how to do this in your `build.rs`:
|
| 177 | +//! |
170 | 178 | //! ```should_panic
|
171 | 179 | //! fn main() {
|
172 | 180 | //! system_deps::Config::new()
|
|
181 | 189 | //!
|
182 | 190 | //! This feature can be controlled using the `SYSTEM_DEPS_$NAME_BUILD_INTERNAL` environment variable
|
183 | 191 | //! which can have the following values:
|
| 192 | +//! |
184 | 193 | //! - `auto`: build the dependency only if the required version has not been found by `pkg-config`;
|
185 | 194 | //! - `always`: always build the dependency, ignoring any version which may be installed on the system;
|
186 | 195 | //! - `never`: (default) never build the dependency, `system-deps` will fail if the required version is not found on the system.
|
@@ -370,7 +379,7 @@ impl Dependencies {
|
370 | 379 | self.aggregate_path_buf(|l| &l.include_paths)
|
371 | 380 | }
|
372 | 381 |
|
373 |
| - /// Returns a vector of [Library::linker_args] of each library, removing duplicates. |
| 382 | + /// Returns a vector of [Library::ld_args] of each library, removing duplicates. |
374 | 383 | pub fn all_linker_args(&self) -> Vec<&Vec<String>> {
|
375 | 384 | let mut v = self
|
376 | 385 | .libs
|
|
0 commit comments