diff options
author | adam <adam@pkgsrc.org> | 2019-09-09 16:19:49 +0000 |
---|---|---|
committer | adam <adam@pkgsrc.org> | 2019-09-09 16:19:49 +0000 |
commit | a0e6f7cb8b1d83302b6320f697a0f038b64f8299 (patch) | |
tree | 559f556092c804c2a4e26751f677aaa27f95fd36 /lang | |
parent | 7c4e5cd456e7d2f37fb98b5fbbc93b3cf22e4e1b (diff) | |
download | pkgsrc-a0e6f7cb8b1d83302b6320f697a0f038b64f8299.tar.gz |
rust: on Darwin, use proper shared library name instead of @rpath
Diffstat (limited to 'lang')
-rw-r--r-- | lang/rust/Makefile | 32 | ||||
-rw-r--r-- | lang/rust/distinfo | 4 | ||||
-rw-r--r-- | lang/rust/options.mk | 6 | ||||
-rw-r--r-- | lang/rust/patches/patch-src_build__helper_lib.rs | 15 | ||||
-rw-r--r-- | lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs | 15 |
5 files changed, 39 insertions, 33 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile index 4edecdaca04..243fd436728 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -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 @@ TOOLS_PATH.md5sum= ${PREFIX}/bin/gmd5sum 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 @@ do-install: 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 --git a/lang/rust/distinfo b/lang/rust/distinfo index b654e76bbfb..c0319dc0eef 100644 --- a/lang/rust/distinfo +++ b/lang/rust/distinfo @@ -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_bin_rustc.rs) = 5e6b0cb25401db4fef6e74f73764e69f3c0956 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 --git a/lang/rust/options.mk b/lang/rust/options.mk index 4c14011c7df..13546e64ece 100644 --- a/lang/rust/options.mk +++ b/lang/rust/options.mk @@ -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 --git a/lang/rust/patches/patch-src_build__helper_lib.rs b/lang/rust/patches/patch-src_build__helper_lib.rs new file mode 100644 index 00000000000..72a1a3d68db --- /dev/null +++ b/lang/rust/patches/patch-src_build__helper_lib.rs @@ -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 --git a/lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs b/lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs new file mode 100644 index 00000000000..0def539aacf --- /dev/null +++ b/lang/rust/patches/patch-src_librustc__codegen__ssa_back_linker.rs @@ -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); + } |