summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2016-09-06 10:36:49 +0000
committerjperkin <jperkin@pkgsrc.org>2016-09-06 10:36:49 +0000
commitc4fe7b8a81d1fae1ab31b7204d42324b2132ca53 (patch)
tree808f526026801feec4e84052a8d24c7efcfd93fe /lang
parent4dba6e64c2c21258a661023129fe2ce2209f948d (diff)
downloadpkgsrc-c4fe7b8a81d1fae1ab31b7204d42324b2132ca53.tar.gz
Import rust 1.11.0 as lang/rust into pkgsrc.
pkgsrc notes: * The build requires binary bootstraps built by the Rust team. Due to the requirement that only the previous version is supported as a bootstrap compiler, and new versions of Rust are released every 6 weeks, it is unlikely to be practical to build TNF bootstraps. Users should evaluate whether they trust binaries from upstream. * There is currently no SunOS bootstrap provided by the Rust team, so for now a version built by myself is provided by Joyent. * Only Darwin/Linux/SunOS are currently supported. The Rust team do provide NetBSD bootstraps so support should be easy enough to add. Information about Rust from the DESCR: 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 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.
Diffstat (limited to 'lang')
-rw-r--r--lang/rust/DESCR13
-rw-r--r--lang/rust/Makefile163
-rw-r--r--lang/rust/PLIST104
-rw-r--r--lang/rust/PLIST.gdb4
-rw-r--r--lang/rust/PLIST.lldb3
-rw-r--r--lang/rust/buildlink3.mk14
-rw-r--r--lang/rust/distinfo37
-rw-r--r--lang/rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk15
-rw-r--r--lang/rust/patches/patch-mk_rt.mk18
-rw-r--r--lang/rust/patches/patch-mk_rustllvm.mk18
-rw-r--r--lang/rust/patches/patch-src_etc_local__stage0.sh25
-rw-r--r--lang/rust/patches/patch-src_liblibc_src_unix_solaris_mod.rs31
-rw-r--r--lang/rust/patches/patch-src_librustc__trans_back_linker.rs15
-rw-r--r--lang/rust/patches/patch-src_libstd_rtdeps.rs19
-rw-r--r--lang/rust/patches/patch-src_libstd_sys_unix_thread.rs14
-rw-r--r--lang/rust/patches/patch-src_llvm_Makefile.rules14
-rw-r--r--lang/rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake15
-rw-r--r--lang/rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp14
-rw-r--r--lang/rust/patches/patch-src_llvm_utils_buildit_build__llvm15
-rw-r--r--lang/rust/patches/patch-src_rust-installer_gen-install-script.sh21
-rw-r--r--lang/rust/patches/patch-src_rust-installer_gen-installer.sh40
-rw-r--r--lang/rust/patches/patch-src_rust-installer_install-template.sh27
22 files changed, 639 insertions, 0 deletions
diff --git a/lang/rust/DESCR b/lang/rust/DESCR
new file mode 100644
index 00000000000..6dc90a671e6
--- /dev/null
+++ b/lang/rust/DESCR
@@ -0,0 +1,13 @@
+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 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/lang/rust/Makefile b/lang/rust/Makefile
new file mode 100644
index 00000000000..ed2085eb0bc
--- /dev/null
+++ b/lang/rust/Makefile
@@ -0,0 +1,163 @@
+# $NetBSD: Makefile,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+DISTNAME= rustc-1.11.0-src
+PKGNAME= ${DISTNAME:S/rustc/rust/:S/-src//}
+CATEGORIES= lang
+MASTER_SITES= http://static.rust-lang.org/dist/
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://www.rust-lang.org/
+COMMENT= Safe, concurrent, practical language
+LICENSE= mit OR apache-2.0
+
+WRKSRC= ${WRKDIR}/${DISTNAME:S/-src//}
+
+USE_GCC_RUNTIME= yes
+USE_LANGUAGES= c c++
+USE_TOOLS+= bash gmake
+
+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
+
+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
+
+#
+# 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.
+#
+# pkgsrc can be used to do this, but the resulting bootstrap must be
+# relocatable (i.e. $ORIGIN) and not depend on anything from pkgsrc (so it
+# is common to use rust's internal llvm).
+#
+# The following variables need to be modified/commented out when producing
+# a stage2 bootstrap.
+#
+CONFIGURE_ARGS+= --enable-local-rust
+CONFIGURE_ARGS+= --local-rust-root=${WRKDIR}/rust-${RUST_STAGE2_VER}-${RUST_ARCH}/rustc
+#
+.if !empty(MACHINE_PLATFORM:MDarwin-*-i386)
+RUST_ARCH= i686-apple-darwin
+.elif !empty(MACHINE_PLATFORM:MDarwin-*-x86_64)
+RUST_ARCH= x86_64-apple-darwin
+.elif !empty(MACHINE_PLATFORM:MLinux-*-i386)
+RUST_ARCH= i686-unknown-linux-gnu
+.elif !empty(MACHINE_PLATFORM:MLinux-*-x86_64)
+RUST_ARCH= x86_64-unknown-linux-gnu
+.elif !empty(MACHINE_PLATFORM:MSunOS-*-x86_64)
+RUST_ARCH= x86_64-sun-solaris
+SITES.${RUST_STAGE2}= https://us-east.manta.joyent.com/pkgsrc/public/tmp/
+.else
+NOT_FOR_PLATFORM+= ${MACHINE_PLATFORM}
+.endif
+
+RUST_STAGE2_VER= 1.10.0
+RUST_STAGE2?= rust-${RUST_STAGE2_VER}-${RUST_ARCH}.tar.gz
+SITES.${RUST_STAGE2}?= https://static.rust-lang.org/dist/
+DISTFILES= ${DEFAULT_DISTFILES} ${RUST_STAGE2}
+
+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= 39b92f95
+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
+
+.include "../../devel/cmake/buildlink3.mk"
+.include "../../lang/python/tool.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/rust/PLIST b/lang/rust/PLIST
new file mode 100644
index 00000000000..71468f25e5a
--- /dev/null
+++ b/lang/rust/PLIST
@@ -0,0 +1,104 @@
+@comment $NetBSD: PLIST,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+bin/rustc
+bin/rustdoc
+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/librbml-${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-rt.a
+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/librand-${RUST_VERHASH}.rlib
+lib/rustlib/${RUST_ARCH}/lib/librbml-${RUST_VERHASH}.${SOEXT}
+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_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/librustc_unicode-${RUST_VERHASH}.rlib
+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}.rlib
+lib/rustlib/${RUST_ARCH}/lib/libstd-${RUST_VERHASH}.${SOEXT}
+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
+share/doc/rust/COPYRIGHT
+share/doc/rust/LICENSE-APACHE
+share/doc/rust/LICENSE-MIT
+share/doc/rust/README.md
diff --git a/lang/rust/PLIST.gdb b/lang/rust/PLIST.gdb
new file mode 100644
index 00000000000..1d4ff655864
--- /dev/null
+++ b/lang/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/lang/rust/PLIST.lldb b/lang/rust/PLIST.lldb
new file mode 100644
index 00000000000..2da9c455d65
--- /dev/null
+++ b/lang/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/lang/rust/buildlink3.mk b/lang/rust/buildlink3.mk
new file mode 100644
index 00000000000..128555fd73a
--- /dev/null
+++ b/lang/rust/buildlink3.mk
@@ -0,0 +1,14 @@
+# $NetBSD: buildlink3.mk,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+BUILDLINK_TREE+= rust
+
+.if !defined(RUST_BUILDLINK3_MK)
+RUST_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.rust+= rust>=0.11.0
+BUILDLINK_PKGSRCDIR.rust?= ../../lang/rust
+
+BUILDLINK_PASSTHRU_DIRS+= ${PREFIX}/lib/rustlib
+.endif
+
+BUILDLINK_TREE+= -rust
diff --git a/lang/rust/distinfo b/lang/rust/distinfo
new file mode 100644
index 00000000000..e93d1f5d3e7
--- /dev/null
+++ b/lang/rust/distinfo
@@ -0,0 +1,37 @@
+$NetBSD: distinfo,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+SHA1 (rust-1.10.0-i686-unknown-linux-gnu.tar.gz) = aded64d8ddc5d286ffc81de21c6a8c47951ac329
+RMD160 (rust-1.10.0-i686-unknown-linux-gnu.tar.gz) = 9248526a5f9656e083a221f0931f9cec6b1a0726
+SHA512 (rust-1.10.0-i686-unknown-linux-gnu.tar.gz) = ef1e874aadc24a64e7df0a09dfea0e5ed6a0bf7acbaf8485976c602f549141289c07b2e27cd7d0a0029f9884042d6ff00c8b917543a9284bae7f7c684ddc6904
+Size (rust-1.10.0-i686-unknown-linux-gnu.tar.gz) = 119011780 bytes
+SHA1 (rust-1.10.0-x86_64-apple-darwin.tar.gz) = 9d88b5a1203f91ac12a2f3d33944d6dbeabf3347
+RMD160 (rust-1.10.0-x86_64-apple-darwin.tar.gz) = 046553af4b914421d2ddcde64b6025f18f610bf5
+SHA512 (rust-1.10.0-x86_64-apple-darwin.tar.gz) = 428c53bd402094254e16b5b29303ce5565abf11275546aaa7fecf4f6ea2b13ec46a7d455b1e9c2a6f50a0fcd5573c10adcef09afd29dc390202fa152c31400ac
+Size (rust-1.10.0-x86_64-apple-darwin.tar.gz) = 107969649 bytes
+SHA1 (rust-1.10.0-x86_64-sun-solaris.tar.gz) = 3bbd80ac1609fe60da890ae90c4d08acb5ca77cb
+RMD160 (rust-1.10.0-x86_64-sun-solaris.tar.gz) = df0208b8bbcbcc8e7d4e3497cb5191a418b40b03
+SHA512 (rust-1.10.0-x86_64-sun-solaris.tar.gz) = 73e5e0bdf072910b280abc1ff2dc71fa3ee1808c4a41a387c9cb5f9a69a00aaea3aa1c31ae167ad60d2a5a8730943d0c8c4c5e902e671250d3398541e80ff7fa
+Size (rust-1.10.0-x86_64-sun-solaris.tar.gz) = 222992235 bytes
+SHA1 (rust-1.10.0-x86_64-unknown-linux-gnu.tar.gz) = 1174c1e9e6d1de47715ecb611bf917938b8be5e9
+RMD160 (rust-1.10.0-x86_64-unknown-linux-gnu.tar.gz) = 72878c0b697ae049919cb04b37d42cf26256f7cd
+SHA512 (rust-1.10.0-x86_64-unknown-linux-gnu.tar.gz) = ffcef849222a57e56e2d21e01134a45265e3f5d03d3042bf8492e54007664e9c290275cb7ffb0ff4d1b1c09e222bcd0946284390886e942aa0f53862b73fb8f2
+Size (rust-1.10.0-x86_64-unknown-linux-gnu.tar.gz) = 118275404 bytes
+SHA1 (rustc-1.11.0-src.tar.gz) = d4c7177fd939be64c08b6460d89a1595b24406b4
+RMD160 (rustc-1.11.0-src.tar.gz) = ada0761c38febb423677c1b8bb2fd5c8fee05d53
+SHA512 (rustc-1.11.0-src.tar.gz) = 6ad050a02e3a3b48f205f5d5ed9393fd2a1a2237e5c78b3e51af8162f410b93a831ebe5980ce78c4d38c5a692395c7fec8442956497a5d21e9f7157404c6b5aa
+Size (rustc-1.11.0-src.tar.gz) = 26126471 bytes
+SHA1 (patch-mk_cfg_x86__64-apple-darwin.mk) = 37b50b64ea5607588d541852e07f02a4611d38c8
+SHA1 (patch-mk_rt.mk) = 888bd6646305c357044f37db9cb23f9d2fe77d90
+SHA1 (patch-mk_rustllvm.mk) = 500ce129d9ea83fc97317679b45a79f12c8ca9e8
+SHA1 (patch-src_etc_local__stage0.sh) = fbfacff23a9236b2c32a49abb2b520be264ece59
+SHA1 (patch-src_liblibc_src_unix_solaris_mod.rs) = 7279fb49054d203b045327a5b9c52b2fbdc2c8d6
+SHA1 (patch-src_librustc__trans_back_linker.rs) = 279850f534bed6380bbc3ffd47e49938fa6423df
+SHA1 (patch-src_libstd_rtdeps.rs) = ed271c5b83a8d623469abd39a2d072bfffbcc890
+SHA1 (patch-src_libstd_sys_unix_thread.rs) = 03ea5a505427faeaf66a58cb2134ac651daf3fb5
+SHA1 (patch-src_llvm_Makefile.rules) = c5f76ef8ee1fc283d2feb7dc388c7938a81c8849
+SHA1 (patch-src_llvm_cmake_modules_AddLLVM.cmake) = 282d97cce8d01cfefe565185d4999c2db9ccc13f
+SHA1 (patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp) = 2899771b1a23be840b9305eff7e5e5f957239ccb
+SHA1 (patch-src_llvm_utils_buildit_build__llvm) = bc2c729153f3eee77ff3f018364544b947bab9d0
+SHA1 (patch-src_rust-installer_gen-install-script.sh) = 689ff4e8fa3ee9cd41202b40b6575f568eef6415
+SHA1 (patch-src_rust-installer_gen-installer.sh) = 43087b7471bfb9b0bcbd7c94cc0de22b2dd2f757
+SHA1 (patch-src_rust-installer_install-template.sh) = 85be7f5a0706c3d3fa9078458555723e797a7c5e
diff --git a/lang/rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk b/lang/rust/patches/patch-mk_cfg_x86__64-apple-darwin.mk
new file mode 100644
index 00000000000..62fa567855b
--- /dev/null
+++ b/lang/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/lang/rust/patches/patch-mk_rt.mk b/lang/rust/patches/patch-mk_rt.mk
new file mode 100644
index 00000000000..23125ebed8b
--- /dev/null
+++ b/lang/rust/patches/patch-mk_rt.mk
@@ -0,0 +1,18 @@
+$NetBSD: patch-mk_rt.mk,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Fix library location on SunOS.
+
+--- mk/rt.mk.orig 2016-08-16 01:54:35.000000000 +0000
++++ mk/rt.mk
+@@ -269,6 +269,11 @@ endif
+ COMPRT_DEFINES_$(1) := -DCOMPILER_RT_ENABLE_IOS=ON
+ endif
+
++ifeq ($$(findstring solaris,$(1)),solaris)
++COMPRT_DIR_$(1) := sunos
++COMPRT_LIB_NAME_$(1) := clang_rt.builtins-$$(COMPRT_ARCH_$(1))
++endif
++
+ ifndef COMPRT_DIR_$(1)
+ # NB: FreeBSD and NetBSD output to "linux"...
+ COMPRT_DIR_$(1) := linux
diff --git a/lang/rust/patches/patch-mk_rustllvm.mk b/lang/rust/patches/patch-mk_rustllvm.mk
new file mode 100644
index 00000000000..194b1384913
--- /dev/null
+++ b/lang/rust/patches/patch-mk_rustllvm.mk
@@ -0,0 +1,18 @@
+$NetBSD: patch-mk_rustllvm.mk,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Ensure we can find generated LLVM includes.
+
+--- mk/rustllvm.mk.orig 2016-07-04 18:04:09.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/, \
+ ExecutionEngineWrapper.cpp RustWrapper.cpp PassWrapper.cpp \
diff --git a/lang/rust/patches/patch-src_etc_local__stage0.sh b/lang/rust/patches/patch-src_etc_local__stage0.sh
new file mode 100644
index 00000000000..374795e130a
--- /dev/null
+++ b/lang/rust/patches/patch-src_etc_local__stage0.sh
@@ -0,0 +1,25 @@
+$NetBSD: patch-src_etc_local__stage0.sh,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Copy additional libarena required on Darwin.
+Copy GCC support libraries required on SunOS.
+
+--- src/etc/local_stage0.sh.orig 2016-08-16 01:54:35.000000000 +0000
++++ src/etc/local_stage0.sh
+@@ -51,6 +51,7 @@ fi
+
+ cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/
+ cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/
++cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}arena*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+@@ -63,6 +64,9 @@ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}log
+ cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbml*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/
+ 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}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/lang/rust/patches/patch-src_liblibc_src_unix_solaris_mod.rs b/lang/rust/patches/patch-src_liblibc_src_unix_solaris_mod.rs
new file mode 100644
index 00000000000..fbda84e49b6
--- /dev/null
+++ b/lang/rust/patches/patch-src_liblibc_src_unix_solaris_mod.rs
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_liblibc_src_unix_solaris_mod.rs,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Additional Solarish support.
+
+--- src/liblibc/src/unix/solaris/mod.rs.orig 2016-08-16 01:54:44.000000000 +0000
++++ src/liblibc/src/unix/solaris/mod.rs
+@@ -487,9 +487,13 @@ pub const SIGSEGV: ::c_int = 11;
+ pub const SIGPIPE: ::c_int = 13;
+ pub const SIGALRM: ::c_int = 14;
+ pub const SIGTERM: ::c_int = 15;
++pub const SIGWINCH: ::c_int = 20;
+
+ pub const WNOHANG: ::c_int = 0x40;
+
++pub const RTLD_NOW: ::c_int = 0x2;
++pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
++
+ pub const PROT_NONE: ::c_int = 0;
+ pub const PROT_READ: ::c_int = 1;
+ pub const PROT_WRITE: ::c_int = 2;
+@@ -707,8 +711,8 @@ pub const IP_TTL: ::c_int = 4;
+ pub const IP_HDRINCL: ::c_int = 2;
+ pub const IP_ADD_MEMBERSHIP: ::c_int = 19;
+ pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
+-pub const IPV6_JOIN_GROUP: ::c_int = 9;
+-pub const IPV6_LEAVE_GROUP: ::c_int = 10;
++pub const IPV6_ADD_MEMBERSHIP: ::c_int = 9;
++pub const IPV6_DROP_MEMBERSHIP: ::c_int = 10;
+
+ pub const TCP_NODELAY: ::c_int = 1;
+ pub const TCP_KEEPIDLE: ::c_int = 34;
diff --git a/lang/rust/patches/patch-src_librustc__trans_back_linker.rs b/lang/rust/patches/patch-src_librustc__trans_back_linker.rs
new file mode 100644
index 00000000000..2190a95b11b
--- /dev/null
+++ b/lang/rust/patches/patch-src_librustc__trans_back_linker.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_librustc__trans_back_linker.rs,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Permit post-install install_name_tool fixup.
+
+--- src/librustc_trans/back/linker.rs.orig 2016-08-16 01:54:35.000000000 +0000
++++ src/librustc_trans/back/linker.rs
+@@ -206,6 +206,8 @@ impl<'a> Linker for GnuLinker<'a> {
+ self.cmd.args(&["-dynamiclib", "-Wl,-dylib"]);
+
+ if self.sess.opts.cg.rpath {
++ // 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/lang/rust/patches/patch-src_libstd_rtdeps.rs b/lang/rust/patches/patch-src_libstd_rtdeps.rs
new file mode 100644
index 00000000000..eb456ffb3e4
--- /dev/null
+++ b/lang/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/lang/rust/patches/patch-src_libstd_sys_unix_thread.rs b/lang/rust/patches/patch-src_libstd_sys_unix_thread.rs
new file mode 100644
index 00000000000..66db30e1816
--- /dev/null
+++ b/lang/rust/patches/patch-src_libstd_sys_unix_thread.rs
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_libstd_sys_unix_thread.rs,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Additional Solarish support.
+
+--- src/libstd/sys/unix/thread.rs.orig 2016-07-04 18:04:09.000000000 +0000
++++ src/libstd/sys/unix/thread.rs
+@@ -12,7 +12,6 @@ use prelude::v1::*;
+
+ use alloc::boxed::FnBox;
+ use cmp;
+-#[cfg(not(any(target_env = "newlib", target_os = "solaris")))]
+ use ffi::CStr;
+ use io;
+ use libc;
diff --git a/lang/rust/patches/patch-src_llvm_Makefile.rules b/lang/rust/patches/patch-src_llvm_Makefile.rules
new file mode 100644
index 00000000000..c87a7110d34
--- /dev/null
+++ b/lang/rust/patches/patch-src_llvm_Makefile.rules
@@ -0,0 +1,14 @@
+$NetBSD: patch-src_llvm_Makefile.rules,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+"-z discard-unused" is only supported by Oracle Solaris ld.
+
+--- src/llvm/Makefile.rules.orig 2016-07-04 18:05:12.000000000 +0000
++++ src/llvm/Makefile.rules
+@@ -644,7 +644,6 @@ ifndef NO_DEAD_STRIP
+ LD.Flags += -Wl,-dead_strip
+ else
+ ifeq ($(HOST_OS),SunOS)
+- LD.Flags += -Wl,-z -Wl,discard-unused=sections
+ else
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ LD.Flags += -Wl,--gc-sections
diff --git a/lang/rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake b/lang/rust/patches/patch-src_llvm_cmake_modules_AddLLVM.cmake
new file mode 100644
index 00000000000..c9ebc4d27c3
--- /dev/null
+++ b/lang/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/lang/rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp b/lang/rust/patches/patch-src_llvm_lib_CodeGen_MachineDominanceFrontier.cpp
new file mode 100644
index 00000000000..2f403d5ee46
--- /dev/null
+++ b/lang/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/lang/rust/patches/patch-src_llvm_utils_buildit_build__llvm b/lang/rust/patches/patch-src_llvm_utils_buildit_build__llvm
new file mode 100644
index 00000000000..873b03b4b4d
--- /dev/null
+++ b/lang/rust/patches/patch-src_llvm_utils_buildit_build__llvm
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_llvm_utils_buildit_build__llvm,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Shell portability fix.
+
+--- src/llvm/utils/buildit/build_llvm.orig 2016-03-03 01:04:56.000000000 +0000
++++ src/llvm/utils/buildit/build_llvm
+@@ -227,7 +227,7 @@ cd $DIR/obj-llvm || exit 1
+
+ # Install the tree into the destination directory.
+ make $JOBS_FLAG $COMMON_MAKEFLAGS UNIVERSAL_ARCH="$HOSTS" install
+-if ! test $? == 0 ; then
++if ! test $? = 0 ; then
+ echo "error: LLVM 'make install' failed!"
+ exit 1
+ fi
diff --git a/lang/rust/patches/patch-src_rust-installer_gen-install-script.sh b/lang/rust/patches/patch-src_rust-installer_gen-install-script.sh
new file mode 100644
index 00000000000..9f169615e8c
--- /dev/null
+++ b/lang/rust/patches/patch-src_rust-installer_gen-install-script.sh
@@ -0,0 +1,21 @@
+$NetBSD: patch-src_rust-installer_gen-install-script.sh,v 1.1 2016/09/06 10:36:49 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
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+ # file at the top-level directory of this distribution and at
+ # http://rust-lang.org/COPYRIGHT.
+@@ -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/lang/rust/patches/patch-src_rust-installer_gen-installer.sh b/lang/rust/patches/patch-src_rust-installer_gen-installer.sh
new file mode 100644
index 00000000000..14751e5393f
--- /dev/null
+++ b/lang/rust/patches/patch-src_rust-installer_gen-installer.sh
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_rust-installer_gen-installer.sh,v 1.1 2016/09/06 10:36:49 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-07-04 18:05:18.000000000 +0000
++++ src/rust-installer/gen-installer.sh
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+ # file at the top-level directory of this distribution and at
+ # http://rust-lang.org/COPYRIGHT.
+@@ -11,7 +11,7 @@
+
+ set -u
+
+-if [ -x /bin/echo ]; then
++if [ -x /bin/donotuseecho ]; then
+ ECHO='/bin/echo'
+ else
+ ECHO='echo'
+@@ -287,7 +287,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 "," " "`
+@@ -324,7 +324,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/lang/rust/patches/patch-src_rust-installer_install-template.sh b/lang/rust/patches/patch-src_rust-installer_install-template.sh
new file mode 100644
index 00000000000..2ec9cfdb937
--- /dev/null
+++ b/lang/rust/patches/patch-src_rust-installer_install-template.sh
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_rust-installer_install-template.sh,v 1.1 2016/09/06 10:36:49 jperkin Exp $
+
+Support SunOS.
+Fix undefined variable warnings.
+
+--- src/rust-installer/install-template.sh.orig 2016-07-04 18:05:18.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
+ ;;
+@@ -381,7 +385,7 @@ get_host_triple() {
+ ;;
+
+ *)
+- err "unknown value from uname -s: $uname_value"
++ err "unknown value from uname -s: $_uname_value"
+ ;;
+ esac
+