Mon Sep 9 16:19:49 2019 UTC ()
rust: on Darwin, use proper shared library name instead of @rpath


(adam)
diff -r1.113 -r1.114 pkgsrc/lang/rust/Makefile
diff -r1.85 -r1.86 pkgsrc/lang/rust/distinfo
diff -r1.4 -r1.5 pkgsrc/lang/rust/options.mk
diff -r0 -r1.1 pkgsrc/lang/rust/patches/patch-src_build__helper_lib.rs
diff -r0 -r1.1 pkgsrc/lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs

cvs diff -r1.113 -r1.114 pkgsrc/lang/rust/Makefile (expand / switch to context diff)
--- pkgsrc/lang/rust/Makefile 2019/08/29 14:09:56 1.113
+++ pkgsrc/lang/rust/Makefile 2019/09/09 16:19:49 1.114
@@ -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.
 #

cvs diff -r1.85 -r1.86 pkgsrc/lang/rust/distinfo (expand / switch to context diff)
--- pkgsrc/lang/rust/distinfo 2019/08/29 14:09:56 1.85
+++ pkgsrc/lang/rust/distinfo 2019/09/09 16:19:49 1.86
@@ -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

cvs diff -r1.4 -r1.5 pkgsrc/lang/rust/options.mk (expand / switch to context diff)
--- pkgsrc/lang/rust/options.mk 2019/08/27 17:23:48 1.4
+++ pkgsrc/lang/rust/options.mk 2019/09/09 16:19:49 1.5
@@ -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"
 

File Added: pkgsrc/lang/rust/patches/Attic/patch-src_build__helper_lib.rs
$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`");

File Added: pkgsrc/lang/rust/patches/Attic/patch-src_librustc__codegen__ssa_back_linker.rs
$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);
             }