pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/rust rust: on Darwin, use proper shared library n...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ed475b7b8b2b
branches:  trunk
changeset: 339275:ed475b7b8b2b
user:      adam <adam%pkgsrc.org@localhost>
date:      Mon Sep 09 16:19:49 2019 +0000

description:
rust: on Darwin, use proper shared library name instead of @rpath

diffstat:

 lang/rust/Makefile                                                |  32 +---------
 lang/rust/distinfo                                                |   4 +-
 lang/rust/options.mk                                              |   6 +-
 lang/rust/patches/patch-src_build__helper_lib.rs                  |  15 ++++
 lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs |  15 ++++
 5 files changed, 39 insertions(+), 33 deletions(-)

diffs (123 lines):

diff -r 514727122eeb -r ed475b7b8b2b lang/rust/Makefile
--- a/lang/rust/Makefile        Mon Sep 09 16:05:01 2019 +0000
+++ b/lang/rust/Makefile        Mon Sep 09 16:19:49 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.113 2019/08/29 14:09:56 he Exp $
+# $NetBSD: Makefile,v 1.114 2019/09/09 16:19:49 adam Exp $
 
 DISTNAME=      rustc-1.37.0-src
 PKGNAME=       ${DISTNAME:S/rustc/rust/:S/-src//}
@@ -277,6 +277,8 @@
 SUBST_CLASSES+=                rpath
 SUBST_STAGE.rpath=     pre-configure
 SUBST_FILES.rpath=     src/bootstrap/bin/rustc.rs
+SUBST_FILES.rpath+=    src/build_helper/lib.rs
+SUBST_FILES.rpath+=    src/librustc_codegen_ssa/back/linker.rs
 SUBST_VARS.rpath=      PREFIX
 
 post-extract:
@@ -339,34 +341,6 @@
 GENERATE_PLIST+=find ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
                sed 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
 
-.if ${OPSYS} == "Darwin"
-LDFLAGS+=              -headerpad_max_install_names
-
-.PHONY: fix-darwin-install-name
-post-install: fix-darwin-install-name
-fix-darwin-install-name:
-.  for bin in cargo-miri clippy-driver miri rls rustc rustdoc
-       otool -XL ${DESTDIR}${PREFIX}/bin/${bin}                        \
-           | ${GREP} '@rpath' | while read rpath rest; do              \
-               install_name_tool -change $$rpath                       \
-                   `${ECHO} $$rpath | ${SED} -e 's,@rpath,${PREFIX}/lib,g'` \
-                   ${DESTDIR}${PREFIX}/bin/${bin};                     \
-       done
-.  endfor
-.  for libdir in lib lib/rustlib/${RUST_ARCH}/lib lib/rustlib/${RUST_ARCH}/codegen-backends
-       for f in ${DESTDIR}${PREFIX}/${libdir}/lib*.dylib; do           \
-               [ ! -f $$f ] && continue;                               \
-               install_name_tool -id `${ECHO} $$f | ${SED} -e 's,${DESTDIR},,g'` $$f; \
-               otool -XL $$f | grep '@rpath' | while read rpath rest; do \
-                       install_name_tool -change $$rpath \
-                           `${ECHO} $$rpath | ${SED} -e 's,@rpath,${PREFIX}/lib,g'` \
-                           $$f;                                        \
-               done;                                                   \
-       done
-.  endfor
-.endif
-
-#
 # Create a relocatable stage2 bootstrap from the bits we just built that can be
 # used to build the next version of rust.  Currently only tested on SmartOS.
 #
diff -r 514727122eeb -r ed475b7b8b2b lang/rust/distinfo
--- a/lang/rust/distinfo        Mon Sep 09 16:05:01 2019 +0000
+++ b/lang/rust/distinfo        Mon Sep 09 16:19:49 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.85 2019/08/29 14:09:56 he Exp $
+$NetBSD: distinfo,v 1.86 2019/09/09 16:19:49 adam Exp $
 
 SHA1 (rust-1.35.0-armv7-unknown-netbsd-eabihf.tar.gz) = 91517fa95f954427c627cf63eb7c518abd068f3e
 RMD160 (rust-1.35.0-armv7-unknown-netbsd-eabihf.tar.gz) = 06a3d922b27aac2deb570301542897a131b47cd0
@@ -108,6 +108,8 @@
 SHA1 (patch-src_bootstrap_bootstrap.py) = 5b886b95857bf019c2e37cb380e6905cb444b756
 SHA1 (patch-src_bootstrap_builder.rs) = 7e23348dc5555fdb3833a7f8734cfe687c6e533c
 SHA1 (patch-src_bootstrap_lib.rs) = bc23743f1b9c4ad3d7557b4fdf8a55976ca7f417
+SHA1 (patch-src_build__helper_lib.rs) = ef0b522e303f0490b86e64f40733c2ecb498da5b
+SHA1 (patch-src_librustc__codegen__ssa_back_linker.rs) = e7c592f78b9ee317521cf0258686173a31f1d2e0
 SHA1 (patch-src_librustc__llvm_build.rs) = d6e71891eb8d42a9c4175505ba7ed98338153860
 SHA1 (patch-src_librustc__target_spec_solaris__base.rs) = 21db8af802edecb5e35ce78ee9af7c4935b4040f
 SHA1 (patch-src_librustc__target_spec_x86__64__sun__solaris.rs) = f6ad33b41906bbf83a1cbd0e2fe13a4da37266fa
diff -r 514727122eeb -r ed475b7b8b2b lang/rust/options.mk
--- a/lang/rust/options.mk      Mon Sep 09 16:05:01 2019 +0000
+++ b/lang/rust/options.mk      Mon Sep 09 16:19:49 2019 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: options.mk,v 1.4 2019/08/27 17:23:48 schmonz Exp $
+# $NetBSD: options.mk,v 1.5 2019/09/09 16:19:49 adam Exp $
 
-PKG_OPTIONS_VAR=               PKG_OPTIONS.rust
-PKG_SUPPORTED_OPTIONS=         
+PKG_OPTIONS_VAR=       PKG_OPTIONS.rust
+PKG_SUPPORTED_OPTIONS= # empty
 
 .include "../../mk/bsd.fast.prefs.mk"
 
diff -r 514727122eeb -r ed475b7b8b2b lang/rust/patches/patch-src_build__helper_lib.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-src_build__helper_lib.rs  Mon Sep 09 16:19:49 2019 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_build__helper_lib.rs,v 1.1 2019/09/09 16:19:49 adam Exp $
+
+On Darwin, do not use @rpath for internal libraries.
+
+--- src/build_helper/lib.rs.orig       2019-09-06 11:17:24.000000000 +0000
++++ src/build_helper/lib.rs
+@@ -212,7 +212,7 @@ impl NativeLibBoilerplate {
+         fs::rename(&src, &dst).unwrap();
+         let status = Command::new("install_name_tool")
+             .arg("-id")
+-            .arg(format!("@rpath/{}", new_name))
++            .arg(format!("@PREFIX@/lib/{}", new_name))
+             .arg(&dst)
+             .status()
+             .expect("failed to execute `install_name_tool`");
diff -r 514727122eeb -r ed475b7b8b2b lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs Mon Sep 09 16:19:49 2019 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_librustc__codegen__ssa_back_linker.rs,v 1.1 2019/09/09 16:19:49 adam Exp $
+
+Do not use @rpath on Darwin.
+
+--- src/librustc_codegen_ssa/back/linker.rs.orig       2019-09-06 11:20:11.000000000 +0000
++++ src/librustc_codegen_ssa/back/linker.rs
+@@ -362,7 +362,7 @@ impl<'a> Linker for GccLinker<'a> {
+             // the right `-Wl,-install_name` with an `@rpath` in it.
+             if self.sess.opts.cg.rpath || self.sess.opts.debugging_opts.osx_rpath_install_name {
+                 self.linker_arg("-install_name");
+-                let mut v = OsString::from("@rpath/");
++                let mut v = OsString::from("@PREFIX@/lib/");
+                 v.push(out_filename.file_name().unwrap());
+                 self.linker_arg(&v);
+             }



Home | Main Index | Thread Index | Old Index