pkgsrc-WIP-changes archive

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

Import rust 1.16 from pkgsrc



Module Name:	pkgsrc-wip
Committed By:	coypu <coypu%sdf.org@localhost>
Pushed By:	coypu
Date:		Mon May 22 00:36:47 2017 +0300
Changeset:	e994f2a7ad5595276aa0b32bed086084b160b96f

Modified Files:
	rust/DESCR
	rust/Makefile
	rust/PLIST
	rust/distinfo
Added Files:
	rust/PLIST.gdb
	rust/PLIST.lldb
	rust/buildlink3.mk
	rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk
	rust/patches/patch-mk_main.mk
	rust/patches/patch-mk_rt.mk
	rust/patches/patch-mk_rustllvm.mk
	rust/patches/patch-src_compiler-rt_lib_builtins_CMakeLists.txt
	rust/patches/patch-src_etc_local__stage0.sh
	rust/patches/patch-src_grammar_check.sh
	rust/patches/patch-src_libcompiler__builtins_build.rs
	rust/patches/patch-src_librustc__trans_back_linker.rs
	rust/patches/patch-src_libstd_rtdeps.rs
	rust/patches/patch-src_libstd_sys_unix_os.rs
	rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake
	rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp
	rust/patches/patch-src_rust-installer_gen-install-script.sh
	rust/patches/patch-src_rust-installer_gen-installer.sh
	rust/patches/patch-src_rust-installer_install-template.sh
Removed Files:
	rust/TODO

Log Message:
Import rust 1.16 from pkgsrc

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e994f2a7ad5595276aa0b32bed086084b160b96f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rust/DESCR                                         |  22 ++-
 rust/Makefile                                      | 216 +++++++++++++++++++--
 rust/PLIST                                         | 129 +++++++++---
 rust/PLIST.gdb                                     |   4 +
 rust/PLIST.lldb                                    |   3 +
 rust/TODO                                          |   4 -
 rust/buildlink3.mk                                 |  14 ++
 rust/distinfo                                      |  51 ++++-
 rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk  |  15 ++
 rust/patches/patch-mk_main.mk                      |  15 ++
 rust/patches/patch-mk_rt.mk                        |  18 ++
 rust/patches/patch-mk_rustllvm.mk                  |  18 ++
 ...tch-src_compiler-rt_lib_builtins_CMakeLists.txt |  20 ++
 rust/patches/patch-src_etc_local__stage0.sh        |  26 +++
 rust/patches/patch-src_grammar_check.sh            |  15 ++
 .../patch-src_libcompiler__builtins_build.rs       |  15 ++
 .../patch-src_librustc__trans_back_linker.rs       |  15 ++
 rust/patches/patch-src_libstd_rtdeps.rs            |  19 ++
 rust/patches/patch-src_libstd_sys_unix_os.rs       |  15 ++
 .../patch-src_llvm_cmake_modules_AddLLVM.cmake     |  15 ++
 ...c_llvm_lib_CodeGen_MachineDominanceFrontier.cpp |  14 ++
 .../patch-src_rust-installer_gen-install-script.sh |  15 ++
 .../patch-src_rust-installer_gen-installer.sh      |  25 +++
 .../patch-src_rust-installer_install-template.sh   |  18 ++
 24 files changed, 660 insertions(+), 61 deletions(-)

diffs:
diff --git a/rust/DESCR b/rust/DESCR
index 63987afb7b..6dc90a671e 100644
--- a/rust/DESCR
+++ b/rust/DESCR
@@ -1,11 +1,13 @@
-Rust is a curly-brace, block-structured expression language. It
-visually resembles the C language family, but differs significantly
-in syntactic and semantic details. Its design is oriented toward
-concerns of "programming in the large", that is, of creating and
-maintaining boundaries - both abstract and operational - that
-preserve large-system integrity, availability and concurrency.
+Rust is a systems programming language focused on three goals: safety,
+speed, and concurrency.  It maintains these goals without having a
+garbage collector, making it a useful language for a number of use cases
+other languages aren't good at: embedding in other languages, programs
+with specific space and time requirements, and writing low-level code,
+like device drivers and operating systems.
 
-It supports a mixture of imperative procedural, concurrent actor,
-object-oriented and pure functional styles. Rust also supports
-generic programming and metaprogramming, in both static and dynamic
-styles.
+It improves on current languages targeting this space by having a number
+of compile-time safety checks that produce no runtime overhead, while
+eliminating all data races.  Rust also aims to achieve "zero-cost
+abstractions" even though some of these abstractions feel like those of
+a high-level language.  Even then, Rust still allows precise control
+like a low-level language would.
diff --git a/rust/Makefile b/rust/Makefile
index 791b5a954d..ac227589ce 100644
--- a/rust/Makefile
+++ b/rust/Makefile
@@ -1,28 +1,214 @@
-# $NetBSD: Makefile,v 1.5 2014/07/30 13:33:55 schmonz Exp $
+# $NetBSD: Makefile,v 1.7 2017/03/20 11:36:35 jperkin Exp $
 
-PKGNAME=	rust-${VER}
-DISTNAME=	rustc-nightly-src
+DISTNAME=	rustc-1.16.0-src
+PKGNAME=	${DISTNAME:S/rustc/rust/:S/-src//}
 CATEGORIES=	lang
-MASTER_SITES=	http://static.rust-lang.org/dist/2016-06-24/
-VER=		1.11.0-dev-nightly20160624
+MASTER_SITES=	http://static.rust-lang.org/dist/
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	http://www.rust-lang.org/
 COMMENT=	Safe, concurrent, practical language
 LICENSE=	mit OR apache-2.0
 
-WRKSRC=	${WRKDIR}/rustc-nightly
+USE_GCC_RUNTIME=	yes
+USE_LANGUAGES=		c c++
+USE_TOOLS+=		bash gmake
 
-HAS_CONFIGURE=	yes
-CONFIGURE_ARGS=	--prefix=${PREFIX} \
-		--mandir=${PREFIX}/${PKGMANDIR}
-USE_LANGUAGES=	c c++
-GCC_REQD=	4.7 4.8
-USE_TOOLS+=	gmake perl
+HAS_CONFIGURE=		yes
+CONFIGURE_ARGS+=	--prefix=${PREFIX}
+CONFIGURE_ARGS+=	--build=${RUST_ARCH}
+CONFIGURE_ARGS+=	--mandir=${PREFIX}/${PKGMANDIR}
+CONFIGURE_ARGS+=	--release-channel=stable
+CONFIGURE_ENV+=		CFG_DISABLE_CODEGEN_TESTS=1
 
-# for guidance: http://www.ntecs.de/blog/2014/07/29/rust-ported-to-dragonflybsd/
-# XXX problem with libtool wrapper
-# XXX needs python during build
+#
+# Use the Makefile-based build system.  Unfortunately this will be going away,
+# likely in the next release, forcing us to use a cargo-based system which will
+# require further binary bootstraps.  Hold out as long as we can.
+#
+CONFIGURE_ARGS+=	--disable-rustbuild
 
+UNLIMIT_RESOURCES+=	cputime
+
+REPLACE_BASH+=	src/rust-installer/gen-install-script.sh
+REPLACE_BASH+=	src/rust-installer/gen-installer.sh
+
+#
+# Lots of per-platform specific documentation, e.g. for each system call,
+# making it difficult to PLIST.  If it ends up being important we'll just have
+# to go with lots of PLIST.${OPSYS}
+#
+CONFIGURE_ARGS+=	--disable-docs
+
+TEST_TARGET=	check
+
+# Required for LLVM (-std=c++11)
+GCC_REQD+=	4.8
+
+.include "../../mk/bsd.prefs.mk"
+
+#
+# Use jemalloc on systems where rust does by default too.
+#
+PLIST_VARS+=		jemalloc
+.if ${OPSYS} == "Linux" || ${OPSYS} == "Darwin"
+.  include "../../devel/jemalloc/buildlink3.mk"
+CONFIGURE_ARGS+=	--jemalloc-root=${BUILDLINK_PREFIX.jemalloc}/lib
+PLIST.jemalloc=		yes
+.else
+CONFIGURE_ARGS+=	--disable-jemalloc
+.endif
+
+#
+# Under NetBSD, do not use DT_RUNPATH
+#
+BUILDLINK_TRANSFORM.NetBSD+=	rm:-Wl,--enable-new-dtags
+
+#
+# Can't use pkgsrc llvm on SunOS at the moment due to a relocation error.
+#
+.if ${OPSYS} != "SunOS"
+.  include "../../lang/llvm/buildlink3.mk"
+CONFIGURE_ARGS+=	--llvm-root=${BUILDLINK_PREFIX.llvm}
+.endif
+
+#
+# Rust unfortunately requires itself to build.  On platforms which aren't
+# supported by upstream (where they offer binary bootstraps), or where we do
+# not trust random binaries from the Internet, we need to build and provide our
+# own bootstrap.  See the stage0-bootstrap below for more details.
+#
+CONFIGURE_ARGS+=	--enable-local-rust
+CONFIGURE_ARGS+=	--local-rust-root=${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/rustc
+#
+DISTFILES:=		${DEFAULT_DISTFILES}
+RUST_STAGE0_VER=	1.15.1
+#
+.if !empty(MACHINE_PLATFORM:MDarwin-*-i386) || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH:=		i686-apple-darwin
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+.endif
+.if !empty(MACHINE_PLATFORM:MDarwin-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH:=		x86_64-apple-darwin
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+.endif
+.if !empty(MACHINE_PLATFORM:MLinux-*-i386) || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH:=		i686-unknown-linux-gnu
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+.endif
+.if !empty(MACHINE_PLATFORM:MLinux-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH:=		x86_64-unknown-linux-gnu
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+.endif
+.if !empty(MACHINE_PLATFORM:MSunOS-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH:=		x86_64-sun-solaris
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+SITES.${RUST_STAGE0}=	https://us-east.manta.joyent.com/pkgsrc/public/pkg-bootstraps/
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+.endif
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-x86_64) || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH=		x86_64-unknown-netbsd
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+.endif
+
+.if !defined(RUST_ARCH)
+NOT_FOR_PLATFORM+=	${MACHINE_PLATFORM}
+.endif
+
+PLIST_SRC=		PLIST
+.if ${OPSYS} == "Darwin"
+PLIST_SRC+=		PLIST.lldb
+.else
+PLIST_SRC+=		PLIST.gdb
+.endif
+
+OPSYSVARS+=		SOEXT
+SOEXT.Darwin=		dylib
+SOEXT.*=		so
+
+RUST_VERHASH=		63283ac5
+PLIST_SUBST+=		RUST_ARCH=${RUST_ARCH:Q}
+PLIST_SUBST+=		RUST_VERHASH=${RUST_VERHASH:Q}
+PLIST_SUBST+=		SOEXT=${SOEXT:Q}
+PRINT_PLIST_AWK+=	{ gsub(/${RUST_ARCH}/, "$${RUST_ARCH}") }
+PRINT_PLIST_AWK+=	{ gsub(/${RUST_VERHASH}/, "$${RUST_VERHASH}") }
+PRINT_PLIST_AWK+=	{ gsub(/\.${SOEXT}/, ".$${SOEXT}") }
+
+.if ${OPSYS} == "SunOS"
+BUILD_DEPENDS+=		grep>=0:../../textproc/grep
+BUILD_DEPENDS+=		coreutils>=0:../../sysutils/coreutils
+TOOLS_PATH.grep=	${PREFIX}/bin/ggrep
+TOOLS_CREATE+=		md5sum
+TOOLS_PATH.md5sum=	${PREFIX}/bin/gmd5sum
+
+SUBST_CLASSES+=		ranlib
+SUBST_STAGE.ranlib=	pre-configure
+SUBST_FILES.ranlib=	mk/rt.mk
+SUBST_SED.ranlib=	-e 's,RANLIB=.* \\,RANLIB="true" \\,g'
+.endif
+
+post-install:
+	${RM} -f ${DESTDIR}${PREFIX}/lib/rustlib/install.log
+
+.if ${OPSYS} == "Darwin"
+.PHONY: fix-darwin-install-name
+post-install: fix-darwin-install-name
+fix-darwin-install-name:
+.  for bin in 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
+	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}/${libdir},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.
+#
+BOOTSTRAP_TMPDIR=	${WRKDIR}/${PKGNAME}-${RUST_ARCH}/rustc
+USE_TOOLS+=		gtar
+
+stage0-bootstrap: install
+	${MKDIR} ${BOOTSTRAP_TMPDIR}
+	${CP} -R ${DESTDIR}/${PREFIX}/bin ${BOOTSTRAP_TMPDIR}/
+	${CP} -R ${DESTDIR}/${PREFIX}/lib ${BOOTSTRAP_TMPDIR}/
+.if ${OS_VARIANT} == "SmartOS"
+	for lib in libgcc_s.so.1 libssp.so.0 libstdc++.so.6; do \
+		${CP} `${PKG_CC} -print-file-name=$${lib}` \
+		    ${BOOTSTRAP_TMPDIR}/lib/; \
+	done
+	for f in ${BOOTSTRAP_TMPDIR}/bin/rust{c,doc}; do \
+		/usr/bin/elfedit -e 'dyn:runpath $$ORIGIN/../lib' $$f; \
+	done
+	for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \
+		/usr/bin/elfedit -e 'dyn:runpath $$ORIGIN' $$f; \
+	done
+	for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/${RUST_ARCH}/lib/*.so*; do \
+		/usr/bin/elfedit -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..' $$f; \
+	done
+.endif
+	(cd ${WRKDIR}; \
+	 ${GTAR} -zcf ${PKGNAME}-${RUST_ARCH}.tar.gz ${PKGNAME}-${RUST_ARCH})
+
+.include "../../devel/cmake/buildlink3.mk"
 .include "../../lang/python/tool.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/rust/PLIST b/rust/PLIST
index 57d7557454..0b77a57abf 100644
--- a/rust/PLIST
+++ b/rust/PLIST
@@ -1,30 +1,107 @@
-@comment $NetBSD: PLIST,v 1.1 2014/01/11 18:29:56 schmonz Exp $
+@comment $NetBSD: PLIST,v 1.3 2017/03/20 11:36:35 jperkin Exp $
 bin/rustc
 bin/rustdoc
-bin/rustpkg
-lib/libextra-fd30a1b1-${PKGVERSION}.dylib
-lib/libgreen-83b1c0e5-${PKGVERSION}.dylib
-lib/librustc-8b28e8d8-${PKGVERSION}.dylib
-lib/librustdoc-f0f95988-${PKGVERSION}.dylib
-lib/librustpkg-7b329bae-${PKGVERSION}.dylib
-lib/librustuv-2ba3695a-${PKGVERSION}.dylib
-lib/libstd-3e5aeb83-${PKGVERSION}.dylib
-lib/libsyntax-9be99726-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libextra-fd30a1b1-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libextra-fd30a1b1-${PKGVERSION}.rlib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libgreen-83b1c0e5-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libgreen-83b1c0e5-${PKGVERSION}.rlib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libmorestack.a
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libnative-cf55a53a-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libnative-cf55a53a-${PKGVERSION}.rlib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/librustc-8b28e8d8-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/librustdoc-f0f95988-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/librustpkg-7b329bae-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/librustuv-2ba3695a-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/librustuv-2ba3695a-${PKGVERSION}.rlib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libstd-3e5aeb83-${PKGVERSION}.dylib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libstd-3e5aeb83-${PKGVERSION}.rlib
-lib/rustlib/${MACHINE_ARCH}-apple-darwin/lib/libsyntax-9be99726-${PKGVERSION}.dylib
+lib/libarena-${RUST_VERHASH}.${SOEXT}
+lib/libflate-${RUST_VERHASH}.${SOEXT}
+lib/libfmt_macros-${RUST_VERHASH}.${SOEXT}
+lib/libgetopts-${RUST_VERHASH}.${SOEXT}
+lib/libgraphviz-${RUST_VERHASH}.${SOEXT}
+lib/liblog-${RUST_VERHASH}.${SOEXT}
+lib/libproc_macro-${RUST_VERHASH}.${SOEXT}
+lib/libproc_macro_plugin-${RUST_VERHASH}.${SOEXT}
+lib/librustc-${RUST_VERHASH}.${SOEXT}
+lib/librustc_back-${RUST_VERHASH}.${SOEXT}
+lib/librustc_borrowck-${RUST_VERHASH}.${SOEXT}
+lib/librustc_const_eval-${RUST_VERHASH}.${SOEXT}
+lib/librustc_const_math-${RUST_VERHASH}.${SOEXT}
+lib/librustc_data_structures-${RUST_VERHASH}.${SOEXT}
+lib/librustc_driver-${RUST_VERHASH}.${SOEXT}
+lib/librustc_errors-${RUST_VERHASH}.${SOEXT}
+lib/librustc_incremental-${RUST_VERHASH}.${SOEXT}
+lib/librustc_lint-${RUST_VERHASH}.${SOEXT}
+lib/librustc_llvm-${RUST_VERHASH}.${SOEXT}
+lib/librustc_metadata-${RUST_VERHASH}.${SOEXT}
+lib/librustc_mir-${RUST_VERHASH}.${SOEXT}
+lib/librustc_passes-${RUST_VERHASH}.${SOEXT}
+lib/librustc_platform_intrinsics-${RUST_VERHASH}.${SOEXT}
+lib/librustc_plugin-${RUST_VERHASH}.${SOEXT}
+lib/librustc_privacy-${RUST_VERHASH}.${SOEXT}
+lib/librustc_resolve-${RUST_VERHASH}.${SOEXT}
+lib/librustc_save_analysis-${RUST_VERHASH}.${SOEXT}
+lib/librustc_trans-${RUST_VERHASH}.${SOEXT}
+lib/librustc_typeck-${RUST_VERHASH}.${SOEXT}
+lib/librustdoc-${RUST_VERHASH}.${SOEXT}
+lib/libserialize-${RUST_VERHASH}.${SOEXT}
+lib/libstd-${RUST_VERHASH}.${SOEXT}
+lib/libsyntax-${RUST_VERHASH}.${SOEXT}
+lib/libsyntax_ext-${RUST_VERHASH}.${SOEXT}
+lib/libsyntax_pos-${RUST_VERHASH}.${SOEXT}
+lib/libterm-${RUST_VERHASH}.${SOEXT}
+lib/libtest-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/components
+lib/rustlib/etc/debugger_pretty_printers_common.py
+lib/rustlib/manifest-rust-std-${RUST_ARCH}
+lib/rustlib/manifest-rustc
+lib/rustlib/rust-installer-version
+lib/rustlib/uninstall.sh
+lib/rustlib/${RUST_ARCH}/lib/liballoc-${RUST_VERHASH}.rlib
+${PLIST.jemalloc}lib/rustlib/${RUST_ARCH}/lib/liballoc_jemalloc-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/liballoc_system-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libarena-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libcollections-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libcompiler_builtins-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libcore-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libflate-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libfmt_macros-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libgetopts-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libgetopts-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libgraphviz-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/liblibc-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/liblog-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libpanic_abort-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libpanic_unwind-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libproc_macro-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libproc_macro_plugin-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librand-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/librustc-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_back-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_bitflags-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/librustc_borrowck-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_const_eval-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_const_math-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_data_structures-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_driver-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_errors-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_i128-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/librustc_incremental-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_lint-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_llvm-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_metadata-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_mir-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_passes-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_platform_intrinsics-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_plugin-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_privacy-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_resolve-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_save_analysis-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_trans-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustc_typeck-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/librustdoc-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libserialize-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libstd-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libstd-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libstd_unicode-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libsyntax-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libsyntax_ext-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libsyntax_pos-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libterm-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libterm-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libtest-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libtest-${RUST_VERHASH}.${SOEXT}
+lib/rustlib/${RUST_ARCH}/lib/libunwind-${RUST_VERHASH}.rlib
 man/man1/rustc.1
 man/man1/rustdoc.1
-man/man1/rustpkg.1
+share/doc/rust/COPYRIGHT
+share/doc/rust/LICENSE-APACHE
+share/doc/rust/LICENSE-MIT
+share/doc/rust/README.md
diff --git a/rust/PLIST.gdb b/rust/PLIST.gdb
new file mode 100644
index 0000000000..1d4ff65586
--- /dev/null
+++ b/rust/PLIST.gdb
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST.gdb,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+bin/rust-gdb
+lib/rustlib/etc/gdb_load_rust_pretty_printers.py
+lib/rustlib/etc/gdb_rust_pretty_printing.py
diff --git a/rust/PLIST.lldb b/rust/PLIST.lldb
new file mode 100644
index 0000000000..2da9c455d6
--- /dev/null
+++ b/rust/PLIST.lldb
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST.lldb,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+bin/rust-lldb
+lib/rustlib/etc/lldb_rust_formatters.py
diff --git a/rust/TODO b/rust/TODO
deleted file mode 100644
index eaf1314555..0000000000
--- a/rust/TODO
+++ /dev/null
@@ -1,4 +0,0 @@
-The next release (after 1.9.0) will change the bootstrapping
-procedure. Stage0 snapshot will no longer be required, which
-will simplify packaging. It is probably a good idea to wait
-for the release or to package one of the beta versions.
diff --git a/rust/buildlink3.mk b/rust/buildlink3.mk
new file mode 100644
index 0000000000..dcced31a5c
--- /dev/null
+++ b/rust/buildlink3.mk
@@ -0,0 +1,14 @@
+# $NetBSD: buildlink3.mk,v 1.2 2017/02/23 09:35:16 jperkin Exp $
+
+BUILDLINK_TREE+=	rust
+
+.if !defined(RUST_BUILDLINK3_MK)
+RUST_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.rust+=	rust>=1.15.1
+BUILDLINK_PKGSRCDIR.rust?=	../../lang/rust
+
+BUILDLINK_PASSTHRU_DIRS+=	${PREFIX}/lib/rustlib
+.endif
+
+BUILDLINK_TREE+=	-rust
diff --git a/rust/distinfo b/rust/distinfo
index 6155dff79b..d83f47346d 100644
--- a/rust/distinfo
+++ b/rust/distinfo
@@ -1,7 +1,46 @@
-$NetBSD: distinfo,v 1.4 2014/07/03 03:11:31 schmonz Exp $
+$NetBSD: distinfo,v 1.6 2017/03/20 11:36:35 jperkin Exp $
 
-SHA1 (rustc-nightly-src.tar.gz) = 5f3ceb435c88e6e35215c96caac0f5830dd99b12
-RMD160 (rustc-nightly-src.tar.gz) = a196af452e34b02717650c77a76261ad0212d9bf
-SHA512 (rustc-nightly-src.tar.gz) = f62d66b522922194f7f0d845ae2d706171e838cb0579b1b1f56dc877a39fe8660f6c0c28987ce69e2733708599f9c7d257d0da48241849bc5b12cb0c74a489ef
-Size (rustc-nightly-src.tar.gz) = 26026047 bytes
-SHA1 (patch-src_llvm_utils_buildit_build__llvm) = 05a49ef5249ca610948fa9f7359de04c8a79c1e7
+SHA1 (rust-1.15.1-i686-apple-darwin.tar.gz) = 485da035b78b3c3df3800d03c3d77bb7a48045d1
+RMD160 (rust-1.15.1-i686-apple-darwin.tar.gz) = 6cded9fd39adfbb0abf71db9859d09ba88de377d
+SHA512 (rust-1.15.1-i686-apple-darwin.tar.gz) = d6b57a25d4d37601534bafdb3381e228439b93fca2b38d6e2732763c0db0ef7585d08eb23eae573316c25da1739db4a685446a4c1d46ad65012d74c039129da1
+Size (rust-1.15.1-i686-apple-darwin.tar.gz) = 88072291 bytes
+SHA1 (rust-1.15.1-i686-unknown-linux-gnu.tar.gz) = eebfb3cac6c184636bd53833153cac9065505eed
+RMD160 (rust-1.15.1-i686-unknown-linux-gnu.tar.gz) = f4ffe7273b1ea957380e5b558b9959bb6eab16bf
+SHA512 (rust-1.15.1-i686-unknown-linux-gnu.tar.gz) = 13d602842e7a2ef360c80d3ec84ecd5d6c742ea6dad642394a2a57b28554a7758905b37daaf2bcc549428c5f9383307270f8508e8685748b906fc2b9230bc4ad
+Size (rust-1.15.1-i686-unknown-linux-gnu.tar.gz) = 103889253 bytes
+SHA1 (rust-1.15.1-x86_64-apple-darwin.tar.gz) = 6e74cc85e2715e474507ad1d93460b9935d595a6
+RMD160 (rust-1.15.1-x86_64-apple-darwin.tar.gz) = 06de1a7c8a2091f3edddc6d6b646abf28beeb197
+SHA512 (rust-1.15.1-x86_64-apple-darwin.tar.gz) = 89be9b7c3aed84fa5fd22d7716be2853fe357002278ac39d47ca796af5529d9d8088e1270ff19f945b0ea019c4267304604b298f97b8e784833f638790bee616
+Size (rust-1.15.1-x86_64-apple-darwin.tar.gz) = 88555672 bytes
+SHA1 (rust-1.15.1-x86_64-sun-solaris.tar.gz) = 139368a49af76b7b50d52d3833a4158267f4635d
+RMD160 (rust-1.15.1-x86_64-sun-solaris.tar.gz) = 546406c0e30805cbb5b12c784700f4308a1f92fe
+SHA512 (rust-1.15.1-x86_64-sun-solaris.tar.gz) = c194222b9c4902e7bea70c0186fc7700171dd53fd289eae6e6dc0f76eaed9e38d24e529dc58a02c1f5d2ae810a1d8f9ce0acae95ca77e6de4346f31d55710283
+Size (rust-1.15.1-x86_64-sun-solaris.tar.gz) = 150925338 bytes
+SHA1 (rust-1.15.1-x86_64-unknown-linux-gnu.tar.gz) = a365f91afa204648e184d3a7622710f59eff9e0a
+RMD160 (rust-1.15.1-x86_64-unknown-linux-gnu.tar.gz) = d232056afc8165735f54c03e894bdd25ccd66ae0
+SHA512 (rust-1.15.1-x86_64-unknown-linux-gnu.tar.gz) = e089c455b1a7507aeed4652f05c0672c4e996e708c46f4405191f4b3a9d08403cab27f1a5a63f865d9a8f099f6ca980d2d2eef37aaa5e7e5bd751a3224e88b84
+Size (rust-1.15.1-x86_64-unknown-linux-gnu.tar.gz) = 101140146 bytes
+SHA1 (rust-1.15.1-x86_64-unknown-netbsd.tar.gz) = 25c896281edba32345b26e1df6c122891cbcd9cd
+RMD160 (rust-1.15.1-x86_64-unknown-netbsd.tar.gz) = 702483df09ea415eb75c031949c82b966236333c
+SHA512 (rust-1.15.1-x86_64-unknown-netbsd.tar.gz) = f733f86db05bfeee0da4fb3d38e0d9ef728ca2fd958662d532e50567370b9245b4af5ed9761fe8dbba1f13f4c9e91159eda2ebdb70d102bb246adf982b86379b
+Size (rust-1.15.1-x86_64-unknown-netbsd.tar.gz) = 104073599 bytes
+SHA1 (rustc-1.16.0-src.tar.gz) = c0a66ad539b1ca9f3b1d174f4a233228cb422cd7
+RMD160 (rustc-1.16.0-src.tar.gz) = 42bb8759c98787d07293d81e45183fe5cf55ebc2
+SHA512 (rustc-1.16.0-src.tar.gz) = 096b1b7406be9bc61161bb7cdd2061f2bc2174c161a31f4ed6ceecf7fc379f315fc2f7cb9f6c134ea4f8519c27bf6e5a3f712cf1e56d5785831d8c8374eb0ba5
+Size (rustc-1.16.0-src.tar.gz) = 28470372 bytes
+SHA1 (patch-mk_cfg_x86__64-apple-darwin.mk) = 37b50b64ea5607588d541852e07f02a4611d38c8
+SHA1 (patch-mk_main.mk) = d821a86920e563618d00d5428d6dd9056d7c7fdb
+SHA1 (patch-mk_rt.mk) = d98d1cd2f87d25c0be4e8709bac33f15c7e924e6
+SHA1 (patch-mk_rustllvm.mk) = 285fb33ce5477d18914289323c0e2db16cc7ccae
+SHA1 (patch-src_compiler-rt_lib_builtins_CMakeLists.txt) = 288870c40b5e4ce29cbfb19cc9f56d35152c47fa
+SHA1 (patch-src_etc_local__stage0.sh) = 31c7eb5fdb5eae61132c8e46998a15b5e5ea7015
+SHA1 (patch-src_grammar_check.sh) = 6958b994da4b04b74cb2d25f026932a19cd80b8a
+SHA1 (patch-src_libcompiler__builtins_build.rs) = 5a57625071a3422e79c7e5a69426aeedd1512633
+SHA1 (patch-src_librustc__trans_back_linker.rs) = 4fee3a23665ebc192b249112faf6e85f4cfacd13
+SHA1 (patch-src_libstd_rtdeps.rs) = ed271c5b83a8d623469abd39a2d072bfffbcc890
+SHA1 (patch-src_libstd_sys_unix_os.rs) = 72eec2cc3d44445dd2636e7c46c9b4a0cf888f88
+SHA1 (patch-src_llvm_cmake_modules_AddLLVM.cmake) = 282d97cce8d01cfefe565185d4999c2db9ccc13f
+SHA1 (patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp) = 2899771b1a23be840b9305eff7e5e5f957239ccb
+SHA1 (patch-src_rust-installer_gen-install-script.sh) = 1b1e9c0ab6e9395b4138dcc15a385952a1138158
+SHA1 (patch-src_rust-installer_gen-installer.sh) = 024b888ae40ecdadb4f3a8fa7865fba0a0590a5b
+SHA1 (patch-src_rust-installer_install-template.sh) = d42b6d55fdbb8640cee75588a230efb3c2641e32
diff --git a/rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk b/rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk
new file mode 100644
index 0000000000..62fa567855
--- /dev/null
+++ b/rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk
@@ -0,0 +1,15 @@
+$NetBSD: patch-mk_cfg_x86__64-apple-darwin.mk,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Ensure we can use install_name_tool to fixup after.
+
+--- mk/cfg/x86_64-apple-darwin.mk.orig	2016-08-16 01:54:35.000000000 +0000
++++ mk/cfg/x86_64-apple-darwin.mk
+@@ -13,7 +13,7 @@ CFG_GCCISH_CXXFLAGS_x86_64-apple-darwin 
+ CFG_GCCISH_LINK_FLAGS_x86_64-apple-darwin := -dynamiclib -pthread  -framework CoreServices -m64
+ CFG_GCCISH_DEF_FLAG_x86_64-apple-darwin := -Wl,-exported_symbols_list,
+ CFG_LLC_FLAGS_x86_64-apple-darwin :=
+-CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1)
++CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1) -Wl,-headerpad_max_install_names
+ CFG_EXE_SUFFIX_x86_64-apple-darwin :=
+ CFG_WINDOWSY_x86_64-apple-darwin :=
+ CFG_UNIXY_x86_64-apple-darwin := 1
diff --git a/rust/patches/patch-mk_main.mk b/rust/patches/patch-mk_main.mk
new file mode 100644
index 0000000000..a055dffb3e
--- /dev/null
+++ b/rust/patches/patch-mk_main.mk
@@ -0,0 +1,15 @@
+$NetBSD: patch-mk_main.mk,v 1.1 2017/02/23 09:35:16 jperkin Exp $
+
+Specify full path to stage0 to work around NetBSD $ORIGIN issues.
+
+--- mk/main.mk.orig	2017-02-09 01:37:48.000000000 +0000
++++ mk/main.mk
+@@ -398,7 +398,7 @@ define SREQ
+ 
+ # Destinations of artifacts for the host compiler
+ HROOT$(1)_H_$(3) = $(3)/stage$(1)
+-HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
++HBIN$(1)_H_$(3) = $$(CURDIR)/$$(HROOT$(1)_H_$(3))/bin
+ 
+ ifeq ($$(CFG_WINDOWSY_$(3)),1)
+ # On Windows we always store host runtime libraries in the 'bin' directory because
diff --git a/rust/patches/patch-mk_rt.mk b/rust/patches/patch-mk_rt.mk
new file mode 100644
index 0000000000..a7253845a1
--- /dev/null
+++ b/rust/patches/patch-mk_rt.mk
@@ -0,0 +1,18 @@
+$NetBSD: patch-mk_rt.mk,v 1.3 2017/02/23 09:35:16 jperkin Exp $
+
+Don't build gcc_personality_v0.o on NetBSD.
+
+--- mk/rt.mk.orig	2017-02-09 01:37:48.000000000 +0000
++++ mk/rt.mk
+@@ -552,9 +552,11 @@ endif
+ ifeq ($$(findstring msvc,$(1)),)
+ 
+ ifeq ($$(findstring freebsd,$(1)),)
++ifeq ($$(findstring netbsd,$(1)),)
+ $(call ADD_INTRINSIC,$(1),gcc_personality_v0.o)
+ endif
+ endif
++endif
+ 
+ ifeq ($$(findstring aarch64,$(1)),aarch64)
+ $(foreach intrinsic,comparetf2.o \
diff --git a/rust/patches/patch-mk_rustllvm.mk b/rust/patches/patch-mk_rustllvm.mk
new file mode 100644
index 0000000000..830db7505a
--- /dev/null
+++ b/rust/patches/patch-mk_rustllvm.mk
@@ -0,0 +1,18 @@
+$NetBSD: patch-mk_rustllvm.mk,v 1.2 2017/02/23 09:35:16 jperkin Exp $
+
+Ensure we can find generated LLVM includes.
+
+--- mk/rustllvm.mk.orig	2016-09-27 07:17:04.000000000 +0000
++++ mk/rustllvm.mk
+@@ -17,11 +17,9 @@ define DEF_RUSTLLVM_TARGETS
+ # FIXME: Lately, on windows, llvm-config --includedir is not enough
+ # to find the llvm includes (probably because we're not actually installing
+ # llvm, but using it straight out of the build directory)
+-ifdef CFG_WINDOWSY_$(1)
+ LLVM_EXTRA_INCDIRS_$(1)= $$(call CFG_CC_INCLUDE_$(1),$(S)src/llvm/include) \
+                          $$(call CFG_CC_INCLUDE_$(1),\
+ 			   $$(CFG_LLVM_BUILD_DIR_$(1))/include)
+-endif
+ 
+ RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, \
+ 	RustWrapper.cpp PassWrapper.cpp \
diff --git a/rust/patches/patch-src_compiler-rt_lib_builtins_CMakeLists.txt b/rust/patches/patch-src_compiler-rt_lib_builtins_CMakeLists.txt
new file mode 100644
index 0000000000..b057d8f5ce
--- /dev/null
+++ b/rust/patches/patch-src_compiler-rt_lib_builtins_CMakeLists.txt
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_compiler-rt_lib_builtins_CMakeLists.txt,v 1.1 2016/09/12 13:27:33 ryoon Exp $
+
+* On NetBSD, do not misdetect unwind.h
+  We do not support ARM build currently, so remove this unconditionally.
+
+--- src/compiler-rt/lib/builtins/CMakeLists.txt.orig	2016-08-16 01:54:40.000000000 +0000
++++ src/compiler-rt/lib/builtins/CMakeLists.txt
+@@ -159,12 +159,6 @@ if(NOT WIN32 OR MINGW)
+       emutls.c)
+ endif()
+ 
+-if (HAVE_UNWIND_H)
+-  set(GENERIC_SOURCES
+-      ${GENERIC_SOURCES}
+-      gcc_personality_v0.c)
+-endif ()
+-
+ if (NOT MSVC)
+   set(x86_64_SOURCES
+       x86_64/chkstk.S
diff --git a/rust/patches/patch-src_etc_local__stage0.sh b/rust/patches/patch-src_etc_local__stage0.sh
new file mode 100644
index 0000000000..c666626c8e
--- /dev/null
+++ b/rust/patches/patch-src_etc_local__stage0.sh
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_etc_local__stage0.sh,v 1.4 2017/02/23 09:35:16 jperkin Exp $
+
+-Copy additional libarena required on Darwin.
+-Copy GCC support libraries required on SunOS.
+
+--- src/etc/local_stage0.sh.orig	2016-12-20 23:34:55.000000000 +0000
++++ src/etc/local_stage0.sh
+@@ -18,7 +18,7 @@ LIB_PREFIX=lib
+ 
+ OS=`uname -s`
+ case $OS in
+-    ("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku")
++    ("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku"|"NetBSD")
+     BIN_SUF=
+     LIB_SUF=.so
+     ;;
+@@ -72,6 +72,9 @@ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbm
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}serialize*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}proc_macro*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
++cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}gcc_s*${LIB_SUF}* ${TARG_DIR}/stage0/${LIB_DIR}/
++cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}ssp*${LIB_SUF}* ${TARG_DIR}/stage0/${LIB_DIR}/
++cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}stdc++*${LIB_SUF}* ${TARG_DIR}/stage0/${LIB_DIR}/
+ 
+ # do not fail if one of the above fails, as all we need is a working rustc!
+ exit 0
diff --git a/rust/patches/patch-src_grammar_check.sh b/rust/patches/patch-src_grammar_check.sh
new file mode 100644
index 0000000000..61a53be0cb
--- /dev/null
+++ b/rust/patches/patch-src_grammar_check.sh
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_grammar_check.sh,v 1.1 2017/02/23 09:35:16 jperkin Exp $
+
+Shell portability fix.
+
+--- src/grammar/check.sh.orig	2017-02-09 01:37:48.000000000 +0000
++++ src/grammar/check.sh
+@@ -9,7 +9,7 @@
+ # Argument $1 is the file to check, $2 is the classpath to use, $3 is the path
+ # to the grun binary, $4 is the path to the verify binary, $5 is the path to
+ # RustLexer.tokens
+-if [ "${VERBOSE}" == "1" ]; then
++if [ "${VERBOSE}" = "1" ]; then
+     set -x
+ fi
+ 
diff --git a/rust/patches/patch-src_libcompiler__builtins_build.rs b/rust/patches/patch-src_libcompiler__builtins_build.rs
new file mode 100644
index 0000000000..fe7101b6a5
--- /dev/null
+++ b/rust/patches/patch-src_libcompiler__builtins_build.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_libcompiler__builtins_build.rs,v 1.1 2017/02/23 09:35:16 jperkin Exp $
+
+Don't build gcc_personality_v0.o on NetBSD.
+
+--- src/libcompiler_builtins/build.rs.orig	2017-02-09 01:37:48.000000000 +0000
++++ src/libcompiler_builtins/build.rs
+@@ -251,7 +251,7 @@ fn main() {
+             sources.extend(&["x86_64/floatdidf.c", "x86_64/floatdisf.c", "x86_64/floatdixf.c"]);
+         }
+     } else {
+-        if !target.contains("freebsd") {
++        if !target.contains("freebsd") & !target.contains("netbsd") {
+             sources.extend(&["gcc_personality_v0.c"]);
+         }
+ 
diff --git a/rust/patches/patch-src_librustc__trans_back_linker.rs b/rust/patches/patch-src_librustc__trans_back_linker.rs
new file mode 100644
index 0000000000..8f44ddf51a
--- /dev/null
+++ b/rust/patches/patch-src_librustc__trans_back_linker.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_librustc__trans_back_linker.rs,v 1.2 2017/02/23 09:35:16 jperkin Exp $
+
+Permit post-install install_name_tool fixup.
+
+--- src/librustc_trans/back/linker.rs.orig	2017-02-09 01:37:48.000000000 +0000
++++ src/librustc_trans/back/linker.rs
+@@ -213,6 +213,8 @@ impl<'a> Linker for GnuLinker<'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 {
++                // Ensure we can use install_name_tool later to fixup.
++                self.cmd.arg("-Wl,-headerpad_max_install_names");
+                 let mut v = OsString::from("-Wl,-install_name,@rpath/");
+                 v.push(out_filename.file_name().unwrap());
+                 self.cmd.arg(&v);
diff --git a/rust/patches/patch-src_libstd_rtdeps.rs b/rust/patches/patch-src_libstd_rtdeps.rs
new file mode 100644
index 0000000000..eb456ffb3e
--- /dev/null
+++ b/rust/patches/patch-src_libstd_rtdeps.rs
@@ -0,0 +1,19 @@
+$NetBSD: patch-src_libstd_rtdeps.rs,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Support PKGSRC_USE_SSP (ugly for now).
+Add umem.
+
+--- src/libstd/rtdeps.rs.orig	2016-08-16 01:54:35.000000000 +0000
++++ src/libstd/rtdeps.rs
+@@ -43,8 +43,10 @@ extern {}
+ 
+ #[cfg(target_os = "solaris")]
+ #[link(name = "socket")]
+-#[link(name = "posix4")]
+ #[link(name = "pthread")]
++// pkgsrc hack until I can figure out how to pass it through properly
++#[link(name = "ssp")]
++#[link(name = "umem")]
+ extern {}
+ 
+ // For PNaCl targets, nacl_io is a Pepper wrapper for some IO functions
diff --git a/rust/patches/patch-src_libstd_sys_unix_os.rs b/rust/patches/patch-src_libstd_sys_unix_os.rs
new file mode 100644
index 0000000000..f132f91cd2
--- /dev/null
+++ b/rust/patches/patch-src_libstd_sys_unix_os.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_libstd_sys_unix_os.rs,v 1.1 2017/02/23 09:35:16 jperkin Exp $
+
+Match prototype (XXX: use POSIX_PTHREAD_SEMANTICS)
+
+--- src/libstd/sys/unix/os.rs.orig	2016-12-20 23:34:55.000000000 +0000
++++ src/libstd/sys/unix/os.rs
+@@ -506,7 +506,7 @@ pub fn home_dir() -> Option<PathBuf> {
+             // getpwuid_r semantics is different on Illumos/Solaris:
+             // http://illumos.org/man/3c/getpwuid_r
+             let result = libc::getpwuid_r(me, passwd, buf.as_mut_ptr(),
+-                                          buf.capacity());
++                                          buf.capacity() as libc::c_int);
+             if result.is_null() { None } else { Some(()) }
+         }
+ 
diff --git a/rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake b/rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake
new file mode 100644
index 0000000000..c9ebc4d27c
--- /dev/null
+++ b/rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_llvm_cmake_modules_AddLLVM.cmake,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+"-z discard-unused" is only supported by Oracle Solaris ld.
+
+--- src/llvm/cmake/modules/AddLLVM.cmake.orig	2016-08-16 01:55:49.000000000 +0000
++++ src/llvm/cmake/modules/AddLLVM.cmake
+@@ -175,8 +175,6 @@ function(add_link_opts target_name)
+         set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+                      LINK_FLAGS " -Wl,-dead_strip")
+       elseif(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+-        set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+-                     LINK_FLAGS " -Wl,-z -Wl,discard-unused=sections")
+       elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD)
+         # Object files are compiled with -ffunction-data-sections.
+         # Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks
diff --git a/rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp b/rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp
new file mode 100644
index 0000000000..2f403d5ee4
--- /dev/null
+++ b/rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Avoid relocation error.
+
+--- src/llvm/lib/CodeGen/MachineDominanceFrontier.cpp.orig	2016-08-16 01:55:50.000000000 +0000
++++ src/llvm/lib/CodeGen/MachineDominanceFrontier.cpp
+@@ -16,7 +16,6 @@
+ using namespace llvm;
+ 
+ namespace llvm {
+-template class DominanceFrontierBase<MachineBasicBlock>;
+ template class ForwardDominanceFrontierBase<MachineBasicBlock>;
+ }
+ 
diff --git a/rust/patches/patch-src_rust-installer_gen-install-script.sh b/rust/patches/patch-src_rust-installer_gen-install-script.sh
new file mode 100644
index 0000000000..f847113229
--- /dev/null
+++ b/rust/patches/patch-src_rust-installer_gen-install-script.sh
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_rust-installer_gen-install-script.sh,v 1.2 2017/02/23 09:35:16 jperkin Exp $
+
+Do not use /bin/echo, not guaranteed to support -n.
+
+--- src/rust-installer/gen-install-script.sh.orig	2016-07-04 18:05:18.000000000 +0000
++++ src/rust-installer/gen-install-script.sh
+@@ -11,7 +11,7 @@
+ 
+ set -u
+ 
+-if [ -x /bin/echo ]; then
++if [ -x /bin/donotuseecho ]; then
+     ECHO='/bin/echo'
+ else
+     ECHO='echo'
diff --git a/rust/patches/patch-src_rust-installer_gen-installer.sh b/rust/patches/patch-src_rust-installer_gen-installer.sh
new file mode 100644
index 0000000000..e7ce0d6569
--- /dev/null
+++ b/rust/patches/patch-src_rust-installer_gen-installer.sh
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_rust-installer_gen-installer.sh,v 1.2 2017/02/23 09:35:16 jperkin Exp $
+
+Do not use /bin/echo, not guaranteed to support -n.
+Unset CDPATH before printing cd output.
+
+--- src/rust-installer/gen-installer.sh.orig	2016-09-27 07:18:21.000000000 +0000
++++ src/rust-installer/gen-installer.sh
+@@ -281,7 +281,7 @@ cp -r "$CFG_IMAGE_DIR/"* "$CFG_WORK_DIR/
+ need_ok "couldn't copy source image"
+ 
+ # Create the manifest
+-manifest=`(cd "$CFG_WORK_DIR/$CFG_PACKAGE_NAME/$CFG_COMPONENT_NAME" && find . -type f | sed 's/^\.\///') | sort`
++manifest=`(unset CDPATH && cd "$CFG_WORK_DIR/$CFG_PACKAGE_NAME/$CFG_COMPONENT_NAME" >/dev/null && find . -type f | sed 's/^\.\///') | sort`
+ 
+ # Remove files in bulk dirs
+ bulk_dirs=`echo "$CFG_BULK_DIRS" | tr "," " "`
+@@ -317,7 +317,7 @@ echo "$rust_installer_version" > "$versi
+ 
+ # Copy the overlay
+ if [ -n "$CFG_NON_INSTALLED_OVERLAY" ]; then
+-    overlay_files=`(cd "$CFG_NON_INSTALLED_OVERLAY" && find . -type f)`
++    overlay_files=`(unset CDPATH && cd "$CFG_NON_INSTALLED_OVERLAY" >/dev/null && find . -type f)`
+     for f in $overlay_files; do
+ 	if [ -e "$CFG_WORK_DIR/$CFG_PACKAGE_NAME/$f" ]; then err "overlay $f exists"; fi
+ 
diff --git a/rust/patches/patch-src_rust-installer_install-template.sh b/rust/patches/patch-src_rust-installer_install-template.sh
new file mode 100644
index 0000000000..6f9956049b
--- /dev/null
+++ b/rust/patches/patch-src_rust-installer_install-template.sh
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_rust-installer_install-template.sh,v 1.2 2017/02/23 09:35:16 jperkin Exp $
+
+Support SunOS.
+Fix undefined variable warnings.
+
+--- src/rust-installer/install-template.sh.orig	2016-09-27 07:18:21.000000000 +0000
++++ src/rust-installer/install-template.sh
+@@ -352,6 +352,10 @@ get_host_triple() {
+             _ostype=apple-darwin
+             ;;
+ 
++	SunOS)
++            _ostype=unknown-solaris
++            ;;
++
+ 	MINGW*)
+             _ostype=pc-windows-gnu
+             ;;



Home | Main Index | Thread Index | Old Index