aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-04-08 20:43:36 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-04-09 15:41:28 +0200
commit2e440a2067add072c4c1936e9496b06b1b403b4c (patch)
tree8a60b292a793109b3992f5de0c8d740d382d8ddf /testing/rust
parent4147e840f62c20b8a776601cca54fd61fe86899c (diff)
downloadaports-2e440a2067add072c4c1936e9496b06b1b403b4c.tar.bz2
aports-2e440a2067add072c4c1936e9496b06b1b403b4c.tar.xz
testing/rust: remove duplicated libs and move only *.rlib to -stdlib
Diffstat (limited to 'testing/rust')
-rw-r--r--testing/rust/APKBUILD31
-rw-r--r--testing/rust/change-rpath-to-rustlib.patch37
2 files changed, 55 insertions, 13 deletions
diff --git a/testing/rust/APKBUILD b/testing/rust/APKBUILD
index 0bade65b02..3ae2222d33 100644
--- a/testing/rust/APKBUILD
+++ b/testing/rust/APKBUILD
@@ -13,7 +13,7 @@ license="ASL-2.0 BSD ISC MIT"
# gcc is needed at runtime just for linking. Someday rustc might invoke
# the linker directly, and then we'll only need binutils.
# See: https://github.com/rust-lang/rust/issues/11937
-depends="$pkgname-stdlib gcc"
+depends="$pkgname-stdlib=$pkgver-r$pkgrel gcc"
# libffi-dev is needed just because we compile llvm with LLVM_ENABLE_FFI.
makedepends="cmake file libffi-dev libunwind-dev llvm llvm-dev
musl-dev python2 tar zlib-dev"
@@ -34,15 +34,19 @@ source="https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz
fix-linux_musl_base.patch
llvm-with-ffi.patch
move-py-scripts-to-share.patch
+ change-rpath-to-rustlib.patch
"
# TODO: strip gently (see Fedora pkg for inspiration)
options="!strip !check"
builddir="$srcdir/rustc-$pkgver-src"
_ctarget="$CARCH-unknown-linux-musl"
+_rlibdir="usr/lib/rustlib/$_ctarget/lib"
_sharedir="usr/share/rust"
_stage0dir="$srcdir/stage0"
+ldpath="/$_rlibdir"
+
prepare() {
default_prepare
@@ -87,8 +91,7 @@ build() {
--enable-vendor \
--enable-llvm-link-shared \
--disable-docs \
- --disable-jemalloc \
- --disable-rpath
+ --disable-jemalloc
# Set LD_LIBRARY_PATH, so rustc in stage0 can find correct libs.
make \
@@ -107,9 +110,6 @@ check() {
VERBOSE=1
}
-# XXX: so libs doesn't have stable ABI, so they should not be registered as
-# provided dependencies. The problem is that abuild doesn't provide an option
-# to disable it without completely disabling dependencies tracking.
package() {
cd "$builddir"
@@ -119,13 +119,18 @@ package() {
cd "$pkgdir"
- # so libs should have executable flag.
- chmod +x usr/lib/*.so
+ # 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/
- rmdir -p usr/lib/rustlib/etc || true
+ rmdir -p usr/lib/rustlib/etc 2>/dev/null || true
# Remove some clutter.
cd usr/lib/rustlib
@@ -133,10 +138,9 @@ package() {
}
stdlib() {
- pkgdesc="The Rust Programming Language (stdlib)"
- depends="$pkgname"
+ pkgdesc="Standard library for Rust (static rlibs)"
- _mv "$pkgdir"/usr/lib/rustlib "$subpkgdir"/usr/lib/
+ _mv "$pkgdir"/$_rlibdir/*.rlib "$subpkgdir"/$_rlibdir/
}
gdb() {
@@ -177,4 +181,5 @@ a87ffe129debcb9fa958c6d007ffa4a87927890030e0694ee5ab1929ea0c5a48dad86b4e8b71550d
541aac679dfdbe5383f884e0493462dd33908308c7b294170b24339d6b9c1e723088c80764125116f24707a67eeeedadceaa9628ca6d2b8c7d0ca9253bf62135 static-pie.patch
f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef fix-linux_musl_base.patch
37416e1fa0bc0c8651cd060a645d6245ff7e2082279ab5e13495c5ee412c71915469019cfbec95a0fd9a7fc144475079a3ad16f0eba7a2f5c8dd99e0002f3225 llvm-with-ffi.patch
-19cc2725d68db3e359e0e3016028374e5818a97fdba24d0103f7d1706601c8b17c4dd95a3152e64f982f98e95ad3e949acddbea8a39ed0ba8dd4f702acc2704d move-py-scripts-to-share.patch"
+19cc2725d68db3e359e0e3016028374e5818a97fdba24d0103f7d1706601c8b17c4dd95a3152e64f982f98e95ad3e949acddbea8a39ed0ba8dd4f702acc2704d move-py-scripts-to-share.patch
+8d6206f8c50856724cf7b4c1854ec82547f040358a1c7d44abeacc27a5c205a963b1fec51e58ec06c68d85bd2f68a9e6e27ebe457f39e8dd043de17758f5063f change-rpath-to-rustlib.patch"
diff --git a/testing/rust/change-rpath-to-rustlib.patch b/testing/rust/change-rpath-to-rustlib.patch
new file mode 100644
index 0000000000..4be0f9d0a6
--- /dev/null
+++ b/testing/rust/change-rpath-to-rustlib.patch
@@ -0,0 +1,37 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 08 Aug 2016 19:56: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
+@@ -189,9 +189,9 @@
+ if stage != "0" {
+ 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") {
+- Some("-Wl,-rpath,$ORIGIN/../lib")
++ Some(format!("-Wl,-rpath,$ORIGIN/../lib/rustlib/{}/lib", target))
+ } else {
+ None
+ };