diff options
Diffstat (limited to 'vendor/pkg-config/debian/patches')
3 files changed, 127 insertions, 0 deletions
diff --git a/vendor/pkg-config/debian/patches/debian-auto-cross-compile.patch b/vendor/pkg-config/debian/patches/debian-auto-cross-compile.patch new file mode 100644 index 0000000..af109de --- /dev/null +++ b/vendor/pkg-config/debian/patches/debian-auto-cross-compile.patch @@ -0,0 +1,17 @@ +Index: pkg-config/src/lib.rs +=================================================================== +--- pkg-config.orig/src/lib.rs ++++ pkg-config/src/lib.rs +@@ -467,7 +467,11 @@ impl Config { + } else { + None + }; +- let exe = pkg_config_exe.unwrap_or_else(|| OsString::from("pkg-config")); ++ let exe = pkg_config_exe.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 = self.command(exe, name, args); + diff --git a/vendor/pkg-config/debian/patches/no-special-snowflake-env.patch b/vendor/pkg-config/debian/patches/no-special-snowflake-env.patch new file mode 100644 index 0000000..696a94c --- /dev/null +++ b/vendor/pkg-config/debian/patches/no-special-snowflake-env.patch @@ -0,0 +1,108 @@ +Index: pkg-config/src/lib.rs +=================================================================== +--- pkg-config.orig/src/lib.rs ++++ pkg-config/src/lib.rs +@@ -12,13 +12,6 @@ + //! * `FOO_NO_PKG_CONFIG` - if set, this will disable running `pkg-config` when + //! probing for the library named `foo`. + //! +-//! * `PKG_CONFIG_ALLOW_CROSS` - The `pkg-config` command usually doesn't +-//! support cross-compilation, and this crate prevents it from selecting +-//! incompatible versions of libraries. +-//! Setting `PKG_CONFIG_ALLOW_CROSS=1` disables this protection, which is +-//! likely to cause linking errors, unless `pkg-config` has been configured +-//! to use appropriate sysroot and search paths for the target platform. +-//! + //! There are also a number of environment variables which can configure how a + //! library is linked to (dynamically vs statically). These variables control + //! whether the `--static` flag is passed. Note that this behavior can be +@@ -117,11 +110,8 @@ pub enum Error { + /// Contains the name of the responsible environment variable. + EnvNoPkgConfig(String), + +- /// Detected cross compilation without a custom sysroot. +- /// +- /// Ignore the error with `PKG_CONFIG_ALLOW_CROSS=1`, +- /// which may let `pkg-config` select libraries +- /// for the host's architecture instead of the target's. ++ /// Cross compilation detected. Kept for compatibility; ++ /// the Debian package never emits this. + CrossCompilation, + + /// Failed to run `pkg-config`. +@@ -161,14 +151,6 @@ impl fmt::Display for Error { + 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 => f.write_str( +- "pkg-config has not been configured to support cross-compilation.\n\ +- \n\ +- Install a sysroot for the target platform and configure it via\n\ +- PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a\n\ +- cross-compiling wrapper for pkg-config and set it via\n\ +- PKG_CONFIG environment variable.", +- ), + Error::Command { + ref command, + ref cause, +@@ -226,7 +208,7 @@ impl fmt::Display for Error { + )?; + format_output(output, f) + } +- Error::__Nonexhaustive => panic!(), ++ Error::CrossCompilation | Error::__Nonexhaustive => panic!(), + } + } + } +@@ -420,6 +402,8 @@ impl Config { + 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. +Index: pkg-config/tests/test.rs +=================================================================== +--- pkg-config.orig/tests/test.rs ++++ pkg-config/tests/test.rs +@@ -31,7 +31,6 @@ fn find(name: &str) -> Result<pkg_config + pkg_config::probe_library(name) + } + +-#[test] + fn cross_disabled() { + let _g = LOCK.lock(); + reset(); +@@ -43,7 +42,6 @@ fn cross_disabled() { + } + } + +-#[test] + fn cross_enabled() { + let _g = LOCK.lock(); + reset(); +@@ -63,7 +61,6 @@ fn cross_enabled_if_customized() { + find("foo").unwrap(); + } + +-#[test] + fn cross_disabled_if_customized() { + let _g = LOCK.lock(); + reset(); +@@ -71,10 +68,10 @@ fn cross_disabled_if_customized() { + env::set_var("HOST", "bar"); + env::set_var("PKG_CONFIG_ALLOW_CROSS", "0"); + env::set_var("PKG_CONFIG_SYSROOT_DIR", "/tmp/cross-test"); +- match find("foo") { +- Err(Error::CrossCompilation) => {} +- _ => panic!("expected CrossCompilation failure"), +- } ++// match find("foo") { ++// Err(Error::CrossCompilation) => {} ++// _ => panic!("expected CrossCompilation failure"), ++// } + } + + #[test] diff --git a/vendor/pkg-config/debian/patches/series b/vendor/pkg-config/debian/patches/series new file mode 100644 index 0000000..5073013 --- /dev/null +++ b/vendor/pkg-config/debian/patches/series @@ -0,0 +1,2 @@ +no-special-snowflake-env.patch +debian-auto-cross-compile.patch |