mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-25 12:15:32 +03:00
40 lines
1.8 KiB
Diff
40 lines
1.8 KiB
Diff
From: Jakub Jirutka <jakub@jirutka.cz>
|
|
Date: Sat, 08 Aug 2016 19:56:00 +0200
|
|
Last-Updated: Sun, 20 May 2018 00:09:00 +0200
|
|
Subject: [PATCH] Change rpath for rustc/rustdoc to rustlib/$TARGET/lib
|
|
|
|
Rust installs two identical sets of *.so libraries into /usr/lib and
|
|
/usr/lib/rustlib/$TARGET/lib. The former comes with the rustc component,
|
|
/usr/bin/rustc and /usr/bin/rustdoc are linked against them. The latter
|
|
comes with rust-std and are used for binaries dynamically linked against
|
|
Rust libraries (usually compiler plugins, like clippy).
|
|
|
|
These *.so libraries don't keep stable ABI, so it's better to treat
|
|
them as private. Such libraries should not be exposed at standard paths
|
|
like /usr/lib, but use rpath.
|
|
|
|
This patch changes rpath for binaries of the rustc component to
|
|
`$ORIGIN/../lib/rustlib/$TARGET/lib`. Duplicate libraries will be still
|
|
installed into /usr/lib, but we can simply remove them when packaging.
|
|
|
|
Related upstream issues:
|
|
|
|
* https://github.com/rust-lang/rust/issues/37971
|
|
* https://github.com/rust-lang-nursery/rustup.rs/issues/837
|
|
|
|
--- a/src/bootstrap/bin/rustc.rs
|
|
+++ b/src/bootstrap/bin/rustc.rs
|
|
@@ -224,11 +224,11 @@
|
|
// so. Note that this is definitely a hack, and we should likely
|
|
// flesh out rpath support more fully in the future.
|
|
cmd.arg("-Z").arg("osx-rpath-install-name");
|
|
- Some("-Wl,-rpath,@loader_path/../lib")
|
|
+ Some("-Wl,-rpath,@loader_path/../lib".to_string())
|
|
} else if !target.contains("windows") &&
|
|
!target.contains("wasm32") &&
|
|
!target.contains("fuchsia") {
|
|
- Some("-Wl,-rpath,$ORIGIN/../lib")
|
|
+ Some(format!("-Wl,-rpath,$ORIGIN/../lib/rustlib/{}/lib", target))
|
|
} else {
|
|
None
|
|
};
|