8 | 8 |
//! * `FOO_NO_PKG_CONFIG` - if set, this will disable running `pkg-config` when
|
9 | 9 |
//! probing for the library named `foo`.
|
10 | 10 |
//!
|
11 | |
@@ -76,15 +74,7 @@
|
12 | |
use std::str;
|
13 | |
|
14 | |
pub fn target_supported() -> bool {
|
15 | |
- let target = env::var("TARGET").unwrap_or_else(|_| String::new());
|
16 | |
- let host = env::var("HOST").unwrap_or_else(|_| String::new());
|
17 | |
-
|
18 | |
- // Only use pkg-config in host == target situations by default (allowing an
|
19 | |
- // override) and then also don't use pkg-config on MSVC as it's really not
|
20 | |
- // meant to work there but when building MSVC code in a MSYS shell we may be
|
21 | |
- // able to run pkg-config anyway.
|
22 | |
- (host == target || env::var_os("PKG_CONFIG_ALLOW_CROSS").is_some()) &&
|
23 | |
- !target.contains("msvc")
|
24 | |
+ true
|
|
11 |
@@ -81,7 +79,7 @@
|
|
12 |
|
|
13 |
// Only use pkg-config in host == target situations by default (allowing an
|
|
14 |
// override).
|
|
15 |
- (host == target || env::var_os("PKG_CONFIG_ALLOW_CROSS").is_some())
|
|
16 |
+ (host == target || true)
|
25 | 17 |
}
|
26 | 18 |
|
27 | 19 |
#[derive(Clone, Default)]
|
28 | |
@@ -116,9 +106,8 @@
|
|
20 |
@@ -113,9 +111,8 @@
|
29 | 21 |
/// Contains the name of the responsible environment variable.
|
30 | 22 |
EnvNoPkgConfig(String),
|
31 | 23 |
|
|
36 | 28 |
+ /// the Debian package never emits this.
|
37 | 29 |
CrossCompilation,
|
38 | 30 |
|
39 | |
/// Attempted to compile using the MSVC ABI build
|
40 | |
@@ -143,10 +132,7 @@
|
|
31 |
/// Failed to run `pkg-config`.
|
|
32 |
@@ -137,10 +134,6 @@
|
41 | 33 |
fn description(&self) -> &str {
|
42 | 34 |
match *self {
|
43 | 35 |
Error::EnvNoPkgConfig(_) => "pkg-config requested to be aborted",
|
|
45 | 37 |
- "pkg-config doesn't handle cross compilation. \
|
46 | 38 |
- Use PKG_CONFIG_ALLOW_CROSS=1 to override"
|
47 | 39 |
- }
|
48 | |
+ Error::CrossCompilation => panic!(),
|
49 | |
Error::MSVC => "pkg-config is incompatible with the MSVC ABI build.",
|
50 | 40 |
Error::Command { .. } => "failed to run pkg-config",
|
51 | 41 |
Error::Failure { .. } => "pkg-config did not exit sucessfully",
|
52 | |
@@ -222,10 +208,7 @@
|
|
42 |
Error::__Nonexhaustive => panic!(),
|
|
43 |
@@ -214,10 +207,6 @@
|
53 | 44 |
Error::EnvNoPkgConfig(ref name) => {
|
54 | 45 |
write!(f, "Aborted because {} is set", name)
|
55 | 46 |
}
|
|
57 | 48 |
- write!(f, "Cross compilation detected. \
|
58 | 49 |
- Use PKG_CONFIG_ALLOW_CROSS=1 to override")
|
59 | 50 |
- }
|
60 | |
+ Error::CrossCompilation => panic!(),
|
61 | |
Error::MSVC => {
|
62 | |
write!(f, "MSVC target detected. If you are using the MSVC ABI \
|
63 | |
rust build, please use the GNU ABI build instead.")
|
64 | |
@@ -405,7 +388,11 @@
|
|
51 |
Error::Command { ref command, ref cause } => {
|
|
52 |
write!(f, "Failed to run `{}`: {}", command, cause)
|
|
53 |
}
|
|
54 |
@@ -388,7 +377,11 @@
|
65 | 55 |
}
|
66 | 56 |
|
67 | 57 |
fn command(&self, name: &str, args: &[&str]) -> Command {
|