Commit cbc114bc authored by Rasmus Thomsen's avatar Rasmus Thomsen
Browse files

community/rust: don't remove libs in /usr/lib

Rust doesn't duplicate libraries anymore, so we mustn't remove libs in /usr/lib
to save space. As such we also won't need the rpath patch anymore.
Bootstrap from tarballs again since the version in the repos has gone bad due
to this.
parent 68b7d37c
......@@ -7,7 +7,7 @@ pkgname=rust
pkgver=1.40.0
_llvmver=9
_bootver=1.39.0
pkgrel=0
pkgrel=1
pkgdesc="The Rust Programming Language"
url="https://www.rust-lang.org"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"
......@@ -58,6 +58,12 @@ subpackages="
cargo-doc:_cargo_doc:noarch
"
source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz
https://dist.cogitri.dev/rust/rust-$_bootver-x86_64.tar
https://dist.cogitri.dev/rust/rust-$_bootver-x86.tar
https://dist.cogitri.dev/rust/rust-$_bootver-armhf.tar
https://dist.cogitri.dev/rust/rust-$_bootver-armv7.tar
https://dist.cogitri.dev/rust/rust-$_bootver-aarch64.tar
https://dist.cogitri.dev/rust/rust-$_bootver-ppc64le.tar
musl-fix-static-linking.patch
musl-fix-linux_musl_base.patch
static-pie.patch
......@@ -69,9 +75,7 @@ source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz
check-rustc
link-musl-dynamically.patch
musl-dont-use-crt-static.patch
0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
alpine-change-rpath-to-rustlib.patch
"
0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch"
builddir="$srcdir/rustc-$pkgver-src"
# secfixes:
......@@ -115,6 +119,8 @@ _sharedir="usr/share/rust"
ldpath="/$_rlibdir"
# Find rustc in the tarball
export PATH="$srcdir/rust-$CARCH/usr/bin:$PATH"
export RUST_BACKTRACE=1
# Don't use system libgit2 for now...
# https://github.com/rust-lang/rust/issues/63476
......@@ -197,14 +203,6 @@ package() {
cd "$pkgdir"
# These libraries are identical to those under rustlib/. Since we have
# linked rustc/rustdoc against those under rustlib/, we can remove
# them. Read change-rpath-to-rustlib.patch for more info.
rm -r usr/lib/*.so
# Shared objects should have executable flag.
chmod +x $_rlibdir/*.so
# Python scripts are noarch, so move them to /usr/share.
# Requires move-py-scripts-to-share.patch to be applied.
_mv usr/lib/rustlib/etc/*.py $_sharedir/etc/
......@@ -313,6 +311,12 @@ _mv() {
}
sha512sums="8afdb7fddbc5f2cec05fe962cd425ff8f3f41b056ffc983135d21d5c7d217084a1d73b4f9e4ff12faf7731ff1332d2889b71eed0a5216dd5eff5302d26b33d1e rustc-1.40.0-src.tar.gz
26de35c032183771374e9f7848d39e9b62d4475290637e3f47362648f4ef5297c0c7fa365cfc7516bfaac24802585b5a3d2be3959ab5cd7191db9808768a4892 rust-1.39.0-x86_64.tar
43530e8cc0f6112c26c13896236165a2ba8578a602dd55c4ea7239071169a649e53759cf995e414d7c5ccdf6d64290db2bbe07752544037f7bc96c2b65c2c470 rust-1.39.0-x86.tar
43c49bb4de1218e731239ed425cf98adcfb0797740f4937bfc216be4c1795603bf833ae2bf8401e491ca779b9e300fc0200e292d7734d199cf54bd2fe14c372e rust-1.39.0-armhf.tar
960201211406c9a7947d72a89a659b68f0119e0abb3b4a3ebaa5f295e05bdfa6b34fc978ff1b7f93f1e8c1d7040889b64fde04845262ec86f069b09c7842911b rust-1.39.0-armv7.tar
3997fb74a36fa22db0fa1ffe6907e3a67fa17627ffa8b0668540bdfe2b64441f0036e0ccca47828a689463309c9b1ecd229a851fabf97a7022cb855b2b70da1c rust-1.39.0-aarch64.tar
eaaf7ed97d7945d40373eb55be6ee6d70e5442579fe8b956d968fc530a9fc466240843b5cfd29fb80396da810b88516aecc6c5c909fc04e1670a0b1318aafe9d rust-1.39.0-ppc64le.tar
8d52048070e9a158810f5ef71eae07a3b107b60986375a593c3509f4c47f8e2f7fcdff8bc558c03c46127dbf66c4077dd7b5b422a83f2c49fb5d52ecfae5697e musl-fix-static-linking.patch
41fd9e8a8dd99074d95d664e65f92dba644b8ef9fa37b9a1d781a01fe49eaa254c430f0f277622dc4f8203aad2d129a045fdf1679a0da526d549fac60654be26 musl-fix-linux_musl_base.patch
97e81c57af93df550577f41d795185a9eb0c37528776c250076cc57f06c87e81139eb71cd6b6a4730528511821ae50c304d7deb534d6422cd08bb44193ae605d static-pie.patch
......@@ -324,5 +328,4 @@ e90e544d2413ae79c553bb1d82eac9b41eb2a7c7ffb7cb28dc3573418bd453c27dcc48f38ce4b8e3
c31fdfe8a9b3411576c75da46645cf0465b9053000a2ab49cf9b2f2733f679d6d33acbf236d67a20e14935d094a685453b7f1840180249f39d610fd0902c3125 check-rustc
2a91c0d149f19a2268b2db8e375e0c10820529f588161d8d8e68900d929235d9b1cb4f0d64539c1e20ecca3948b4715f2d9d3d16a2754373d56b4b5808bed6bd link-musl-dynamically.patch
795194976763326c5e4a9eefc8b651b6d5fb533d2d000631ed48a92bafac90e9ca33b8d662e6c53ef109ea1a90c69def715d7d7154e3f9fb9035a58a313a7db3 musl-dont-use-crt-static.patch
f15c8e6a4c8ad33ee5874580ed76463e2a7359e9b4a8651eb974ea5354c3f992fd2ce1d04661ee8cff2105b25967428894ecdd144a6a45f09c7e1952b2f3731c 0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
f1b956fd1367b09a959367ee4f61b77d88e2b445d2b778080f9f0b1ef0bd8c65edd993faad45ef355f92d60ca3d62029d92cdf52fbe7b2a979add829bedb4d6b alpine-change-rpath-to-rustlib.patch"
f15c8e6a4c8ad33ee5874580ed76463e2a7359e9b4a8651eb974ea5354c3f992fd2ce1d04661ee8cff2105b25967428894ecdd144a6a45f09c7e1952b2f3731c 0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch"
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/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -989,12 +989,12 @@
// so. Note that this is definitely a hack, and we should likely
// flesh out rpath support more fully in the future.
rustflags.arg("-Zosx-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("emscripten") &&
!target.contains("fuchsia") {
- Some("-Wl,-rpath,$ORIGIN/../lib")
+ Some(format!("-Wl,-rpath,$ORIGIN/../lib/rustlib/{}/lib", target))
} else {
None
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment