d-rustflags
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Sat, 29 Aug 2020 15:54:36 +0000 (16:54 +0100)
committerXimin Luo <infinity0@debian.org>
Sat, 29 Aug 2020 15:54:36 +0000 (16:54 +0100)
Gbp-Pq: Name d-rustflags.patch

src/bootstrap/builder.rs

index c7061f8ca15fa95c04c5ae743147f4a964b22601..c4a11d54e80d0139044f34b9fe800e293a4e1415 100644 (file)
@@ -831,6 +831,21 @@ impl<'a> Builder<'a> {
             rustflags.arg("--cfg=bootstrap");
         }
 
+        // Debian-specific stuff here
+        // don't error on warnings, this sometimes causes builds to fail when
+        // we re-bootstrap using the same version, that introduced a new warning
+        rustflags.arg("--cap-lints=warn");
+        // set linker flags from LDFLAGS
+        if let Ok(ldflags) = env::var("LDFLAGS") {
+            for flag in ldflags.split_whitespace() {
+                if target.contains("windows") && flag.contains("relro") {
+                    // relro is ELF-specific
+                    continue;
+                }
+                rustflags.arg(&format!("-Clink-args={}", flag));
+            }
+        }
+
         // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
         // but this breaks CI. At the very least, stage0 `rustdoc` needs `--cfg bootstrap`. See
         // #71458.