rustc/debian/patches/d-0002-pkg-config-no-special-snowflake.patch

85 lines
2.7 KiB
Diff

--- a/vendor/pkg-config/src/lib.rs
+++ b/vendor/pkg-config/src/lib.rs
@@ -9,8 +9,6 @@
//! A number of environment variables are available to globally configure how
//! this crate will invoke `pkg-config`:
//!
-//! * `PKG_CONFIG_ALLOW_CROSS` - if this variable is not set, then `pkg-config`
-//! will automatically be disabled for all cross compiles.
//! * `FOO_NO_PKG_CONFIG` - if set, this will disable running `pkg-config` when
//! probing for the library named `foo`.
//!
@@ -106,9 +104,8 @@
/// Contains the name of the responsible environment variable.
EnvNoPkgConfig(String),
- /// Cross compilation detected.
- ///
- /// Override with `PKG_CONFIG_ALLOW_CROSS=1`.
+ /// Cross compilation detected. Kept for compatibility;
+ /// the Debian package never emits this.
CrossCompilation,
/// Failed to run `pkg-config`.
@@ -132,11 +129,6 @@
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
match *self {
Error::EnvNoPkgConfig(ref name) => write!(f, "Aborted because {} is set", name),
- Error::CrossCompilation => write!(
- f,
- "Cross compilation detected. \
- Use PKG_CONFIG_ALLOW_CROSS=1 to override"
- ),
Error::Command {
ref command,
ref cause,
@@ -160,7 +152,7 @@
}
Ok(())
}
- Error::__Nonexhaustive => panic!(),
+ Error::CrossCompilation | Error::__Nonexhaustive => panic!(),
}
}
}
@@ -321,6 +313,8 @@
if host == target {
return true;
}
+ // always enable PKG_CONFIG_ALLOW_CROSS override in Debian
+ return true;
// pkg-config may not be aware of cross-compilation, and require
// a wrapper script that sets up platform-specific prefixes.
@@ -380,7 +374,11 @@
fn command(&self, name: &str, args: &[&str]) -> Command {
let exe = self
.env_var_os("PKG_CONFIG")
- .unwrap_or_else(|| OsString::from("pkg-config"));
+ .unwrap_or_else(|| {
+ self.env_var_os("DEB_HOST_GNU_TYPE")
+ .map(|mut t| { t.push(OsString::from("-pkg-config")); t })
+ .unwrap_or_else(|| OsString::from("pkg-config"))
+ });
let mut cmd = Command::new(exe);
if self.is_static(name) {
cmd.arg("--static");
--- a/vendor/pkg-config/tests/test.rs
+++ b/vendor/pkg-config/tests/test.rs
@@ -34,7 +34,6 @@
pkg_config::probe_library(name)
}
-#[test]
fn cross_disabled() {
let _g = LOCK.lock();
reset();
@@ -46,7 +45,6 @@
}
}
-#[test]
fn cross_enabled() {
let _g = LOCK.lock();
reset();