d-cross-compile-install
authorRust Maintainers <pkg-rust-maintainers@lists.alioth.debian.org>
Mon, 17 Jul 2017 11:41:59 +0000 (12:41 +0100)
committerXimin Luo <infinity0@debian.org>
Mon, 17 Jul 2017 11:41:59 +0000 (12:41 +0100)
Gbp-Pq: Name d-cross-compile-install.patch

src/bootstrap/step.rs

index bfa1e4b6ddd7cc5383334cd80971f3e537392a1e..d4abfe43d72e4d409a5c7992753fd4b0d5a64aaf 100644 (file)
@@ -899,11 +899,18 @@ pub struct Rules<'a> {
 
 impl<'a> Rules<'a> {
     fn new(build: &'a Build) -> Rules<'a> {
+        let target_env = ::std::env::var("DEB_HOST_RUST_TYPE").unwrap();
+        // rust forces us to do this dance because of lifetimes :/
+        let hosts = &build.config.host;
+        let target = match hosts.iter().position(|x| x == target_env.as_str()) {
+            None => &build.config.build,
+            Some(tidx) => hosts[tidx].as_str()
+        };
         Rules {
             build: build,
             sbuild: Step {
                 stage: build.flags.stage.unwrap_or(2),
-                target: &build.config.build,
+                target: target,
                 host: &build.config.build,
                 name: "",
             },