svn commit: r390497 - in head/lang/rust: . files

Jean-Sebastien Pedron dumbbell at FreeBSD.org
Wed Jun 24 17:09:29 UTC 2015


Author: dumbbell (src committer)
Date: Wed Jun 24 17:09:27 2015
New Revision: 390497
URL: https://svnweb.freebsd.org/changeset/ports/390497

Log:
  lang/rust: Use LLVM 3.6 from Ports instead of the bundled one
  
  Dependencies are updated: Perl is not a dependency at all and Python is
  a build dependency only.
  
  Rust may fail to build if a previous version is already installed
  because the bootstrapped rustc puts "-L/usr/local/lib" at the beginning
  of the linker flags. Therefore, mark rust as a CONFLICTS_BUILD with
  itself.
  
  Fix the build as a normal user by setting permissions on all directories
  to 0755 [1].
  
  Be closer to the standalone installer's file hierarchy by installing
  files such as "components", "manifest-rustc" and "uninstall.sh".
  
  Add "files/patch-src_librustc__back_target_freebsd__base.rs"
  to remove "-L/usr/local/lib", "-L/usr/local/lib/gcc46" and
  "-L/usr/local/lib/gcc44" from the builtin linker flags.
  
  Differential Revision:	https://reviews.freebsd.org/D2466
  Submitted by:	Chris Hutchinson [1]
  Reviewed by:	jonathan, kwm
  Approved by:	jonathan

Added:
  head/lang/rust/files/patch-src_librustc__back_target_freebsd__base.rs   (contents, props changed)
Modified:
  head/lang/rust/Makefile
  head/lang/rust/pkg-plist

Modified: head/lang/rust/Makefile
==============================================================================
--- head/lang/rust/Makefile	Wed Jun 24 16:51:15 2015	(r390496)
+++ head/lang/rust/Makefile	Wed Jun 24 17:09:27 2015	(r390497)
@@ -3,6 +3,7 @@
 
 PORTNAME=	rust
 PORTVERSION=	1.0.0
+PORTREVISION=	1
 CATEGORIES=	lang
 MASTER_SITES=	http://static.rust-lang.org/dist/:src \
 		http://static.rust-lang.org/stage0-snapshots/:bootstrap
@@ -23,17 +24,26 @@ LICENSE_FILE=	${WRKSRC}/LICENSE-APACHE \
 ONLY_FOR_ARCHS=	amd64
 ONLY_FOR_ARCHS_REASON=	requires prebuilt bootstrap compiler
 
+# FIXME: The bootstrapped rustc adds -L/usr/local/lib in front of
+# the LDFLAGS. When stage0's rustc is linked, it picks the installed
+# librust*so and fails.
+CONFLICTS_BUILD=	rust \
+			rust-nightly
+CONFLICTS_INSTALL=	rust-nightly
+
 RUST_SOURCE=	${DISTNAME}-src${EXTRACT_SUFX}
 RUST_BOOT=	rust-stage0-${RUST_BOOT_SIG}.tar.bz2
 RUST_BOOT_SIG=	2015-03-27-5520801-freebsd-x86_64-0910bbad35e213f679d0433884fd51398eb3bc8d
 
-USES=		gmake perl5 python:2
+USES=		gmake python:2,build
 HAS_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-valgrind --disable-docs \
 		--enable-clang --mandir=${MANPREFIX}/man
-USE_LDCONFIG=	yes
-USE_PERL5=	build
-MAKE_ARGS=	ARCH=x86_64
+
+# Use LLVM from ports, instead of the copy shipped with rust.
+LLVM_VER=	36
+BUILD_DEPENDS+=	llvm${LLVM_VER}>=0:${PORTSDIR}/devel/llvm${LLVM_VER}
+CONFIGURE_ARGS+=--llvm-root=${LOCALBASE}/llvm${LLVM_VER}
 
 .if defined(BATCH) || defined(PACKAGE_BUILDING)
 MAKE_ARGS+=	VERBOSE=1
@@ -57,14 +67,33 @@ IGNORE=		please use lang/rust-dragonfly 
 post-extract:
 	@${MKDIR} ${WRKSRC}/dl
 	${LN} -sf ${DISTDIR}/${RUST_BOOT} ${WRKSRC}/dl
+	(cd ${WRKSRC} && find . -type d -exec chmod 0755 {} \;)
+
+# In case the previous "make stage" failed, this ensures rust's
+# install.sh won't backup previously staged files before reinstalling
+# new ones. Otherwise, the staging directory is polluted with unneeded
+# files.
+pre-install:
+	@if test -f ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-rustc; then \
+		${SED} -E -e 's,^(dir|file:),${STAGEDIR},' \
+		< ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-rustc \
+		| ${XARGS} ${RM}; \
+	fi
+	@${RM} \
+		${STAGEDIR}${PREFIX}/lib/rustlib/components \
+		${STAGEDIR}${PREFIX}/lib/rustlib/manifest-rustc \
+		${STAGEDIR}${PREFIX}/lib/rustlib/rust-installer-version \
+		${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
 
 post-install:
-	@${RM} ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-rustc
 	@${RM} ${STAGEDIR}${PREFIX}/lib/rustlib/install.log
-	@${RM} ${STAGEDIR}${PREFIX}/lib/rustlib/uninstall.sh
-	@${STRIP_CMD} `${GREP} -v -e '^@dir' -e '^man' -e 'rlib$$' \
-		-e '^.*\.a$$' -e '^.*\.py$$' -e '^%' -e '^.*/rust-gdb$$' \
-		-e '^.*rustlib/components$$' -e '^.*/rust-installer-version$$' \
-		${PLIST} | ${SED} 's:^:${STAGEDIR}${PREFIX}/:'`
+	@${REINPLACE_CMD} -e 's|${STAGEDIR}||' \
+		${STAGEDIR}${PREFIX}/lib/rustlib/manifest-rustc
+	@${RM} ${STAGEDIR}${PREFIX}/lib/rustlib/manifest-rustc.bak
+	@${STRIP_CMD} \
+		${STAGEDIR}${PREFIX}/bin/rustc \
+		${STAGEDIR}${PREFIX}/bin/rustdoc \
+		${STAGEDIR}${PREFIX}/lib/*.so \
+		${STAGEDIR}${PREFIX}/lib/rustlib/*/lib/*.so
 
 .include <bsd.port.post.mk>

Added: head/lang/rust/files/patch-src_librustc__back_target_freebsd__base.rs
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/rust/files/patch-src_librustc__back_target_freebsd__base.rs	Wed Jun 24 17:09:27 2015	(r390497)
@@ -0,0 +1,12 @@
+--- src/librustc_back/target/freebsd_base.rs.orig	2015-05-07 14:37:17 UTC
++++ src/librustc_back/target/freebsd_base.rs
+@@ -19,9 +19,6 @@ pub fn opts() -> TargetOptions {
+         morestack: true,
+         has_rpath: true,
+         pre_link_args: vec!(
+-            "-L/usr/local/lib".to_string(),
+-            "-L/usr/local/lib/gcc46".to_string(),
+-            "-L/usr/local/lib/gcc44".to_string(),
+         ),
+ 
+         .. Default::default()

Modified: head/lang/rust/pkg-plist
==============================================================================
--- head/lang/rust/pkg-plist	Wed Jun 24 16:51:15 2015	(r390496)
+++ head/lang/rust/pkg-plist	Wed Jun 24 17:09:27 2015	(r390497)
@@ -27,7 +27,9 @@ lib/libtest-4e7c5e5c.so
 lib/rustlib/components
 lib/rustlib/etc/gdb_load_rust_pretty_printers.py
 lib/rustlib/etc/gdb_rust_pretty_printing.py
+lib/rustlib/manifest-rustc
 lib/rustlib/rust-installer-version
+lib/rustlib/uninstall.sh
 lib/rustlib/x86_64-unknown-freebsd/lib/liballoc-4e7c5e5c.rlib
 lib/rustlib/x86_64-unknown-freebsd/lib/libarena-4e7c5e5c.rlib
 lib/rustlib/x86_64-unknown-freebsd/lib/libarena-4e7c5e5c.so


More information about the svn-ports-all mailing list