Package: rustc / 1.46.0+dfsg1-1

d-0002-pkg-config-no-special-snowflake.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
--- 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 @@ pub enum Error {
     /// 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`.
@@ -130,13 +127,9 @@ impl error::Error for Error {
     fn description(&self) -> &str {
         match *self {
             Error::EnvNoPkgConfig(_) => "pkg-config requested to be aborted",
-            Error::CrossCompilation => {
-                "pkg-config doesn't handle cross compilation. \
-                 Use PKG_CONFIG_ALLOW_CROSS=1 to override"
-            }
             Error::Command { .. } => "failed to run pkg-config",
             Error::Failure { .. } => "pkg-config did not exit sucessfully",
-            Error::__Nonexhaustive => panic!(),
+            Error::CrossCompilation | Error::__Nonexhaustive => panic!(),
         }
     }
 
@@ -152,11 +145,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 => write!(
-                f,
-                "Cross compilation detected. \
-                 Use PKG_CONFIG_ALLOW_CROSS=1 to override"
-            ),
             Error::Command {
                 ref command,
                 ref cause,
@@ -180,7 +168,7 @@ impl fmt::Display for Error {
                 }
                 Ok(())
             }
-            Error::__Nonexhaustive => panic!(),
+            Error::CrossCompilation | Error::__Nonexhaustive => panic!(),
         }
     }
 }
@@ -341,6 +329,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.
@@ -399,7 +389,11 @@ impl Config {
     fn command(&self, name: &str, args: &[&str]) -> Command {
         let exe = self
             .env_var("PKG_CONFIG")
-            .unwrap_or_else(|_| String::from("pkg-config"));
+            .unwrap_or_else(|_| {
+                self.env_var("DEB_HOST_GNU_TYPE")
+                    .map(|t| t.to_string() + "-pkg-config")
+                    .unwrap_or_else(|_| String::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 @@ fn find(name: &str) -> Result<pkg_config
     pkg_config::probe_library(name)
 }
 
-#[test]
 fn cross_disabled() {
     let _g = LOCK.lock();
     reset();
@@ -46,7 +45,6 @@ fn cross_disabled() {
     }
 }
 
-#[test]
 fn cross_enabled() {
     let _g = LOCK.lock();
     reset();