void-packages/srcpkgs/rust/patches/lzma-sys-cross-ldflags.patch
q66 a57bfd40e8 rust: fix miscompilation of rustc on musl + enable vendor crates
This commit fixes several things.

1) It enables usage of vendor crates, making our patches actually
   do something (those for the vendor/ subdirectory anyway)
2) By extension, it enables dynamic linking of musl, which was not
   being done at all.
3) Removes the ugly LDFLAGS hack, which was causing miscompilation
   in cross environments, as it didn't pass the cross sysroot to
   search for libs in when linking. This resulted in a particularly
   bad miscompilation when cross-compiling from glibc to musl on
   the same architecture, as it would link against glibc's libc.a
   instead of musl's libc.a (not libc.so because the musl dynamic
   link patch was not being used), resulting in failures when
   actually compiling various projects. This hack is now replaced
   with properly patching the lzma-sys crate instead, which was
   the culprit previously when it comes to failures.

[ci skip]
2019-05-03 15:46:57 +02:00

11 lines
455 B
Diff

This allows lzma-sys to build in a cross-compiling environment.
--- rustc-1.33.0-src/vendor/lzma-sys/build.rs
+++ rustc-1.33.0-src/vendor/lzma-sys/build.rs
@@ -101,6 +101,7 @@
}
cmd.env("CC", compiler.path())
.env("CFLAGS", cflags)
+ .env("LDFLAGS", "")
.current_dir(&dst.join("build"))
.arg(sanitize_sh(&src.join("configure")));
cmd.arg(format!("--prefix={}", sanitize_sh(&dst)));