summaryrefslogtreecommitdiff
path: root/lang/rust/patches
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/rust/patches
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/rust/patches')
-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
15 files changed, 301 insertions, 0 deletions
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
+