pkgsrc-WIP-changes archive

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

rust: Rename to 173



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Mon Oct 23 13:00:41 2023 -0400
Changeset:	272fec8abc36bc23498c2591bf8174a57967c3ac

Modified Files:
	Makefile
Added Files:
	rust173/DESCR
	rust173/Makefile
	rust173/buildlink3.mk
	rust173/cargo.mk
	rust173/cross.mk
	rust173/distinfo
	rust173/do-cross.mk
	rust173/files/gcc-wrap
	rust173/options.mk
	rust173/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
	rust173/patches/patch-compiler_rustc__llvm_build.rs
	rust173/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs
	rust173/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs
	rust173/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs
	rust173/patches/patch-compiler_rustc__target_src_spec_mod.rs
	rust173/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs
	rust173/patches/patch-library_backtrace_src_symbolize_gimli.rs
	rust173/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
	rust173/patches/patch-library_std_src_sys_unix_mod.rs
	rust173/patches/patch-library_std_src_sys_unix_thread.rs
	rust173/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs
	rust173/patches/patch-src_bootstrap_bootstrap.py
	rust173/patches/patch-src_bootstrap_builder.rs
	rust173/patches/patch-src_bootstrap_compile.rs
	rust173/patches/patch-src_bootstrap_lib.rs
	rust173/patches/patch-src_bootstrap_llvm.rs
	rust173/patches/patch-src_llvm-project_llvm_CMakeLists.txt
	rust173/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
	rust173/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
	rust173/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
	rust173/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h
	rust173/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp
	rust173/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
	rust173/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
	rust173/patches/patch-src_tools_cargo_tests_testsuite_build.rs
	rust173/patches/patch-src_tools_rust-installer_install-template.sh
	rust173/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
	rust173/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
	rust173/patches/patch-vendor_cc-1.0.73_src_lib.rs
	rust173/patches/patch-vendor_cc_src_lib.rs
	rust173/patches/patch-vendor_crossbeam-epoch_no__atomic.rs
	rust173/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs
	rust173/patches/patch-vendor_crossbeam-utils_no__atomic.rs
	rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust173/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs
	rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust173/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs
	rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust173/patches/patch-vendor_libc_src_unix_solarish_mod.rs
	rust173/patches/patch-vendor_lzma-sys_config.h
	rust173/patches/patch-vendor_nix_src_sys_signal.rs
	rust173/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf
	rust173/patches/patch-vendor_openssl-src_src_lib.rs
	rust173/patches/patch-vendor_openssl-sys_build_find__normal.rs
	rust173/patches/patch-vendor_openssl-sys_build_main.rs
	rust173/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
	rust173/patches/patch-vendor_stacker_src_lib.rs
	rust173/patches/patch-vendor_target-lexicon_src_targets.rs
	rust173/patches/patch-vendor_valuable_no__atomic.rs
	rust173/platform.mk
	rust173/rust.mk
Removed Files:
	rust/DESCR
	rust/Makefile
	rust/buildlink3.mk
	rust/cargo.mk
	rust/cross.mk
	rust/distinfo
	rust/do-cross.mk
	rust/files/gcc-wrap
	rust/options.mk
	rust/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
	rust/patches/patch-compiler_rustc__llvm_build.rs
	rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs
	rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs
	rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs
	rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
	rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs
	rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
	rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
	rust/patches/patch-library_std_src_sys_unix_mod.rs
	rust/patches/patch-library_std_src_sys_unix_thread.rs
	rust/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs
	rust/patches/patch-src_bootstrap_bootstrap.py
	rust/patches/patch-src_bootstrap_builder.rs
	rust/patches/patch-src_bootstrap_compile.rs
	rust/patches/patch-src_bootstrap_lib.rs
	rust/patches/patch-src_bootstrap_llvm.rs
	rust/patches/patch-src_llvm-project_llvm_CMakeLists.txt
	rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
	rust/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
	rust/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
	rust/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h
	rust/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp
	rust/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
	rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
	rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
	rust/patches/patch-src_tools_rust-installer_install-template.sh
	rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
	rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
	rust/patches/patch-vendor_cc-1.0.73_src_lib.rs
	rust/patches/patch-vendor_cc_src_lib.rs
	rust/patches/patch-vendor_crossbeam-epoch_no__atomic.rs
	rust/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs
	rust/patches/patch-vendor_crossbeam-utils_no__atomic.rs
	rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs
	rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs
	rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs
	rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
	rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
	rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs
	rust/patches/patch-vendor_lzma-sys_config.h
	rust/patches/patch-vendor_nix_src_sys_signal.rs
	rust/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf
	rust/patches/patch-vendor_openssl-src_src_lib.rs
	rust/patches/patch-vendor_openssl-sys_build_find__normal.rs
	rust/patches/patch-vendor_openssl-sys_build_main.rs
	rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
	rust/patches/patch-vendor_stacker_src_lib.rs
	rust/patches/patch-vendor_target-lexicon_src_targets.rs
	rust/patches/patch-vendor_valuable_no__atomic.rs
	rust/platform.mk
	rust/rust.mk

Log Message:
rust: Rename to 173

The point is that each rust version will be suffixed in wip, so that
multiple can exist, avoiding the problem that 1.72 to be used to
update pkgsrc is now only in history.

As proposed on tech-pkg without objections.

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

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

diffstat:
 Makefile                                           |   2 +-
 rust/DESCR                                         |  13 -
 rust/Makefile                                      | 714 ---------------------
 rust/buildlink3.mk                                 |  17 -
 rust/cargo.mk                                      |  99 ---
 rust/cross.mk                                      |  82 ---
 rust/distinfo                                      | 171 -----
 rust/do-cross.mk                                   | 107 ---
 rust/files/gcc-wrap                                | 199 ------
 rust/options.mk                                    |  68 --
 ...compiler_rustc__codegen__ssa_src_back_linker.rs |  15 -
 rust/patches/patch-compiler_rustc__llvm_build.rs   |  48 --
 ...rustc__target_src_spec_i586__unknown__netbsd.rs |  30 -
 ...c__target_src_spec_mips64el__unknown__netbsd.rs |  29 -
 ...stc__target_src_spec_mipsel__unknown__netbsd.rs |  30 -
 .../patch-compiler_rustc__target_src_spec_mod.rs   |  15 -
 ...compiler_rustc__target_src_spec_netbsd__base.rs |  29 -
 .../patch-library_backtrace_src_symbolize_gimli.rs |  14 -
 ...ch-library_backtrace_src_symbolize_gimli_elf.rs |  24 -
 rust/patches/patch-library_std_src_sys_unix_mod.rs |  14 -
 .../patch-library_std_src_sys_unix_thread.rs       |  56 --
 ...rary_std_src_sys_unix_thread__parking_netbsd.rs |  34 -
 rust/patches/patch-src_bootstrap_bootstrap.py      |  36 --
 rust/patches/patch-src_bootstrap_builder.rs        |  15 -
 rust/patches/patch-src_bootstrap_compile.rs        |  15 -
 rust/patches/patch-src_bootstrap_lib.rs            |  23 -
 rust/patches/patch-src_bootstrap_llvm.rs           |  21 -
 .../patch-src_llvm-project_llvm_CMakeLists.txt     |  18 -
 ...c_llvm-project_llvm_cmake_modules_AddLLVM.cmake |  49 --
 ...rc_llvm-project_llvm_include_llvm-c_DataTypes.h |  34 -
 ...ct_llvm_include_llvm_Analysis_ConstantFolding.h |  17 -
 ...-project_llvm_lib_Support_BLAKE3_blake3__impl.h |  20 -
 ...ect_llvm_lib_Target_PowerPC_PPCISelLowering.cpp |  17 -
 ...llvm-project_llvm_utils_FileCheck_FileCheck.cpp |  15 -
 ...atch-src_tools_cargo_src_cargo_core_profiles.rs |  17 -
 .../patch-src_tools_cargo_tests_testsuite_build.rs |  31 -
 ...ch-src_tools_rust-installer_install-template.sh | 168 -----
 .../patch-vendor_backtrace_src_symbolize_gimli.rs  |  14 -
 ...tch-vendor_backtrace_src_symbolize_gimli_elf.rs |  24 -
 rust/patches/patch-vendor_cc-1.0.73_src_lib.rs     |  16 -
 rust/patches/patch-vendor_cc_src_lib.rs            |  40 --
 .../patch-vendor_crossbeam-epoch_no__atomic.rs     |  20 -
 ...tch-vendor_crossbeam-utils-0.8.14-no__atomic.rs |  14 -
 .../patch-vendor_crossbeam-utils_no__atomic.rs     |  19 -
 ...-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 -
 ...c-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 --
 ...2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  31 -
 ...-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 -
 ...c-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 --
 ...2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  29 -
 ...ch-vendor_libc-0.2.140_src_unix_solarish_mod.rs |  15 -
 ...-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 -
 ...2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  31 -
 ...-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 -
 ...c-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 --
 ...2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  29 -
 ...ch-vendor_libc-0.2.146_src_unix_solarish_mod.rs |  15 -
 ...dor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 -
 ...ndor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 --
 ..._libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  31 -
 .../patch-vendor_libc_src_unix_solarish_mod.rs     |  15 -
 rust/patches/patch-vendor_lzma-sys_config.h        |  18 -
 rust/patches/patch-vendor_nix_src_sys_signal.rs    |  15 -
 ...openssl-src_openssl_Configurations_10-main.conf |  18 -
 rust/patches/patch-vendor_openssl-src_src_lib.rs   |  64 --
 .../patch-vendor_openssl-sys_build_find__normal.rs |  30 -
 .../patches/patch-vendor_openssl-sys_build_main.rs |  24 -
 ...target_src_spec_aarch64__be__unknown__netbsd.rs |  27 -
 rust/patches/patch-vendor_stacker_src_lib.rs       |  15 -
 .../patch-vendor_target-lexicon_src_targets.rs     |  30 -
 rust/patches/patch-vendor_valuable_no__atomic.rs   |  14 -
 rust/platform.mk                                   |  26 -
 rust/rust.mk                                       |  55 --
 rust173/DESCR                                      |  13 +
 rust173/Makefile                                   | 714 +++++++++++++++++++++
 rust173/buildlink3.mk                              |  17 +
 rust173/cargo.mk                                   |  99 +++
 rust173/cross.mk                                   |  82 +++
 rust173/distinfo                                   | 171 +++++
 rust173/do-cross.mk                                | 107 +++
 rust173/files/gcc-wrap                             | 199 ++++++
 rust173/options.mk                                 |  68 ++
 ...compiler_rustc__codegen__ssa_src_back_linker.rs |  15 +
 .../patches/patch-compiler_rustc__llvm_build.rs    |  48 ++
 ...rustc__target_src_spec_i586__unknown__netbsd.rs |  30 +
 ...c__target_src_spec_mips64el__unknown__netbsd.rs |  29 +
 ...stc__target_src_spec_mipsel__unknown__netbsd.rs |  30 +
 .../patch-compiler_rustc__target_src_spec_mod.rs   |  15 +
 ...compiler_rustc__target_src_spec_netbsd__base.rs |  29 +
 .../patch-library_backtrace_src_symbolize_gimli.rs |  14 +
 ...ch-library_backtrace_src_symbolize_gimli_elf.rs |  24 +
 .../patches/patch-library_std_src_sys_unix_mod.rs  |  14 +
 .../patch-library_std_src_sys_unix_thread.rs       |  56 ++
 ...rary_std_src_sys_unix_thread__parking_netbsd.rs |  34 +
 rust173/patches/patch-src_bootstrap_bootstrap.py   |  36 ++
 rust173/patches/patch-src_bootstrap_builder.rs     |  15 +
 rust173/patches/patch-src_bootstrap_compile.rs     |  15 +
 rust173/patches/patch-src_bootstrap_lib.rs         |  23 +
 rust173/patches/patch-src_bootstrap_llvm.rs        |  21 +
 .../patch-src_llvm-project_llvm_CMakeLists.txt     |  18 +
 ...c_llvm-project_llvm_cmake_modules_AddLLVM.cmake |  49 ++
 ...rc_llvm-project_llvm_include_llvm-c_DataTypes.h |  34 +
 ...ct_llvm_include_llvm_Analysis_ConstantFolding.h |  17 +
 ...-project_llvm_lib_Support_BLAKE3_blake3__impl.h |  20 +
 ...ect_llvm_lib_Target_PowerPC_PPCISelLowering.cpp |  17 +
 ...llvm-project_llvm_utils_FileCheck_FileCheck.cpp |  15 +
 ...atch-src_tools_cargo_src_cargo_core_profiles.rs |  17 +
 .../patch-src_tools_cargo_tests_testsuite_build.rs |  31 +
 ...ch-src_tools_rust-installer_install-template.sh | 168 +++++
 .../patch-vendor_backtrace_src_symbolize_gimli.rs  |  14 +
 ...tch-vendor_backtrace_src_symbolize_gimli_elf.rs |  24 +
 rust173/patches/patch-vendor_cc-1.0.73_src_lib.rs  |  16 +
 rust173/patches/patch-vendor_cc_src_lib.rs         |  40 ++
 .../patch-vendor_crossbeam-epoch_no__atomic.rs     |  20 +
 ...tch-vendor_crossbeam-utils-0.8.14-no__atomic.rs |  14 +
 .../patch-vendor_crossbeam-utils_no__atomic.rs     |  19 +
 ...-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 +
 ...c-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 ++
 ...2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  31 +
 ...-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 +
 ...c-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 ++
 ...2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  29 +
 ...ch-vendor_libc-0.2.140_src_unix_solarish_mod.rs |  15 +
 ...-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 +
 ...2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  31 +
 ...-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 +
 ...c-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 ++
 ...2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  29 +
 ...ch-vendor_libc-0.2.146_src_unix_solarish_mod.rs |  15 +
 ...dor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs |  29 +
 ...ndor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs |  59 ++
 ..._libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs |  31 +
 .../patch-vendor_libc_src_unix_solarish_mod.rs     |  15 +
 rust173/patches/patch-vendor_lzma-sys_config.h     |  18 +
 rust173/patches/patch-vendor_nix_src_sys_signal.rs |  15 +
 ...openssl-src_openssl_Configurations_10-main.conf |  18 +
 .../patches/patch-vendor_openssl-src_src_lib.rs    |  64 ++
 .../patch-vendor_openssl-sys_build_find__normal.rs |  30 +
 .../patches/patch-vendor_openssl-sys_build_main.rs |  24 +
 ...target_src_spec_aarch64__be__unknown__netbsd.rs |  27 +
 rust173/patches/patch-vendor_stacker_src_lib.rs    |  15 +
 .../patch-vendor_target-lexicon_src_targets.rs     |  30 +
 .../patches/patch-vendor_valuable_no__atomic.rs    |  14 +
 rust173/platform.mk                                |  26 +
 rust173/rust.mk                                    |  55 ++
 145 files changed, 3365 insertions(+), 3365 deletions(-)

diffs:
diff --git a/Makefile b/Makefile
index 4eb6f824cb..3d0f3ee1d3 100644
--- a/Makefile
+++ b/Makefile
@@ -4946,7 +4946,7 @@ SUBDIR+=	ruby-xmpp4r
 SUBDIR+=	ruby-yaml_waml
 SUBDIR+=	runas
 SUBDIR+=	runcpm
-SUBDIR+=	rust
+SUBDIR+=	rust173
 SUBDIR+=	rust-analyzer
 SUBDIR+=	rust-synapse-compress-state
 SUBDIR+=	s2tc
diff --git a/rust/DESCR b/rust/DESCR
deleted file mode 100644
index 6dc90a671e..0000000000
--- a/rust/DESCR
+++ /dev/null
@@ -1,13 +0,0 @@
-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/rust/Makefile b/rust/Makefile
deleted file mode 100644
index 5dcac68758..0000000000
--- a/rust/Makefile
+++ /dev/null
@@ -1,714 +0,0 @@
-# $NetBSD: Makefile,v 1.284 2023/06/19 14:46:47 bsiegert Exp $
-
-DISTNAME=	rustc-1.73.0-src
-PKGNAME=	${DISTNAME:S/rustc/rust/:S/-src//}
-CATEGORIES=	lang
-MASTER_SITES=	https://static.rust-lang.org/dist/
-
-MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
-HOMEPAGE=	https://www.rust-lang.org/
-COMMENT=	Safe, concurrent, practical language
-LICENSE=	mit OR apache-2.0
-
-CONFLICTS+=	rust-bin-[0-9]*
-
-# LLVM uses -std=c++17
-USE_CXX_FEATURES+=      c++17
-
-USE_GCC_RUNTIME=	yes
-USE_LANGUAGES=		c c++17
-USE_LIBTOOL=		yes
-USE_TOOLS+=		bash grep gmake perl:build pkg-config
-
-# The NetBSD bootstraps are built for NetBSD 8 (because rust doesn't
-# build on 7).  Mark earlier versions as broken.
-BROKEN_ON_PLATFORM+=	NetBSD-[1-7].*-*
-# Bootstrap is built for NetBSD 9.x on these platforms:
-BROKEN_ON_PLATFORM+=	NetBSD-8.*-*arm*
-BROKEN_ON_PLATFORM+=	NetBSD-8.*-aarch64
-BROKEN_ON_PLATFORM+=	NetBSD-8.*-sparc64
-
-HAS_CONFIGURE=		yes
-PYTHON_FOR_BUILD_ONLY=	yes
-CONFIG_SHELL=		${PYTHONBIN}
-CONFIGURE_SCRIPT=	src/bootstrap/configure.py
-CONFIGURE_ARGS+=	--prefix=${PREFIX}
-CONFIGURE_ARGS+=	--mandir=${PREFIX}/${PKGMANDIR}
-CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
-CONFIGURE_ARGS+=	--python=${PYTHONBIN}
-CONFIGURE_ARGS+=	--release-channel=stable
-CONFIGURE_ARGS+=	--local-rust-root=${RUST_BOOTSTRAP_PATH}
-CONFIGURE_ARGS+=	--enable-extended	# Build and install cargo too.
-CONFIGURE_ARGS+=	--enable-rpath
-CONFIGURE_ARGS+=	--disable-codegen-tests
-CONFIGURE_ARGS+=	--disable-compiler-docs
-CONFIGURE_ARGS+=	--disable-llvm-static-stdcpp
-CONFIGURE_ARGS+=	--disable-ninja
-CONFIGURE_ARGS+=	--dist-compression-formats=xz
-
-# Include (optional) settings to cross-build rust
-.include "cross.mk"
-
-# optional from do-cross.mk
-CONFIGURE_ARGS+=	${ADD_CONFIGURE_ARGS}
-
-# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
-# uncommenting the LD_LIBRARY_PATH setting may be required to run
-# the bootstrap
-PKGSRC_MAKE_ENV+=	LD_LIBRARY_PATH=${RUST_BOOTSTRAP_PATH:Q}/lib
-
-# This should allow us to perform "offline" builds (so cargo doesn't fetch
-# dependencies during the build stage) but this isn't hooked up yet.
-CONFIGURE_ARGS+=	--enable-vendor
-
-# cargo defaults to using the number of available CPUs
-MAKE_ENV+=		CARGO_BUILD_JOBS=${_MAKE_JOBS_N}
-
-# Rust builds some bundled components with strict version requirements, ensure
-# that any conflicting packages pulled in via dependencies are not buildlinked.
-BUILDLINK_FILES_CMD.libssh2=	${TRUE}
-BUILDLINK_FILES_CMD.xz=		${TRUE}
-MAKE_ENV+=			LZMA_API_STATIC=1
-
-# MacOS X 10.7 is the oldest supported version. See
-# ${WRKSRC}/src/bootstrap/lib.rs
-MAKE_ENV.Darwin+=	MACOSX_DEPLOYMENT_TARGET="10.7"
-
-CFLAGS.SunOS+=		-D_POSIX_PTHREAD_SEMANTICS
-MAKE_ENV.SunOS+=	AR=gar
-
-#UNLIMIT_RESOURCES+=	cputime stacksize datasize virtualsize
-UNLIMIT_RESOURCES+=	cputime stacksize datasize
-
-TEST_TARGET=	check
-
-# bin/* lib/*, but names vary
-CHECK_RELRO_SUPPORTED=	no
-CHECK_SSP_SUPPORTED=	no
-
-.include "../../mk/bsd.prefs.mk"
-
-# Allow overriding MAKE_JOBS_SAFE
-# some may chose to mostly build faster,
-# and deal with any failures due to deadlocks
-.if !empty(rust.MAKE_JOBS_SAFE)
-.  if ${rust.MAKE_JOBS_SAFE:tl} == "yes"
-MAKE_JOBS_SAFE=		yes
-.  endif
-.endif
-
-.if !empty(rust.BUILD_TARGET)
-BUILD_TARGET=	${rust.BUILD_TARGET}
-.endif
-
-.if !empty(TARGET)
-# Use "dist" build target for cross compile of bootstrap
-BUILD_TARGET?=		dist
-.else
-BUILD_TARGET?=		build
-.endif
-
-.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || \
-    ${MACHINE_PLATFORM:MNetBSD-*-earmv[67]hf} || \
-    ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || \
-    !empty(TARGET:Marmv[67]-unknown-netbsd-eabihf) || \
-    !empty(TARGET:Mmipsel-unknown-netbsd)
-# Bootstrapping on NetBSD/powerpc requires no debug-info from rustc
-# (both for amd64->powerpc built and powerpc->powerpc built bootstrap bits)
-# Also try to downsize the armv[67] build.
-CONFIGURE_ARGS+=	--disable-debug
-CONFIGURE_ARGS+=	--disable-debug-assertions
-CONFIGURE_ARGS+=	--disable-llvm-release-debuginfo
-CONFIGURE_ARGS+=	--debuginfo-level=0
-CONFIGURE_ARGS+=	--debuginfo-level-rustc=0
-CONFIGURE_ARGS+=	--debuginfo-level-std=0
-CONFIGURE_ARGS+=	--debuginfo-level-tools=0
-CONFIGURE_ARGS+=	--debuginfo-level-tests=0
-.endif
-
-# Only build the ARM target on/for this host, due to resource constraints
-.if ${MACHINE_PLATFORM:MNetBSD-*-earmv[67]hf}
-CONFIGURE_ARGS+=	--set llvm.targets="ARM"
-.endif
-# When cross-building for ARM on X86, X86 needs to go along due
-# to 2-stage build process
-.if !empty(TARGET:Marmv[67]-unknown-netbsd-eabihf)
-CONFIGURE_ARGS+=	--set llvm.targets="ARM;X86"
-.endif
-# Same for mips:
-.if ${MACHINE_PLATFORM:MNetBSD-*-mipsel}
-CONFIGURE_ARGS+=	--set llvm.targets="Mips"
-.endif
-.if !empty(TARGET:Mmipsel-unknown-netbsd)
-CONFIGURE_ARGS+=	--set llvm.targets="Mips;X86"
-.endif
-
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/android-sdk.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/debuglink.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/run.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/run-docker.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/core/src/unicode/printable.py
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/build-std-detect.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/dox.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/run-docker.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/run.sh
-CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/style.sh
-
-.if ${OPSYS} == "NetBSD"
-# This block contains information about known trouble on NetBSD and workarounds.
-
-# Parallel builds failed on NetBSD due to dynamic linker locking bugs.
-# \todo Explain if the build is believed to be sound if not parallel,
-# or if a non-parallel build is merely more likely to work.
-#
-# See toolchain/54192 at
-#   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54192
-# which was fixed in -current on 2020-04-19:
-#   http://mail-index.netbsd.org/source-changes/2020/04/16/msg116256.html
-#   http://mail-index.netbsd.org/source-changes/2020/04/19/msg116337.html
-# These  were pulled up to netbsd-9 on 2020-05-13:
-#   http://releng.netbsd.org/cgi-bin/req-9.cgi?show=907
-# This has not been pulled up to netbsd-8
-#   \todo Explain if it's not applicable, shouldn't be pulled up, should be
-#   but hasn't, is too hard, etc.
-#
-# On pkgbuild for 2020Q1 9.0_RELEASE amd64, rust did not build despite
-# MAKE_JOBS_SAFE=no, but setting MAKE_JOBS=1 resulted in success. (No
-# PR is open for this.)  \todo Understand and fix.
-#
-# If we aren't on 9-current, and are on 8.x or 9.x, avoid parallel.
-# Release 9.x and 9.1 or later is OK.
-.  if ${OPSYS} == "NetBSD" && 090999 < ${OPSYS_VERSION} && ${OPSYS_VERSION} < 090900
-MAKE_JOBS_SAFE?=	no
-.  endif
-
-# Open PRs
-#
-# Broken package with PREFIX not /usr/pkg:
-#   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54453
-#
-
-.endif
-
-#
-# Under NetBSD, do not use DT_RUNPATH
-#
-BUILDLINK_TRANSFORM.NetBSD+=	rm:-Wl,--enable-new-dtags
-
-#
-# Somewhere in the LLVM build "-arch x86_64" is passed on macOS/arm64 which
-# breaks linking, see https://github.com/rust-lang/rust/issues/81790.  Until
-# this can be located (proving difficult!) we just force it.
-#
-.if ${MACHINE_PLATFORM:MDarwin-*-aarch64}
-BUILDLINK_TRANSFORM+=	opt:x86_64:arm64
-.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.
-#
-DISTFILES:=		${DEFAULT_DISTFILES}
-
-.if ${MACHINE_PLATFORM:MDarwin-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		aarch64-apple-darwin
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MDarwin-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		x86_64-apple-darwin
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MLinux-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		aarch64-unknown-linux-gnu
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MLinux-*-earmv6hf} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		arm-unknown-linux-gnueabihf
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MLinux-*-earmv7hf} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		armv7-unknown-linux-gnueabihf
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MLinux-*-i386} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		i686-unknown-linux-gnu
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MLinux-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		x86_64-unknown-linux-gnu
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-#
-# The SunOS target defaults to illumos as that's what the current bootstraps
-# are built on.  If you wish to target Oracle Solaris you'll need to create an
-# x86_64-sun-solaris bootstrap and comment out the overrides.
-#
-.if ${MACHINE_PLATFORM:MSunOS-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		x86_64-unknown-illumos
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-SITES.${RUST_STAGE0}=	https://us-central.manta.mnx.io/pkgsrc/public/pkg-bootstraps/
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
-RUST_BOOTSTRAP_PATH?=	${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}
-# Override default "x86_64-sun-solaris" selection
-CONFIGURE_ARGS+=	--set=target.${RUST_ARCH}.llvm-config=${LLVM_CONFIG_PATH}
-CONFIGURE_ARGS+=	--build=${RUST_ARCH}
-CONFIGURE_ARGS+=	--host=${RUST_ARCH}
-CONFIGURE_ARGS+=	--target=${RUST_ARCH}
-.endif
-.if ${MACHINE_PLATFORM:MFreeBSD-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH:=		x86_64-unknown-freebsd
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-i386} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH=		i586-unknown-netbsd
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-SITES.${RUST_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-# Setting this changes it for every distfile, which doesn't match what is
-# currently in distinfo.
-#DIST_SUBDIR=		${PKGNAME}
-# For atomic ops
-CFLAGS+=		-march=i586
-CONFIGURE_ARGS+=	--build=${RUST_ARCH}
-pre-build: pre-build-fix-paxctl
-.PHONY: pre-build-fix-paxctl
-pre-build-fix-paxctl:
-	${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/cargo
-	${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/rustc
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH=		x86_64-unknown-netbsd
-RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=	1.72.1
-RUST_ARCH=		powerpc-unknown-netbsd
-
-# Cross-built against NetBSD 9.0
-.  if empty(OS_VERSION:M8.*) || make(distinfo) || make(makesum) || make(mdi)
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}90.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}90.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.  endif
-
-# Cross-built against NetBSD 8.0
-#.  if !empty(OS_VERSION:M8.*) || make(distinfo) || make(makesum) || make(mdi)
-#RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-#RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-#DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-#SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-#SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-#.  endif
-
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=		1.72.1
-RUST_ARCH=			aarch64-unknown-netbsd
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-aarch64eb} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=		1.72.1
-RUST_ARCH=			aarch64_be-unknown-netbsd
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-sparc64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_STAGE0_VER=		1.72.1
-RUST_ARCH=			sparc64-unknown-netbsd
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-earmv7hf} || make(distinfo) || make (makesum) || make(mdi)
-RUST_ARCH=			armv7-unknown-netbsd-eabihf
-RUST_STAGE0_VER=		1.72.1
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-earmv6hf} || make(distinfo) || make (makesum) || make(mdi)
-RUST_ARCH=			armv6-unknown-netbsd-eabihf
-RUST_STAGE0_VER=		1.72.1
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.endif
-#.if ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || make(distinfo) || make (makesum) || make(mdi)
-#RUST_ARCH=			mipsel-unknown-netbsd
-#RUST_STAGE0_VER=		1.72.1
-#RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-#RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-#DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-#SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-#SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-#.endif
-.if ${MACHINE_PLATFORM:MNetBSD-*-riscv64} || make(distinfo) || make (makesum) || make(mdi)
-RUST_ARCH=			riscv64gc-unknown-netbsd
-RUST_STAGE0_VER=		1.72.1
-RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
-DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
-SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
-SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
-.endif
-
-# You may override RUST_BOOTSTRAP_PATH and RUST_ARCH in mk.conf
-# if you have a local bootstrap compiler.
-.if !defined(RUST_ARCH) && !defined(RUST_BOOTSTRAP_PATH)
-NOT_FOR_PLATFORM+=	${MACHINE_PLATFORM}
-.else
-RUST_BOOTSTRAP_PATH?=	${WRKDIR}/rust-bootstrap
-.endif
-
-.if ${OPSYS} == "SunOS"
-TOOL_DEPENDS+=		coreutils>=0:../../sysutils/coreutils
-TOOL_DEPENDS+=		gzip>=0:../../archivers/gzip
-TOOLS_CREATE+=		md5sum
-TOOLS_PATH.md5sum=	${PREFIX}/bin/gmd5sum
-TOOLS_PLATFORM.gzcat=	${PREFIX}/bin/gzip -cd
-.endif
-
-SUBST_CLASSES+=		rpath
-SUBST_STAGE.rpath=	pre-configure
-SUBST_FILES.rpath+=	compiler/rustc_codegen_ssa/src/back/linker.rs
-SUBST_FILES.rpath+=	compiler/rustc_target/src/spec/netbsd_base.rs
-SUBST_FILES.rpath+=	src/bootstrap/builder.rs
-SUBST_FILES.rpath+=	src/bootstrap/compile.rs
-SUBST_VARS.rpath=	PREFIX
-
-#
-# Generate list of subst entries for various .cargo-checksum.json files.  These
-# are all handled together in one big substitution to simplify things rather
-# than one substitution entry per file, but are kept separate below to ease
-# updating and verification.
-#
-
-CKSUM_CRATES+=	vendor/cc-1.0.73
-CKSUMS+=	38970d678de0efb4b5e2978265daa8a613a1db35fc42e669621b03fc56d5b138
-CKSUMS+=	65de0d6593a4256e5fcaf898f9468d71bab672c70a2dfab3dcb8514e9b72819c
-
-CKSUM_CRATES+=	vendor/cc
-CKSUMS+=	17a4659710aa290c4ed9c23063c7b202c5bcf2a84de33aa1f01fc6fded69a1f8
-CKSUMS+=	a19bcb1a561d4ba5846f8f89fcfe6f05a3cb2e79baf8f21f53f0fba012db1b7f
-
-CKSUM_CRATES+=	vendor/libc
-CKSUMS+=	55ce4624745e31ad226b47fde177a46176a89da3fa5030663673a115102471f9
-CKSUMS+=	09ab15cd50245f4ced230b7919657ab170e06443bb0ed4baf4449d3472f5f656
-CKSUMS+=	90dd33ef20dc3be8aef5bd152a6a06e7ab34f9527b3978487b593aaa16a907bd
-CKSUMS+=	ec1cb2b8522ce7d35c9fce2f5b17a1a7e28cae9836f1cf11e267f222b72dff60
-
-CKSUM_CRATES+=	vendor/libc-0.2.138
-CKSUMS+=	107a4aa396b8383c66e0ace2f941450b4b69146558cdc4d9fbe33eeab51760f1
-CKSUMS+=	4be83bef456569d59405edf134e7fe8eff78f3fe35f1efd60e15405d5c822725
-
-CKSUM_CRATES+=	vendor/libc-0.2.140
-CKSUMS+=	4493317993af390d8aafc2cb7ace4c349dfc9d2451fd666844f04a4fa1f47442
-CKSUMS+=	537a01c3cd5507f493616193991e1135c7896aae3fc92d98ec9facbfe243d980
-CKSUMS+=	6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937
-CKSUMS+=	ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95
-
-CKSUM_CRATES+=	vendor/libc-0.2.146
-#CKSUMS+=	6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937
-#CKSUMS+=	ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95
-#CKSUMS+=	6a60a542639528a0a34b9c9a7298973ec2cf1449c59546b7b30dcef6c51874dd
-#CKSUMS+=	ec1cb2b8522ce7d35c9fce2f5b17a1a7e28cae9836f1cf11e267f222b72dff60
-
-CKSUM_CRATES+=	vendor/lzma-sys
-CKSUMS+=	6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9
-CKSUMS+=	5e252578b5d266f6a4c8dc9f71ca7a91536ccb8c5c7d7753b82f12ec886459ef
-
-CKSUM_CRATES+=	vendor/stacker
-CKSUMS+=	59ca847887cf19387119d18c57f08d5a8520d714876ca0142b8f1c001ecde06b
-CKSUMS+=	03be8ae293b713fe6e9703e4809dd68caaec992bae6777914ffddae8da2a9bc7
-
-CKSUM_CRATES+=	vendor/crossbeam-utils
-CKSUMS+=	5f75132808d9e8d6e266fe77f9e20bbc35855a1c37a5dbc0940b3e989bca1a94
-CKSUMS+=	3d7c747108434546837b1c5664111c9146fcbfb2e084c95f8ce0be970d652421
-
-CKSUM_CRATES+=	vendor/crossbeam-utils-0.8.14
-CKSUMS+=	3314524d2afa0360c947455a6e6566fb54ebf909c99479ca3b7435741fd3293e
-CKSUMS+=	eaef167dea04efa811cf0d53de98feac6063ec2196eccd315d345ef86c551aaa
-
-CKSUM_CRATES+=	vendor/crossbeam-epoch
-CKSUMS+=	5f75132808d9e8d6e266fe77f9e20bbc35855a1c37a5dbc0940b3e989bca1a94
-CKSUMS+=	3d7c747108434546837b1c5664111c9146fcbfb2e084c95f8ce0be970d652421
-
-CKSUM_CRATES+=	vendor/openssl-sys
-CKSUMS+=	03f2de4a6d5c4baff39aff416cae0529ab57624e090a48843528242a1c7f20d9
-CKSUMS+=	a4ec7dac1eb920c609ef4ebf0e0a90af34e4e2a3e6eb3059ed110c029aa1d1cf
-CKSUMS+=	1f9233e5993c3537767d39b66fa5a43f5268a9bf89b70884886652cfa7e869c6
-CKSUMS+=	93dd56b8ea8c24678cf390232a1de7bbf0de64a5eaa40da95848e22e611c6dcb
-
-CKSUM_CRATES+=	vendor/openssl-src
-CKSUMS+=	683c9ed1a7953f7f9da43412010de95ba733860a18bc28a4fc3cbcc6ac93c4d7
-CKSUMS+=	d83220880699d6a4d9a4e265d19b7896ca4dc7235e3e2f546c5fa06222bdc258
-CKSUMS+=	090744f85cf99a9b8412c23fca1eabb61eb45d830f0f9f0e7309be2572c1e827
-CKSUMS+=	ead7bdeee121f1357b99741b175a564c8b7026f694cbc388aae2a86b3bae913f
-
-CKSUM_CRATES+=	vendor/nix
-CKSUMS+=	c3e13a2edea54d190a4b051f62efc97953c00b5051a9fda0e39e3bc732a31939
-CKSUMS+=	263bd7ace66a4cfee3de18532f61c187327fcbd564666b4f97c4b01ae6885d98
-
-SUBST_CLASSES+=		cksum
-SUBST_STAGE.cksum=	pre-configure
-.for crate in ${CKSUM_CRATES}
-SUBST_FILES.cksum+=	${crate}/.cargo-checksum.json
-.endfor
-.for from to in ${CKSUMS}
-SUBST_SED.cksum+=	-e 's,${from},${to},g'
-.endfor
-
-post-extract:
-	set -e;									\
-	if ${TEST} -e ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/install.sh	\
-	  -a ! -e ${RUST_BOOTSTRAP_PATH}/bin/rustc; then \
-		cd ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH};	\
-		env ${MAKE_ENV} ${TOOLS_BASH} \
-			./install.sh --prefix=${RUST_BOOTSTRAP_PATH};	\
-		cd ${WRKDIR}/rust-std-${RUST_STAGE0_VER}-${RUST_ARCH};	\
-		env ${MAKE_ENV} ${TOOLS_BASH} \
-			./install.sh --prefix=${RUST_BOOTSTRAP_PATH};	\
-	fi
-.if ${OPSYS} == "NetBSD"
-	SDIR=${WRKDIR}/scripts; \
-	${MKDIR} $${SDIR}; \
-	cd $${SDIR}; \
-	${RM} -f c++-wrap; \
-	${RM} -f clang++-wrap; \
-	${RM} -f clang-wrap; \
-	${RM} -f ar-wrap; \
-	${CP} ${.CURDIR}/files/gcc-wrap .; \
-	${CHMOD} +x gcc-wrap; \
-	${LN} -s gcc-wrap c++-wrap; \
-	${LN} -s gcc-wrap clang++-wrap; \
-	${LN} -s gcc-wrap clang-wrap; \
-	${LN} -s gcc-wrap ar-wrap
-.endif
-
-.if ${OPSYS} == "FreeBSD"
-MAKE_ENV+=		OPENSSL_DIR=${SSLBASE}
-.endif
-
-.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
-BUILDLINK_TRANSFORM+=	rm:-lgcc_s
-MAKE_ENV+=		PKGSRC_HAVE_LIBCPP=yes
-
-pre-build: provide-libgcc-for-bootstrap
-.PHONY: provide-libgcc-for-bootstrap
-provide-libgcc-for-bootstrap:
-.  if exists(${FILESDIR}/libgcc_s.so.1)
-	cp ${FILESDIR}/libgcc_s.so.1 ${RUST_BOOTSTRAP_PATH}/lib/.
-.  endif
-.endif
-
-#
-# These are essentially copies of the "all", "test", and "install" Makefile
-# targets, but are duplicated here so that we can specify -j.
-#
-do-build:
-	${RUN}${_ULIMIT_CMD}						\
-	cd ${WRKSRC} &&							\
-	${SETENV} ${MAKE_ENV}						\
-	sh -c "if [ \"${BUILD_TARGET}\" = \"dist\" ]; then		\
-		unset DESTDIR;						\
-		${PYTHONBIN} ./x.py -v					\
-		    ${BUILD_TARGET} -j ${_MAKE_JOBS_N};			\
-	else								\
-		${PYTHONBIN} ./x.py -v					\
-		    ${BUILD_TARGET} --stage 2 -j ${_MAKE_JOBS_N} &&	\
-		${PYTHONBIN} ./x.py -v					\
-		    doc --stage 2 -j ${_MAKE_JOBS_N};			\
-	fi"
-
-do-test:
-	${RUN}${_ULIMIT_CMD}						\
-	cd ${WRKSRC} &&							\
-	${SETENV} ${MAKE_ENV}						\
-		${PYTHONBIN} ./x.py -v test -j ${_MAKE_JOBS_N}
-
-do-install:
-	${RUN}${_ULIMIT_CMD}						\
-	cd ${WRKSRC} &&							\
-	${SETENV} ${MAKE_ENV} ${INSTALL_ENV} 				\
-		${PYTHONBIN} ./x.py -v install -j ${_MAKE_JOBS_N}
-
-GENERATE_PLIST+=	${FIND} ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
-			${SED} -e 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
-
-# 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.
-#
-# Use the alternate BOOTSTRAP_NAME when creating a nightly release.
-#
-#BOOTSTRAP_NAME=	${PKGNAME_NOREV:C/rust/rust-nightly/}-${RUST_ARCH}
-BOOTSTRAP_NAME=		${PKGNAME_NOREV}-${RUST_ARCH}
-BOOTSTRAP_TMPDIR=	${WRKDIR}/${BOOTSTRAP_NAME}
-USE_TOOLS+=		gtar
-
-# The NetBSD part is so far untested, because I could not convince
-# the rust build to use the gcc wrapper when building natively,
-# so that I could get a placeholder in the RPATH, because chrpath
-# cannot extend the length of the RPATH...
-ELFEDIT?=	/usr/bin/elfedit
-
-.PHONY: stage0-bootstrap
-stage0-bootstrap: install
-	${RM} -rf ${BOOTSTRAP_TMPDIR}
-	${MKDIR} ${BOOTSTRAP_TMPDIR}
-.if ${OPSYS} == "NetBSD"
-	(cd ${BOOTSTRAP_TMPDIR}; \
-	DISTDIR=${WRKSRC}/bild/dist; \
-	VER_ARCH=${PKGVERSION}-${RUST_ARCH}; \
-	RUSTC=rustc-$${VER_ARCH}; \
-	RUSTC_FILE=$${RUSTC}.tar.gz; \
-	RUST_STD=rust-std-$${VER_ARCH}; \
-	RUST_STD_FILE=$${RUST_STD}.tar.gz; \
-	${GTAR} -xzf $${DISTDIR}/$${RUSTC_FILE}; \
-		(cd ${RUSTC}; \
-	RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN/../lib'; \
-	for f in rls-preview/bin/rls rustc/bin/rustc rustc/bin/rustdoc; do \
-		chrpath -r $$RPATH $$f; \
-	done; \
-	RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN'; \
-	for f in rustc/lib/*.so*; do \
-		chrpath -r $$RPATH $$f; \
-	done; \
-	RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN:$$ORIGIN/../../..'; \
-	for f in rustc/lib/rustlib/*/*/*.so*; do \
-		chrpath -r $$RPATH $$f; \
-	done;); \
-	${GTAR} -czf $${RUSTC_FILE} $${RUSTC}; \
-	${CP} $${DISTDIR}/$${RUST_STD_FILE} .; \
-	${ECHO} "Fixed stage0 bootstrap in ${BOOTSTRAP_TMPDIR}:"; \
-	${ECHO} "$${RUSTC_FILE}"; \
-	${ECHO} "$${RUST_STD_FILE}"; \
-	)
-.endif
-.if ${OS_VARIANT} == "SmartOS"
-	${CP} -R ${DESTDIR}/${PREFIX}/bin ${BOOTSTRAP_TMPDIR}/
-	${CP} -R ${DESTDIR}/${PREFIX}/lib ${BOOTSTRAP_TMPDIR}/
-	${MKDIR} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc
-	set -e; \
-	for lib in libgcc_s.so.1 libstdc++.so.6; do \
-		${CP} `${PKG_CC} -print-file-name=$${lib}` \
-		    ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
-	done; \
-	for lib in libLLVM-15.so libcrypto.so.1.1 libcurl.so.4 \
-		   libssl.so.1.1 libz.so.1 libzstd.so.1; do \
-		${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
-	done; \
-	for lib in libiconv.so.2 libidn2.so.0 libintl.so.8 liblber.so.2 \
-		   libldap.so.2 libnghttp2.so.14 libsasl2.so.3 \
-		   libssh2.so.1 libunistring.so.5; do \
-		${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
-	done; \
-	for f in ${BOOTSTRAP_TMPDIR}/bin/*; do \
-		/bin/file -b "$$f" | grep ^ELF >/dev/null || continue; \
-		${ELFEDIT} -e 'dyn:runpath $$ORIGIN/../lib:$$ORIGIN/../lib/pkgsrc' $$f; \
-	done; \
-	for f in ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/*.so*; do \
-		${ELFEDIT} -e 'dyn:runpath $$ORIGIN' $$f; \
-	done; \
-	for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \
-		${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/pkgsrc' $$f; \
-	done; \
-	for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/*/*/*.so*; do \
-		${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..:$$ORIGIN/../../../pkgsrc' $$f; \
-	done; \
-	cd ${WRKDIR}; ${GTAR} -zcf ${BOOTSTRAP_NAME}.tar.gz ${BOOTSTRAP_NAME}
-	@${ECHO} ""
-	@${ECHO} "Verify correct library paths using the following:"
-	@${ECHO} ""
-	@${ECHO} "	cd ${BOOTSTRAP_TMPDIR}"
-	@${ECHO} "	find . -type f | xargs ldd 2>/dev/null | egrep 'not.found|${PREFIX}'"
-	@${ECHO} ""
-	@${ECHO} "If there is no output then this bootstrap kit is ready to go:"
-	@${ECHO} ""
-	@${ECHO} "	${WRKDIR}/${BOOTSTRAP_NAME}.tar.gz"
-	@${ECHO} ""
-.endif
-
-.include "options.mk"
-
-# These dependencies currently use the bundled sources as they require
-# development features not yet available in released versions.
-#
-#.include "../../devel/libgit2/buildlink3.mk"
-#.include "../../security/libssh2/buildlink3.mk"
-#.include "../../www/http-parser/buildlink3.mk"
-#.include "../../devel/jemalloc/buildlink3.mk"
-
-## Issues specific to: bootstrap AND NetBSD follow
-
-# rust i386 and sparc64 bootstraps are built for 8.0
-# and still depend on libstdc++.so.8.
-# Pull in compat80 on 9.x and newer.
-.if (${MACHINE_PLATFORM:MNetBSD-*-i386} || \
-     ${MACHINE_PLATFORM:MNetBSD-*-sparc64}) \
-    && empty(OS_VERSION:M8.*)
-TOOL_DEPENDS+=	compat80>=0:../../emulators/compat80
-.endif
-
-.include "../../mk/atomic64.mk"
-# This is for when we build natively:
-.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || \
-    ${MACHINE_PLATFORM:MNetBSD-*-i386} || \
-    ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || \
-    ${MACHINE_PLATFORM:MNetBSD-*-riscv64}
-# Make libatomic library available via a unique directory:
-DEPENDS+=	libatomic-links>=0:../../devel/libatomic-links
-.endif
-
-TOOL_DEPENDS+= cmake-[0-9]*:../../devel/cmake
-.include "../../devel/cmake/buildlink3.mk"
-.include "../../devel/zlib/buildlink3.mk"
-.include "../../lang/python/tool.mk"
-.include "../../mk/bsd.pkg.mk"
diff --git a/rust/buildlink3.mk b/rust/buildlink3.mk
deleted file mode 100644
index 1e4c6a9c9d..0000000000
--- a/rust/buildlink3.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# $NetBSD: buildlink3.mk,v 1.6 2020/07/08 14:46:14 jperkin Exp $
-
-BUILDLINK_TREE+=	rust
-
-#
-# DO NOT include this directly! Use rust.mk instead.
-#
-
-.if !defined(RUST_BUILDLINK3_MK)
-RUST_BUILDLINK3_MK:=
-
-BUILDLINK_API_DEPENDS.rust+=	rust>=1.56.1
-BUILDLINK_PKGSRCDIR.rust?=	../../wip/rust
-BUILDLINK_PASSTHRU_DIRS+=	${PREFIX}/lib/rustlib
-.endif
-
-BUILDLINK_TREE+=	-rust
diff --git a/rust/cargo.mk b/rust/cargo.mk
deleted file mode 100644
index 5651090b54..0000000000
--- a/rust/cargo.mk
+++ /dev/null
@@ -1,99 +0,0 @@
-# $NetBSD: cargo.mk,v 1.35 2023/05/16 06:10:52 wiz Exp $
-#
-# Common logic that can be used by packages that depend on cargo crates
-# from crates.io. This lets existing pkgsrc infrastructure fetch and verify
-# cargo crates instead of using the rust package manager in the build phase.
-# Inspired by cargo.mk from FreeBSD ports.
-#
-# Usage example:
-#
-# CARGO_CRATE_DEPENDS+=	sha1-0.20
-# .include "../../lang/rust/cargo.mk"
-#
-# If modifying the list of dependencies, re-run the build once without
-# --offline in CARGO_ARGS to generate a new valid Cargo.lock.
-# e.g: make CARGO_ARGS="build --release" build
-#
-# a list of CARGO_CRATE_DEPENDS can be generated via
-#      make print-cargo-depends > cargo-depends.mk
-#
-# See also www/geckodriver for a full example.
-
-MASTER_SITES?=	-${MASTER_SITE_CRATESIO}${PKGBASE}/${PKGVERSION_NOREV}/download
-
-CHECK_SSP_SUPPORTED=	no
-
-.include "../../lang/rust/rust.mk"
-
-USE_TOOLS+=		bsdtar
-CARGO_VENDOR_DIR=	${WRKDIR}/vendor
-CARGO_WRKSRC?=		${WRKSRC}
-
-# TODO: some Cargo.lock files include git+https sources which need to be fetched from the URL (not necessarily resolving to a crate.io url)
-DISTFILES?=			${DEFAULT_DISTFILES}
-.for crate in ${CARGO_CRATE_DEPENDS}
-DISTFILES+=			${crate}.crate
-SITES.${crate}.crate+=		-${MASTER_SITE_CRATESIO}${crate:C/-[0-9]+\.[0-9.]+.*$//}/${crate:C/^.*-([0-9]+\.[0-9.]+.*)$/\1/}/download
-EXTRACT_DIR.${crate}.crate?=	${CARGO_VENDOR_DIR}
-.endfor
-
-.include "../../mk/bsd.prefs.mk"
-# Triggers NetBSD ld.so bug (PR toolchain/54192)
-# See Makefile for further information.
-.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} < 099957
-MAKE_JOBS_SAFE=	no
-.endif
-
-post-extract: cargo-vendor-crates
-.PHONY: cargo-vendor-crates
-cargo-vendor-crates:
-	@${STEP_MSG} "Extracting local cargo crates"
-	${RUN}${MKDIR} ${CARGO_WRKSRC}/.cargo
-	${RUN}${PRINTF} "[source.crates-io]\nreplace-with = \"vendored-sources\"\n[source.vendored-sources]\ndirectory = \"${CARGO_VENDOR_DIR}\"\n" > ${CARGO_WRKSRC}/.cargo/config
-	${RUN}${MKDIR} ${CARGO_VENDOR_DIR}
-.for crate in ${CARGO_CRATE_DEPENDS}
-	${RUN}${PRINTF} '{"package":"%s","files":{}}'	\
-	  `${DIGEST} sha256 < ${_DISTDIR}/${crate}.crate` \
-	  > ${CARGO_VENDOR_DIR}/${crate}/.cargo-checksum.json
-.endfor
-
-# Legacy name
-.PHONY: show-cargo-depends
-show-cargo-depends: print-cargo-depends
-
-.PHONY: print-cargo-depends
-print-cargo-depends:
-	${RUN}${AWK} 'BEGIN {print "# $$Net" "BSD$$"; print;}		\
-		/^name = / { split($$3, a, "\""); name=a[2]; }		\
-		/^version = / { split($$3, a, "\""); vers=a[2]; }	\
-		/^source = / {						\
-			print "CARGO_CRATE_DEPENDS+=\t" name "-" vers;	\
-			}' ${CARGO_WRKSRC}/Cargo.lock
-
-DEFAULT_CARGO_ARGS=	--offline -j${_MAKE_JOBS_N}	\
-			  ${CARGO_NO_DEFAULT_FEATURES:M[yY][eE][sS]:C/[yY][eE][sS]/--no-default-features/}	\
-			  ${CARGO_FEATURES:C/.*/--features/W}	\
-			  ${CARGO_FEATURES:S/ /,/Wg}
-CARGO_ARGS?=		build --release ${DEFAULT_CARGO_ARGS}
-CARGO_INSTALL_ARGS?=	install --path . --root ${DESTDIR}${PREFIX} ${DEFAULT_CARGO_ARGS}
-
-MAKE_ENV+=		RUSTFLAGS=${RUSTFLAGS:Q}
-
-.if !target(do-build)
-do-build: do-cargo-build
-.endif
-
-.PHONY: do-cargo-build
-do-cargo-build:
-	${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_ARGS}
-
-.if !target(do-install) && ${GNU_CONFIGURE:Uno:tl} == no
-do-install: do-cargo-install
-.endif
-
-.PHONY: do-cargo-install
-do-cargo-install:
-	${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_INSTALL_ARGS}
-	# remove files cargo uses for tracking installations
-	${RM} -f ${DESTDIR}${PREFIX}/.crates.toml
-	${RM} -f ${DESTDIR}${PREFIX}/.crates2.json
diff --git a/rust/cross.mk b/rust/cross.mk
deleted file mode 100644
index 2984a3d058..0000000000
--- a/rust/cross.mk
+++ /dev/null
@@ -1,82 +0,0 @@
-# $NetBSD: cross.mk,v 1.3 2020/07/16 09:35:37 jperkin Exp $
-
-# These settings may be used to cross-build rust.
-#
-# They interact with the files/gcc-wrap script to pick the
-# right compiler for the different phases of the build, and
-# use the headers for the target when required.  Note that the
-# cross-root tree will need to have the required binary packages
-# installed (curl etc., see list of buildlink3.mk includes in main
-# Makefile).
-
-# The gcc-wrap / c++-wrap script takes CROSS_ROOT environment variable
-# to do a cross-build.  The wrapper script assumes dest/ and tools/
-# as a result of a cross-build of NetBSD as subdirectories of this root
-#CROSS_ROOT=		/u/evbarm-armv7hf
-#CROSS_ROOT=		/u/evbarm-armv6hf
-#CROSS_ROOT=		/u/sparc64
-#CROSS_ROOT=		/u/macppc
-#CROSS_ROOT=		/u/evbarm64
-#CROSS_ROOT=		/u/evbarm64eb
-#CROSS_ROOT=		/u/i386
-#CROSS_ROOT=		/u/mipsel
-#CROSS_ROOT=		/u/riscv64
-#CROSS_ROOT=		/
-#MAKE_ENV+=		CROSS_ROOT=${CROSS_ROOT}
-
-# The GNU cross target designation
-#GNU_CROSS_TARGET=	armv7--netbsdelf-eabihf
-#GNU_CROSS_TARGET=	armv6--netbsdelf-eabihf
-#GNU_CROSS_TARGET=	sparc64--netbsd
-#GNU_CROSS_TARGET=	powerpc--netbsd
-#GNU_CROSS_TARGET=	aarch64--netbsd
-#GNU_CROSS_TARGET=	aarch64_be--netbsd
-#GNU_CROSS_TARGET=	i486--netbsdelf
-#GNU_CROSS_TARGET=	mipsel--netbsd
-#GNU_CROSS_TARGET=	riscv64--netbsd
-#MAKE_ENV+=		GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
-
-# To cross-build rust, you need to specify
-# the ultimate target to built for, as well as the
-# host the compiler is supposed to run on.
-# Rust's target designation
-#TARGET=		armv7-unknown-netbsd-eabihf
-#TARGET=		armv6-unknown-netbsd-eabihf
-#TARGET=		sparc64-unknown-netbsd
-#TARGET=		powerpc-unknown-netbsd
-#TARGET=		aarch64-unknown-netbsd
-#TARGET=		aarch64_be-unknown-netbsd
-#TARGET=		i686-unknown-netbsd
-#TARGET=		i586-unknown-netbsd
-#TARGET=		mipsel-unknown-netbsd
-#TARGET=		riscv64gc-unknown-netbsd
-#
-#SCRIPTS=		${WRKDIR}/scripts
-#CONFIGURE_ARGS+=	--host=${TARGET}
-#CONFIGURE_ARGS+=	--target=${TARGET}
-#CONFIGURE_ARGS+=	--set=target.${TARGET}.cc=${SCRIPTS}/gcc-wrap
-#CONFIGURE_ARGS+=	--set=target.${TARGET}.cxx=${SCRIPTS}/c++-wrap
-#CONFIGURE_ARGS+=	--set=target.${TARGET}.linker=${SCRIPTS}/gcc-wrap
-# Pick one:
-#CONFIGURE_ARGS+=	--set=target.${TARGET}.ar=${CROSS_ROOT}/tools/bin/${GNU_CROSS_TARGET}-ar
-#CONFIGURE_ARGS+=	--set=target.${TARGET}.ar=${SCRIPTS}/ar-wrap
-
-# May be required when cross-building on NetBSD
-#MAKE_ENV+=		OPENSSL_DIR=/usr
-
-#
-# Cross-compile illumos target.  The host is identical, it's just the target
-# that is renamed from x86_64-sun-solaris to x86_64-unknown-illumos.
-#
-#TARGET=		x86_64-unknown-illumos
-#
-# Use these variables for "cross-compiling" from x86_64-sun-solaris.
-#
-#CONFIGURE_ARGS+=	--set=target.${TARGET}.llvm-config=${LLVM_CONFIG_PATH}
-#CONFIGURE_ARGS+=	--host=${TARGET}
-#CONFIGURE_ARGS+=	--target=${TARGET}
-#
-# Set this variable when using a native x86_64-unknown-illumos bootstrap, as
-# the build still defaults to x86_64-sun-solaris based on uname.
-#
-#CONFIGURE_ARGS+=	--build=${TARGET}
diff --git a/rust/distinfo b/rust/distinfo
deleted file mode 100644
index 55449fcf3b..0000000000
--- a/rust/distinfo
+++ /dev/null
@@ -1,171 +0,0 @@
-$NetBSD: distinfo,v 1.159 2023/06/19 14:46:47 bsiegert Exp $
-
-BLAKE2s (rust-1.72.1-aarch64-apple-darwin.tar.gz) = 87fab4618cb38c18488048b427a2558a41ede6d50f358f09bcdc952564f6d978
-SHA512 (rust-1.72.1-aarch64-apple-darwin.tar.gz) = ed66346bb438444a723f5573e1a3bf1ce10454b08cfd691917e3ddeafead5202a2f0306f5eb6e7df27824cd51a974a2131ccb49eee2d27664b71c5edce4eff61
-Size (rust-1.72.1-aarch64-apple-darwin.tar.gz) = 240667277 bytes
-BLAKE2s (rust-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 7ca06c03da832308c3c5bc576260d5fa7e82a25fc248927f5b4b18698351e9a4
-SHA512 (rust-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 21819320daf5f7c73e977a41d320bffa0b9fb14f5b75d34c6e760ebbd5ae676b5811d48b41b4be565650aaf5a682161255f8bdaa1f2d0d3557e0fd5d2aad1c21
-Size (rust-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 452734527 bytes
-BLAKE2s (rust-1.72.1-aarch64-unknown-netbsd.tar.xz) = c5aa3084f3653be97fd14dbb2dd20d36334277450733143f6185162c0caf5298
-SHA512 (rust-1.72.1-aarch64-unknown-netbsd.tar.xz) = ff5b2d2046e6ea04f01a32e2cf3d22d65223f52c2b27c1d29ea808bfa9f3eee94e0410971ab21c9fd49abddf1599454c6544bdabfab22f2ffd802c2f620649e7
-Size (rust-1.72.1-aarch64-unknown-netbsd.tar.xz) = 159770736 bytes
-BLAKE2s (rust-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 71fc52b117716633ab9f36a5b472b28ce20f3ee9ae7c5316e073e43cecf6d5d8
-SHA512 (rust-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 872e10f767c968f1d38c24b90e7932e88472ce8d8321ffcbdd4791b301c52c72dd9101cd513add46c92cad8d6018e6d30549d714ff9f5a14dc09891d490f25fa
-Size (rust-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 156090180 bytes
-BLAKE2s (rust-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 0b9334699acc11131632a915350940f49ccf802701b3381268de350acecdc336
-SHA512 (rust-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 497f2a3e7abccf191d7949b08d3f2049904dd7eb376f4844c4dc043adfd98d4776e6bc20edc92d9814306e745702867f1d03a4923b7c225eb4514f7e846fe8ff
-Size (rust-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 343135032 bytes
-BLAKE2s (rust-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 964f468e2ae3cdf3d92e6326f6b5d6bd889117f012327031567f5ecbb4ce1dd4
-SHA512 (rust-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 55703e8cff1a43d87153644a603baa0ab46a27590c0571303999e990d0713707ab7d35d022feab957c6e93fbaac9a1a609e13abb4dc7d70e38ead757bae4f899
-Size (rust-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 135260448 bytes
-BLAKE2s (rust-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 2622b4436f876679bd2fe63fa267ec156d3fcda39d7571b046caec3ad3ab6dd2
-SHA512 (rust-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = d88f46749fa854f5ae17565d9ca42e4382af4381a95d4a99c9e68407456506a087b67ebf2f03127c8ef5a816595b4bcbf4dd7fb64ae87f27ee81d3b88d33b5d4
-Size (rust-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 332764970 bytes
-BLAKE2s (rust-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = ef9382449c90ea1ffae53f7aebcbb08f417cd65df5d7f321a5507eb4e45bc10c
-SHA512 (rust-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 0a2c2ca3096b33f992630de3cf1a1b254626bf6d1c81418c651e43b57ef265241158854098c70c22d5a2d6c31904e35ef6d2affe2da3cca99809700b9254088c
-Size (rust-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 137884200 bytes
-BLAKE2s (rust-1.72.1-i586-unknown-netbsd.tar.xz) = a558a2141bc66451b6848262ec838d920ee0ee13fdc8484e4a1d110c3c9abe3c
-SHA512 (rust-1.72.1-i586-unknown-netbsd.tar.xz) = 3732d9cf3b6220f27543ae576792a300c97a1c54b7f63083d34a750fe010a4e2c5a5d4899a6bd3135ec9829a18b1529c58caf7fbb4eb49672093e122c59cf4a3
-Size (rust-1.72.1-i586-unknown-netbsd.tar.xz) = 172583092 bytes
-BLAKE2s (rust-1.72.1-i686-unknown-linux-gnu.tar.gz) = c6ee38b43061827a8c513b92a6c64140d655b2a19c747a9060b1f51435e6b8d7
-SHA512 (rust-1.72.1-i686-unknown-linux-gnu.tar.gz) = 0c29343b219ca57e90d46a5ea88cdf1f1f9b01c243f27b0e5cb1a27f1a09c7c20c65d4dd1a77a59e2450c304386b2403198e7fd7a3e5b0835929ead04a673966
-Size (rust-1.72.1-i686-unknown-linux-gnu.tar.gz) = 402826521 bytes
-BLAKE2s (rust-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 45bc45ec36a0d1f308aa34aba19c0eec1b8686b37e5f596ced020558ad90a68e
-SHA512 (rust-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 4b4cebc34bb53c316fc001a13335dfdd62ace20ce7098d99696bcf07b28691425964e2e50e3b6e7cfcf43cd68741842807b773bb6cb464f9d3ebc61aba1c7d72
-Size (rust-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 185984568 bytes
-BLAKE2s (rust-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 8abdeb94d799fc03ba2e6a1f3e2eb1b0b0ada2cfb5ae4c4d1d4ac27a6422e27b
-SHA512 (rust-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 55596059cac2fd3dc2f1a4793e6e56d8cf9dead58d1bd809bdc6997d32ac0346abcb0b1ad6889f22db61b7aab957cb50f51d2ad41c0336da07cf2640018607e9
-Size (rust-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 170193092 bytes
-BLAKE2s (rust-1.72.1-sparc64-unknown-netbsd.tar.xz) = 1b7afd4bae462ac1ca63cd2524e7005a0efd119a96df9b9df7aae56cdf3cdf47
-SHA512 (rust-1.72.1-sparc64-unknown-netbsd.tar.xz) = ba77c7cebda788f0e880bf97569cc89d8779f70cc6b9e7291d5de62bdb1e2d68015dcdf4e353460840d86f8ef2703b7ecd63f8bf297af37d75ab4e669852874c
-Size (rust-1.72.1-sparc64-unknown-netbsd.tar.xz) = 153019884 bytes
-BLAKE2s (rust-1.72.1-x86_64-apple-darwin.tar.gz) = 6e73dfdfb8e06cf2298b44b1c94feea52a129f37d53b11bda9d493420cfb8de1
-SHA512 (rust-1.72.1-x86_64-apple-darwin.tar.gz) = dfc68cac8a95111e330e76c60d57b56e7255c4f93a0f79980e8a67b1c14ef0a3899c62eb21f7bd476b653b0463b6348a1ae53bd9f0e69c8d0ba5625d23c65957
-Size (rust-1.72.1-x86_64-apple-darwin.tar.gz) = 326613420 bytes
-BLAKE2s (rust-1.72.1-x86_64-unknown-freebsd.tar.gz) = 1e1d64313fb4dfddf0b3307e35e9ec124f787c1a4d084ff91ff43434dab370a2
-SHA512 (rust-1.72.1-x86_64-unknown-freebsd.tar.gz) = 7c175a47bdcec2b122c11e0ab9cef2d55b1fc13d2be4ab17d7b8cd01053492ac8592884268866df5e6cc96f51eb5db6557549216be494cb63f372f2a23bc4abe
-Size (rust-1.72.1-x86_64-unknown-freebsd.tar.gz) = 308102058 bytes
-BLAKE2s (rust-1.72.1-x86_64-unknown-illumos.tar.gz) = 14073b33014a1a53d01ad6ee5001a646f26445c05eb84d361ccd86de8999dd63
-SHA512 (rust-1.72.1-x86_64-unknown-illumos.tar.gz) = 143fdeabbeacded6f37ee447c4a2ddcc13816083ab356da13d8b52e8c873560f29d67621e62bc68089c578d6ffdab3756a02fcd07c3192c43e5617803398d422
-Size (rust-1.72.1-x86_64-unknown-illumos.tar.gz) = 230033646 bytes
-BLAKE2s (rust-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = d7bf1d87d6cfd3984c987e3cefe7a9edf5c363fb573257acf0d1c27ed1c850af
-SHA512 (rust-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = 26c580a6020bca41c00d4e82662f672bf9c8c59964616aee6975eb486070f6814050159cff1df5447ae7eb505f83efd996596c13da8ee05bbc03b86e69d037dc
-Size (rust-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = 348259650 bytes
-BLAKE2s (rust-1.72.1-x86_64-unknown-netbsd.tar.xz) = 38b1cc764cef9fbf016aa8e43d920ac67bde53024e67bd6172dd5e50916ad4ea
-SHA512 (rust-1.72.1-x86_64-unknown-netbsd.tar.xz) = 4c2e138bdbec6e35fecec3a84b9d3eb151f232ff1a264c3d6ce2b0ba80ecbf8ef3e5bb52b2cfcbbc5a745e6041e0f110bdd8ec946c256403a74f4dae8b20c6c5
-Size (rust-1.72.1-x86_64-unknown-netbsd.tar.xz) = 150968500 bytes
-BLAKE2s (rust-std-1.72.1-aarch64-apple-darwin.tar.gz) = f85c6c6bd0a4c7a7b72da357dee2d321c7fed55f28c64053d6004de398a0e0ff
-SHA512 (rust-std-1.72.1-aarch64-apple-darwin.tar.gz) = da8d2faade69e0ebb9017b1f537c1e4da941b8dcdcd68676c80405935e475d5268006b7f31acd462c72ce324f04389877c52e0a08244a9d428f5bfe813e0edda
-Size (rust-std-1.72.1-aarch64-apple-darwin.tar.gz) = 40650417 bytes
-BLAKE2s (rust-std-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 86b8f5ab67d120bc2c50a6197d423c85d0d3d3f59eab2cb04f405014c0f363ca
-SHA512 (rust-std-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 1160303ac4863a849d04a26b5280f3c552e4071510e884c91a6e73e1862b1ee8a8e4bfe727e82512ed5368bc85a41703f7c50e9cd2e5e48d84fb6bfe6dfd5d18
-Size (rust-std-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 64878862 bytes
-BLAKE2s (rust-std-1.72.1-aarch64-unknown-netbsd.tar.xz) = bf3f779d2db6990592b5d80f0cee34417efae1a5f7ab2950c00477b64592a5a8
-SHA512 (rust-std-1.72.1-aarch64-unknown-netbsd.tar.xz) = 853a7a729c4c279ba4b3d2764f2198bc0cfcde2faae6c727a1cfb0aae57f07f1a98bfc580a1ab3aaa9c13120ff379761fadb1558bb67c81b63cbad8a1fe4348f
-Size (rust-std-1.72.1-aarch64-unknown-netbsd.tar.xz) = 23143948 bytes
-BLAKE2s (rust-std-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 06a2099a6bba4e3143cda1ef5d6e2c81aa2fda5ec49c999fe1dfea3bea4853ec
-SHA512 (rust-std-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = a07fdd49fc277ed51829312f551b1f02bb5521d5697abc8fd3422656c14276f29d9c7c6d78c340e46706c64c7e15c1bd6eac252b93e5bd6c071e0d7b4f83f07f
-Size (rust-std-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 23208140 bytes
-BLAKE2s (rust-std-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = a4043a57e1f1faeba2b931ecfd502157d8330747693098d49aed597e5be05285
-SHA512 (rust-std-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 5a90c418fecb3d0e51b2d02c492d46126aec7a0a27d05bb748b6201de56cf0b4a057e4edb3b5d4da3682f35a838df7f14d892003904ad0e678f78988a4639b3c
-Size (rust-std-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 37783915 bytes
-BLAKE2s (rust-std-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 495a7525f76c3edb7877eee39239518f0042d37dd1a4b94ddcbb0a9bac870591
-SHA512 (rust-std-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = abe779de0a5c22cbd73effd4607dad499c2350903fb5fe8d3ef0a1ac31c2a27c611c4621d2052ce74f28e0a4eaa91b690a1d3a52da49a58d2638d181acfb8e67
-Size (rust-std-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 21555600 bytes
-BLAKE2s (rust-std-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = bf7d187d8287a9ae307c137064799fe5c2afaf04c3d707e5bb833b867501f4e9
-SHA512 (rust-std-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 9b58417cc947ee1f1c61f6cf905c132f6bd3922a2a96c4e8a589bb3fcb83c5f22c6c77b143117a4610bb490d92190c053945816302487da463aad92ff48427f5
-Size (rust-std-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 39266181 bytes
-BLAKE2s (rust-std-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = ae4df952eb4995237d5bf5ddf353ceffa22959f69965a21413c8649d85323555
-SHA512 (rust-std-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 1b2d0faa1fc3cbd80322d18a4891f885731ce2e99a34e57ba7b974ba19b6872f97a03c94851e41120e3be165e9ce9a7e440d720a32f1cec50960d98833fa8fdf
-Size (rust-std-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 22448372 bytes
-BLAKE2s (rust-std-1.72.1-i586-unknown-netbsd.tar.xz) = a44c59dd79f1538c6791274d90cb82f3836b87a2d776c7f9ee8d53eaed8324f5
-SHA512 (rust-std-1.72.1-i586-unknown-netbsd.tar.xz) = 9900c388ba60d439e32d64e7c88b669fe4c4b70d8862537972c6fb9a4bb764315782e1fc35539c882188a888377fce7151aa387cb2f65610cf1dc519cb7e55e9
-Size (rust-std-1.72.1-i586-unknown-netbsd.tar.xz) = 23666268 bytes
-BLAKE2s (rust-std-1.72.1-i686-unknown-linux-gnu.tar.gz) = 4b64e043cd5559e8c82fa87f1a036eb536f0e5a7016699766941800bb23f4dc6
-SHA512 (rust-std-1.72.1-i686-unknown-linux-gnu.tar.gz) = cdfbe09036e4628a2e5ef9c4d3eb734214c4d8991c7b7710e8995dbd019fb459b06d978aa30c2846702ee194c3ada0dc2225be26cd0ab127d6a569312474bef0
-Size (rust-std-1.72.1-i686-unknown-linux-gnu.tar.gz) = 41477541 bytes
-BLAKE2s (rust-std-1.72.1-powerpc-unknown-netbsd90.tar.xz) = a0583c15929ae338f95ba3bbd536df60053ebfc6008e1c3101cf7213a0603623
-SHA512 (rust-std-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 94fd617997f0a4c9347f747f8c4bde70c5fa2bb6e6791411b37eace90cec990ef8063673407ce3eb7533fadc30b57660f11d8724d790dc170ac0e983d18cccad
-Size (rust-std-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 21615996 bytes
-BLAKE2s (rust-std-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = aa49ab95fe56a94612bb3d70147846ff644f3a0980040dc5b77a4afcbfca96d0
-SHA512 (rust-std-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = ee71979c48dc20f858d5ed93b3fdaf033565763fd9085d001a9ed57504d52de55f9c10a9ff75013dc25a6f671d3c9b70ff5b9dfe6e9d58db32a64b9c65f7978c
-Size (rust-std-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 21928348 bytes
-BLAKE2s (rust-std-1.72.1-sparc64-unknown-netbsd.tar.xz) = c16c747e8af3c0aa416776fd1c13382211aa87c4d4dfdb9a405e84dc598cde35
-SHA512 (rust-std-1.72.1-sparc64-unknown-netbsd.tar.xz) = 2223b73667fe9a4d116efea4e384c2b18dc044c0fc43130f70683cb53148228cbdeb565365d05f6b1b607acbb75d0cbd9c01f4acd4050bf58b7e9271f0ad030d
-Size (rust-std-1.72.1-sparc64-unknown-netbsd.tar.xz) = 21571728 bytes
-BLAKE2s (rust-std-1.72.1-x86_64-apple-darwin.tar.gz) = 12690ad9f18e0677946b430b74aa3af1951115323409e56b07feeb2f29a522fe
-SHA512 (rust-std-1.72.1-x86_64-apple-darwin.tar.gz) = 3fe3effc8785e5bae07dd0c21f7f1b2fdaaf1e5fa8d0ddbec487cd42d221a7578b490ee77f2d3e48ef092cd272a385bf9bb6d6098b027111541730cdf619136c
-Size (rust-std-1.72.1-x86_64-apple-darwin.tar.gz) = 43029167 bytes
-BLAKE2s (rust-std-1.72.1-x86_64-unknown-freebsd.tar.gz) = ef85734ee1ea4f9e6a1fb93b5a92477ac8dd27789179cf29dc9644d551fd5542
-SHA512 (rust-std-1.72.1-x86_64-unknown-freebsd.tar.gz) = 3bb282775434841ae7d0e3e6f9f090bf7790be9631512dab194bc6e984a957ab9d07bb6074e30cd0ee55f2383b894de5431a75255adea3e0134602c383380f97
-Size (rust-std-1.72.1-x86_64-unknown-freebsd.tar.gz) = 44489747 bytes
-BLAKE2s (rust-std-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = e6396c67ef0911771f083ad7a461a074a7afa24f22b6768be03d2aa98b9aec00
-SHA512 (rust-std-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = d35a3db35485ebf771f02e24dbeefa85269fe8b3895f754fe7dd2ba4891ee050641613db901544695e8a3849dae51c358d206b1bc84518b582218795c9d48fce
-Size (rust-std-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = 46277735 bytes
-BLAKE2s (rust-std-1.72.1-x86_64-unknown-netbsd.tar.xz) = 6ad1f651f97ff82a68c5aefbd34b2ed9c424c407887f266213ab0bdd85409113
-SHA512 (rust-std-1.72.1-x86_64-unknown-netbsd.tar.xz) = 4bd3487085c29ef5ba46ecd7c1b12a9f3ce24e5e1234acf0b9f829790ffc5ed1b065aa787c66e1730ef2d74fcd2e333973b2af22ddac8fc6b52b8f2178724d99
-Size (rust-std-1.72.1-x86_64-unknown-netbsd.tar.xz) = 25225220 bytes
-BLAKE2s (rustc-1.73.0-src.tar.gz) = 2d3fb1ef162c82d6d5afa1868792108dc68ef42a6d640fb7674c350b17057aaf
-SHA512 (rustc-1.73.0-src.tar.gz) = 4e5de9455f3c17b9a01847ec2280b6354c66f7eae00513433b3f7c84c908942999167b51d683967019c8e68fe30b5add5c29f7a4c3a3a1fa0c3e290c7fe09816
-Size (rustc-1.73.0-src.tar.gz) = 280735223 bytes
-SHA1 (patch-compiler_rustc__codegen__ssa_src_back_linker.rs) = 62819cf6db7d2e3e77d433fe883046c28fc20d91
-SHA1 (patch-compiler_rustc__llvm_build.rs) = 037e7b02aa6f98dc0ebfc33bb336ea9347f33528
-SHA1 (patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs) = 866d01e7c1f3d8dd7d26f2fdc4360df273ed401f
-SHA1 (patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs) = a0fb5338d0020d3ee1266d1ed1361e7bf2eea611
-SHA1 (patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs) = fc78fc681f170be9e3b6e3c823a6bd62da742cbd
-SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = f49f8f8e36db396f29ea1c908ed61fe831e0d4cd
-SHA1 (patch-compiler_rustc__target_src_spec_netbsd__base.rs) = bc73a140d7b1d3ced12ad2564be4edce5b9579f0
-SHA1 (patch-library_backtrace_src_symbolize_gimli.rs) = 1ab343595e65ff6348f83cffc30e53d764485ff8
-SHA1 (patch-library_backtrace_src_symbolize_gimli_elf.rs) = 56621c10310914672a851cf5dfbf343a9ff4e1be
-SHA1 (patch-library_std_src_sys_unix_mod.rs) = f8669d680f169137ac2891af2977909619366a97
-SHA1 (patch-library_std_src_sys_unix_thread.rs) = 3f79b21fa033782122e09ffc44de55a0e5ecaecb
-SHA1 (patch-library_std_src_sys_unix_thread__parking_netbsd.rs) = c29eb1cf074766d34bd2b8c348ce29c6ae2ba163
-SHA1 (patch-src_bootstrap_bootstrap.py) = 00e11eb1f8e8534440bf3760837be6058e800c83
-SHA1 (patch-src_bootstrap_builder.rs) = a30ad08861034944ed3d7b37df6289f4356f7f19
-SHA1 (patch-src_bootstrap_compile.rs) = 71b58c0e14b820dafc48ce087292267e7d2eed0f
-SHA1 (patch-src_bootstrap_lib.rs) = f6918e0939b6fe63ae9b524d4c809375149efb15
-SHA1 (patch-src_bootstrap_llvm.rs) = afa4ec0b26aaf9c590859969b08a485e77322371
-SHA1 (patch-src_llvm-project_llvm_CMakeLists.txt) = 7abfabb6ec70df229a69355f8c76825610165c37
-SHA1 (patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake) = e1b2eb2f0b3cf1cf87b443656ae306b3242f6b12
-SHA1 (patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h) = cb011fc19957883c01725797f7c85ed1b20f96f1
-SHA1 (patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h) = 39d76e6659143d154ae690ac70781b698a2023d8
-SHA1 (patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h) = 67e93f198258a5b59580be20ff47ce58b146c5d5
-SHA1 (patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp) = b68197c1486a4dc40154b3b23dfd55d44048a2d2
-SHA1 (patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp) = 2587c2f4d11ad8f75bf8a16de625135b26bacc15
-SHA1 (patch-src_tools_cargo_src_cargo_core_profiles.rs) = e1af7fde97416e0a269ee34efd37f4f47fcf7a95
-SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 60713699c968f3e389f486e796009d31a5048906
-SHA1 (patch-src_tools_rust-installer_install-template.sh) = 28fbfd37793c8438a603cb0e19483bd5b9138e4b
-SHA1 (patch-vendor_backtrace_src_symbolize_gimli.rs) = b93148ff72a60a17c6a444f2616386c40d872153
-SHA1 (patch-vendor_backtrace_src_symbolize_gimli_elf.rs) = 308538090d9ce11d206d6eef0e675581a1fc6e80
-SHA1 (patch-vendor_cc-1.0.73_src_lib.rs) = 98acea9fb98898f63bbb0f6555df5e4b15da2b85
-SHA1 (patch-vendor_cc_src_lib.rs) = c64f7922684b75a559c3b6244114524eb3ab8385
-SHA1 (patch-vendor_crossbeam-epoch_no__atomic.rs) = a493d0b57a22b9a83c843a1076c91b6d36d2e007
-SHA1 (patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs) = 2053e2cffcb2981435c94df04d0e3f333fa77c07
-SHA1 (patch-vendor_crossbeam-utils_no__atomic.rs) = 26f797159530bc2c5e1be83a225a13e5458879b2
-SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs) = eda31064a08cba20fc0652b669e419871875ae29
-SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 33d06b92a65908185226f8aed055782e5b5a613a
-SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 24ebcb044aeefec3415323b77ac25805a98b296e
-SHA1 (patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 998160de7640c4567bf042dfa7a74a4555b0568b
-SHA1 (patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 2b0b4320aaed24514c1fdc8bbbeeb59191b36058
-SHA1 (patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 74b6353687cdc029bcdc9110b7b1e96e9ffb8e43
-SHA1 (patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs) = c3db9af7ebcc4356015159c170603b620c21dde0
-SHA1 (patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs) = b99ebc7233690df5dd3fa7674d86ec08831eec59
-SHA1 (patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 511e5d97083638352d77a463582aca8812602b45
-SHA1 (patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 4b9ff57adb8d67f467eb36c023548afef8b1ed74
-SHA1 (patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 3434376111d3f4759eab5eb278eb64ac5e170ffb
-SHA1 (patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 66b4cd0853154e6a8fcd009a06ebbae5a1c98f82
-SHA1 (patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs) = 17884a63798eee6d68771faa8d9592525aa2a3bb
-SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 09326b70d7821b1742285c464c70b347400191d7
-SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 4ad61200f935032f411a719c2e1d4724a7def652
-SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = a0434dfc965e4286dc4a21c6433edbd30eb16779
-SHA1 (patch-vendor_libc_src_unix_solarish_mod.rs) = 8364e19ea09203d32494c37ff3db19fe3d6b9d8a
-SHA1 (patch-vendor_lzma-sys_config.h) = b654c7e129fa02697734bc87173f89b3056a5437
-SHA1 (patch-vendor_nix_src_sys_signal.rs) = bf4fcdc5b71d8d73b3d7e8acfccd0554d822c131
-SHA1 (patch-vendor_openssl-src_openssl_Configurations_10-main.conf) = 9813c98a0551dba197ff47e9ac0f766c50351569
-SHA1 (patch-vendor_openssl-src_src_lib.rs) = fc38171e21ab88540a774917f419d41d67f509ca
-SHA1 (patch-vendor_openssl-sys_build_find__normal.rs) = 98927415bd3517a7492b87da99c8933c19c7299e
-SHA1 (patch-vendor_openssl-sys_build_main.rs) = 20618b13b56cc93bb5c051f96046604dd4977345
-SHA1 (patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = 4e86aec4c89db9a331950a12f8ec7b8aaa50eed7
-SHA1 (patch-vendor_stacker_src_lib.rs) = e00a1e95eb16540ff182715db778bf97ebd07a5e
-SHA1 (patch-vendor_target-lexicon_src_targets.rs) = 8562658e5f11ab1cf977d83fc48c4b3c000fbc0e
-SHA1 (patch-vendor_valuable_no__atomic.rs) = 3a40cb846bf1fae864c55a0ddba8fdeb5efcba72
diff --git a/rust/do-cross.mk b/rust/do-cross.mk
deleted file mode 100644
index 412ecb2e3a..0000000000
--- a/rust/do-cross.mk
+++ /dev/null
@@ -1,107 +0,0 @@
-# $NetBSD$
-# Do all the NetBSD cross builds
-# Collect the bootstrap kits in dist/
-
-VERSION!=	make show-var VARNAME=PKGVERSION
-V_NOREV!=	make show-var VARNAME=PKGVERSION_NOREV
-
-SHORT_TARGETS+=		armv7
-SHORT_TARGETS+=		armv6
-SHORT_TARGETS+=		sparc64
-SHORT_TARGETS+=		powerpc
-SHORT_TARGETS+=		arm64
-SHORT_TARGETS+=		arm64_be
-SHORT_TARGETS+=		i386
-SHORT_TARGETS+=		riscv64
-SHORT_TARGETS+=		mipsel	# produces mips32 (not mips1) executables
-
-# Conditional local overrides of ROOT.* variables:
-.sinclude "local-roots.mk"
-
-# Root of target directories.
-# Must have dest/ (build.sh's DESTDIR) and tools/ subdirectories
-ROOT.armv7?=		/u/evbarm-armv7hf
-ROOT.armv6?=		/u/evbarm-armv6hf
-ROOT.sparc64?=		/u/sparc64
-ROOT.powerpc?=		/u/macppc
-ROOT.arm64?=		/u/evbarm64
-ROOT.arm64_be?=		/u/evbarm64eb
-ROOT.i386?=		/u/i386
-ROOT.mipsel?=		/u/mipsel
-ROOT.riscv64?=		/u/riscv64
-
-# Mapping to GNU triple
-G_TGT.armv7=		armv7--netbsdelf-eabihf
-G_TGT.armv6=		armv6--netbsdelf-eabihf
-G_TGT.sparc64=		sparc64--netbsd
-G_TGT.powerpc=		powerpc--netbsd
-G_TGT.arm64=		aarch64--netbsd
-G_TGT.arm64_be=		aarch64_be--netbsd
-G_TGT.i386=		i486--netbsdelf
-G_TGT.mipsel=		mipsel--netbsd
-G_TGT.riscv64=		riscv64--netbsd
-
-# Mapping to rust's TARGET specification
-TGT.armv7=		armv7-unknown-netbsd-eabihf
-TGT.armv6=		armv6-unknown-netbsd-eabihf
-TGT.sparc64=		sparc64-unknown-netbsd
-TGT.powerpc=		powerpc-unknown-netbsd
-TGT.arm64=		aarch64-unknown-netbsd
-TGT.arm64_be=		aarch64_be-unknown-netbsd
-TGT.i386=		i586-unknown-netbsd
-TGT.mipsel=		mipsel-unknown-netbsd
-TGT.riscv64=		riscv64gc-unknown-netbsd
-
-# Optional target tweak for bootstrap files
-TT.powerpc=		powerpc-unknown-netbsd90
-
-WRKDIR=		${.CURDIR}/work
-SCRIPTS=	${WRKDIR}/scripts
-
-#DEBUG=		echo
-
-# Make list of make targets
-.for st in ${SHORT_TARGETS}
-MTGTS+=	do-${st}
-.endfor
-
-all: ${MTGTS}
-
-# Define the individual build targets, used above
-.for st in ${SHORT_TARGETS}
-CA.${st}=--host=${TGT.${st}}
-CA.${st}+=--target=${TGT.${st}}
-CA.${st}+=--set=target.${TGT.${st}}.cc=${SCRIPTS}/gcc-wrap
-CA.${st}+=--set=target.${TGT.${st}}.cxx=${SCRIPTS}/c++-wrap
-CA.${st}+=--set=target.${TGT.${st}}.linker=${SCRIPTS}/gcc-wrap
-CA.${st}+=--set=target.${TGT.${st}}.ar=${ROOT.${st}}/tools/bin/${G_TGT.${st}}-ar
-do-${st}:
-	mkdir -p dist
-	@echo "=======> Cross-building rust for ${st}"
-	${DEBUG} make -f Makefile clean
-	${DEBUG} env \
-		CROSS_ROOT=${ROOT.${st}} \
-		GNU_CROSS_TARGET=${G_TGT.${st}} \
-		make -f Makefile \
-			ADD_CONFIGURE_ARGS="${CA.${st}}" \
-			TARGET=${TGT.${st}}
-	if [ "${TT.${st}}" != "" ]; then \
-		TT=${TT.${st}}; \
-	else \
-		TT=${TGT.${st}}; \
-	fi; \
-	distdir=${WRKDIR}/rustc-${V_NOREV}-src/build/dist; \
-	for comp in rust rust-std; do \
-		src=$${distdir}/$${comp}-${V_NOREV}-${TGT.${st}}.tar.xz; \
-		tgt=dist/$${comp}-${VERSION}-$${TT}.tar.xz; \
-		if [ ! -f "$${tgt}" ]; then \
-			echo ln $${src} $${tgt}; \
-			${DEBUG} ln $${src} $${tgt}; \
-		fi; \
-	done; \
-	src_comp=rust-src-${V_NOREV}.tar.xz; \
-	if [ ! -f dist/$${src_comp} ]; then \
-		echo ln $${distdir}/$${src_comp} dist; \
-		${DEBUG} ln $${distdir}/$${src_comp} dist; \
-	fi
-.endfor
diff --git a/rust/files/gcc-wrap b/rust/files/gcc-wrap
deleted file mode 100644
index 957ebfa032..0000000000
--- a/rust/files/gcc-wrap
+++ /dev/null
@@ -1,199 +0,0 @@
-#! /bin/sh
-
-# Root of targets tools + dest directories
-# or unset to default to a native build.
-
-# This script assumes target tools in $root/tools 
-# and target's destdir in $root/dest, the result of a NetBSD build.sh.
-# ...or the native root, when we don't cross-compile
-root=${CROSS_ROOT:-/}
-
-incadd=""
-native=false
-if [ $root = "/" ]; then
-	native=true
-else
-	# What's the tools/bin prefix (if we're cross-building)?
-	gnuarch=${GNU_CROSS_TARGET:?}
-
-	# A special hack for netbsd-8 targets.
-	# netbsd-8 has gcc 5.5, but llvm and rust needs >= 7
-	# so we build tools from -9, and try to use that, but
-	# then the include path becomes wrong, and <stdatomic.h>
-	# is no longer picked up automatically by the compiler
-	# from the target destination directory
-	case $gnuarch in
-		sparc64*)	incadd="-I=/usr/include/gcc-5"
-				;;
-
-				# immintrin & from gcc-5 not
-				# compatible with gcc7, apparently
-		i[3456]86*)	incadd="-I=/usr/include/gcc-7"
-				;;
-
-				# mips64 does soft-float
-		mips64*)	madd="-msoft-float"
-				;;
-	esac
-	# We build both for -8 and -9 due to ABI differences,
-	# so can't just test $gnuarch...  Yes, a vile hack.
-	if [ "$root" = "/u/macppc" ]; then
-		incadd="-I=/usr/include/gcc-5"
-	fi
-fi
-
-# Who are we a wrapper for? (Typically either gcc or c++)
-who=$(basename $0 | sed -e 's/-wrap$//')
-
-args=""
-if [ ! -z "$madd" ]; then
-	args="$args $madd"
-fi
-
-# May need to add $linkadd before first -l or fist -L
-linkadd="-Wl,--sysroot=${root}/dest"
-# (perhaps this is overly cautious, other adjustments we do
-# below may be sufficient...)
-# Lib directories to ensure we search and have in run-path
-libs="/lib /usr/lib /usr/pkg/lib"
-
-for d in $libs; do
-	if ! $native; then
-		linkadd="$linkadd -L=$d"
-		linkadd="$linkadd -Wl,-rpath-link=${root}/dest/$d"
-	fi
-	# Run-path is for when we execute on the target,
-	# so no $root prefix
-	linkadd="$linkadd -Wl,-rpath,$d"
-done
-
-# ...and add a placeholder so we can tweak RPATH with chrpath,
-# since chrpath can't extend the length of the run path
-# (This may also not be needed, we use LD_LIBRARY_PATH instead)
-placeholder="placeholder-$(date | openssl dgst -sha1 | \
-	awk '{ print $2 }')"
-linkadd="$linkadd -Wl,-rpath,/$placeholder"
-# the / is a sneaky attempt to let it past cwrapper...
-
-# More debugging
-linkadd="$linkadd -Wl,--verbose"
-
-linktweaked=false
-
-# Step through args, tweak where required
-set -- "$@"
-while [ $# -gt 0 ]; do
-	case "$1" in
-# Insert = at the front of -isystem args.
-# This is to get --sysroot prepended, so that
-# we pick up the correct set of header files.
-# (I thought this wasn't reqired, but apparently it is...)
-		-isystem)
-			shift
-			args="$args -isystem =$1"
-			;;
-# Also doctor -I directives of known paths and
-# redirect them to the --sysroot.
-		-I/usr/include)
-			args="$args -I=/usr/include"
-			;;
-		-I/usr/include/krb5)
-			args="$args -I=/usr/include/krb5"
-			;;
-		-I/usr/pkg/include)
-# Try to drop this...
-			if ! $native; then
-				args="$args -I=/usr/pkg/include"
-			fi
-			;;
-		-I)
-			if [ $2 = "/usr/include" ]; then
-				args="$args -I=/usr/include"
-				shift
-			elif [ $2 = "/usr/include/krb5" ]; then
-				args="$args -I=/usr/include/krb5"
-				shift
-			elif [ $2 = "/usr/pkg/include" ]; then
-# Try to drop this too...
-				if ! $native; then
-					args="$args -I=/usr/pkg/include"
-				fi
-				shift
-			else
-				args="$args -I"
-			fi
-			;;
-		-l*)
-			if ! $linktweaked; then
-				args="$args $linkadd"
-				linktweaked=true
-			fi
-			args="$args $1"
-			;;
-		-L)
-			if ! $linktweaked; then
-				args="$args $linkadd"
-				linktweaked=true
-			fi
-			shift
-			tweaked=false
-			# redirect these to -Wl,--sysroot
-			for d in /lib /usr/lib /usr/pkg/lib; do
-				if [ $1 = $d ]; then
-					args="$args -L =$d"
-					tweaked=true
-				fi
-			done
-			# Not redirected?  If so we need to add
-			if ! $tweaked; then
-				args="$args -L $1"
-			fi
-			;;
-			
-		-L/lib)
-			if ! $linktweaked; then
-				args="$args $linkadd"
-				linktweaked=true
-			fi
-			args="$args -L=/lib"
-			;;
-		-L/usr/lib)
-			if ! $linktweaked; then
-				args="$args $linkadd"
-				linktweaked=true
-			fi
-			args="$args -L=/usr/lib"
-			;;
-		-L/usr/pkg/lib)
-			if ! $linktweaked; then
-				args="$args $linkadd"
-				linktweaked=true
-			fi
-			args="$args -L=/usr/pkg/lib"
-			;;
-		-Wl,--enable-new-dtags)
-			# ignore
-			;;
-		*)
-			args="$args $1"
-			;;
-	esac
-	shift
-done
-
-if $native; then
-	# Try to avoid cwrappers, which does "undocumented magic"
-	# by invoking the compiler "directly".
-	#cmd="/usr/bin/${who} $args"
-	# (however, this wrapper isn't used when buliding natively...)
-	cmd="${who} $args"
-else
-	cmd="${root}/tools/bin/${gnuarch}-${who} \
-		--sysroot=${root}/dest \
-		$incadd \
-		$args"
-fi
-
-# Cannot echo to stdout, messes up e.g. "gcc -print-prog-name=ld" output...
-#echo $cmd >> /tmp/gcc-wrap.log
-exec $cmd
diff --git a/rust/options.mk b/rust/options.mk
deleted file mode 100644
index eb7e1783c0..0000000000
--- a/rust/options.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-# $NetBSD: options.mk,v 1.26 2022/07/11 20:13:50 jperkin Exp $
-
-PKG_OPTIONS_VAR=	PKG_OPTIONS.rust
-PKG_SUPPORTED_OPTIONS+=	rust-cargo-static rust-docs
-
-.include "../../mk/bsd.fast.prefs.mk"
-
-# The bundled LLVM current has issues building on SunOS.
-.if ${OPSYS} != "SunOS"
-PKG_SUPPORTED_OPTIONS+=		rust-internal-llvm
-# There may be compatibility issues with the base LLVM on e.g. NetBSD.
-.  if !empty(HAVE_LLVM) || ${MACHINE_PLATFORM:MDarwin-*-aarch64}
-PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
-.  endif
-.endif
-
-# If cross-building, always use the internal LLVM
-.if !empty(TARGET)
-PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
-.endif
-
-# (NetBSD)/sparc64 systems fail to build libunwind,
-# a dependency of pkgsrc llvm, so use the internal one instead
-.if ${MACHINE_PLATFORM:MNetBSD-*-sparc64}
-PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
-.endif
-
-# Bundle OpenSSL and curl into the cargo binary when producing
-# bootstraps on NetBSD.
-.if ${OPSYS} == "NetBSD" && ${BUILD_TARGET} == "dist"
-PKG_SUGGESTED_OPTIONS+=	rust-cargo-static
-.endif
-
-PKG_OPTIONS_LEGACY_OPTS+=	rust-llvm:rust-internal-llvm
-
-.include "../../mk/bsd.options.mk"
-
-#
-# Use the internal copy of LLVM or the external one?
-#
-.if empty(PKG_OPTIONS:Mrust-internal-llvm)
-.include "../../lang/llvm/buildlink3.mk"
-CONFIGURE_ARGS+=	--enable-llvm-link-shared
-#CONFIGURE_ARGS+=	--llvm-libunwind=system
-CONFIGURE_ARGS+=	--llvm-root=${BUILDLINK_PREFIX.llvm}
-.endif
-
-#
-# Link cargo statically against "native" libraries.
-# (openssl and curl specifically).
-#
-.if !empty(PKG_OPTIONS:Mrust-cargo-static)
-CONFIGURE_ARGS+=	--enable-cargo-native-static
-.else
-BUILDLINK_API_DEPENDS.nghttp2+= nghttp2>=1.41.0
-BUILDLINK_API_DEPENDS.curl+= 	curl>=7.67.0
-.include "../../www/curl/buildlink3.mk"
-.include "../../security/openssl/buildlink3.mk"
-.endif
-
-#
-# Install documentation.
-#
-.if !empty(PKG_OPTIONS:Mrust-docs)
-CONFIGURE_ARGS+=	--enable-docs
-.else
-CONFIGURE_ARGS+=	--disable-docs
-.endif
diff --git a/rust/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs b/rust/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
deleted file mode 100644
index d603fa804b..0000000000
--- a/rust/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Do not use @rpath on Darwin.
-
---- compiler/rustc_codegen_ssa/src/back/linker.rs.orig	2022-12-12 16:02:12.000000000 +0000
-+++ compiler/rustc_codegen_ssa/src/back/linker.rs
-@@ -325,7 +325,7 @@ impl<'a> GccLinker<'a> {
-             // principled solution at some point to force the compiler to pass
-             // the right `-Wl,-install_name` with an `@rpath` in it.
-             if self.sess.opts.cg.rpath || self.sess.opts.unstable_opts.osx_rpath_install_name {
--                let mut rpath = OsString::from("@rpath/");
-+                let mut rpath = OsString::from("@PREFIX@/lib/");
-                 rpath.push(out_filename.file_name().unwrap());
-                 self.linker_args(&[OsString::from("-install_name"), rpath]);
-             }
diff --git a/rust/patches/patch-compiler_rustc__llvm_build.rs b/rust/patches/patch-compiler_rustc__llvm_build.rs
deleted file mode 100644
index 635bee3f78..0000000000
--- a/rust/patches/patch-compiler_rustc__llvm_build.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-$NetBSD$
-
-Fix build on NetBSD HEAD-llvm. XXX there is probably a better way to do this.
-
-Pick up -latomic tweak from
-https://github.com/rust-lang/rust/issues/104220
-and
-https://github.com/rust-lang/rust/pull/104572
-
---- compiler/rustc_llvm/build.rs.orig	2023-10-03 02:52:17.000000000 +0000
-+++ compiler/rustc_llvm/build.rs
-@@ -249,12 +249,21 @@ fn main() {
-     {
-         // 32-bit targets need to link libatomic.
-         println!("cargo:rustc-link-lib=atomic");
-+        println!("cargo:rustc-link-lib=z");
-     } else if target.contains("windows-gnu") {
-         println!("cargo:rustc-link-lib=shell32");
-         println!("cargo:rustc-link-lib=uuid");
-     } else if target.contains("haiku") || target.contains("darwin") {
-         println!("cargo:rustc-link-lib=z");
-     } else if target.contains("netbsd") {
-+        // We build for i486, and then need -latomic for 64-bit atomics
-+        if target.starts_with("i386")
-+           || target.starts_with("i486")
-+           || target.starts_with("i586")
-+           || target.starts_with("i686")
-+        {
-+          println!("cargo:rustc-link-lib=atomic");
-+        }
-         println!("cargo:rustc-link-lib=z");
-         println!("cargo:rustc-link-lib=execinfo");
-     }
-@@ -343,7 +352,13 @@ fn main() {
-         "c++"
-     } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
-         // NetBSD uses a separate library when relocation is required
--        "stdc++_p"
-+	if env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
-+            "c++_pic"
-+	} else {
-+            "stdc++_pic"
-+	}
-+    } else if env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
-+	"c++"
-     } else if llvm_use_libcxx.is_some() {
-         "c++"
-     } else {
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs b/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs
deleted file mode 100644
index 3e786a4b62..0000000000
--- a/rust/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
-Add an i586 / pentium variant, in an effort to support AMD Geode etc.
-
---- compiler/rustc_target/src/spec/i586_unknown_netbsd.rs.orig	2022-12-21 19:11:11.452711494 +0000
-+++ compiler/rustc_target/src/spec/i586_unknown_netbsd.rs
-@@ -0,0 +1,23 @@
-+use crate::spec::{Cc, Lld, LinkerFlavor, StackProbeType, Target, TargetOptions};
-+
-+pub fn target() -> Target {
-+    let mut base = super::netbsd_base::opts();
-+    base.cpu = "pentium".into();
-+    base.max_atomic_width = Some(64);
-+    base.pre_link_args
-+        .entry(LinkerFlavor::Gnu(Cc::Yes, Lld::No))
-+        .or_default()
-+        .push("-m32".into());
-+    // don't use probe-stack=inline-asm until rust-lang/rust#83139 is resolved.
-+    base.stack_probes = StackProbeType::Call;
-+
-+    Target {
-+        llvm_target: "i586-unknown-netbsdelf".into(),
-+        pointer_width: 32,
-+        data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
-+            f64:32:64-f80:32-n8:16:32-S128"
-+            .into(),
-+        arch: "x86".into(),
-+        options: TargetOptions { mcount: "__mcount".into(), ..base },
-+    }
-+}
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs b/rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs
deleted file mode 100644
index aea9becd9b..0000000000
--- a/rust/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Provide a mips64el target with N32, suitable for NetBSD/mips64el.
-
---- compiler/rustc_target/src/spec/mips64el_unknown_netbsd.rs.orig	2022-12-29 22:55:00.640217876 +0000
-+++ compiler/rustc_target/src/spec/mips64el_unknown_netbsd.rs
-@@ -0,0 +1,22 @@
-+use crate::abi::Endian;
-+use crate::spec::{Target, TargetOptions};
-+
-+pub fn target() -> Target {
-+    let mut base = super::netbsd_base::opts();
-+    base.max_atomic_width = Some(32);
-+    base.cpu = "mips32".into();
-+
-+    Target {
-+        llvm_target: "mipsel-unknown-netbsd".into(),
-+        pointer_width: 32,
-+        data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
-+        arch: "mips".into(),
-+        options: TargetOptions {
-+            abi: "n32".into(),
-+            features: "+soft-float,+abi=n32".into(),
-+            endian: Endian::Little,
-+            mcount: "__mcount".into(),
-+            ..base
-+        },
-+    }
-+}
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs b/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs
deleted file mode 100644
index cdee1caa6f..0000000000
--- a/rust/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
-Add target spec for NetBSD/mipsel.
-This one uses mips32 (mips1 llvm fails), so this one is not universally
-usable on NetBSD's supported 32-bit MIPS processors.
-
---- compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs.orig	2022-11-06 18:16:59.750850353 +0000
-+++ compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs	2022-11-06 18:14:10.846209169 +0000
-@@ -0,0 +1,21 @@
-+use crate::abi::Endian;
-+use crate::spec::{Target, TargetOptions};
-+
-+pub fn target() -> Target {
-+    let mut base = super::netbsd_base::opts();
-+    base.max_atomic_width = Some(32);
-+    base.cpu = "mips32".into();
-+
-+    Target {
-+	llvm_target: "mipsel-unknown-netbsd".into(),
-+	pointer_width: 32,
-+	data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
-+	arch: "mips".into(),
-+	options: TargetOptions {
-+	    features: "+soft-float".into(),
-+	    mcount: "__mcount".into(),
-+	    endian: Endian::Little,
-+	    ..base
-+	},
-+    }
-+}
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs b/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
deleted file mode 100644
index 05f500b8da..0000000000
--- a/rust/patches/patch-compiler_rustc__target_src_spec_mod.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Add i586(pentium) and mipsel NetBSD targets.
-
---- compiler/rustc_target/src/spec/mod.rs.orig	2021-03-23 16:15:10.000000000 +0000
-+++ compiler/rustc_target/src/spec/mod.rs
-@@ -1324,6 +1324,8 @@ supported_targets! {
-     ("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
-     ("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
-     ("i686-unknown-netbsd", i686_unknown_netbsd),
-+    ("i586-unknown-netbsd", i586_unknown_netbsd),
-+    ("mipsel-unknown-netbsd", mipsel_unknown_netbsd),
-     ("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
-     ("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),
-     ("sparc64-unknown-netbsd", sparc64_unknown_netbsd),
diff --git a/rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs b/rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs
deleted file mode 100644
index 3297c3f2f9..0000000000
--- a/rust/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-For the benefit of powerpc, when libatomic-links is installed,
-search the directory containing the symlinks to -latomic.
-
---- compiler/rustc_target/src/spec/netbsd_base.rs.orig	2022-12-12 16:02:12.000000000 +0000
-+++ compiler/rustc_target/src/spec/netbsd_base.rs
-@@ -1,12 +1,20 @@
--use crate::spec::{cvs, RelroLevel, TargetOptions};
-+use crate::spec::{cvs, Cc, Lld, RelroLevel, LinkerFlavor, TargetOptions};
- 
- pub fn opts() -> TargetOptions {
-+    let pre_link_args = TargetOptions::link_args(
-+        LinkerFlavor::Gnu(Cc::Yes, Lld::No),
-+       &[
-+            // For the benefit of powerpc, when libatomic-links is installed,
-+            "-Wl,-L@PREFIX@/lib/libatomic".into(),
-+        ],
-+    );
-     TargetOptions {
-         os: "netbsd".into(),
-         dynamic_linking: true,
-         families: cvs!["unix"],
-         no_default_libraries: false,
-         has_rpath: true,
-+        pre_link_args,
-         position_independent_executables: true,
-         relro_level: RelroLevel::Full,
-         use_ctors_section: true,
diff --git a/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs b/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
deleted file mode 100644
index 0ed9af7822..0000000000
--- a/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Add NetBSD to the family who is in the unix class.
-
---- library/backtrace/src/symbolize/gimli.rs.orig	2022-04-04 09:41:26.000000000 +0000
-+++ library/backtrace/src/symbolize/gimli.rs
-@@ -38,6 +38,7 @@ cfg_if::cfg_if! {
-         target_os = "ios",
-         target_os = "linux",
-         target_os = "macos",
-+        target_os = "netbsd",
-         target_os = "openbsd",
-         target_os = "solaris",
-         target_os = "illumos",
diff --git a/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs b/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
deleted file mode 100644
index ff9292e2b0..0000000000
--- a/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD$
-
-Make NetBSD also find its debug libraries, if present.
-
---- library/backtrace/src/symbolize/gimli/elf.rs.orig	2022-04-04 09:41:26.000000000 +0000
-+++ library/backtrace/src/symbolize/gimli/elf.rs
-@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output:
-     }
- }
- 
-+#[cfg(target_os = "netbsd")]
-+const DEBUG_PATH: &[u8] = b"/usr/libdata/debug";
-+#[cfg(not(target_os = "netbsd"))]
- const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
- 
- fn debug_path_exists() -> bool {
-     cfg_if::cfg_if! {
--        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
-+        if #[cfg(any(target_os = "freebsd", 
-+		     target_os = "netbsd",
-+                     target_os = "linux"))] {
-             use core::sync::atomic::{AtomicU8, Ordering};
-             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
- 
diff --git a/rust/patches/patch-library_std_src_sys_unix_mod.rs b/rust/patches/patch-library_std_src_sys_unix_mod.rs
deleted file mode 100644
index 025b74b7b4..0000000000
--- a/rust/patches/patch-library_std_src_sys_unix_mod.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Add libexecinfo for backtrace() on NetBSD.
-
---- library/std/src/sys/unix/mod.rs.orig	2021-02-10 17:36:44.000000000 +0000
-+++ library/std/src/sys/unix/mod.rs
-@@ -269,6 +269,7 @@ cfg_if::cfg_if! {
-         #[link(name = "pthread")]
-         extern "C" {}
-     } else if #[cfg(target_os = "netbsd")] {
-+        #[link(name = "execinfo")]
-         #[link(name = "pthread")]
-         #[link(name = "rt")]
-         extern "C" {}
diff --git a/rust/patches/patch-library_std_src_sys_unix_thread.rs b/rust/patches/patch-library_std_src_sys_unix_thread.rs
deleted file mode 100644
index f01348ffb6..0000000000
--- a/rust/patches/patch-library_std_src_sys_unix_thread.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-$NetBSD$
-
-Fix stack-clash on SunOS.
-
-Undo new(ish) code (from 1.72.0) which attempts to count threads/CPUs
-on NetBSD; somehow it is causing crashes in bootstrap() on certain
-CPU architectures (i386, powerpc, armv7, but not riscv64, aarch64
-or amd64); _cpuset_isset() crashes with SEGV.  And according to
-what I hear, the code is bogus; by default threads do not have
-affinity to any specific set of CPUs in NetBSD, and trying to
-replicate this with a simple C program always results in 0.
-So rip the newish code out with prejudice, and instead fallback to
-the sysctl() method of getting "number of CPUs" which was used
-before (and is still present, following the ripped-out code).
-
---- library/std/src/sys/unix/thread.rs.orig	2020-10-07 07:53:22.000000000 +0000
-+++ library/std/src/sys/unix/thread.rs
-@@ -352,29 +352,6 @@ pub fn available_parallelism() -> io::Re
-                 }
-             }
- 
--            #[cfg(target_os = "netbsd")]
--            {
--                unsafe {
--                    let set = libc::_cpuset_create();
--                    if !set.is_null() {
--                        let mut count: usize = 0;
--                        if libc::pthread_getaffinity_np(libc::pthread_self(), libc::_cpuset_size(set), set) == 0 {
--                            for i in 0..u64::MAX {
--                                match libc::_cpuset_isset(i, set) {
--                                    -1 => break,
--                                    0 => continue,
--                                    _ => count = count + 1,
--                                }
--                            }
--                        }
--                        libc::_cpuset_destroy(set);
--                        if let Some(count) = NonZeroUsize::new(count) {
--                            return Ok(count);
--                        }
--                    }
--                }
--            }
--
-             let mut cpus: libc::c_uint = 0;
-             let mut cpus_size = crate::mem::size_of_val(&cpus);
- 
-@@ -812,7 +789,7 @@ pub mod guard {
-         let page_size = os::page_size();
-         PAGE_SIZE.store(page_size, Ordering::Relaxed);
- 
--        if cfg!(all(target_os = "linux", not(target_env = "musl"))) {
-+        if cfg!(any(target_os = "solaris", all(target_os = "linux", not(target_env = "musl")))) {
-             // Linux doesn't allocate the whole stack right away, and
-             // the kernel has its own stack-guard mechanism to fault
-             // when growing too close to an existing mapping. If we map
diff --git a/rust/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs b/rust/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs
deleted file mode 100644
index 57dcc19ec1..0000000000
--- a/rust/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-$NetBSD$
-
-Try to cast to make this build, to avoid
-
-error[E0277]: the trait bound `i32: core::convert::From<u32>` is not satisfied
-  --> library/std/src/sys/unix/thread_parking/netbsd.rs:37:37
-   |
-37 |         tv_nsec: dur.subsec_nanos().into(),
-   |                                     ^^^^ the trait `core::convert::From<u32>` is not implemented for `i32`
-   |
-   = help: the following other types implement trait `core::convert::From<T>`:
-             <i32 as core::convert::From<NonZeroI32>>
-             <i32 as core::convert::From<bool>>
-             <i32 as core::convert::From<i16>>
-             <i32 as core::convert::From<i8>>
-             <i32 as core::convert::From<u16>>
-             <i32 as core::convert::From<u8>>
-   = note: required for `u32` to implement `core::convert::Into<i32>`
-
-For more information about this error, try `rustc --explain E0277`.
-
-This to un-break the 32-bit ports ... again.
-
---- library/std/src/sys/unix/thread_parking/netbsd.rs.orig	2023-03-06 15:58:58.000000000 +0000
-+++ library/std/src/sys/unix/thread_parking/netbsd.rs
-@@ -34,7 +34,7 @@ pub fn park_timeout(dur: Duration, hint:
-         // Saturate so that the operation will definitely time out
-         // (even if it is after the heat death of the universe).
-         tv_sec: dur.as_secs().try_into().ok().unwrap_or(time_t::MAX),
--        tv_nsec: dur.subsec_nanos().into(),
-+        tv_nsec: (dur.subsec_nanos() as libc::c_long).into(),
-     };
- 
-     // Timeout needs to be mutable since it is modified on NetBSD 9.0 and
diff --git a/rust/patches/patch-src_bootstrap_bootstrap.py b/rust/patches/patch-src_bootstrap_bootstrap.py
deleted file mode 100644
index 7bf70ddfd9..0000000000
--- a/rust/patches/patch-src_bootstrap_bootstrap.py
+++ /dev/null
@@ -1,36 +0,0 @@
-$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.4 2020/02/17 20:24:18 jperkin Exp $
-
-Use `uname -p` on NetBSD, as that is reliable and sensible there.
-Handle earmv[67]hf for NetBSD.
-
---- src/bootstrap/bootstrap.py.orig	2023-07-12 03:32:40.000000000 +0000
-+++ src/bootstrap/bootstrap.py
-@@ -268,6 +268,10 @@ def default_build_triple(verbose):
-         'NetBSD': 'unknown-netbsd',
-         'OpenBSD': 'unknown-openbsd'
-     }
-+    # For NetBSD, use `uname -p`, as there it is reliable & sensible
-+    if kernel == 'NetBSD':
-+        cputype = subprocess.check_output(
-+            ['uname', '-p']).strip().decode(default_encoding)
- 
-     # Consider the direct transformation first and then the special cases
-     if kernel in kerneltype_mapper:
-@@ -362,10 +366,16 @@ def default_build_triple(verbose):
-             kernel = 'linux-androideabi'
-         else:
-             kernel += 'eabihf'
--    elif cputype in {'armv7l', 'armv8l'}:
-+    elif cputype in {'armv6hf', 'earmv6hf'}:
-+        cputype = 'armv6'
-+        if kernel == 'unknown-netbsd':
-+            kernel += '-eabihf'
-+    elif cputype in {'armv7l', 'earmv7hf', 'armv8l'}:
-         cputype = 'armv7'
-         if kernel == 'linux-android':
-             kernel = 'linux-androideabi'
-+        elif kernel == 'unknown-netbsd':
-+            kernel += '-eabihf'
-         else:
-             kernel += 'eabihf'
-     elif cputype == 'mips':
diff --git a/rust/patches/patch-src_bootstrap_builder.rs b/rust/patches/patch-src_bootstrap_builder.rs
deleted file mode 100644
index 799eafa8b4..0000000000
--- a/rust/patches/patch-src_bootstrap_builder.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-src_bootstrap_builder.rs,v 1.11 2020/07/06 13:56:32 he Exp $
-
-Use @PREFIX@, not $ORIGIN in rpath.
-
---- src/bootstrap/builder.rs.orig	2023-10-03 02:52:17.000000000 +0000
-+++ src/bootstrap/builder.rs
-@@ -1637,7 +1637,7 @@ impl<'a> Builder<'a> {
-                 Some(format!("-Wl,-rpath,@loader_path/../{libdir}"))
-             } else if !target.contains("windows") && !target.contains("aix") {
-                 rustflags.arg("-Clink-args=-Wl,-z,origin");
--                Some(format!("-Wl,-rpath,$ORIGIN/../{libdir}"))
-+                Some(format!("-Wl,-rpath,@PREFIX@/lib"))
-             } else {
-                 None
-             };
diff --git a/rust/patches/patch-src_bootstrap_compile.rs b/rust/patches/patch-src_bootstrap_compile.rs
deleted file mode 100644
index d8362e84fd..0000000000
--- a/rust/patches/patch-src_bootstrap_compile.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-src_bootstrap_compile.rs,v 1.1 2020/03/14 08:02:46 jperkin Exp $
-
-On Darwin, do not use @rpath for internal libraries.
-
---- src/bootstrap/compile.rs.orig	2022-12-12 16:02:12.000000000 +0000
-+++ src/bootstrap/compile.rs
-@@ -488,7 +488,7 @@ fn copy_sanitizers(
-             || target == "x86_64-apple-ios"
-         {
-             // Update the library’s install name to reflect that it has been renamed.
--            apple_darwin_update_library_name(&dst, &format!("@rpath/{}", &runtime.name));
-+            apple_darwin_update_library_name(&dst, &format!("@PREFIX@/lib/{}", &runtime.name));
-             // Upon renaming the install name, the code signature of the file will invalidate,
-             // so we will sign it again.
-             apple_darwin_sign_file(&dst);
diff --git a/rust/patches/patch-src_bootstrap_lib.rs b/rust/patches/patch-src_bootstrap_lib.rs
deleted file mode 100644
index 5a21ea08f8..0000000000
--- a/rust/patches/patch-src_bootstrap_lib.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-$NetBSD: patch-src_bootstrap_lib.rs,v 1.7 2020/03/13 18:34:53 jperkin Exp $
-
-Don't filter out optimization flags.
-FreeBSD has a particular C++ runtime library name
-
---- src/bootstrap/lib.rs.orig	2021-09-06 18:42:35.000000000 +0000
-+++ src/bootstrap/lib.rs
-@@ -954,14 +954,13 @@ impl Build {
-             .args()
-             .iter()
-             .map(|s| s.to_string_lossy().into_owned())
--            .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
-             .collect::<Vec<String>>();
- 
-         // If we're compiling on macOS then we add a few unconditional flags
-         // indicating that we want libc++ (more filled out than libstdc++) and
-         // we want to compile for 10.7. This way we can ensure that
-         // LLVM/etc are all properly compiled.
--        if target.contains("apple-darwin") {
-+        if target.contains("apple-darwin") || target.contains("freebsd") {
-             base.push("-stdlib=libc++".into());
-         }
- 
diff --git a/rust/patches/patch-src_bootstrap_llvm.rs b/rust/patches/patch-src_bootstrap_llvm.rs
deleted file mode 100644
index 0f3d31b6de..0000000000
--- a/rust/patches/patch-src_bootstrap_llvm.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD$
-
-Add NetBSD to the list of riscv's which don't need -latomic.
-Try to force use of -latomic on mips* on NetBSD.
-
---- src/bootstrap/llvm.rs.orig	2023-08-03 12:13:07.000000000 +0000
-+++ src/bootstrap/llvm.rs
-@@ -396,6 +396,13 @@ impl Step for Llvm {
-             ldflags.shared.push(" -latomic");
-         }
- 
-+        if target.starts_with("mips") && target.contains("netbsd")
-+        {
-+            // try to force this here, should possibly go elsewhere...
-+            ldflags.exe.push(" -latomic");
-+            ldflags.shared.push(" -latomic");
-+        }
-+
-         if target.contains("msvc") {
-             cfg.define("LLVM_USE_CRT_DEBUG", "MT");
-             cfg.define("LLVM_USE_CRT_RELEASE", "MT");
diff --git a/rust/patches/patch-src_llvm-project_llvm_CMakeLists.txt b/rust/patches/patch-src_llvm-project_llvm_CMakeLists.txt
deleted file mode 100644
index 2477a555c8..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-src_llvm-project_llvm_CMakeLists.txt,v 1.1 2019/04/14 12:42:03 he Exp $
-
-Don't implement sys/regset.h workaround, fix source instead.
-
---- src/llvm-project/llvm/CMakeLists.txt.orig	2018-03-10 02:51:13.000000000 +0000
-+++ src/llvm-project/llvm/CMakeLists.txt
-@@ -939,11 +939,6 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
- # (this is a variable that CrossCompile sets on recursive invocations)
- endif()
- 
--if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
--   # special hack for Solaris to handle crazy system sys/regset.h
--   include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")
--endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
--
- # Make sure we don't get -rdynamic in every binary. For those that need it,
- # use export_executable_symbols(target).
- set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
diff --git a/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake b/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
deleted file mode 100644
index b213c40364..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-$NetBSD: patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake,v 1.3 2020/08/06 11:42:56 jperkin Exp $
-
-On Darwin, use correct install-name for shared libraries.
-
-Undo some of the RPATH magic so that cross-building
-works inside pkgsrc again (indirectly eliminates $ORIGIN rpath
-handling / editing, $ORIGIN handling is partially undone by cwrappers
-in pkgsrc).
-
---- src/llvm-project/llvm/cmake/modules/AddLLVM.cmake.orig	2023-07-12 03:33:01.000000000 +0000
-+++ src/llvm-project/llvm/cmake/modules/AddLLVM.cmake
-@@ -2311,7 +2311,7 @@ function(llvm_setup_rpath name)
-   endif()
- 
-   if (APPLE)
--    set(_install_name_dir INSTALL_NAME_DIR "@rpath")
-+    set(_install_name_dir INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
-     set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-   elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS)
-     # $ORIGIN is not interpreted at link time by aix ld.
-@@ -2320,8 +2320,7 @@ function(llvm_setup_rpath name)
-     # FIXME: update this when there is better solution.
-     set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-   elseif(UNIX)
--    set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
--    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
-+    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
-     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
-       set_property(TARGET ${name} APPEND_STRING PROPERTY
-                    LINK_FLAGS " -Wl,-z,origin ")
-@@ -2335,16 +2334,9 @@ function(llvm_setup_rpath name)
-     return()
-   endif()
- 
--  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not
--  # building for macOS or AIX, as those platforms seemingly require it.
--  # On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF
--  # on install at the moment, so BUILD_WITH_INSTALL_RPATH is required.
-+  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
-   if("${CMAKE_BUILD_RPATH}" STREQUAL "")
--    if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX")
--      set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
--    else()
--      set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")
--    endif()
-+    set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
-   endif()
- 
-   set_target_properties(${name} PROPERTIES
diff --git a/rust/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h b/rust/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
deleted file mode 100644
index 7250a1f149..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
+++ /dev/null
@@ -1,34 +0,0 @@
-$NetBSD: patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h,v 1.1 2019/04/14 12:42:03 he Exp $
-
-Don't implement sys/regset.h workaround, fix source instead.
-
---- src/llvm-project/llvm/include/llvm-c/DataTypes.h.orig	2021-04-17 01:50:37.000000000 +0000
-+++ src/llvm-project/llvm/include/llvm-c/DataTypes.h
-@@ -77,4 +77,27 @@ typedef signed int ssize_t;
- # define UINT64_MAX 0xffffffffffffffffULL
- #endif
- 
-+#if defined(__sun)
-+#include <sys/regset.h>
-+#undef CS
-+#undef DS
-+#undef ES
-+#undef FS
-+#undef GS
-+#undef SS
-+#undef EAX
-+#undef ECX
-+#undef EDX
-+#undef EBX
-+#undef ESP
-+#undef EBP
-+#undef ESI
-+#undef EDI
-+#undef EIP
-+#undef UESP
-+#undef EFL
-+#undef ERR
-+#undef TRAPNO
-+#endif
-+
- #endif /* LLVM_C_DATATYPES_H */
diff --git a/rust/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h b/rust/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
deleted file mode 100644
index 37d491478d..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h,v 1.1 2019/04/14 12:42:03 he Exp $
-
-Fix SunOS CS conflict not handled by include/llvm-c/DataTypes.h
-
---- src/llvm-project/llvm/include/llvm/Analysis/ConstantFolding.h.orig	2018-08-01 16:32:37.000000000 +0000
-+++ src/llvm-project/llvm/include/llvm/Analysis/ConstantFolding.h
-@@ -19,6 +19,10 @@
- #ifndef LLVM_ANALYSIS_CONSTANTFOLDING_H
- #define LLVM_ANALYSIS_CONSTANTFOLDING_H
- 
-+#ifdef __sun
-+#undef CS
-+#endif
-+
- #include <stdint.h>
- 
- namespace llvm {
diff --git a/rust/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h b/rust/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h
deleted file mode 100644
index dbd66f923d..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD$
-
-Do not try to use neon on big-endian aarch64, as we have
-an #error waiting there.
-
---- src/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h.orig	2022-09-02 08:17:54.000000000 +0000
-+++ src/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h
-@@ -64,7 +64,11 @@ enum blake3_flags {
- #if !defined(BLAKE3_USE_NEON) 
-   // If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness
-   #if defined(IS_AARCH64)
--    #define BLAKE3_USE_NEON 1
-+    #if defined(__ARM_BIG_ENDIAN)
-+      #define BLAKE3_USE_NEON 0
-+    #else
-+      #define BLAKE3_USE_NEON 1
-+    #endif
-   #else
-     #define BLAKE3_USE_NEON 0
-   #endif
diff --git a/rust/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp b/rust/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp
deleted file mode 100644
index a368af1663..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD$
-
-Backport change from LLVM 17.0.3, so that rust builds
-with the embedded LLVM.
-Ref. https://github.com/rust-lang/rust/issues/116845.
-
---- src/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp.orig	2023-10-03 02:52:40.000000000 +0000
-+++ src/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
-@@ -15527,7 +15527,7 @@ SDValue PPCTargetLowering::PerformDAGCom
-       break;
-     SDValue ConstOp = DAG.getConstant(Imm, dl, MVT::i32);
-     SDValue NarrowAnd = DAG.getNode(ISD::AND, dl, MVT::i32, NarrowOp, ConstOp);
--    return DAG.getAnyExtOrTrunc(NarrowAnd, dl, N->getValueType(0));
-+    return DAG.getZExtOrTrunc(NarrowAnd, dl, N->getValueType(0));
-   }
-   case ISD::SHL:
-     return combineSHL(N, DCI);
diff --git a/rust/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp b/rust/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
deleted file mode 100644
index 02c93ff2ec..0000000000
--- a/rust/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp,v 1.2 2019/10/02 12:51:43 he Exp $
-
-Avoid ambiguous function call.
-
---- src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp.orig	2019-02-12 15:22:48.000000000 +0000
-+++ src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp
-@@ -592,7 +592,7 @@ static void DumpAnnotatedInput(raw_ostre
-   unsigned LineCount = InputFileText.count('\n');
-   if (InputFileEnd[-1] != '\n')
-     ++LineCount;
--  unsigned LineNoWidth = std::log10(LineCount) + 1;
-+  unsigned LineNoWidth = std::log10((float)LineCount) + 1;
-   // +3 below adds spaces (1) to the left of the (right-aligned) line numbers
-   // on input lines and (2) to the right of the (left-aligned) labels on
-   // annotation lines so that input lines and annotation lines are more
diff --git a/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs b/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
deleted file mode 100644
index ac9ad7239c..0000000000
--- a/rust/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-src_tools_cargo_src_cargo_core_profiles.rs,v 1.3 2019/03/07 20:19:11 jperkin Exp $
-
-Turn off incremental builds for sparc64, ref.
-https://sources.debian.org/patches/cargo/0.29.0-1/2007_sparc64_disable_incremental_build.patch/
-
---- src/tools/cargo/src/cargo/core/profiles.rs.orig	2023-07-12 03:33:05.000000000 +0000
-+++ src/tools/cargo/src/cargo/core/profiles.rs
-@@ -681,6 +681,9 @@ impl Profile {
-             debuginfo: DebugInfo::Resolved(TomlDebugInfo::Full),
-             debug_assertions: true,
-             overflow_checks: true,
-+            #[cfg(target_arch = "sparc64")]
-+            incremental: false,
-+            #[cfg(not(target_arch = "sparc64"))]
-             incremental: true,
-             ..Profile::default()
-         }
diff --git a/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs b/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
deleted file mode 100644
index 7ffba0f965..0000000000
--- a/rust/patches/patch-src_tools_cargo_tests_testsuite_build.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-src_tools_cargo_tests_testsuite_build.rs,v 1.5 2019/08/29 14:09:57 he Exp $
-
-Don't attempt incremental operations on sparc64, ref.
-https://sources.debian.org/patches/cargo/0.29.0-1/2007_sparc64_disable_incremental_build.patch/
-
---- src/tools/cargo/tests/testsuite/build.rs.orig	2019-08-13 06:27:40.000000000 +0000
-+++ src/tools/cargo/tests/testsuite/build.rs
-@@ -47,6 +47,7 @@ fn cargo_fail_with_no_stderr() {
- 
- /// Checks that the `CARGO_INCREMENTAL` environment variable results in
- /// `rustc` getting `-C incremental` passed to it.
-+#[cfg(not(target_arch = "sparc64"))]
- #[cargo_test]
- fn cargo_compile_incremental() {
-     let p = project()
-@@ -69,6 +70,7 @@ fn cargo_compile_incremental() {
-         .run();
- }
- 
-+#[cfg(not(target_arch = "sparc64"))]
- #[cargo_test]
- fn incremental_profile() {
-     let p = project()
-@@ -111,6 +113,7 @@ fn incremental_profile() {
-         .run();
- }
- 
-+#[cfg(not(target_arch = "sparc64"))]
- #[cargo_test]
- fn incremental_config() {
-     let p = project()
diff --git a/rust/patches/patch-src_tools_rust-installer_install-template.sh b/rust/patches/patch-src_tools_rust-installer_install-template.sh
deleted file mode 100644
index e6f15d3a65..0000000000
--- a/rust/patches/patch-src_tools_rust-installer_install-template.sh
+++ /dev/null
@@ -1,168 +0,0 @@
-$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.5 2021/06/09 13:42:30 adam Exp $
-
-No logging to 'install.log'.
-Do not create 'uninstall.sh'.
-
-Rewrite to not use a whole lot of subprocesses just for doing
-pattern matching and substitution in the install phase using "grep"
-and "sed" when shell builtin "case" and "omit shortest match" ops
-should do just fine.
-
---- src/tools/rust-installer/install-template.sh.orig	2021-05-09 02:52:58.000000000 +0000
-+++ src/tools/rust-installer/install-template.sh
-@@ -6,20 +6,12 @@ set -u
- init_logging() {
-     local _abs_libdir="$1"
-     local _logfile="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/install.log"
--    rm -f "$_logfile"
--    need_ok "failed to remove old installation log"
--    touch "$_logfile"
--    need_ok "failed to create installation log"
-     LOGFILE="$_logfile"
- }
- 
- log_line() {
-     local _line="$1"
- 
--    if [ -n "${LOGFILE-}" -a -e "${LOGFILE-}" ]; then
--    echo "$_line" >> "$LOGFILE"
--    # Ignore errors, which may happen e.g. after the manifest dir is deleted
--    fi
- }
- 
- msg() {
-@@ -433,8 +425,8 @@ uninstall_components() {
-             local _directive
-             while read _directive; do
- 
--            local _command=`echo $_directive | cut -f1 -d:`
--            local _file=`echo $_directive | cut -f2 -d:`
-+            local _command=${_directive%%:*}
-+            local _file=${_directive#*:}
- 
-             # Sanity checks
-             if [ ! -n "$_command" ]; then critical_err "malformed installation directive"; fi
-@@ -541,8 +533,8 @@ install_components() {
-     local _directive
-     while read _directive; do
- 
--        local _command=`echo $_directive | cut -f1 -d:`
--        local _file=`echo $_directive | cut -f2 -d:`
-+        local _command=${_directive%%:*}
-+        local _file=${_directive#*:}
- 
-         # Sanity checks
-         if [ ! -n "$_command" ]; then critical_err "malformed installation directive"; fi
-@@ -551,36 +543,24 @@ install_components() {
-         # Decide the destination of the file
-         local _file_install_path="$_dest_prefix/$_file"
- 
--        if echo "$_file" | grep "^etc/" > /dev/null
--        then
--        local _f="$(echo "$_file" | sed 's/^etc\///')"
--        _file_install_path="$CFG_SYSCONFDIR/$_f"
--        fi
--
--        if echo "$_file" | grep "^bin/" > /dev/null
--        then
--        local _f="$(echo "$_file" | sed 's/^bin\///')"
--        _file_install_path="$CFG_BINDIR/$_f"
--        fi
--
--        if echo "$_file" | grep "^lib/" > /dev/null
--        then
--        local _f="$(echo "$_file" | sed 's/^lib\///')"
--        _file_install_path="$CFG_LIBDIR/$_f"
--        fi
--
--        if echo "$_file" | grep "^share" > /dev/null
--        then
--        local _f="$(echo "$_file" | sed 's/^share\///')"
--        _file_install_path="$CFG_DATADIR/$_f"
--        fi
--
--        if echo "$_file" | grep "^share/man/" > /dev/null
--        then
--        local _f="$(echo "$_file" | sed 's/^share\/man\///')"
--        _file_install_path="$CFG_MANDIR/$_f"
--        fi
--
-+        case "$_file" in
-+            etc/*)
-+                local _f=${_file#"etc/"}
-+                _file_install_path="$CFG_DESTDIR_PREFIX/share/doc/cargo/$_f"
-+                ;;
-+            bin/*)
-+                local _f=${_file#"bin/"}
-+                _file_install_path="$CFG_BINDIR/$_f"
-+                ;;
-+            lib/*)
-+                local _f=${_file#"lib/"}
-+                _file_install_path="$CFG_LIBDIR/$_f"
-+                ;;
-+            share/man/*)
-+                local _f=${_file#"share/man/"}
-+                _file_install_path="$CFG_MANDIR/$_f"
-+                ;;
-+            share/doc/*)
-             # HACK: Try to support overriding --docdir.  Paths with the form
-             # "share/doc/$product/" can be redirected to a single --docdir
-             # path. If the following detects that --docdir has been specified
-@@ -591,14 +571,17 @@ install_components() {
-             # contents of those directories are _not_ disjoint. Since this feature
-             # is almost entirely to support 'make install' anyway I don't expect
-             # this problem to be a big deal in practice.
--            if [ "$CFG_DOCDIR" != "<default>" ]
--            then
--            if echo "$_file" | grep "^share/doc/" > /dev/null
--            then
--            local _f="$(echo "$_file" | sed 's/^share\/doc\/[^/]*\///')"
--            _file_install_path="$CFG_DOCDIR/$_f"
--            fi
--            fi
-+                if [ "$CFG_DOCDIR" != "<default>" ]; then
-+                    local _f=${_file#"share/doc/"*/}
-+                    _file_install_path="$CFG_DOCDIR/$_f"
-+                fi
-+                ;;
-+            share/*)
-+                local _f=${_file#"share/"}
-+                _file_install_path="$CFG_DATADIR/$_f"
-+                ;;
-+        esac
-+
- 
-         # Make sure there's a directory for it
-         make_dir_recursive "$(dirname "$_file_install_path")"
-@@ -617,14 +600,16 @@ install_components() {
- 
-             maybe_backup_path "$_file_install_path"
- 
--            if echo "$_file" | grep "^bin/" > /dev/null || test -x "$_src_dir/$_component/$_file"
--            then
--            run cp "$_src_dir/$_component/$_file" "$_file_install_path"
--            run chmod 755 "$_file_install_path"
--            else
-+            local mode=644
-+            if test -x "$_src_dir/$_component/$_file"; then
-+                mode=755
-+            fi
-+            case "$_file" in
-+                bin/*) mode=755
-+                       ;;
-+            esac
-             run cp "$_src_dir/$_component/$_file" "$_file_install_path"
--            run chmod 644 "$_file_install_path"
--            fi
-+            run chmod $mode "$_file_install_path"
-             critical_need_ok "file creation failed"
- 
-             # Update the manifest
-@@ -986,7 +971,6 @@ write_to_file "$TEMPLATE_RUST_INSTALLER_
- critical_need_ok "failed to write installer version"
- 
- # Install the uninstaller
--install_uninstaller "$src_dir" "$src_basename" "$abs_libdir"
- 
- # Install each component
- install_components "$src_dir" "$abs_libdir" "$dest_prefix" "$components"
diff --git a/rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs b/rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
deleted file mode 100644
index 367e90786a..0000000000
--- a/rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Do mmap on NetBSD as well.
-
---- ./vendor/backtrace/src/symbolize/gimli.rs.orig	2022-04-04 11:10:55.000000000 +0000
-+++ ./vendor/backtrace/src/symbolize/gimli.rs
-@@ -38,6 +38,7 @@ cfg_if::cfg_if! {
-         target_os = "ios",
-         target_os = "linux",
-         target_os = "macos",
-+        target_os = "netbsd",
-         target_os = "openbsd",
-         target_os = "solaris",
-         target_os = "illumos",
diff --git a/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs b/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
deleted file mode 100644
index ad3afcd8d1..0000000000
--- a/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD$
-
-Make NetBSD also find its debug libraries, if present.
-
---- vendor/backtrace/src/symbolize/gimli/elf.rs.orig	2022-04-04 11:10:55.000000000 +0000
-+++ vendor/backtrace/src/symbolize/gimli/elf.rs
-@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output:
-     }
- }
- 
-+#[cfg(target_os = "netbsd")]
-+const DEBUG_PATH: &[u8] = b"/usr/libdata/debug";
-+#[cfg(target_os != "netbsd")]
- const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
- 
- fn debug_path_exists() -> bool {
-     cfg_if::cfg_if! {
--        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
-+        if #[cfg(any(target_os = "freebsd", 
-+                     target_os = "netbsd",
-+                     target_os = "linux"))] {
-             use core::sync::atomic::{AtomicU8, Ordering};
-             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
- 
diff --git a/rust/patches/patch-vendor_cc-1.0.73_src_lib.rs b/rust/patches/patch-vendor_cc-1.0.73_src_lib.rs
deleted file mode 100644
index 864beacf10..0000000000
--- a/rust/patches/patch-vendor_cc-1.0.73_src_lib.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD$
-
-Use correct ABI on NetBSD/riscv64.
-
---- vendor/cc-1.0.73/src/lib.rs.orig	2023-05-31 21:44:47.000000000 +0000
-+++ vendor/cc-1.0.73/src/lib.rs
-@@ -1830,6 +1830,9 @@ impl Build {
-                         } else if target.contains("freebsd") && arch.starts_with("64") {
-                             cmd.args.push(("-march=rv64gc").into());
-                             cmd.args.push("-mabi=lp64d".into());
-+                        } else if target.contains("netbsd") && arch.starts_with("64") {
-+                            cmd.args.push(("-march=rv64gc").into());
-+                            cmd.args.push("-mabi=lp64d".into());
-                         } else if target.contains("openbsd") && arch.starts_with("64") {
-                             cmd.args.push(("-march=rv64gc").into());
-                             cmd.args.push("-mabi=lp64d".into());
diff --git a/rust/patches/patch-vendor_cc_src_lib.rs b/rust/patches/patch-vendor_cc_src_lib.rs
deleted file mode 100644
index a4baec163b..0000000000
--- a/rust/patches/patch-vendor_cc_src_lib.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-$NetBSD$
-
-Add aarch64_eb, mipsel and riscv64 for NetBSD.
-
---- vendor/cc/src/lib.rs.orig	2023-10-03 04:12:09.000000000 +0000
-+++ vendor/cc/src/lib.rs
-@@ -1946,6 +1946,9 @@ impl Build {
-                         } else if target.contains("freebsd") && arch.starts_with("64") {
-                             cmd.args.push(("-march=rv64gc").into());
-                             cmd.args.push("-mabi=lp64d".into());
-+                        } else if target.contains("netbsd") && arch.starts_with("64") {
-+                            cmd.args.push(("-march=rv64gc").into());
-+                            cmd.args.push("-mabi=lp64d".into());
-                         } else if target.contains("openbsd") && arch.starts_with("64") {
-                             cmd.args.push(("-march=rv64gc").into());
-                             cmd.args.push("-mabi=lp64d".into());
-@@ -2887,6 +2890,7 @@ impl Build {
-             "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
-             "aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"),
-             "aarch64-unknown-netbsd" => Some("aarch64--netbsd"),
-+            "aarch64_be-unknown-netbsd" => Some("aarch64_be--netbsd"),
-             "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
-             "armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
-             "armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
-@@ -2921,6 +2925,7 @@ impl Build {
-             "mips-unknown-linux-musl" => Some("mips-linux-musl"),
-             "mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"),
-             "mipsel-unknown-linux-musl" => Some("mipsel-linux-musl"),
-+            "mipsel-unknown-netbsd" => Some("mipsel--netbsd"),
-             "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"),
-             "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"),
-             "mipsisa32r6-unknown-linux-gnu" => Some("mipsisa32r6-linux-gnu"),
-@@ -2963,6 +2968,7 @@ impl Build {
-                 "riscv32-unknown-elf",
-                 "riscv-none-embed",
-             ]),
-+            "riscv64gc-unknown-netbsd" => Some("riscv64--netbsd"),
-             "riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"),
-             "riscv32gc-unknown-linux-gnu" => Some("riscv32-linux-gnu"),
-             "riscv64gc-unknown-linux-musl" => Some("riscv64-linux-musl"),
diff --git a/rust/patches/patch-vendor_crossbeam-epoch_no__atomic.rs b/rust/patches/patch-vendor_crossbeam-epoch_no__atomic.rs
deleted file mode 100644
index a05b394053..0000000000
--- a/rust/patches/patch-vendor_crossbeam-epoch_no__atomic.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD$
-
-Add "mipsel-unknown-netbsd" to the list who don't have 
-native 64-bit atomic ops.
-Unify with crossbeam-epoch to get same after-checksum...
-
---- vendor/crossbeam-epoch/no_atomic.rs.orig	2023-07-12 05:06:31.000000000 +0000
-+++ vendor/crossbeam-epoch/no_atomic.rs
-@@ -38,10 +38,10 @@ const NO_ATOMIC_64: &[&str] = &[
-     "mips-unknown-linux-musl",
-     "mips-unknown-linux-uclibc",
-     "mipsel-sony-psp",
--    "mipsel-sony-psx",
-     "mipsel-unknown-linux-gnu",
-     "mipsel-unknown-linux-musl",
-     "mipsel-unknown-linux-uclibc",
-+    "mipsel-unknown-netbsd",
-     "mipsel-unknown-none",
-     "mipsisa32r6-unknown-linux-gnu",
-     "mipsisa32r6el-unknown-linux-gnu",
diff --git a/rust/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs b/rust/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs
deleted file mode 100644
index a0f384c943..0000000000
--- a/rust/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-No 64-bit atomics on NetBSD/mipsel.
-
---- vendor/crossbeam-utils-0.8.14/no_atomic.rs.orig	2023-07-12 05:06:31.000000000 +0000
-+++ vendor/crossbeam-utils-0.8.14/no_atomic.rs
-@@ -41,6 +41,7 @@ const NO_ATOMIC_64: &[&str] = &[
-     "mipsel-unknown-linux-gnu",
-     "mipsel-unknown-linux-musl",
-     "mipsel-unknown-linux-uclibc",
-+    "mipsel-unknown-netbsd",
-     "mipsel-unknown-none",
-     "mipsisa32r6-unknown-linux-gnu",
-     "mipsisa32r6el-unknown-linux-gnu",
diff --git a/rust/patches/patch-vendor_crossbeam-utils_no__atomic.rs b/rust/patches/patch-vendor_crossbeam-utils_no__atomic.rs
deleted file mode 100644
index 39278590c8..0000000000
--- a/rust/patches/patch-vendor_crossbeam-utils_no__atomic.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD$
-
-Add mipsel-unknown-netbsd target as not having 64-bit atomics.
-Unify with crossbeam-utils-0.8.12 by removing mipsel-sony-psx.
-
---- vendor/crossbeam-utils/no_atomic.rs.orig	2023-07-12 05:06:31.000000000 +0000
-+++ vendor/crossbeam-utils/no_atomic.rs
-@@ -38,10 +38,10 @@ const NO_ATOMIC_64: &[&str] = &[
-     "mips-unknown-linux-musl",
-     "mips-unknown-linux-uclibc",
-     "mipsel-sony-psp",
--    "mipsel-sony-psx",
-     "mipsel-unknown-linux-gnu",
-     "mipsel-unknown-linux-musl",
-     "mipsel-unknown-linux-uclibc",
-+    "mipsel-unknown-netbsd",
-     "mipsel-unknown-none",
-     "mipsisa32r6-unknown-linux-gnu",
-     "mipsisa32r6el-unknown-linux-gnu",
diff --git a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs
deleted file mode 100644
index 481c21650c..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add file for NetBSD/mips in mips32 variant.
-
---- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-04-23 15:53:16.504282187 +0000
-+++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mips.rs
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i32;
-+pub type c_ulong = u32;
-+pub type c_char = i8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
deleted file mode 100644
index 3255ae313a..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-$NetBSD$
-
-Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips
-and NetBSD/riscv64.
-
-Add fix to cpuid_t definition by applying
-  https://github.com/rust-lang/libc/pull/3386
-
---- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2023-04-16 23:32:41.000000000 +0000
-+++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mod.rs
-@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
- pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
- pub type lwpid_t = ::c_uint;
- pub type shmatt_t = ::c_uint;
--pub type cpuid_t = u64;
-+pub type cpuid_t = ::c_ulong;
- pub type cpuset_t = _cpuset;
- pub type pthread_spin_t = ::c_uchar;
- pub type timer_t = ::c_int;
-@@ -3049,6 +3049,22 @@ extern "C" {
-     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
- }
- 
-+#[link(name = "execinfo")]
-+extern "C" {
-+    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
-+    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
-+    pub fn backtrace_symbols_fd(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fd: ::c_int,
-+    ) -> ::c_int;
-+    pub fn backtrace_symbols_fmt(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fmt: *const ::c_char,
-+    ) -> *mut *mut ::c_char;
-+}
-+
- cfg_if! {
-     if #[cfg(target_arch = "aarch64")] {
-         mod aarch64;
-@@ -3068,7 +3084,15 @@ cfg_if! {
-     } else if #[cfg(target_arch = "x86")] {
-         mod x86;
-         pub use self::x86::*;
-+    } else if #[cfg(target_arch = "mips")] {
-+	mod mips;
-+	pub use self::mips::*;
-+    } else if #[cfg(target_arch = "riscv64")] {
-+        mod riscv64;
-+        pub use self::riscv64:*;
-     } else {
--        // Unknown target_arch
-+        // Unknown target_arch, this should error out
-+	mod unknown;
-+	pub use self::unknown::*;
-     }
- }
diff --git a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
deleted file mode 100644
index 1d49d0e5ff..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD$
-
-Spec for riscv64.
-
---- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-02 18:40:59.815126792 +0000
-+++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/riscv64.rs	2023-07-02 18:38:40.729445691 +0000
-@@ -0,0 +1,24 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i64;
-+pub type c_ulong = u64;
-+pub type c_char = u8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+// pub const _MAX_PAGE_SHIFT: u32 = 12;
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs
deleted file mode 100644
index c1c5c2a88a..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add NetBSD/mipsel (mips32 required).
-
---- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-07-14 09:09:26.430133820 +0000
-+++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mips.rs
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i32;
-+pub type c_ulong = u32;
-+pub type c_char = i8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs
deleted file mode 100644
index b44d69b4ba..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-$NetBSD$
-
-Add support for NetBSD/mipsel and NetBSD/riscv64.
-Also try to enable backtrace support.
-
-Add fix to cpuid_t definition by applying
-  https://github.com/rust-lang/libc/pull/3386
-
---- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2023-07-12 05:06:31.000000000 +0000
-+++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mod.rs
-@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
- pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
- pub type lwpid_t = ::c_uint;
- pub type shmatt_t = ::c_uint;
--pub type cpuid_t = u64;
-+pub type cpuid_t = ::c_ulong;
- pub type cpuset_t = _cpuset;
- pub type pthread_spin_t = ::c_uchar;
- pub type timer_t = ::c_int;
-@@ -3111,6 +3111,22 @@ extern "C" {
-     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
- }
- 
-+#[link(name = "execinfo")]
-+extern "C" {
-+    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
-+    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
-+    pub fn backtrace_symbols_fd(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fd: ::c_int,
-+    ) -> ::c_int;
-+    pub fn backtrace_symbols_fmt(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fmt: *const ::c_char,
-+    ) -> *mut *mut ::c_char;
-+}
-+
- cfg_if! {
-     if #[cfg(target_arch = "aarch64")] {
-         mod aarch64;
-@@ -3130,7 +3146,15 @@ cfg_if! {
-     } else if #[cfg(target_arch = "x86")] {
-         mod x86;
-         pub use self::x86::*;
-+    } else if #[cfg(target_arch = "mips")] {
-+        mod mips;
-+        pub use self::mips::*;
-+    } else if #[cfg(target_arch = "riscv64")] {
-+        mod riscv64;
-+        pub use self::riscv64::*;
-     } else {
--        // Unknown target_arch
-+        // Unknown target_arch, this should error out
-+        mod unknown;
-+        pub use self::unknown::*;
-     }
- }
diff --git a/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
deleted file mode 100644
index fc553ba621..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add support for NetBSD/riscv64.
-
---- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-14 09:12:33.579150305 +0000
-+++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i64;
-+pub type c_ulong = u64;
-+pub type c_char = u8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs b/rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs
deleted file mode 100644
index 26aacb29c2..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Fix xattr build.
-
---- vendor/libc-0.2.140/src/unix/solarish/mod.rs.orig	2023-08-23 22:08:20.000000000 +0000
-+++ vendor/libc-0.2.140/src/unix/solarish/mod.rs
-@@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58;
- pub const ENOTRECOVERABLE: ::c_int = 59;
- pub const ENOSTR: ::c_int = 60;
- pub const ENODATA: ::c_int = 61;
-+// This is not supported but is required for xattr
-+pub const ENOATTR: ::c_int = ::ENODATA;
- pub const ETIME: ::c_int = 62;
- pub const ENOSR: ::c_int = 63;
- pub const ENONET: ::c_int = 64;
diff --git a/rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs
deleted file mode 100644
index 714f43f385..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add file for NetBSD/mips in mips32 variant.
-
---- vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-04-23 16:08:32.294600810 +0000
-+++ vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/mips.rs
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i32;
-+pub type c_ulong = u32;
-+pub type c_char = i8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
deleted file mode 100644
index 90705866f9..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD$
-
-Spec for riscv64.
-
---- vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-02 18:40:59.815126792 +0000
-+++ vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/riscv64.rs	2023-07-02 18:38:40.729445691 +0000
-@@ -0,0 +1,24 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i64;
-+pub type c_ulong = u64;
-+pub type c_char = u8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+// pub const _MAX_PAGE_SHIFT: u32 = 12;
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs
deleted file mode 100644
index 1c653365cd..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add support for NetBSD/mipsel (needs mips32).
-
---- vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-07-14 09:16:55.357761685 +0000
-+++ vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mips.rs
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i32;
-+pub type c_ulong = u32;
-+pub type c_char = i8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs
deleted file mode 100644
index d91f3aefa1..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-$NetBSD$
-
-Add support for NetBSD/mipsel and NetBSD/riscv64.
-Also try to enable backtrace support.
-
-Add fix to cpuid_t definition by applying
-  https://github.com/rust-lang/libc/pull/3386
-
---- vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2023-07-12 05:06:31.000000000 +0000
-+++ vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mod.rs
-@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
- pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
- pub type lwpid_t = ::c_uint;
- pub type shmatt_t = ::c_uint;
--pub type cpuid_t = u64;
-+pub type cpuid_t = ::c_ulong;
- pub type cpuset_t = _cpuset;
- pub type pthread_spin_t = ::c_uchar;
- pub type timer_t = ::c_int;
-@@ -3153,6 +3153,22 @@ extern "C" {
-     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
- }
- 
-+#[link(name = "execinfo")]
-+extern "C" {
-+    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
-+    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
-+    pub fn backtrace_symbols_fd(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fd: ::c_int,
-+    ) -> ::c_int;
-+    pub fn backtrace_symbols_fmt(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fmt: *const ::c_char,
-+    ) -> *mut *mut ::c_char;
-+}
-+
- cfg_if! {
-     if #[cfg(target_arch = "aarch64")] {
-         mod aarch64;
-@@ -3172,7 +3188,15 @@ cfg_if! {
-     } else if #[cfg(target_arch = "x86")] {
-         mod x86;
-         pub use self::x86::*;
-+    } else if #[cfg(target_arch = "mips")] {
-+        mod mips;
-+        pub use self::mips::*;
-+    } else if #[cfg(target_arch = "riscv64")] {
-+        mod riscv64;
-+        pub use self::riscv64::*;
-     } else {
--        // Unknown target_arch
-+        // Unknown target_arch, this should error out
-+        mod unknown;
-+        pub use self::unknown::*;
-     }
- }
diff --git a/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
deleted file mode 100644
index 9b552a0f2b..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add support for NetBSD/riscv64.
-
---- vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-14 09:17:03.907579820 +0000
-+++ vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i64;
-+pub type c_ulong = u64;
-+pub type c_char = u8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs b/rust/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs
deleted file mode 100644
index 1cffe4aacf..0000000000
--- a/rust/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Fix xattr build.
-
---- vendor/libc-0.2.146/src/unix/solarish/mod.rs.orig	2023-08-23 22:08:20.000000000 +0000
-+++ vendor/libc-0.2.146/src/unix/solarish/mod.rs
-@@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58;
- pub const ENOTRECOVERABLE: ::c_int = 59;
- pub const ENOSTR: ::c_int = 60;
- pub const ENODATA: ::c_int = 61;
-+// This is not supported but is required for xattr
-+pub const ENOATTR: ::c_int = ::ENODATA;
- pub const ETIME: ::c_int = 62;
- pub const ENOSR: ::c_int = 63;
- pub const ENONET: ::c_int = 64;
diff --git a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs
deleted file mode 100644
index 514e6518ca..0000000000
--- a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-$NetBSD$
-
-Add mips support.
-
---- vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2022-11-06 22:14:03.866753983 +0000
-+++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs	2022-11-06 22:07:15.448812020 +0000
-@@ -0,0 +1,22 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i32;
-+pub type c_ulong = u32;
-+pub type c_char = i8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
deleted file mode 100644
index 90d1171191..0000000000
--- a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-$NetBSD$
-
-Copy execinfo function definitions from openbsd's mod.rs.
-Add entries for NetBSD/mipsel and NetBSD/riscv64.
-
-Add fix to cpuid_t definition by applying
-  https://github.com/rust-lang/libc/pull/3386
-
---- vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2022-05-10 20:59:35.217463943 +0000
-+++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
-@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
- pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
- pub type lwpid_t = ::c_uint;
- pub type shmatt_t = ::c_uint;
--pub type cpuid_t = u64;
-+pub type cpuid_t = ::c_ulong;
- pub type cpuset_t = _cpuset;
- pub type pthread_spin_t = ::c_uchar;
- pub type timer_t = ::c_int;
-@@ -3153,6 +3153,22 @@ extern "C" {
-     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
- }
- 
-+#[link(name = "execinfo")]
-+extern "C" {
-+    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
-+    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
-+    pub fn backtrace_symbols_fd(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fd: ::c_int,
-+    ) -> ::c_int;
-+    pub fn backtrace_symbols_fmt(
-+        addrlist: *const *mut ::c_void,
-+        len: ::size_t,
-+        fmt: *const ::c_char,
-+    ) -> *mut *mut ::c_char;
-+}
-+
- cfg_if! {
-     if #[cfg(target_arch = "aarch64")] {
-         mod aarch64;
-@@ -3172,7 +3188,15 @@ cfg_if! {
-     } else if #[cfg(target_arch = "x86")] {
-         mod x86;
-         pub use self::x86::*;
-+    } else if #[cfg(target_arch = "mips")] {
-+        mod mips;
-+        pub use self::mips::*;
-+    } else if #[cfg(target_arch = "riscv64")] {
-+        mod riscv64;
-+        pub use self::riscv64::*;
-     } else {
--        // Unknown target_arch
-+        // Unknown target_arch, this should error out
-+        mod unknown;
-+        pub use self::unknown::*;
-     }
- }
diff --git a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
deleted file mode 100644
index 4be5badc1c..0000000000
--- a/rust/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD$
-
-Spec for riscv64.
-
---- vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-10-06 16:39:21.061468733 +0000
-+++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
-@@ -0,0 +1,24 @@
-+use PT_FIRSTMACH;
-+
-+pub type c_long = i64;
-+pub type c_ulong = u64;
-+pub type c_char = u8;
-+pub type __cpu_simple_lock_nv_t = ::c_int;
-+
-+// should be pub(crate), but that requires Rust 1.18.0
-+cfg_if! {
-+    if #[cfg(libc_const_size_of)] {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
-+    } else {
-+        #[doc(hidden)]
-+        pub const _ALIGNBYTES: usize = 8 - 1;
-+    }
-+}
-+
-+// pub const _MAX_PAGE_SHIFT: u32 = 12;
-+
-+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
-+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
-+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
-+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs b/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs
deleted file mode 100644
index bcf64dadb2..0000000000
--- a/rust/patches/patch-vendor_libc_src_unix_solarish_mod.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-vendor_libc_src_unix_solarish_mod.rs,v 1.1 2019/05/31 14:11:23 jperkin Exp $
-
-Fix xattr build.
-
---- vendor/libc/src/unix/solarish/mod.rs.orig	2019-05-20 13:47:24.000000000 +0000
-+++ vendor/libc/src/unix/solarish/mod.rs
-@@ -1215,6 +1215,8 @@ pub const EOWNERDEAD: ::c_int = 58;
- pub const ENOTRECOVERABLE: ::c_int = 59;
- pub const ENOSTR: ::c_int = 60;
- pub const ENODATA: ::c_int = 61;
-+// This is not supported but is required for xattr
-+pub const ENOATTR: ::c_int = ::ENODATA;
- pub const ETIME: ::c_int = 62;
- pub const ENOSR: ::c_int = 63;
- pub const ENONET: ::c_int = 64;
diff --git a/rust/patches/patch-vendor_lzma-sys_config.h b/rust/patches/patch-vendor_lzma-sys_config.h
deleted file mode 100644
index 67963cec47..0000000000
--- a/rust/patches/patch-vendor_lzma-sys_config.h
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-vendor_lzma-sys_config.h,v 1.1 2019/10/28 00:42:21 jperkin Exp $
-
-Fix SunOS builds with newer compilers.
-
---- vendor/lzma-sys/config.h.orig	2020-10-07 09:33:31.000000000 +0000
-+++ vendor/lzma-sys/config.h
-@@ -35,7 +35,11 @@
-     // change to `MYTHREAD_WIN95` if targeting Windows XP or earlier
-     #define MYTHREAD_VISTA 1
- #else
-+#if !defined(__sun) || (__STDC_VERSION__-0 < 199901L)
-     #define _POSIX_C_SOURCE 199506L
-+#else
-+    #define _POSIX_C_SOURCE 200112L
-+#endif
-     #define MYTHREAD_POSIX 1
- #endif
- 
diff --git a/rust/patches/patch-vendor_nix_src_sys_signal.rs b/rust/patches/patch-vendor_nix_src_sys_signal.rs
deleted file mode 100644
index 7bac2daf6c..0000000000
--- a/rust/patches/patch-vendor_nix_src_sys_signal.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD$
-
-Narrow the conditional on mips to only apply to Linux.
-
---- vendor/nix/src/sys/signal.rs.orig	2023-01-25 01:49:16.000000000 +0000
-+++ vendor/nix/src/sys/signal.rs
-@@ -1069,7 +1069,7 @@ mod sigevent {
-                 SigevNotify::SigevThreadId{..} => libc::SIGEV_THREAD_ID,
-                 #[cfg(all(target_os = "linux", target_env = "uclibc"))]
-                 SigevNotify::SigevThreadId{..} => libc::SIGEV_THREAD_ID,
--                #[cfg(any(all(target_os = "linux", target_env = "musl"), target_arch = "mips"))]
-+                #[cfg(all(target_os = "linux", target_env = "musl", target_arch = "mips"))]
-                 SigevNotify::SigevThreadId{..} => 4  // No SIGEV_THREAD_ID defined
-             };
-             sev.sigev_signo = match sigev_notify {
diff --git a/rust/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf b/rust/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf
deleted file mode 100644
index 17def504e5..0000000000
--- a/rust/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD$
-
-Replicate part of
-https://github.com/openssl/openssl/pull/15086
-
---- vendor/openssl-src/openssl/Configurations/10-main.conf.orig	2023-08-03 13:47:25.000000000 +0000
-+++ vendor/openssl-src/openssl/Configurations/10-main.conf
-@@ -950,6 +950,10 @@ my %targets = (
-         shared_cflag     => "-fPIC",
-         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
-     },
-+    "NetBSD-generic32" => {
-+        inherit_from     => [ "BSD-generic32" ],
-+        ex_libs          => add("-latomic"),
-+    },
-     "BSD-generic64" => {
-         inherit_from     => [ "BSD-generic32" ],
-         bn_ops           => "SIXTY_FOUR_BIT_LONG",
diff --git a/rust/patches/patch-vendor_openssl-src_src_lib.rs b/rust/patches/patch-vendor_openssl-src_src_lib.rs
deleted file mode 100644
index 7c72ce5edf..0000000000
--- a/rust/patches/patch-vendor_openssl-src_src_lib.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-$NetBSD: patch-vendor_openssl-src_src_lib.rs,v 1.1 2021/01/01 20:44:48 he Exp $
-
-Provide defaults for the various NetBSD targets.
-
---- vendor/openssl-src/src/lib.rs.orig	2023-07-12 05:06:32.000000000 +0000
-+++ vendor/openssl-src/src/lib.rs
-@@ -239,6 +239,8 @@ impl Build {
-             "aarch64-unknown-freebsd" => "BSD-generic64",
-             "aarch64-unknown-linux-gnu" => "linux-aarch64",
-             "aarch64-unknown-linux-musl" => "linux-aarch64",
-+            "aarch64-unknown-netbsd" => "BSD-generic64",
-+            "aarch64_be-unknown-netbsd" => "BSD-generic64",
-             "aarch64-pc-windows-msvc" => "VC-WIN64-ARM",
-             "arm-linux-androideabi" => "linux-armv4",
-             "armv7-linux-androideabi" => "linux-armv4",
-@@ -249,14 +251,17 @@ impl Build {
-             "armv5te-unknown-linux-gnueabi" => "linux-armv4",
-             "armv5te-unknown-linux-musleabi" => "linux-armv4",
-             "armv6-unknown-freebsd" => "BSD-generic32",
-+            "armv6-unknown-netbsd-eabihf" => "BSD-generic32",
-             "armv7-unknown-freebsd" => "BSD-generic32",
-             "armv7-unknown-linux-gnueabi" => "linux-armv4",
-             "armv7-unknown-linux-musleabi" => "linux-armv4",
-             "armv7-unknown-linux-gnueabihf" => "linux-armv4",
-             "armv7-unknown-linux-musleabihf" => "linux-armv4",
-+            "armv7-unknown-netbsd-eabihf" => "BSD-generic32",
-             "asmjs-unknown-emscripten" => "gcc",
-             "i586-unknown-linux-gnu" => "linux-elf",
-             "i586-unknown-linux-musl" => "linux-elf",
-+            "i586-unknown-netbsd" => "BSD-x86-elf",
-             "i686-apple-darwin" => "darwin-i386-cc",
-             "i686-linux-android" => "linux-elf",
-             "i686-pc-windows-gnu" => "mingw",
-@@ -264,6 +269,7 @@ impl Build {
-             "i686-unknown-freebsd" => "BSD-x86-elf",
-             "i686-unknown-linux-gnu" => "linux-elf",
-             "i686-unknown-linux-musl" => "linux-elf",
-+            "i686-unknown-netbsd" => "BSD-x86-elf",
-             "loongarch64-unknown-linux-gnu" => "linux64-loongarch64",
-             "mips-unknown-linux-gnu" => "linux-mips32",
-             "mips-unknown-linux-musl" => "linux-mips32",
-@@ -273,9 +279,11 @@ impl Build {
-             "mips64el-unknown-linux-muslabi64" => "linux64-mips64",
-             "mipsel-unknown-linux-gnu" => "linux-mips32",
-             "mipsel-unknown-linux-musl" => "linux-mips32",
-+            "mipsel-unknown-netbsd" => "NetBSD-generic32",
-             "powerpc-unknown-freebsd" => "BSD-generic32",
-             "powerpc-unknown-linux-gnu" => "linux-ppc",
-             "powerpc-unknown-linux-gnuspe" => "linux-ppc",
-+            "powerpc-unknown-netbsd" => "BSD-generic32",
-             "powerpc64-unknown-freebsd" => "BSD-generic64",
-             "powerpc64-unknown-linux-gnu" => "linux-ppc64",
-             "powerpc64-unknown-linux-musl" => "linux-ppc64",
-@@ -283,8 +291,10 @@ impl Build {
-             "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
-             "powerpc64le-unknown-linux-musl" => "linux-ppc64le",
-             "riscv64gc-unknown-linux-gnu" => "linux-generic64",
-+            "riscv64gc-unknown-netbsd" => "BSD-generic64",
-             "s390x-unknown-linux-gnu" => "linux64-s390x",
-             "s390x-unknown-linux-musl" => "linux64-s390x",
-+            "sparc64-unknown-netbsd" => "BSD-generic64",
-             "x86_64-apple-darwin" => "darwin64-x86_64-cc",
-             "x86_64-linux-android" => "linux-x86_64",
-             "x86_64-pc-windows-gnu" => "mingw64",
diff --git a/rust/patches/patch-vendor_openssl-sys_build_find__normal.rs b/rust/patches/patch-vendor_openssl-sys_build_find__normal.rs
deleted file mode 100644
index 05d96b1783..0000000000
--- a/rust/patches/patch-vendor_openssl-sys_build_find__normal.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD: patch-vendor_openssl-sys_build_find__normal.rs,v 1.1 2023/06/19 14:46:47 bsiegert Exp $
-
-Add hack for Darwin when homebrew is installed.
-
---- vendor/openssl-sys/build/find_normal.rs.orig	2023-05-31 21:44:49.000000000 +0000
-+++ vendor/openssl-sys/build/find_normal.rs
-@@ -72,23 +72,6 @@ fn resolve_with_wellknown_location(dir:
- fn find_openssl_dir(target: &str) -> OsString {
-     let host = env::var("HOST").unwrap();
- 
--    if host == target && target.ends_with("-apple-darwin") {
--        let homebrew_dir = match target {
--            "aarch64-apple-darwin" => "/opt/homebrew",
--            _ => "/usr/local",
--        };
--
--        if let Some(dir) = resolve_with_wellknown_homebrew_location(homebrew_dir) {
--            return dir.into();
--        } else if let Some(dir) = resolve_with_wellknown_location("/opt/pkg") {
--            // pkgsrc
--            return dir.into();
--        } else if let Some(dir) = resolve_with_wellknown_location("/opt/local") {
--            // MacPorts
--            return dir.into();
--        }
--    }
--
-     try_pkg_config();
-     try_vcpkg();
- 
diff --git a/rust/patches/patch-vendor_openssl-sys_build_main.rs b/rust/patches/patch-vendor_openssl-sys_build_main.rs
deleted file mode 100644
index 7433a659c2..0000000000
--- a/rust/patches/patch-vendor_openssl-sys_build_main.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-$NetBSD$
-
-Patterned after Linux and Android, on 32-bit NetBSD ports
-include -latomic.  Parts of this inspired by
-https://github.com/sfackler/rust-openssl/commit/a0a1d1d29263abb7c47fc2e58cef8dab13762a45
-
---- vendor/openssl-sys/build/main.rs.orig	2022-11-02 16:21:42.000000000 +0000
-+++ vendor/openssl-sys/build/main.rs
-@@ -122,6 +122,15 @@ fn main() {
-         println!("cargo:rustc-link-lib={}={}", kind, lib);
-     }
- 
-+    // Patterned of the above, make sure we include -latomic
-+    // on ilp32 ports (yes, this only tests the "p32" part).
-+    if kind == "static"
-+	&& env::var("CARGO_CFG_TARGET_OS").unwrap() == "netbsd"
-+	&& env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32"
-+    {
-+	println!("cargo:rustc-link-lib=dylib=atomic");
-+    }
-+
-     if kind == "static" && target.contains("windows") {
-         println!("cargo:rustc-link-lib=dylib=gdi32");
-         println!("cargo:rustc-link-lib=dylib=user32");
diff --git a/rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs b/rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
deleted file mode 100644
index 98a1d9cb7b..0000000000
--- a/rust/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD$
-
-Add aarch64_be NetBSD target.
-
---- /dev/null	2021-04-26 00:02:43.147970692 +0200
-+++ vendor/rustc-ap-rustc_target/src/spec/aarch64_be_unknown_netbsd.rs	2021-04-26 00:07:44.657579025 +0200
-@@ -0,0 +1,20 @@
-+use crate::abi::Endian;
-+use crate::spec::{Target, TargetOptions};
-+
-+pub fn target() -> Target {
-+    let mut base = super::netbsd_base::opts();
-+    base.max_atomic_width = Some(128);
-+    base.unsupported_abis = super::arm_base::unsupported_abis();
-+
-+    Target {
-+        llvm_target: "aarch64_be-unknown-netbsd".to_string(),
-+        pointer_width: 64,
-+        data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
-+        arch: "aarch64".to_string(),
-+        options: TargetOptions {
-+            mcount: "__mcount".to_string(),
-+            endian: Endian::Big,
-+            ..base
-+        },
-+    }
-+}
diff --git a/rust/patches/patch-vendor_stacker_src_lib.rs b/rust/patches/patch-vendor_stacker_src_lib.rs
deleted file mode 100644
index dfd1589f54..0000000000
--- a/rust/patches/patch-vendor_stacker_src_lib.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-vendor_stacker_src_lib.rs,v 1.1 2020/08/06 11:42:56 jperkin Exp $
-
-Avoid missing pthread_* on older SunOS.
-
---- vendor/stacker/src/lib.rs.orig	2020-07-13 18:18:17.000000000 +0000
-+++ vendor/stacker/src/lib.rs
-@@ -407,7 +407,7 @@ cfg_if! {
-             );
-             Some(mi.assume_init().AllocationBase as usize + get_thread_stack_guarantee() + 0x1000)
-         }
--    } else if #[cfg(any(target_os = "linux", target_os="solaris", target_os = "netbsd"))] {
-+    } else if #[cfg(any(target_os = "linux", target_os = "netbsd"))] {
-         unsafe fn guess_os_stack_limit() -> Option<usize> {
-             let mut attr = std::mem::MaybeUninit::<libc::pthread_attr_t>::uninit();
-             assert_eq!(libc::pthread_attr_init(attr.as_mut_ptr()), 0);
diff --git a/rust/patches/patch-vendor_target-lexicon_src_targets.rs b/rust/patches/patch-vendor_target-lexicon_src_targets.rs
deleted file mode 100644
index 7771d25feb..0000000000
--- a/rust/patches/patch-vendor_target-lexicon_src_targets.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-$NetBSD$
-
-Add aarch64_eb, mipsel and riscv64gc for NetBSD.
-
---- vendor/target-lexicon/src/targets.rs.orig	2021-05-03 21:35:46.000000000 +0000
-+++ vendor/target-lexicon/src/targets.rs
-@@ -1357,6 +1357,7 @@ mod tests {
-             "aarch64-unknown-linux-gnu_ilp32",
-             "aarch64-unknown-linux-musl",
-             "aarch64-unknown-netbsd",
-+            "aarch64_be-unknown-netbsd",
-             "aarch64-unknown-none",
-             "aarch64-unknown-none-softfloat",
-             "aarch64-unknown-openbsd",
-@@ -1441,6 +1442,7 @@ mod tests {
-             "mipsel-unknown-linux-gnu",
-             "mipsel-unknown-linux-musl",
-             "mipsel-unknown-linux-uclibc",
-+            "mipsel-unknown-netbsd",
-             "mipsel-unknown-none",
-             "mipsisa32r6el-unknown-linux-gnu",
-             "mipsisa32r6-unknown-linux-gnu",
-@@ -1478,6 +1480,7 @@ mod tests {
-             "riscv64gc-unknown-freebsd",
-             "riscv64gc-unknown-linux-gnu",
-             "riscv64gc-unknown-linux-musl",
-+            "riscv64gc-unknown-netbsd",
-             "riscv64gc-unknown-none-elf",
-             "riscv64gc-unknown-openbsd",
-             "riscv64imac-unknown-none-elf",
diff --git a/rust/patches/patch-vendor_valuable_no__atomic.rs b/rust/patches/patch-vendor_valuable_no__atomic.rs
deleted file mode 100644
index f485c63d9d..0000000000
--- a/rust/patches/patch-vendor_valuable_no__atomic.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD$
-
-Add mipsel-unknown-netbsd.
-
---- vendor/valuable/no_atomic.rs.orig	2022-09-19 15:35:03.000000000 +0000
-+++ vendor/valuable/no_atomic.rs
-@@ -30,6 +30,7 @@ const NO_ATOMIC_64: &[&str] = &[
-     "mipsel-unknown-linux-musl",
-     "mipsel-unknown-linux-uclibc",
-     "mipsel-unknown-none",
-+    "mipsel-unknown-netbsd",
-     "mipsisa32r6-unknown-linux-gnu",
-     "mipsisa32r6el-unknown-linux-gnu",
-     "powerpc-unknown-freebsd",
diff --git a/rust/platform.mk b/rust/platform.mk
deleted file mode 100644
index cc75fd55ab..0000000000
--- a/rust/platform.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# $NetBSD: platform.mk,v 1.6 2020/12/26 10:04:51 nia Exp $
-
-# This file encodes whether a given platform has support for rust.
-
-# Platforms where rust ought to work but does not require a link to an
-# open PR.
-
-.if !defined(PLATFORM_SUPPORTS_RUST)
-
-# Rust needs NetBSD>7
-.for rust_arch in aarch64 earmv7hf i386 powerpc riscv64 sparc64 x86_64
-.  for rust_os in Darwin FreeBSD Linux NetBSD SunOS
-.    if ${OPSYS} != "NetBSD" || empty(OS_VERSION:M[0-7].*)
-RUST_PLATFORMS+=	${rust_os}-*-${rust_arch}
-.    endif
-.  endfor
-.endfor
-
-.for rust_platform in ${RUST_PLATFORMS}
-.  if !empty(MACHINE_PLATFORM:M${rust_platform})
-PLATFORM_SUPPORTS_RUST=		yes
-.  endif
-.endfor
-PLATFORM_SUPPORTS_RUST?=	no
-
-.endif # !defined(PLATFORM_SUPPORTS_RUST)
diff --git a/rust/rust.mk b/rust/rust.mk
deleted file mode 100644
index d930124865..0000000000
--- a/rust/rust.mk
+++ /dev/null
@@ -1,55 +0,0 @@
-# $NetBSD: rust.mk,v 1.7 2020/10/14 08:23:49 triaxx Exp $
-#
-# This file determines the type of rust package to use.
-#
-# It should be included by rust-dependent packages that don't use
-# cargo.mk.
-#
-# === User-settable variables ===
-#
-# RUST_TYPE
-#	The preferred type of Rust release to use -
-#	either bootstrap-from-source or an official binary.
-#
-#	Official Rust binaries are only published for certain platforms,
-#	including Darwin, FreeBSD, Linux, and NetBSD x86_64.
-#
-#	Possible values: src bin
-#	Default: src
-#
-# === Package-settable variables ===
-#
-# RUST_REQ
-#	The minimum version of Rust required by the package.
-#
-#	Default: 1.56.1
-#
-# RUST_RUNTIME
-#	Whether rust is a runtime dependency.
-#	Usually it is only needed to build.
-#
-#	Possible values: yes no
-#	Default: no
-
-.include "../../mk/bsd.fast.prefs.mk"
-
-RUST_REQ?=	1.56.1
-RUST_RUNTIME?=	no
-
-RUST_TYPE?=	src
-
-.if ${RUST_TYPE} == "bin"
-.  if ${RUST_RUNTIME} == "no"
-BUILDLINK_DEPMETHOD.rust-bin?=		build
-.  endif
-BUILDLINK_API_DEPENDS.rust-bin+=	rust-bin>=${RUST_REQ}
-.  include "../../lang/rust-bin/buildlink3.mk"
-.endif
-
-.if ${RUST_TYPE} == "src"
-.  if ${RUST_RUNTIME} == "no"
-BUILDLINK_DEPMETHOD.rust?=		build
-.  endif
-BUILDLINK_API_DEPENDS.rust+=		rust>=${RUST_REQ}
-.  include "../../lang/rust/buildlink3.mk"
-.endif
diff --git a/rust173/DESCR b/rust173/DESCR
new file mode 100644
index 0000000000..6dc90a671e
--- /dev/null
+++ b/rust173/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/rust173/Makefile b/rust173/Makefile
new file mode 100644
index 0000000000..5dcac68758
--- /dev/null
+++ b/rust173/Makefile
@@ -0,0 +1,714 @@
+# $NetBSD: Makefile,v 1.284 2023/06/19 14:46:47 bsiegert Exp $
+
+DISTNAME=	rustc-1.73.0-src
+PKGNAME=	${DISTNAME:S/rustc/rust/:S/-src//}
+CATEGORIES=	lang
+MASTER_SITES=	https://static.rust-lang.org/dist/
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://www.rust-lang.org/
+COMMENT=	Safe, concurrent, practical language
+LICENSE=	mit OR apache-2.0
+
+CONFLICTS+=	rust-bin-[0-9]*
+
+# LLVM uses -std=c++17
+USE_CXX_FEATURES+=      c++17
+
+USE_GCC_RUNTIME=	yes
+USE_LANGUAGES=		c c++17
+USE_LIBTOOL=		yes
+USE_TOOLS+=		bash grep gmake perl:build pkg-config
+
+# The NetBSD bootstraps are built for NetBSD 8 (because rust doesn't
+# build on 7).  Mark earlier versions as broken.
+BROKEN_ON_PLATFORM+=	NetBSD-[1-7].*-*
+# Bootstrap is built for NetBSD 9.x on these platforms:
+BROKEN_ON_PLATFORM+=	NetBSD-8.*-*arm*
+BROKEN_ON_PLATFORM+=	NetBSD-8.*-aarch64
+BROKEN_ON_PLATFORM+=	NetBSD-8.*-sparc64
+
+HAS_CONFIGURE=		yes
+PYTHON_FOR_BUILD_ONLY=	yes
+CONFIG_SHELL=		${PYTHONBIN}
+CONFIGURE_SCRIPT=	src/bootstrap/configure.py
+CONFIGURE_ARGS+=	--prefix=${PREFIX}
+CONFIGURE_ARGS+=	--mandir=${PREFIX}/${PKGMANDIR}
+CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
+CONFIGURE_ARGS+=	--python=${PYTHONBIN}
+CONFIGURE_ARGS+=	--release-channel=stable
+CONFIGURE_ARGS+=	--local-rust-root=${RUST_BOOTSTRAP_PATH}
+CONFIGURE_ARGS+=	--enable-extended	# Build and install cargo too.
+CONFIGURE_ARGS+=	--enable-rpath
+CONFIGURE_ARGS+=	--disable-codegen-tests
+CONFIGURE_ARGS+=	--disable-compiler-docs
+CONFIGURE_ARGS+=	--disable-llvm-static-stdcpp
+CONFIGURE_ARGS+=	--disable-ninja
+CONFIGURE_ARGS+=	--dist-compression-formats=xz
+
+# Include (optional) settings to cross-build rust
+.include "cross.mk"
+
+# optional from do-cross.mk
+CONFIGURE_ARGS+=	${ADD_CONFIGURE_ARGS}
+
+# Getting RPATH with $ORIGIN into bootstrap may be troublesome, so
+# uncommenting the LD_LIBRARY_PATH setting may be required to run
+# the bootstrap
+PKGSRC_MAKE_ENV+=	LD_LIBRARY_PATH=${RUST_BOOTSTRAP_PATH:Q}/lib
+
+# This should allow us to perform "offline" builds (so cargo doesn't fetch
+# dependencies during the build stage) but this isn't hooked up yet.
+CONFIGURE_ARGS+=	--enable-vendor
+
+# cargo defaults to using the number of available CPUs
+MAKE_ENV+=		CARGO_BUILD_JOBS=${_MAKE_JOBS_N}
+
+# Rust builds some bundled components with strict version requirements, ensure
+# that any conflicting packages pulled in via dependencies are not buildlinked.
+BUILDLINK_FILES_CMD.libssh2=	${TRUE}
+BUILDLINK_FILES_CMD.xz=		${TRUE}
+MAKE_ENV+=			LZMA_API_STATIC=1
+
+# MacOS X 10.7 is the oldest supported version. See
+# ${WRKSRC}/src/bootstrap/lib.rs
+MAKE_ENV.Darwin+=	MACOSX_DEPLOYMENT_TARGET="10.7"
+
+CFLAGS.SunOS+=		-D_POSIX_PTHREAD_SEMANTICS
+MAKE_ENV.SunOS+=	AR=gar
+
+#UNLIMIT_RESOURCES+=	cputime stacksize datasize virtualsize
+UNLIMIT_RESOURCES+=	cputime stacksize datasize
+
+TEST_TARGET=	check
+
+# bin/* lib/*, but names vary
+CHECK_RELRO_SUPPORTED=	no
+CHECK_SSP_SUPPORTED=	no
+
+.include "../../mk/bsd.prefs.mk"
+
+# Allow overriding MAKE_JOBS_SAFE
+# some may chose to mostly build faster,
+# and deal with any failures due to deadlocks
+.if !empty(rust.MAKE_JOBS_SAFE)
+.  if ${rust.MAKE_JOBS_SAFE:tl} == "yes"
+MAKE_JOBS_SAFE=		yes
+.  endif
+.endif
+
+.if !empty(rust.BUILD_TARGET)
+BUILD_TARGET=	${rust.BUILD_TARGET}
+.endif
+
+.if !empty(TARGET)
+# Use "dist" build target for cross compile of bootstrap
+BUILD_TARGET?=		dist
+.else
+BUILD_TARGET?=		build
+.endif
+
+.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || \
+    ${MACHINE_PLATFORM:MNetBSD-*-earmv[67]hf} || \
+    ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || \
+    !empty(TARGET:Marmv[67]-unknown-netbsd-eabihf) || \
+    !empty(TARGET:Mmipsel-unknown-netbsd)
+# Bootstrapping on NetBSD/powerpc requires no debug-info from rustc
+# (both for amd64->powerpc built and powerpc->powerpc built bootstrap bits)
+# Also try to downsize the armv[67] build.
+CONFIGURE_ARGS+=	--disable-debug
+CONFIGURE_ARGS+=	--disable-debug-assertions
+CONFIGURE_ARGS+=	--disable-llvm-release-debuginfo
+CONFIGURE_ARGS+=	--debuginfo-level=0
+CONFIGURE_ARGS+=	--debuginfo-level-rustc=0
+CONFIGURE_ARGS+=	--debuginfo-level-std=0
+CONFIGURE_ARGS+=	--debuginfo-level-tools=0
+CONFIGURE_ARGS+=	--debuginfo-level-tests=0
+.endif
+
+# Only build the ARM target on/for this host, due to resource constraints
+.if ${MACHINE_PLATFORM:MNetBSD-*-earmv[67]hf}
+CONFIGURE_ARGS+=	--set llvm.targets="ARM"
+.endif
+# When cross-building for ARM on X86, X86 needs to go along due
+# to 2-stage build process
+.if !empty(TARGET:Marmv[67]-unknown-netbsd-eabihf)
+CONFIGURE_ARGS+=	--set llvm.targets="ARM;X86"
+.endif
+# Same for mips:
+.if ${MACHINE_PLATFORM:MNetBSD-*-mipsel}
+CONFIGURE_ARGS+=	--set llvm.targets="Mips"
+.endif
+.if !empty(TARGET:Mmipsel-unknown-netbsd)
+CONFIGURE_ARGS+=	--set llvm.targets="Mips;X86"
+.endif
+
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/android-sdk.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/debuglink.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/run.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/backtrace/ci/run-docker.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/core/src/unicode/printable.py
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/build-std-detect.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/dox.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/run-docker.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/run.sh
+CHECK_INTERPRETER_SKIP+=	lib/rustlib/src/rust/library/stdarch/ci/style.sh
+
+.if ${OPSYS} == "NetBSD"
+# This block contains information about known trouble on NetBSD and workarounds.
+
+# Parallel builds failed on NetBSD due to dynamic linker locking bugs.
+# \todo Explain if the build is believed to be sound if not parallel,
+# or if a non-parallel build is merely more likely to work.
+#
+# See toolchain/54192 at
+#   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54192
+# which was fixed in -current on 2020-04-19:
+#   http://mail-index.netbsd.org/source-changes/2020/04/16/msg116256.html
+#   http://mail-index.netbsd.org/source-changes/2020/04/19/msg116337.html
+# These  were pulled up to netbsd-9 on 2020-05-13:
+#   http://releng.netbsd.org/cgi-bin/req-9.cgi?show=907
+# This has not been pulled up to netbsd-8
+#   \todo Explain if it's not applicable, shouldn't be pulled up, should be
+#   but hasn't, is too hard, etc.
+#
+# On pkgbuild for 2020Q1 9.0_RELEASE amd64, rust did not build despite
+# MAKE_JOBS_SAFE=no, but setting MAKE_JOBS=1 resulted in success. (No
+# PR is open for this.)  \todo Understand and fix.
+#
+# If we aren't on 9-current, and are on 8.x or 9.x, avoid parallel.
+# Release 9.x and 9.1 or later is OK.
+.  if ${OPSYS} == "NetBSD" && 090999 < ${OPSYS_VERSION} && ${OPSYS_VERSION} < 090900
+MAKE_JOBS_SAFE?=	no
+.  endif
+
+# Open PRs
+#
+# Broken package with PREFIX not /usr/pkg:
+#   http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54453
+#
+
+.endif
+
+#
+# Under NetBSD, do not use DT_RUNPATH
+#
+BUILDLINK_TRANSFORM.NetBSD+=	rm:-Wl,--enable-new-dtags
+
+#
+# Somewhere in the LLVM build "-arch x86_64" is passed on macOS/arm64 which
+# breaks linking, see https://github.com/rust-lang/rust/issues/81790.  Until
+# this can be located (proving difficult!) we just force it.
+#
+.if ${MACHINE_PLATFORM:MDarwin-*-aarch64}
+BUILDLINK_TRANSFORM+=	opt:x86_64:arm64
+.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.
+#
+DISTFILES:=		${DEFAULT_DISTFILES}
+
+.if ${MACHINE_PLATFORM:MDarwin-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		aarch64-apple-darwin
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MDarwin-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		x86_64-apple-darwin
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MLinux-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		aarch64-unknown-linux-gnu
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MLinux-*-earmv6hf} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		arm-unknown-linux-gnueabihf
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MLinux-*-earmv7hf} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		armv7-unknown-linux-gnueabihf
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MLinux-*-i386} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		i686-unknown-linux-gnu
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MLinux-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		x86_64-unknown-linux-gnu
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+#
+# The SunOS target defaults to illumos as that's what the current bootstraps
+# are built on.  If you wish to target Oracle Solaris you'll need to create an
+# x86_64-sun-solaris bootstrap and comment out the overrides.
+#
+.if ${MACHINE_PLATFORM:MSunOS-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		x86_64-unknown-illumos
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+SITES.${RUST_STAGE0}=	https://us-central.manta.mnx.io/pkgsrc/public/pkg-bootstraps/
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0}
+RUST_BOOTSTRAP_PATH?=	${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}
+# Override default "x86_64-sun-solaris" selection
+CONFIGURE_ARGS+=	--set=target.${RUST_ARCH}.llvm-config=${LLVM_CONFIG_PATH}
+CONFIGURE_ARGS+=	--build=${RUST_ARCH}
+CONFIGURE_ARGS+=	--host=${RUST_ARCH}
+CONFIGURE_ARGS+=	--target=${RUST_ARCH}
+.endif
+.if ${MACHINE_PLATFORM:MFreeBSD-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH:=		x86_64-unknown-freebsd
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.gz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-i386} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH=		i586-unknown-netbsd
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+SITES.${RUST_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+# Setting this changes it for every distfile, which doesn't match what is
+# currently in distinfo.
+#DIST_SUBDIR=		${PKGNAME}
+# For atomic ops
+CFLAGS+=		-march=i586
+CONFIGURE_ARGS+=	--build=${RUST_ARCH}
+pre-build: pre-build-fix-paxctl
+.PHONY: pre-build-fix-paxctl
+pre-build-fix-paxctl:
+	${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/cargo
+	${TOOLS_PLATFORM.paxctl} +am ${WRKDIR}/rust-bootstrap/bin/rustc
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-x86_64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH=		x86_64-unknown-netbsd
+RUST_STAGE0:=		rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=	rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=		${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=	1.72.1
+RUST_ARCH=		powerpc-unknown-netbsd
+
+# Cross-built against NetBSD 9.0
+.  if empty(OS_VERSION:M8.*) || make(distinfo) || make(makesum) || make(mdi)
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}90.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}90.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.  endif
+
+# Cross-built against NetBSD 8.0
+#.  if !empty(OS_VERSION:M8.*) || make(distinfo) || make(makesum) || make(mdi)
+#RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+#RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+#DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+#SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+#SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+#.  endif
+
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=		1.72.1
+RUST_ARCH=			aarch64-unknown-netbsd
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-aarch64eb} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=		1.72.1
+RUST_ARCH=			aarch64_be-unknown-netbsd
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-sparc64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER=		1.72.1
+RUST_ARCH=			sparc64-unknown-netbsd
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-earmv7hf} || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH=			armv7-unknown-netbsd-eabihf
+RUST_STAGE0_VER=		1.72.1
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-earmv6hf} || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH=			armv6-unknown-netbsd-eabihf
+RUST_STAGE0_VER=		1.72.1
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.endif
+#.if ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || make(distinfo) || make (makesum) || make(mdi)
+#RUST_ARCH=			mipsel-unknown-netbsd
+#RUST_STAGE0_VER=		1.72.1
+#RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+#RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+#DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+#SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+#SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+#.endif
+.if ${MACHINE_PLATFORM:MNetBSD-*-riscv64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_ARCH=			riscv64gc-unknown-netbsd
+RUST_STAGE0_VER=		1.72.1
+RUST_STAGE0:=			rust-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+RUST_STD_STAGE0:=		rust-std-${RUST_STAGE0_VER}-${RUST_ARCH}.tar.xz
+DISTFILES:=			${DISTFILES} ${RUST_STAGE0} ${RUST_STD_STAGE0}
+SITES.${RUST_STAGE0}=		${MASTER_SITE_LOCAL:=rust/}
+SITES.${RUST_STD_STAGE0}=	${MASTER_SITE_LOCAL:=rust/}
+.endif
+
+# You may override RUST_BOOTSTRAP_PATH and RUST_ARCH in mk.conf
+# if you have a local bootstrap compiler.
+.if !defined(RUST_ARCH) && !defined(RUST_BOOTSTRAP_PATH)
+NOT_FOR_PLATFORM+=	${MACHINE_PLATFORM}
+.else
+RUST_BOOTSTRAP_PATH?=	${WRKDIR}/rust-bootstrap
+.endif
+
+.if ${OPSYS} == "SunOS"
+TOOL_DEPENDS+=		coreutils>=0:../../sysutils/coreutils
+TOOL_DEPENDS+=		gzip>=0:../../archivers/gzip
+TOOLS_CREATE+=		md5sum
+TOOLS_PATH.md5sum=	${PREFIX}/bin/gmd5sum
+TOOLS_PLATFORM.gzcat=	${PREFIX}/bin/gzip -cd
+.endif
+
+SUBST_CLASSES+=		rpath
+SUBST_STAGE.rpath=	pre-configure
+SUBST_FILES.rpath+=	compiler/rustc_codegen_ssa/src/back/linker.rs
+SUBST_FILES.rpath+=	compiler/rustc_target/src/spec/netbsd_base.rs
+SUBST_FILES.rpath+=	src/bootstrap/builder.rs
+SUBST_FILES.rpath+=	src/bootstrap/compile.rs
+SUBST_VARS.rpath=	PREFIX
+
+#
+# Generate list of subst entries for various .cargo-checksum.json files.  These
+# are all handled together in one big substitution to simplify things rather
+# than one substitution entry per file, but are kept separate below to ease
+# updating and verification.
+#
+
+CKSUM_CRATES+=	vendor/cc-1.0.73
+CKSUMS+=	38970d678de0efb4b5e2978265daa8a613a1db35fc42e669621b03fc56d5b138
+CKSUMS+=	65de0d6593a4256e5fcaf898f9468d71bab672c70a2dfab3dcb8514e9b72819c
+
+CKSUM_CRATES+=	vendor/cc
+CKSUMS+=	17a4659710aa290c4ed9c23063c7b202c5bcf2a84de33aa1f01fc6fded69a1f8
+CKSUMS+=	a19bcb1a561d4ba5846f8f89fcfe6f05a3cb2e79baf8f21f53f0fba012db1b7f
+
+CKSUM_CRATES+=	vendor/libc
+CKSUMS+=	55ce4624745e31ad226b47fde177a46176a89da3fa5030663673a115102471f9
+CKSUMS+=	09ab15cd50245f4ced230b7919657ab170e06443bb0ed4baf4449d3472f5f656
+CKSUMS+=	90dd33ef20dc3be8aef5bd152a6a06e7ab34f9527b3978487b593aaa16a907bd
+CKSUMS+=	ec1cb2b8522ce7d35c9fce2f5b17a1a7e28cae9836f1cf11e267f222b72dff60
+
+CKSUM_CRATES+=	vendor/libc-0.2.138
+CKSUMS+=	107a4aa396b8383c66e0ace2f941450b4b69146558cdc4d9fbe33eeab51760f1
+CKSUMS+=	4be83bef456569d59405edf134e7fe8eff78f3fe35f1efd60e15405d5c822725
+
+CKSUM_CRATES+=	vendor/libc-0.2.140
+CKSUMS+=	4493317993af390d8aafc2cb7ace4c349dfc9d2451fd666844f04a4fa1f47442
+CKSUMS+=	537a01c3cd5507f493616193991e1135c7896aae3fc92d98ec9facbfe243d980
+CKSUMS+=	6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937
+CKSUMS+=	ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95
+
+CKSUM_CRATES+=	vendor/libc-0.2.146
+#CKSUMS+=	6442ed05eb390d44a03daa9800af1030f2ee3e61db98675262c227b28de51937
+#CKSUMS+=	ec554c837999c718786debfcfe2241984193751fcd52156323b418d96319aa95
+#CKSUMS+=	6a60a542639528a0a34b9c9a7298973ec2cf1449c59546b7b30dcef6c51874dd
+#CKSUMS+=	ec1cb2b8522ce7d35c9fce2f5b17a1a7e28cae9836f1cf11e267f222b72dff60
+
+CKSUM_CRATES+=	vendor/lzma-sys
+CKSUMS+=	6fd5e9245db34c6f557b8bfcaf03db82fc88c3b06dbfbb5f03b2bcd138983ef9
+CKSUMS+=	5e252578b5d266f6a4c8dc9f71ca7a91536ccb8c5c7d7753b82f12ec886459ef
+
+CKSUM_CRATES+=	vendor/stacker
+CKSUMS+=	59ca847887cf19387119d18c57f08d5a8520d714876ca0142b8f1c001ecde06b
+CKSUMS+=	03be8ae293b713fe6e9703e4809dd68caaec992bae6777914ffddae8da2a9bc7
+
+CKSUM_CRATES+=	vendor/crossbeam-utils
+CKSUMS+=	5f75132808d9e8d6e266fe77f9e20bbc35855a1c37a5dbc0940b3e989bca1a94
+CKSUMS+=	3d7c747108434546837b1c5664111c9146fcbfb2e084c95f8ce0be970d652421
+
+CKSUM_CRATES+=	vendor/crossbeam-utils-0.8.14
+CKSUMS+=	3314524d2afa0360c947455a6e6566fb54ebf909c99479ca3b7435741fd3293e
+CKSUMS+=	eaef167dea04efa811cf0d53de98feac6063ec2196eccd315d345ef86c551aaa
+
+CKSUM_CRATES+=	vendor/crossbeam-epoch
+CKSUMS+=	5f75132808d9e8d6e266fe77f9e20bbc35855a1c37a5dbc0940b3e989bca1a94
+CKSUMS+=	3d7c747108434546837b1c5664111c9146fcbfb2e084c95f8ce0be970d652421
+
+CKSUM_CRATES+=	vendor/openssl-sys
+CKSUMS+=	03f2de4a6d5c4baff39aff416cae0529ab57624e090a48843528242a1c7f20d9
+CKSUMS+=	a4ec7dac1eb920c609ef4ebf0e0a90af34e4e2a3e6eb3059ed110c029aa1d1cf
+CKSUMS+=	1f9233e5993c3537767d39b66fa5a43f5268a9bf89b70884886652cfa7e869c6
+CKSUMS+=	93dd56b8ea8c24678cf390232a1de7bbf0de64a5eaa40da95848e22e611c6dcb
+
+CKSUM_CRATES+=	vendor/openssl-src
+CKSUMS+=	683c9ed1a7953f7f9da43412010de95ba733860a18bc28a4fc3cbcc6ac93c4d7
+CKSUMS+=	d83220880699d6a4d9a4e265d19b7896ca4dc7235e3e2f546c5fa06222bdc258
+CKSUMS+=	090744f85cf99a9b8412c23fca1eabb61eb45d830f0f9f0e7309be2572c1e827
+CKSUMS+=	ead7bdeee121f1357b99741b175a564c8b7026f694cbc388aae2a86b3bae913f
+
+CKSUM_CRATES+=	vendor/nix
+CKSUMS+=	c3e13a2edea54d190a4b051f62efc97953c00b5051a9fda0e39e3bc732a31939
+CKSUMS+=	263bd7ace66a4cfee3de18532f61c187327fcbd564666b4f97c4b01ae6885d98
+
+SUBST_CLASSES+=		cksum
+SUBST_STAGE.cksum=	pre-configure
+.for crate in ${CKSUM_CRATES}
+SUBST_FILES.cksum+=	${crate}/.cargo-checksum.json
+.endfor
+.for from to in ${CKSUMS}
+SUBST_SED.cksum+=	-e 's,${from},${to},g'
+.endfor
+
+post-extract:
+	set -e;									\
+	if ${TEST} -e ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH}/install.sh	\
+	  -a ! -e ${RUST_BOOTSTRAP_PATH}/bin/rustc; then \
+		cd ${WRKDIR}/rust-${RUST_STAGE0_VER}-${RUST_ARCH};	\
+		env ${MAKE_ENV} ${TOOLS_BASH} \
+			./install.sh --prefix=${RUST_BOOTSTRAP_PATH};	\
+		cd ${WRKDIR}/rust-std-${RUST_STAGE0_VER}-${RUST_ARCH};	\
+		env ${MAKE_ENV} ${TOOLS_BASH} \
+			./install.sh --prefix=${RUST_BOOTSTRAP_PATH};	\
+	fi
+.if ${OPSYS} == "NetBSD"
+	SDIR=${WRKDIR}/scripts; \
+	${MKDIR} $${SDIR}; \
+	cd $${SDIR}; \
+	${RM} -f c++-wrap; \
+	${RM} -f clang++-wrap; \
+	${RM} -f clang-wrap; \
+	${RM} -f ar-wrap; \
+	${CP} ${.CURDIR}/files/gcc-wrap .; \
+	${CHMOD} +x gcc-wrap; \
+	${LN} -s gcc-wrap c++-wrap; \
+	${LN} -s gcc-wrap clang++-wrap; \
+	${LN} -s gcc-wrap clang-wrap; \
+	${LN} -s gcc-wrap ar-wrap
+.endif
+
+.if ${OPSYS} == "FreeBSD"
+MAKE_ENV+=		OPENSSL_DIR=${SSLBASE}
+.endif
+
+.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang) && !exists(/lib/libgcc_s.so)
+BUILDLINK_TRANSFORM+=	rm:-lgcc_s
+MAKE_ENV+=		PKGSRC_HAVE_LIBCPP=yes
+
+pre-build: provide-libgcc-for-bootstrap
+.PHONY: provide-libgcc-for-bootstrap
+provide-libgcc-for-bootstrap:
+.  if exists(${FILESDIR}/libgcc_s.so.1)
+	cp ${FILESDIR}/libgcc_s.so.1 ${RUST_BOOTSTRAP_PATH}/lib/.
+.  endif
+.endif
+
+#
+# These are essentially copies of the "all", "test", and "install" Makefile
+# targets, but are duplicated here so that we can specify -j.
+#
+do-build:
+	${RUN}${_ULIMIT_CMD}						\
+	cd ${WRKSRC} &&							\
+	${SETENV} ${MAKE_ENV}						\
+	sh -c "if [ \"${BUILD_TARGET}\" = \"dist\" ]; then		\
+		unset DESTDIR;						\
+		${PYTHONBIN} ./x.py -v					\
+		    ${BUILD_TARGET} -j ${_MAKE_JOBS_N};			\
+	else								\
+		${PYTHONBIN} ./x.py -v					\
+		    ${BUILD_TARGET} --stage 2 -j ${_MAKE_JOBS_N} &&	\
+		${PYTHONBIN} ./x.py -v					\
+		    doc --stage 2 -j ${_MAKE_JOBS_N};			\
+	fi"
+
+do-test:
+	${RUN}${_ULIMIT_CMD}						\
+	cd ${WRKSRC} &&							\
+	${SETENV} ${MAKE_ENV}						\
+		${PYTHONBIN} ./x.py -v test -j ${_MAKE_JOBS_N}
+
+do-install:
+	${RUN}${_ULIMIT_CMD}						\
+	cd ${WRKSRC} &&							\
+	${SETENV} ${MAKE_ENV} ${INSTALL_ENV} 				\
+		${PYTHONBIN} ./x.py -v install -j ${_MAKE_JOBS_N}
+
+GENERATE_PLIST+=	${FIND} ${DESTDIR}${PREFIX} \( -type f -o -type l \) -print | \
+			${SED} -e 's,${DESTDIR}${PREFIX}/,,' | ${SORT} ;
+
+# 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.
+#
+# Use the alternate BOOTSTRAP_NAME when creating a nightly release.
+#
+#BOOTSTRAP_NAME=	${PKGNAME_NOREV:C/rust/rust-nightly/}-${RUST_ARCH}
+BOOTSTRAP_NAME=		${PKGNAME_NOREV}-${RUST_ARCH}
+BOOTSTRAP_TMPDIR=	${WRKDIR}/${BOOTSTRAP_NAME}
+USE_TOOLS+=		gtar
+
+# The NetBSD part is so far untested, because I could not convince
+# the rust build to use the gcc wrapper when building natively,
+# so that I could get a placeholder in the RPATH, because chrpath
+# cannot extend the length of the RPATH...
+ELFEDIT?=	/usr/bin/elfedit
+
+.PHONY: stage0-bootstrap
+stage0-bootstrap: install
+	${RM} -rf ${BOOTSTRAP_TMPDIR}
+	${MKDIR} ${BOOTSTRAP_TMPDIR}
+.if ${OPSYS} == "NetBSD"
+	(cd ${BOOTSTRAP_TMPDIR}; \
+	DISTDIR=${WRKSRC}/bild/dist; \
+	VER_ARCH=${PKGVERSION}-${RUST_ARCH}; \
+	RUSTC=rustc-$${VER_ARCH}; \
+	RUSTC_FILE=$${RUSTC}.tar.gz; \
+	RUST_STD=rust-std-$${VER_ARCH}; \
+	RUST_STD_FILE=$${RUST_STD}.tar.gz; \
+	${GTAR} -xzf $${DISTDIR}/$${RUSTC_FILE}; \
+		(cd ${RUSTC}; \
+	RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN/../lib'; \
+	for f in rls-preview/bin/rls rustc/bin/rustc rustc/bin/rustdoc; do \
+		chrpath -r $$RPATH $$f; \
+	done; \
+	RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN'; \
+	for f in rustc/lib/*.so*; do \
+		chrpath -r $$RPATH $$f; \
+	done; \
+	RPATH='/usr/pkg/lib:/lib:/usr/lib:$$ORIGIN:$$ORIGIN/../../..'; \
+	for f in rustc/lib/rustlib/*/*/*.so*; do \
+		chrpath -r $$RPATH $$f; \
+	done;); \
+	${GTAR} -czf $${RUSTC_FILE} $${RUSTC}; \
+	${CP} $${DISTDIR}/$${RUST_STD_FILE} .; \
+	${ECHO} "Fixed stage0 bootstrap in ${BOOTSTRAP_TMPDIR}:"; \
+	${ECHO} "$${RUSTC_FILE}"; \
+	${ECHO} "$${RUST_STD_FILE}"; \
+	)
+.endif
+.if ${OS_VARIANT} == "SmartOS"
+	${CP} -R ${DESTDIR}/${PREFIX}/bin ${BOOTSTRAP_TMPDIR}/
+	${CP} -R ${DESTDIR}/${PREFIX}/lib ${BOOTSTRAP_TMPDIR}/
+	${MKDIR} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc
+	set -e; \
+	for lib in libgcc_s.so.1 libstdc++.so.6; do \
+		${CP} `${PKG_CC} -print-file-name=$${lib}` \
+		    ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
+	done; \
+	for lib in libLLVM-15.so libcrypto.so.1.1 libcurl.so.4 \
+		   libssl.so.1.1 libz.so.1 libzstd.so.1; do \
+		${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
+	done; \
+	for lib in libiconv.so.2 libidn2.so.0 libintl.so.8 liblber.so.2 \
+		   libldap.so.2 libnghttp2.so.14 libsasl2.so.3 \
+		   libssh2.so.1 libunistring.so.5; do \
+		${CP} ${PREFIX}/lib/$${lib} ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/; \
+	done; \
+	for f in ${BOOTSTRAP_TMPDIR}/bin/*; do \
+		/bin/file -b "$$f" | grep ^ELF >/dev/null || continue; \
+		${ELFEDIT} -e 'dyn:runpath $$ORIGIN/../lib:$$ORIGIN/../lib/pkgsrc' $$f; \
+	done; \
+	for f in ${BOOTSTRAP_TMPDIR}/lib/pkgsrc/*.so*; do \
+		${ELFEDIT} -e 'dyn:runpath $$ORIGIN' $$f; \
+	done; \
+	for f in ${BOOTSTRAP_TMPDIR}/lib/*.so*; do \
+		${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/pkgsrc' $$f; \
+	done; \
+	for f in ${BOOTSTRAP_TMPDIR}/lib/rustlib/*/*/*.so*; do \
+		${ELFEDIT} -e 'dyn:runpath $$ORIGIN:$$ORIGIN/../../..:$$ORIGIN/../../../pkgsrc' $$f; \
+	done; \
+	cd ${WRKDIR}; ${GTAR} -zcf ${BOOTSTRAP_NAME}.tar.gz ${BOOTSTRAP_NAME}
+	@${ECHO} ""
+	@${ECHO} "Verify correct library paths using the following:"
+	@${ECHO} ""
+	@${ECHO} "	cd ${BOOTSTRAP_TMPDIR}"
+	@${ECHO} "	find . -type f | xargs ldd 2>/dev/null | egrep 'not.found|${PREFIX}'"
+	@${ECHO} ""
+	@${ECHO} "If there is no output then this bootstrap kit is ready to go:"
+	@${ECHO} ""
+	@${ECHO} "	${WRKDIR}/${BOOTSTRAP_NAME}.tar.gz"
+	@${ECHO} ""
+.endif
+
+.include "options.mk"
+
+# These dependencies currently use the bundled sources as they require
+# development features not yet available in released versions.
+#
+#.include "../../devel/libgit2/buildlink3.mk"
+#.include "../../security/libssh2/buildlink3.mk"
+#.include "../../www/http-parser/buildlink3.mk"
+#.include "../../devel/jemalloc/buildlink3.mk"
+
+## Issues specific to: bootstrap AND NetBSD follow
+
+# rust i386 and sparc64 bootstraps are built for 8.0
+# and still depend on libstdc++.so.8.
+# Pull in compat80 on 9.x and newer.
+.if (${MACHINE_PLATFORM:MNetBSD-*-i386} || \
+     ${MACHINE_PLATFORM:MNetBSD-*-sparc64}) \
+    && empty(OS_VERSION:M8.*)
+TOOL_DEPENDS+=	compat80>=0:../../emulators/compat80
+.endif
+
+.include "../../mk/atomic64.mk"
+# This is for when we build natively:
+.if ${MACHINE_PLATFORM:MNetBSD-*-powerpc} || \
+    ${MACHINE_PLATFORM:MNetBSD-*-i386} || \
+    ${MACHINE_PLATFORM:MNetBSD-*-mipsel} || \
+    ${MACHINE_PLATFORM:MNetBSD-*-riscv64}
+# Make libatomic library available via a unique directory:
+DEPENDS+=	libatomic-links>=0:../../devel/libatomic-links
+.endif
+
+TOOL_DEPENDS+= cmake-[0-9]*:../../devel/cmake
+.include "../../devel/cmake/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../lang/python/tool.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/rust173/buildlink3.mk b/rust173/buildlink3.mk
new file mode 100644
index 0000000000..1e4c6a9c9d
--- /dev/null
+++ b/rust173/buildlink3.mk
@@ -0,0 +1,17 @@
+# $NetBSD: buildlink3.mk,v 1.6 2020/07/08 14:46:14 jperkin Exp $
+
+BUILDLINK_TREE+=	rust
+
+#
+# DO NOT include this directly! Use rust.mk instead.
+#
+
+.if !defined(RUST_BUILDLINK3_MK)
+RUST_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.rust+=	rust>=1.56.1
+BUILDLINK_PKGSRCDIR.rust?=	../../wip/rust
+BUILDLINK_PASSTHRU_DIRS+=	${PREFIX}/lib/rustlib
+.endif
+
+BUILDLINK_TREE+=	-rust
diff --git a/rust173/cargo.mk b/rust173/cargo.mk
new file mode 100644
index 0000000000..5651090b54
--- /dev/null
+++ b/rust173/cargo.mk
@@ -0,0 +1,99 @@
+# $NetBSD: cargo.mk,v 1.35 2023/05/16 06:10:52 wiz Exp $
+#
+# Common logic that can be used by packages that depend on cargo crates
+# from crates.io. This lets existing pkgsrc infrastructure fetch and verify
+# cargo crates instead of using the rust package manager in the build phase.
+# Inspired by cargo.mk from FreeBSD ports.
+#
+# Usage example:
+#
+# CARGO_CRATE_DEPENDS+=	sha1-0.20
+# .include "../../lang/rust/cargo.mk"
+#
+# If modifying the list of dependencies, re-run the build once without
+# --offline in CARGO_ARGS to generate a new valid Cargo.lock.
+# e.g: make CARGO_ARGS="build --release" build
+#
+# a list of CARGO_CRATE_DEPENDS can be generated via
+#      make print-cargo-depends > cargo-depends.mk
+#
+# See also www/geckodriver for a full example.
+
+MASTER_SITES?=	-${MASTER_SITE_CRATESIO}${PKGBASE}/${PKGVERSION_NOREV}/download
+
+CHECK_SSP_SUPPORTED=	no
+
+.include "../../lang/rust/rust.mk"
+
+USE_TOOLS+=		bsdtar
+CARGO_VENDOR_DIR=	${WRKDIR}/vendor
+CARGO_WRKSRC?=		${WRKSRC}
+
+# TODO: some Cargo.lock files include git+https sources which need to be fetched from the URL (not necessarily resolving to a crate.io url)
+DISTFILES?=			${DEFAULT_DISTFILES}
+.for crate in ${CARGO_CRATE_DEPENDS}
+DISTFILES+=			${crate}.crate
+SITES.${crate}.crate+=		-${MASTER_SITE_CRATESIO}${crate:C/-[0-9]+\.[0-9.]+.*$//}/${crate:C/^.*-([0-9]+\.[0-9.]+.*)$/\1/}/download
+EXTRACT_DIR.${crate}.crate?=	${CARGO_VENDOR_DIR}
+.endfor
+
+.include "../../mk/bsd.prefs.mk"
+# Triggers NetBSD ld.so bug (PR toolchain/54192)
+# See Makefile for further information.
+.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} < 099957
+MAKE_JOBS_SAFE=	no
+.endif
+
+post-extract: cargo-vendor-crates
+.PHONY: cargo-vendor-crates
+cargo-vendor-crates:
+	@${STEP_MSG} "Extracting local cargo crates"
+	${RUN}${MKDIR} ${CARGO_WRKSRC}/.cargo
+	${RUN}${PRINTF} "[source.crates-io]\nreplace-with = \"vendored-sources\"\n[source.vendored-sources]\ndirectory = \"${CARGO_VENDOR_DIR}\"\n" > ${CARGO_WRKSRC}/.cargo/config
+	${RUN}${MKDIR} ${CARGO_VENDOR_DIR}
+.for crate in ${CARGO_CRATE_DEPENDS}
+	${RUN}${PRINTF} '{"package":"%s","files":{}}'	\
+	  `${DIGEST} sha256 < ${_DISTDIR}/${crate}.crate` \
+	  > ${CARGO_VENDOR_DIR}/${crate}/.cargo-checksum.json
+.endfor
+
+# Legacy name
+.PHONY: show-cargo-depends
+show-cargo-depends: print-cargo-depends
+
+.PHONY: print-cargo-depends
+print-cargo-depends:
+	${RUN}${AWK} 'BEGIN {print "# $$Net" "BSD$$"; print;}		\
+		/^name = / { split($$3, a, "\""); name=a[2]; }		\
+		/^version = / { split($$3, a, "\""); vers=a[2]; }	\
+		/^source = / {						\
+			print "CARGO_CRATE_DEPENDS+=\t" name "-" vers;	\
+			}' ${CARGO_WRKSRC}/Cargo.lock
+
+DEFAULT_CARGO_ARGS=	--offline -j${_MAKE_JOBS_N}	\
+			  ${CARGO_NO_DEFAULT_FEATURES:M[yY][eE][sS]:C/[yY][eE][sS]/--no-default-features/}	\
+			  ${CARGO_FEATURES:C/.*/--features/W}	\
+			  ${CARGO_FEATURES:S/ /,/Wg}
+CARGO_ARGS?=		build --release ${DEFAULT_CARGO_ARGS}
+CARGO_INSTALL_ARGS?=	install --path . --root ${DESTDIR}${PREFIX} ${DEFAULT_CARGO_ARGS}
+
+MAKE_ENV+=		RUSTFLAGS=${RUSTFLAGS:Q}
+
+.if !target(do-build)
+do-build: do-cargo-build
+.endif
+
+.PHONY: do-cargo-build
+do-cargo-build:
+	${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_ARGS}
+
+.if !target(do-install) && ${GNU_CONFIGURE:Uno:tl} == no
+do-install: do-cargo-install
+.endif
+
+.PHONY: do-cargo-install
+do-cargo-install:
+	${RUN} cd ${CARGO_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo ${CARGO_INSTALL_ARGS}
+	# remove files cargo uses for tracking installations
+	${RM} -f ${DESTDIR}${PREFIX}/.crates.toml
+	${RM} -f ${DESTDIR}${PREFIX}/.crates2.json
diff --git a/rust173/cross.mk b/rust173/cross.mk
new file mode 100644
index 0000000000..2984a3d058
--- /dev/null
+++ b/rust173/cross.mk
@@ -0,0 +1,82 @@
+# $NetBSD: cross.mk,v 1.3 2020/07/16 09:35:37 jperkin Exp $
+
+# These settings may be used to cross-build rust.
+#
+# They interact with the files/gcc-wrap script to pick the
+# right compiler for the different phases of the build, and
+# use the headers for the target when required.  Note that the
+# cross-root tree will need to have the required binary packages
+# installed (curl etc., see list of buildlink3.mk includes in main
+# Makefile).
+
+# The gcc-wrap / c++-wrap script takes CROSS_ROOT environment variable
+# to do a cross-build.  The wrapper script assumes dest/ and tools/
+# as a result of a cross-build of NetBSD as subdirectories of this root
+#CROSS_ROOT=		/u/evbarm-armv7hf
+#CROSS_ROOT=		/u/evbarm-armv6hf
+#CROSS_ROOT=		/u/sparc64
+#CROSS_ROOT=		/u/macppc
+#CROSS_ROOT=		/u/evbarm64
+#CROSS_ROOT=		/u/evbarm64eb
+#CROSS_ROOT=		/u/i386
+#CROSS_ROOT=		/u/mipsel
+#CROSS_ROOT=		/u/riscv64
+#CROSS_ROOT=		/
+#MAKE_ENV+=		CROSS_ROOT=${CROSS_ROOT}
+
+# The GNU cross target designation
+#GNU_CROSS_TARGET=	armv7--netbsdelf-eabihf
+#GNU_CROSS_TARGET=	armv6--netbsdelf-eabihf
+#GNU_CROSS_TARGET=	sparc64--netbsd
+#GNU_CROSS_TARGET=	powerpc--netbsd
+#GNU_CROSS_TARGET=	aarch64--netbsd
+#GNU_CROSS_TARGET=	aarch64_be--netbsd
+#GNU_CROSS_TARGET=	i486--netbsdelf
+#GNU_CROSS_TARGET=	mipsel--netbsd
+#GNU_CROSS_TARGET=	riscv64--netbsd
+#MAKE_ENV+=		GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
+
+# To cross-build rust, you need to specify
+# the ultimate target to built for, as well as the
+# host the compiler is supposed to run on.
+# Rust's target designation
+#TARGET=		armv7-unknown-netbsd-eabihf
+#TARGET=		armv6-unknown-netbsd-eabihf
+#TARGET=		sparc64-unknown-netbsd
+#TARGET=		powerpc-unknown-netbsd
+#TARGET=		aarch64-unknown-netbsd
+#TARGET=		aarch64_be-unknown-netbsd
+#TARGET=		i686-unknown-netbsd
+#TARGET=		i586-unknown-netbsd
+#TARGET=		mipsel-unknown-netbsd
+#TARGET=		riscv64gc-unknown-netbsd
+#
+#SCRIPTS=		${WRKDIR}/scripts
+#CONFIGURE_ARGS+=	--host=${TARGET}
+#CONFIGURE_ARGS+=	--target=${TARGET}
+#CONFIGURE_ARGS+=	--set=target.${TARGET}.cc=${SCRIPTS}/gcc-wrap
+#CONFIGURE_ARGS+=	--set=target.${TARGET}.cxx=${SCRIPTS}/c++-wrap
+#CONFIGURE_ARGS+=	--set=target.${TARGET}.linker=${SCRIPTS}/gcc-wrap
+# Pick one:
+#CONFIGURE_ARGS+=	--set=target.${TARGET}.ar=${CROSS_ROOT}/tools/bin/${GNU_CROSS_TARGET}-ar
+#CONFIGURE_ARGS+=	--set=target.${TARGET}.ar=${SCRIPTS}/ar-wrap
+
+# May be required when cross-building on NetBSD
+#MAKE_ENV+=		OPENSSL_DIR=/usr
+
+#
+# Cross-compile illumos target.  The host is identical, it's just the target
+# that is renamed from x86_64-sun-solaris to x86_64-unknown-illumos.
+#
+#TARGET=		x86_64-unknown-illumos
+#
+# Use these variables for "cross-compiling" from x86_64-sun-solaris.
+#
+#CONFIGURE_ARGS+=	--set=target.${TARGET}.llvm-config=${LLVM_CONFIG_PATH}
+#CONFIGURE_ARGS+=	--host=${TARGET}
+#CONFIGURE_ARGS+=	--target=${TARGET}
+#
+# Set this variable when using a native x86_64-unknown-illumos bootstrap, as
+# the build still defaults to x86_64-sun-solaris based on uname.
+#
+#CONFIGURE_ARGS+=	--build=${TARGET}
diff --git a/rust173/distinfo b/rust173/distinfo
new file mode 100644
index 0000000000..55449fcf3b
--- /dev/null
+++ b/rust173/distinfo
@@ -0,0 +1,171 @@
+$NetBSD: distinfo,v 1.159 2023/06/19 14:46:47 bsiegert Exp $
+
+BLAKE2s (rust-1.72.1-aarch64-apple-darwin.tar.gz) = 87fab4618cb38c18488048b427a2558a41ede6d50f358f09bcdc952564f6d978
+SHA512 (rust-1.72.1-aarch64-apple-darwin.tar.gz) = ed66346bb438444a723f5573e1a3bf1ce10454b08cfd691917e3ddeafead5202a2f0306f5eb6e7df27824cd51a974a2131ccb49eee2d27664b71c5edce4eff61
+Size (rust-1.72.1-aarch64-apple-darwin.tar.gz) = 240667277 bytes
+BLAKE2s (rust-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 7ca06c03da832308c3c5bc576260d5fa7e82a25fc248927f5b4b18698351e9a4
+SHA512 (rust-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 21819320daf5f7c73e977a41d320bffa0b9fb14f5b75d34c6e760ebbd5ae676b5811d48b41b4be565650aaf5a682161255f8bdaa1f2d0d3557e0fd5d2aad1c21
+Size (rust-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 452734527 bytes
+BLAKE2s (rust-1.72.1-aarch64-unknown-netbsd.tar.xz) = c5aa3084f3653be97fd14dbb2dd20d36334277450733143f6185162c0caf5298
+SHA512 (rust-1.72.1-aarch64-unknown-netbsd.tar.xz) = ff5b2d2046e6ea04f01a32e2cf3d22d65223f52c2b27c1d29ea808bfa9f3eee94e0410971ab21c9fd49abddf1599454c6544bdabfab22f2ffd802c2f620649e7
+Size (rust-1.72.1-aarch64-unknown-netbsd.tar.xz) = 159770736 bytes
+BLAKE2s (rust-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 71fc52b117716633ab9f36a5b472b28ce20f3ee9ae7c5316e073e43cecf6d5d8
+SHA512 (rust-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 872e10f767c968f1d38c24b90e7932e88472ce8d8321ffcbdd4791b301c52c72dd9101cd513add46c92cad8d6018e6d30549d714ff9f5a14dc09891d490f25fa
+Size (rust-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 156090180 bytes
+BLAKE2s (rust-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 0b9334699acc11131632a915350940f49ccf802701b3381268de350acecdc336
+SHA512 (rust-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 497f2a3e7abccf191d7949b08d3f2049904dd7eb376f4844c4dc043adfd98d4776e6bc20edc92d9814306e745702867f1d03a4923b7c225eb4514f7e846fe8ff
+Size (rust-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 343135032 bytes
+BLAKE2s (rust-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 964f468e2ae3cdf3d92e6326f6b5d6bd889117f012327031567f5ecbb4ce1dd4
+SHA512 (rust-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 55703e8cff1a43d87153644a603baa0ab46a27590c0571303999e990d0713707ab7d35d022feab957c6e93fbaac9a1a609e13abb4dc7d70e38ead757bae4f899
+Size (rust-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 135260448 bytes
+BLAKE2s (rust-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 2622b4436f876679bd2fe63fa267ec156d3fcda39d7571b046caec3ad3ab6dd2
+SHA512 (rust-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = d88f46749fa854f5ae17565d9ca42e4382af4381a95d4a99c9e68407456506a087b67ebf2f03127c8ef5a816595b4bcbf4dd7fb64ae87f27ee81d3b88d33b5d4
+Size (rust-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 332764970 bytes
+BLAKE2s (rust-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = ef9382449c90ea1ffae53f7aebcbb08f417cd65df5d7f321a5507eb4e45bc10c
+SHA512 (rust-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 0a2c2ca3096b33f992630de3cf1a1b254626bf6d1c81418c651e43b57ef265241158854098c70c22d5a2d6c31904e35ef6d2affe2da3cca99809700b9254088c
+Size (rust-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 137884200 bytes
+BLAKE2s (rust-1.72.1-i586-unknown-netbsd.tar.xz) = a558a2141bc66451b6848262ec838d920ee0ee13fdc8484e4a1d110c3c9abe3c
+SHA512 (rust-1.72.1-i586-unknown-netbsd.tar.xz) = 3732d9cf3b6220f27543ae576792a300c97a1c54b7f63083d34a750fe010a4e2c5a5d4899a6bd3135ec9829a18b1529c58caf7fbb4eb49672093e122c59cf4a3
+Size (rust-1.72.1-i586-unknown-netbsd.tar.xz) = 172583092 bytes
+BLAKE2s (rust-1.72.1-i686-unknown-linux-gnu.tar.gz) = c6ee38b43061827a8c513b92a6c64140d655b2a19c747a9060b1f51435e6b8d7
+SHA512 (rust-1.72.1-i686-unknown-linux-gnu.tar.gz) = 0c29343b219ca57e90d46a5ea88cdf1f1f9b01c243f27b0e5cb1a27f1a09c7c20c65d4dd1a77a59e2450c304386b2403198e7fd7a3e5b0835929ead04a673966
+Size (rust-1.72.1-i686-unknown-linux-gnu.tar.gz) = 402826521 bytes
+BLAKE2s (rust-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 45bc45ec36a0d1f308aa34aba19c0eec1b8686b37e5f596ced020558ad90a68e
+SHA512 (rust-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 4b4cebc34bb53c316fc001a13335dfdd62ace20ce7098d99696bcf07b28691425964e2e50e3b6e7cfcf43cd68741842807b773bb6cb464f9d3ebc61aba1c7d72
+Size (rust-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 185984568 bytes
+BLAKE2s (rust-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 8abdeb94d799fc03ba2e6a1f3e2eb1b0b0ada2cfb5ae4c4d1d4ac27a6422e27b
+SHA512 (rust-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 55596059cac2fd3dc2f1a4793e6e56d8cf9dead58d1bd809bdc6997d32ac0346abcb0b1ad6889f22db61b7aab957cb50f51d2ad41c0336da07cf2640018607e9
+Size (rust-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 170193092 bytes
+BLAKE2s (rust-1.72.1-sparc64-unknown-netbsd.tar.xz) = 1b7afd4bae462ac1ca63cd2524e7005a0efd119a96df9b9df7aae56cdf3cdf47
+SHA512 (rust-1.72.1-sparc64-unknown-netbsd.tar.xz) = ba77c7cebda788f0e880bf97569cc89d8779f70cc6b9e7291d5de62bdb1e2d68015dcdf4e353460840d86f8ef2703b7ecd63f8bf297af37d75ab4e669852874c
+Size (rust-1.72.1-sparc64-unknown-netbsd.tar.xz) = 153019884 bytes
+BLAKE2s (rust-1.72.1-x86_64-apple-darwin.tar.gz) = 6e73dfdfb8e06cf2298b44b1c94feea52a129f37d53b11bda9d493420cfb8de1
+SHA512 (rust-1.72.1-x86_64-apple-darwin.tar.gz) = dfc68cac8a95111e330e76c60d57b56e7255c4f93a0f79980e8a67b1c14ef0a3899c62eb21f7bd476b653b0463b6348a1ae53bd9f0e69c8d0ba5625d23c65957
+Size (rust-1.72.1-x86_64-apple-darwin.tar.gz) = 326613420 bytes
+BLAKE2s (rust-1.72.1-x86_64-unknown-freebsd.tar.gz) = 1e1d64313fb4dfddf0b3307e35e9ec124f787c1a4d084ff91ff43434dab370a2
+SHA512 (rust-1.72.1-x86_64-unknown-freebsd.tar.gz) = 7c175a47bdcec2b122c11e0ab9cef2d55b1fc13d2be4ab17d7b8cd01053492ac8592884268866df5e6cc96f51eb5db6557549216be494cb63f372f2a23bc4abe
+Size (rust-1.72.1-x86_64-unknown-freebsd.tar.gz) = 308102058 bytes
+BLAKE2s (rust-1.72.1-x86_64-unknown-illumos.tar.gz) = 14073b33014a1a53d01ad6ee5001a646f26445c05eb84d361ccd86de8999dd63
+SHA512 (rust-1.72.1-x86_64-unknown-illumos.tar.gz) = 143fdeabbeacded6f37ee447c4a2ddcc13816083ab356da13d8b52e8c873560f29d67621e62bc68089c578d6ffdab3756a02fcd07c3192c43e5617803398d422
+Size (rust-1.72.1-x86_64-unknown-illumos.tar.gz) = 230033646 bytes
+BLAKE2s (rust-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = d7bf1d87d6cfd3984c987e3cefe7a9edf5c363fb573257acf0d1c27ed1c850af
+SHA512 (rust-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = 26c580a6020bca41c00d4e82662f672bf9c8c59964616aee6975eb486070f6814050159cff1df5447ae7eb505f83efd996596c13da8ee05bbc03b86e69d037dc
+Size (rust-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = 348259650 bytes
+BLAKE2s (rust-1.72.1-x86_64-unknown-netbsd.tar.xz) = 38b1cc764cef9fbf016aa8e43d920ac67bde53024e67bd6172dd5e50916ad4ea
+SHA512 (rust-1.72.1-x86_64-unknown-netbsd.tar.xz) = 4c2e138bdbec6e35fecec3a84b9d3eb151f232ff1a264c3d6ce2b0ba80ecbf8ef3e5bb52b2cfcbbc5a745e6041e0f110bdd8ec946c256403a74f4dae8b20c6c5
+Size (rust-1.72.1-x86_64-unknown-netbsd.tar.xz) = 150968500 bytes
+BLAKE2s (rust-std-1.72.1-aarch64-apple-darwin.tar.gz) = f85c6c6bd0a4c7a7b72da357dee2d321c7fed55f28c64053d6004de398a0e0ff
+SHA512 (rust-std-1.72.1-aarch64-apple-darwin.tar.gz) = da8d2faade69e0ebb9017b1f537c1e4da941b8dcdcd68676c80405935e475d5268006b7f31acd462c72ce324f04389877c52e0a08244a9d428f5bfe813e0edda
+Size (rust-std-1.72.1-aarch64-apple-darwin.tar.gz) = 40650417 bytes
+BLAKE2s (rust-std-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 86b8f5ab67d120bc2c50a6197d423c85d0d3d3f59eab2cb04f405014c0f363ca
+SHA512 (rust-std-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 1160303ac4863a849d04a26b5280f3c552e4071510e884c91a6e73e1862b1ee8a8e4bfe727e82512ed5368bc85a41703f7c50e9cd2e5e48d84fb6bfe6dfd5d18
+Size (rust-std-1.72.1-aarch64-unknown-linux-gnu.tar.gz) = 64878862 bytes
+BLAKE2s (rust-std-1.72.1-aarch64-unknown-netbsd.tar.xz) = bf3f779d2db6990592b5d80f0cee34417efae1a5f7ab2950c00477b64592a5a8
+SHA512 (rust-std-1.72.1-aarch64-unknown-netbsd.tar.xz) = 853a7a729c4c279ba4b3d2764f2198bc0cfcde2faae6c727a1cfb0aae57f07f1a98bfc580a1ab3aaa9c13120ff379761fadb1558bb67c81b63cbad8a1fe4348f
+Size (rust-std-1.72.1-aarch64-unknown-netbsd.tar.xz) = 23143948 bytes
+BLAKE2s (rust-std-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 06a2099a6bba4e3143cda1ef5d6e2c81aa2fda5ec49c999fe1dfea3bea4853ec
+SHA512 (rust-std-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = a07fdd49fc277ed51829312f551b1f02bb5521d5697abc8fd3422656c14276f29d9c7c6d78c340e46706c64c7e15c1bd6eac252b93e5bd6c071e0d7b4f83f07f
+Size (rust-std-1.72.1-aarch64_be-unknown-netbsd.tar.xz) = 23208140 bytes
+BLAKE2s (rust-std-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = a4043a57e1f1faeba2b931ecfd502157d8330747693098d49aed597e5be05285
+SHA512 (rust-std-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 5a90c418fecb3d0e51b2d02c492d46126aec7a0a27d05bb748b6201de56cf0b4a057e4edb3b5d4da3682f35a838df7f14d892003904ad0e678f78988a4639b3c
+Size (rust-std-1.72.1-arm-unknown-linux-gnueabihf.tar.gz) = 37783915 bytes
+BLAKE2s (rust-std-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 495a7525f76c3edb7877eee39239518f0042d37dd1a4b94ddcbb0a9bac870591
+SHA512 (rust-std-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = abe779de0a5c22cbd73effd4607dad499c2350903fb5fe8d3ef0a1ac31c2a27c611c4621d2052ce74f28e0a4eaa91b690a1d3a52da49a58d2638d181acfb8e67
+Size (rust-std-1.72.1-armv6-unknown-netbsd-eabihf.tar.xz) = 21555600 bytes
+BLAKE2s (rust-std-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = bf7d187d8287a9ae307c137064799fe5c2afaf04c3d707e5bb833b867501f4e9
+SHA512 (rust-std-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 9b58417cc947ee1f1c61f6cf905c132f6bd3922a2a96c4e8a589bb3fcb83c5f22c6c77b143117a4610bb490d92190c053945816302487da463aad92ff48427f5
+Size (rust-std-1.72.1-armv7-unknown-linux-gnueabihf.tar.gz) = 39266181 bytes
+BLAKE2s (rust-std-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = ae4df952eb4995237d5bf5ddf353ceffa22959f69965a21413c8649d85323555
+SHA512 (rust-std-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 1b2d0faa1fc3cbd80322d18a4891f885731ce2e99a34e57ba7b974ba19b6872f97a03c94851e41120e3be165e9ce9a7e440d720a32f1cec50960d98833fa8fdf
+Size (rust-std-1.72.1-armv7-unknown-netbsd-eabihf.tar.xz) = 22448372 bytes
+BLAKE2s (rust-std-1.72.1-i586-unknown-netbsd.tar.xz) = a44c59dd79f1538c6791274d90cb82f3836b87a2d776c7f9ee8d53eaed8324f5
+SHA512 (rust-std-1.72.1-i586-unknown-netbsd.tar.xz) = 9900c388ba60d439e32d64e7c88b669fe4c4b70d8862537972c6fb9a4bb764315782e1fc35539c882188a888377fce7151aa387cb2f65610cf1dc519cb7e55e9
+Size (rust-std-1.72.1-i586-unknown-netbsd.tar.xz) = 23666268 bytes
+BLAKE2s (rust-std-1.72.1-i686-unknown-linux-gnu.tar.gz) = 4b64e043cd5559e8c82fa87f1a036eb536f0e5a7016699766941800bb23f4dc6
+SHA512 (rust-std-1.72.1-i686-unknown-linux-gnu.tar.gz) = cdfbe09036e4628a2e5ef9c4d3eb734214c4d8991c7b7710e8995dbd019fb459b06d978aa30c2846702ee194c3ada0dc2225be26cd0ab127d6a569312474bef0
+Size (rust-std-1.72.1-i686-unknown-linux-gnu.tar.gz) = 41477541 bytes
+BLAKE2s (rust-std-1.72.1-powerpc-unknown-netbsd90.tar.xz) = a0583c15929ae338f95ba3bbd536df60053ebfc6008e1c3101cf7213a0603623
+SHA512 (rust-std-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 94fd617997f0a4c9347f747f8c4bde70c5fa2bb6e6791411b37eace90cec990ef8063673407ce3eb7533fadc30b57660f11d8724d790dc170ac0e983d18cccad
+Size (rust-std-1.72.1-powerpc-unknown-netbsd90.tar.xz) = 21615996 bytes
+BLAKE2s (rust-std-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = aa49ab95fe56a94612bb3d70147846ff644f3a0980040dc5b77a4afcbfca96d0
+SHA512 (rust-std-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = ee71979c48dc20f858d5ed93b3fdaf033565763fd9085d001a9ed57504d52de55f9c10a9ff75013dc25a6f671d3c9b70ff5b9dfe6e9d58db32a64b9c65f7978c
+Size (rust-std-1.72.1-riscv64gc-unknown-netbsd.tar.xz) = 21928348 bytes
+BLAKE2s (rust-std-1.72.1-sparc64-unknown-netbsd.tar.xz) = c16c747e8af3c0aa416776fd1c13382211aa87c4d4dfdb9a405e84dc598cde35
+SHA512 (rust-std-1.72.1-sparc64-unknown-netbsd.tar.xz) = 2223b73667fe9a4d116efea4e384c2b18dc044c0fc43130f70683cb53148228cbdeb565365d05f6b1b607acbb75d0cbd9c01f4acd4050bf58b7e9271f0ad030d
+Size (rust-std-1.72.1-sparc64-unknown-netbsd.tar.xz) = 21571728 bytes
+BLAKE2s (rust-std-1.72.1-x86_64-apple-darwin.tar.gz) = 12690ad9f18e0677946b430b74aa3af1951115323409e56b07feeb2f29a522fe
+SHA512 (rust-std-1.72.1-x86_64-apple-darwin.tar.gz) = 3fe3effc8785e5bae07dd0c21f7f1b2fdaaf1e5fa8d0ddbec487cd42d221a7578b490ee77f2d3e48ef092cd272a385bf9bb6d6098b027111541730cdf619136c
+Size (rust-std-1.72.1-x86_64-apple-darwin.tar.gz) = 43029167 bytes
+BLAKE2s (rust-std-1.72.1-x86_64-unknown-freebsd.tar.gz) = ef85734ee1ea4f9e6a1fb93b5a92477ac8dd27789179cf29dc9644d551fd5542
+SHA512 (rust-std-1.72.1-x86_64-unknown-freebsd.tar.gz) = 3bb282775434841ae7d0e3e6f9f090bf7790be9631512dab194bc6e984a957ab9d07bb6074e30cd0ee55f2383b894de5431a75255adea3e0134602c383380f97
+Size (rust-std-1.72.1-x86_64-unknown-freebsd.tar.gz) = 44489747 bytes
+BLAKE2s (rust-std-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = e6396c67ef0911771f083ad7a461a074a7afa24f22b6768be03d2aa98b9aec00
+SHA512 (rust-std-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = d35a3db35485ebf771f02e24dbeefa85269fe8b3895f754fe7dd2ba4891ee050641613db901544695e8a3849dae51c358d206b1bc84518b582218795c9d48fce
+Size (rust-std-1.72.1-x86_64-unknown-linux-gnu.tar.gz) = 46277735 bytes
+BLAKE2s (rust-std-1.72.1-x86_64-unknown-netbsd.tar.xz) = 6ad1f651f97ff82a68c5aefbd34b2ed9c424c407887f266213ab0bdd85409113
+SHA512 (rust-std-1.72.1-x86_64-unknown-netbsd.tar.xz) = 4bd3487085c29ef5ba46ecd7c1b12a9f3ce24e5e1234acf0b9f829790ffc5ed1b065aa787c66e1730ef2d74fcd2e333973b2af22ddac8fc6b52b8f2178724d99
+Size (rust-std-1.72.1-x86_64-unknown-netbsd.tar.xz) = 25225220 bytes
+BLAKE2s (rustc-1.73.0-src.tar.gz) = 2d3fb1ef162c82d6d5afa1868792108dc68ef42a6d640fb7674c350b17057aaf
+SHA512 (rustc-1.73.0-src.tar.gz) = 4e5de9455f3c17b9a01847ec2280b6354c66f7eae00513433b3f7c84c908942999167b51d683967019c8e68fe30b5add5c29f7a4c3a3a1fa0c3e290c7fe09816
+Size (rustc-1.73.0-src.tar.gz) = 280735223 bytes
+SHA1 (patch-compiler_rustc__codegen__ssa_src_back_linker.rs) = 62819cf6db7d2e3e77d433fe883046c28fc20d91
+SHA1 (patch-compiler_rustc__llvm_build.rs) = 037e7b02aa6f98dc0ebfc33bb336ea9347f33528
+SHA1 (patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs) = 866d01e7c1f3d8dd7d26f2fdc4360df273ed401f
+SHA1 (patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs) = a0fb5338d0020d3ee1266d1ed1361e7bf2eea611
+SHA1 (patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs) = fc78fc681f170be9e3b6e3c823a6bd62da742cbd
+SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = f49f8f8e36db396f29ea1c908ed61fe831e0d4cd
+SHA1 (patch-compiler_rustc__target_src_spec_netbsd__base.rs) = bc73a140d7b1d3ced12ad2564be4edce5b9579f0
+SHA1 (patch-library_backtrace_src_symbolize_gimli.rs) = 1ab343595e65ff6348f83cffc30e53d764485ff8
+SHA1 (patch-library_backtrace_src_symbolize_gimli_elf.rs) = 56621c10310914672a851cf5dfbf343a9ff4e1be
+SHA1 (patch-library_std_src_sys_unix_mod.rs) = f8669d680f169137ac2891af2977909619366a97
+SHA1 (patch-library_std_src_sys_unix_thread.rs) = 3f79b21fa033782122e09ffc44de55a0e5ecaecb
+SHA1 (patch-library_std_src_sys_unix_thread__parking_netbsd.rs) = c29eb1cf074766d34bd2b8c348ce29c6ae2ba163
+SHA1 (patch-src_bootstrap_bootstrap.py) = 00e11eb1f8e8534440bf3760837be6058e800c83
+SHA1 (patch-src_bootstrap_builder.rs) = a30ad08861034944ed3d7b37df6289f4356f7f19
+SHA1 (patch-src_bootstrap_compile.rs) = 71b58c0e14b820dafc48ce087292267e7d2eed0f
+SHA1 (patch-src_bootstrap_lib.rs) = f6918e0939b6fe63ae9b524d4c809375149efb15
+SHA1 (patch-src_bootstrap_llvm.rs) = afa4ec0b26aaf9c590859969b08a485e77322371
+SHA1 (patch-src_llvm-project_llvm_CMakeLists.txt) = 7abfabb6ec70df229a69355f8c76825610165c37
+SHA1 (patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake) = e1b2eb2f0b3cf1cf87b443656ae306b3242f6b12
+SHA1 (patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h) = cb011fc19957883c01725797f7c85ed1b20f96f1
+SHA1 (patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h) = 39d76e6659143d154ae690ac70781b698a2023d8
+SHA1 (patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h) = 67e93f198258a5b59580be20ff47ce58b146c5d5
+SHA1 (patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp) = b68197c1486a4dc40154b3b23dfd55d44048a2d2
+SHA1 (patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp) = 2587c2f4d11ad8f75bf8a16de625135b26bacc15
+SHA1 (patch-src_tools_cargo_src_cargo_core_profiles.rs) = e1af7fde97416e0a269ee34efd37f4f47fcf7a95
+SHA1 (patch-src_tools_cargo_tests_testsuite_build.rs) = 60713699c968f3e389f486e796009d31a5048906
+SHA1 (patch-src_tools_rust-installer_install-template.sh) = 28fbfd37793c8438a603cb0e19483bd5b9138e4b
+SHA1 (patch-vendor_backtrace_src_symbolize_gimli.rs) = b93148ff72a60a17c6a444f2616386c40d872153
+SHA1 (patch-vendor_backtrace_src_symbolize_gimli_elf.rs) = 308538090d9ce11d206d6eef0e675581a1fc6e80
+SHA1 (patch-vendor_cc-1.0.73_src_lib.rs) = 98acea9fb98898f63bbb0f6555df5e4b15da2b85
+SHA1 (patch-vendor_cc_src_lib.rs) = c64f7922684b75a559c3b6244114524eb3ab8385
+SHA1 (patch-vendor_crossbeam-epoch_no__atomic.rs) = a493d0b57a22b9a83c843a1076c91b6d36d2e007
+SHA1 (patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs) = 2053e2cffcb2981435c94df04d0e3f333fa77c07
+SHA1 (patch-vendor_crossbeam-utils_no__atomic.rs) = 26f797159530bc2c5e1be83a225a13e5458879b2
+SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs) = eda31064a08cba20fc0652b669e419871875ae29
+SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 33d06b92a65908185226f8aed055782e5b5a613a
+SHA1 (patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 24ebcb044aeefec3415323b77ac25805a98b296e
+SHA1 (patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 998160de7640c4567bf042dfa7a74a4555b0568b
+SHA1 (patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 2b0b4320aaed24514c1fdc8bbbeeb59191b36058
+SHA1 (patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 74b6353687cdc029bcdc9110b7b1e96e9ffb8e43
+SHA1 (patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs) = c3db9af7ebcc4356015159c170603b620c21dde0
+SHA1 (patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs) = b99ebc7233690df5dd3fa7674d86ec08831eec59
+SHA1 (patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 511e5d97083638352d77a463582aca8812602b45
+SHA1 (patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 4b9ff57adb8d67f467eb36c023548afef8b1ed74
+SHA1 (patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 3434376111d3f4759eab5eb278eb64ac5e170ffb
+SHA1 (patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = 66b4cd0853154e6a8fcd009a06ebbae5a1c98f82
+SHA1 (patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs) = 17884a63798eee6d68771faa8d9592525aa2a3bb
+SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs) = 09326b70d7821b1742285c464c70b347400191d7
+SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 4ad61200f935032f411a719c2e1d4724a7def652
+SHA1 (patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs) = a0434dfc965e4286dc4a21c6433edbd30eb16779
+SHA1 (patch-vendor_libc_src_unix_solarish_mod.rs) = 8364e19ea09203d32494c37ff3db19fe3d6b9d8a
+SHA1 (patch-vendor_lzma-sys_config.h) = b654c7e129fa02697734bc87173f89b3056a5437
+SHA1 (patch-vendor_nix_src_sys_signal.rs) = bf4fcdc5b71d8d73b3d7e8acfccd0554d822c131
+SHA1 (patch-vendor_openssl-src_openssl_Configurations_10-main.conf) = 9813c98a0551dba197ff47e9ac0f766c50351569
+SHA1 (patch-vendor_openssl-src_src_lib.rs) = fc38171e21ab88540a774917f419d41d67f509ca
+SHA1 (patch-vendor_openssl-sys_build_find__normal.rs) = 98927415bd3517a7492b87da99c8933c19c7299e
+SHA1 (patch-vendor_openssl-sys_build_main.rs) = 20618b13b56cc93bb5c051f96046604dd4977345
+SHA1 (patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = 4e86aec4c89db9a331950a12f8ec7b8aaa50eed7
+SHA1 (patch-vendor_stacker_src_lib.rs) = e00a1e95eb16540ff182715db778bf97ebd07a5e
+SHA1 (patch-vendor_target-lexicon_src_targets.rs) = 8562658e5f11ab1cf977d83fc48c4b3c000fbc0e
+SHA1 (patch-vendor_valuable_no__atomic.rs) = 3a40cb846bf1fae864c55a0ddba8fdeb5efcba72
diff --git a/rust173/do-cross.mk b/rust173/do-cross.mk
new file mode 100644
index 0000000000..412ecb2e3a
--- /dev/null
+++ b/rust173/do-cross.mk
@@ -0,0 +1,107 @@
+# $NetBSD$
+# Do all the NetBSD cross builds
+# Collect the bootstrap kits in dist/
+
+VERSION!=	make show-var VARNAME=PKGVERSION
+V_NOREV!=	make show-var VARNAME=PKGVERSION_NOREV
+
+SHORT_TARGETS+=		armv7
+SHORT_TARGETS+=		armv6
+SHORT_TARGETS+=		sparc64
+SHORT_TARGETS+=		powerpc
+SHORT_TARGETS+=		arm64
+SHORT_TARGETS+=		arm64_be
+SHORT_TARGETS+=		i386
+SHORT_TARGETS+=		riscv64
+SHORT_TARGETS+=		mipsel	# produces mips32 (not mips1) executables
+
+# Conditional local overrides of ROOT.* variables:
+.sinclude "local-roots.mk"
+
+# Root of target directories.
+# Must have dest/ (build.sh's DESTDIR) and tools/ subdirectories
+ROOT.armv7?=		/u/evbarm-armv7hf
+ROOT.armv6?=		/u/evbarm-armv6hf
+ROOT.sparc64?=		/u/sparc64
+ROOT.powerpc?=		/u/macppc
+ROOT.arm64?=		/u/evbarm64
+ROOT.arm64_be?=		/u/evbarm64eb
+ROOT.i386?=		/u/i386
+ROOT.mipsel?=		/u/mipsel
+ROOT.riscv64?=		/u/riscv64
+
+# Mapping to GNU triple
+G_TGT.armv7=		armv7--netbsdelf-eabihf
+G_TGT.armv6=		armv6--netbsdelf-eabihf
+G_TGT.sparc64=		sparc64--netbsd
+G_TGT.powerpc=		powerpc--netbsd
+G_TGT.arm64=		aarch64--netbsd
+G_TGT.arm64_be=		aarch64_be--netbsd
+G_TGT.i386=		i486--netbsdelf
+G_TGT.mipsel=		mipsel--netbsd
+G_TGT.riscv64=		riscv64--netbsd
+
+# Mapping to rust's TARGET specification
+TGT.armv7=		armv7-unknown-netbsd-eabihf
+TGT.armv6=		armv6-unknown-netbsd-eabihf
+TGT.sparc64=		sparc64-unknown-netbsd
+TGT.powerpc=		powerpc-unknown-netbsd
+TGT.arm64=		aarch64-unknown-netbsd
+TGT.arm64_be=		aarch64_be-unknown-netbsd
+TGT.i386=		i586-unknown-netbsd
+TGT.mipsel=		mipsel-unknown-netbsd
+TGT.riscv64=		riscv64gc-unknown-netbsd
+
+# Optional target tweak for bootstrap files
+TT.powerpc=		powerpc-unknown-netbsd90
+
+WRKDIR=		${.CURDIR}/work
+SCRIPTS=	${WRKDIR}/scripts
+
+#DEBUG=		echo
+
+# Make list of make targets
+.for st in ${SHORT_TARGETS}
+MTGTS+=	do-${st}
+.endfor
+
+all: ${MTGTS}
+
+# Define the individual build targets, used above
+.for st in ${SHORT_TARGETS}
+CA.${st}=--host=${TGT.${st}}
+CA.${st}+=--target=${TGT.${st}}
+CA.${st}+=--set=target.${TGT.${st}}.cc=${SCRIPTS}/gcc-wrap
+CA.${st}+=--set=target.${TGT.${st}}.cxx=${SCRIPTS}/c++-wrap
+CA.${st}+=--set=target.${TGT.${st}}.linker=${SCRIPTS}/gcc-wrap
+CA.${st}+=--set=target.${TGT.${st}}.ar=${ROOT.${st}}/tools/bin/${G_TGT.${st}}-ar
+do-${st}:
+	mkdir -p dist
+	@echo "=======> Cross-building rust for ${st}"
+	${DEBUG} make -f Makefile clean
+	${DEBUG} env \
+		CROSS_ROOT=${ROOT.${st}} \
+		GNU_CROSS_TARGET=${G_TGT.${st}} \
+		make -f Makefile \
+			ADD_CONFIGURE_ARGS="${CA.${st}}" \
+			TARGET=${TGT.${st}}
+	if [ "${TT.${st}}" != "" ]; then \
+		TT=${TT.${st}}; \
+	else \
+		TT=${TGT.${st}}; \
+	fi; \
+	distdir=${WRKDIR}/rustc-${V_NOREV}-src/build/dist; \
+	for comp in rust rust-std; do \
+		src=$${distdir}/$${comp}-${V_NOREV}-${TGT.${st}}.tar.xz; \
+		tgt=dist/$${comp}-${VERSION}-$${TT}.tar.xz; \
+		if [ ! -f "$${tgt}" ]; then \
+			echo ln $${src} $${tgt}; \
+			${DEBUG} ln $${src} $${tgt}; \
+		fi; \
+	done; \
+	src_comp=rust-src-${V_NOREV}.tar.xz; \
+	if [ ! -f dist/$${src_comp} ]; then \
+		echo ln $${distdir}/$${src_comp} dist; \
+		${DEBUG} ln $${distdir}/$${src_comp} dist; \
+	fi
+.endfor
diff --git a/rust173/files/gcc-wrap b/rust173/files/gcc-wrap
new file mode 100644
index 0000000000..957ebfa032
--- /dev/null
+++ b/rust173/files/gcc-wrap
@@ -0,0 +1,199 @@
+#! /bin/sh
+
+# Root of targets tools + dest directories
+# or unset to default to a native build.
+
+# This script assumes target tools in $root/tools 
+# and target's destdir in $root/dest, the result of a NetBSD build.sh.
+# ...or the native root, when we don't cross-compile
+root=${CROSS_ROOT:-/}
+
+incadd=""
+native=false
+if [ $root = "/" ]; then
+	native=true
+else
+	# What's the tools/bin prefix (if we're cross-building)?
+	gnuarch=${GNU_CROSS_TARGET:?}
+
+	# A special hack for netbsd-8 targets.
+	# netbsd-8 has gcc 5.5, but llvm and rust needs >= 7
+	# so we build tools from -9, and try to use that, but
+	# then the include path becomes wrong, and <stdatomic.h>
+	# is no longer picked up automatically by the compiler
+	# from the target destination directory
+	case $gnuarch in
+		sparc64*)	incadd="-I=/usr/include/gcc-5"
+				;;
+
+				# immintrin & from gcc-5 not
+				# compatible with gcc7, apparently
+		i[3456]86*)	incadd="-I=/usr/include/gcc-7"
+				;;
+
+				# mips64 does soft-float
+		mips64*)	madd="-msoft-float"
+				;;
+	esac
+	# We build both for -8 and -9 due to ABI differences,
+	# so can't just test $gnuarch...  Yes, a vile hack.
+	if [ "$root" = "/u/macppc" ]; then
+		incadd="-I=/usr/include/gcc-5"
+	fi
+fi
+
+# Who are we a wrapper for? (Typically either gcc or c++)
+who=$(basename $0 | sed -e 's/-wrap$//')
+
+args=""
+if [ ! -z "$madd" ]; then
+	args="$args $madd"
+fi
+
+# May need to add $linkadd before first -l or fist -L
+linkadd="-Wl,--sysroot=${root}/dest"
+# (perhaps this is overly cautious, other adjustments we do
+# below may be sufficient...)
+# Lib directories to ensure we search and have in run-path
+libs="/lib /usr/lib /usr/pkg/lib"
+
+for d in $libs; do
+	if ! $native; then
+		linkadd="$linkadd -L=$d"
+		linkadd="$linkadd -Wl,-rpath-link=${root}/dest/$d"
+	fi
+	# Run-path is for when we execute on the target,
+	# so no $root prefix
+	linkadd="$linkadd -Wl,-rpath,$d"
+done
+
+# ...and add a placeholder so we can tweak RPATH with chrpath,
+# since chrpath can't extend the length of the run path
+# (This may also not be needed, we use LD_LIBRARY_PATH instead)
+placeholder="placeholder-$(date | openssl dgst -sha1 | \
+	awk '{ print $2 }')"
+linkadd="$linkadd -Wl,-rpath,/$placeholder"
+# the / is a sneaky attempt to let it past cwrapper...
+
+# More debugging
+linkadd="$linkadd -Wl,--verbose"
+
+linktweaked=false
+
+# Step through args, tweak where required
+set -- "$@"
+while [ $# -gt 0 ]; do
+	case "$1" in
+# Insert = at the front of -isystem args.
+# This is to get --sysroot prepended, so that
+# we pick up the correct set of header files.
+# (I thought this wasn't reqired, but apparently it is...)
+		-isystem)
+			shift
+			args="$args -isystem =$1"
+			;;
+# Also doctor -I directives of known paths and
+# redirect them to the --sysroot.
+		-I/usr/include)
+			args="$args -I=/usr/include"
+			;;
+		-I/usr/include/krb5)
+			args="$args -I=/usr/include/krb5"
+			;;
+		-I/usr/pkg/include)
+# Try to drop this...
+			if ! $native; then
+				args="$args -I=/usr/pkg/include"
+			fi
+			;;
+		-I)
+			if [ $2 = "/usr/include" ]; then
+				args="$args -I=/usr/include"
+				shift
+			elif [ $2 = "/usr/include/krb5" ]; then
+				args="$args -I=/usr/include/krb5"
+				shift
+			elif [ $2 = "/usr/pkg/include" ]; then
+# Try to drop this too...
+				if ! $native; then
+					args="$args -I=/usr/pkg/include"
+				fi
+				shift
+			else
+				args="$args -I"
+			fi
+			;;
+		-l*)
+			if ! $linktweaked; then
+				args="$args $linkadd"
+				linktweaked=true
+			fi
+			args="$args $1"
+			;;
+		-L)
+			if ! $linktweaked; then
+				args="$args $linkadd"
+				linktweaked=true
+			fi
+			shift
+			tweaked=false
+			# redirect these to -Wl,--sysroot
+			for d in /lib /usr/lib /usr/pkg/lib; do
+				if [ $1 = $d ]; then
+					args="$args -L =$d"
+					tweaked=true
+				fi
+			done
+			# Not redirected?  If so we need to add
+			if ! $tweaked; then
+				args="$args -L $1"
+			fi
+			;;
+			
+		-L/lib)
+			if ! $linktweaked; then
+				args="$args $linkadd"
+				linktweaked=true
+			fi
+			args="$args -L=/lib"
+			;;
+		-L/usr/lib)
+			if ! $linktweaked; then
+				args="$args $linkadd"
+				linktweaked=true
+			fi
+			args="$args -L=/usr/lib"
+			;;
+		-L/usr/pkg/lib)
+			if ! $linktweaked; then
+				args="$args $linkadd"
+				linktweaked=true
+			fi
+			args="$args -L=/usr/pkg/lib"
+			;;
+		-Wl,--enable-new-dtags)
+			# ignore
+			;;
+		*)
+			args="$args $1"
+			;;
+	esac
+	shift
+done
+
+if $native; then
+	# Try to avoid cwrappers, which does "undocumented magic"
+	# by invoking the compiler "directly".
+	#cmd="/usr/bin/${who} $args"
+	# (however, this wrapper isn't used when buliding natively...)
+	cmd="${who} $args"
+else
+	cmd="${root}/tools/bin/${gnuarch}-${who} \
+		--sysroot=${root}/dest \
+		$incadd \
+		$args"
+fi
+
+# Cannot echo to stdout, messes up e.g. "gcc -print-prog-name=ld" output...
+#echo $cmd >> /tmp/gcc-wrap.log
+exec $cmd
diff --git a/rust173/options.mk b/rust173/options.mk
new file mode 100644
index 0000000000..eb7e1783c0
--- /dev/null
+++ b/rust173/options.mk
@@ -0,0 +1,68 @@
+# $NetBSD: options.mk,v 1.26 2022/07/11 20:13:50 jperkin Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.rust
+PKG_SUPPORTED_OPTIONS+=	rust-cargo-static rust-docs
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+# The bundled LLVM current has issues building on SunOS.
+.if ${OPSYS} != "SunOS"
+PKG_SUPPORTED_OPTIONS+=		rust-internal-llvm
+# There may be compatibility issues with the base LLVM on e.g. NetBSD.
+.  if !empty(HAVE_LLVM) || ${MACHINE_PLATFORM:MDarwin-*-aarch64}
+PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
+.  endif
+.endif
+
+# If cross-building, always use the internal LLVM
+.if !empty(TARGET)
+PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
+.endif
+
+# (NetBSD)/sparc64 systems fail to build libunwind,
+# a dependency of pkgsrc llvm, so use the internal one instead
+.if ${MACHINE_PLATFORM:MNetBSD-*-sparc64}
+PKG_SUGGESTED_OPTIONS+=		rust-internal-llvm
+.endif
+
+# Bundle OpenSSL and curl into the cargo binary when producing
+# bootstraps on NetBSD.
+.if ${OPSYS} == "NetBSD" && ${BUILD_TARGET} == "dist"
+PKG_SUGGESTED_OPTIONS+=	rust-cargo-static
+.endif
+
+PKG_OPTIONS_LEGACY_OPTS+=	rust-llvm:rust-internal-llvm
+
+.include "../../mk/bsd.options.mk"
+
+#
+# Use the internal copy of LLVM or the external one?
+#
+.if empty(PKG_OPTIONS:Mrust-internal-llvm)
+.include "../../lang/llvm/buildlink3.mk"
+CONFIGURE_ARGS+=	--enable-llvm-link-shared
+#CONFIGURE_ARGS+=	--llvm-libunwind=system
+CONFIGURE_ARGS+=	--llvm-root=${BUILDLINK_PREFIX.llvm}
+.endif
+
+#
+# Link cargo statically against "native" libraries.
+# (openssl and curl specifically).
+#
+.if !empty(PKG_OPTIONS:Mrust-cargo-static)
+CONFIGURE_ARGS+=	--enable-cargo-native-static
+.else
+BUILDLINK_API_DEPENDS.nghttp2+= nghttp2>=1.41.0
+BUILDLINK_API_DEPENDS.curl+= 	curl>=7.67.0
+.include "../../www/curl/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.endif
+
+#
+# Install documentation.
+#
+.if !empty(PKG_OPTIONS:Mrust-docs)
+CONFIGURE_ARGS+=	--enable-docs
+.else
+CONFIGURE_ARGS+=	--disable-docs
+.endif
diff --git a/rust173/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs b/rust173/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
new file mode 100644
index 0000000000..d603fa804b
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Do not use @rpath on Darwin.
+
+--- compiler/rustc_codegen_ssa/src/back/linker.rs.orig	2022-12-12 16:02:12.000000000 +0000
++++ compiler/rustc_codegen_ssa/src/back/linker.rs
+@@ -325,7 +325,7 @@ impl<'a> GccLinker<'a> {
+             // principled solution at some point to force the compiler to pass
+             // the right `-Wl,-install_name` with an `@rpath` in it.
+             if self.sess.opts.cg.rpath || self.sess.opts.unstable_opts.osx_rpath_install_name {
+-                let mut rpath = OsString::from("@rpath/");
++                let mut rpath = OsString::from("@PREFIX@/lib/");
+                 rpath.push(out_filename.file_name().unwrap());
+                 self.linker_args(&[OsString::from("-install_name"), rpath]);
+             }
diff --git a/rust173/patches/patch-compiler_rustc__llvm_build.rs b/rust173/patches/patch-compiler_rustc__llvm_build.rs
new file mode 100644
index 0000000000..635bee3f78
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__llvm_build.rs
@@ -0,0 +1,48 @@
+$NetBSD$
+
+Fix build on NetBSD HEAD-llvm. XXX there is probably a better way to do this.
+
+Pick up -latomic tweak from
+https://github.com/rust-lang/rust/issues/104220
+and
+https://github.com/rust-lang/rust/pull/104572
+
+--- compiler/rustc_llvm/build.rs.orig	2023-10-03 02:52:17.000000000 +0000
++++ compiler/rustc_llvm/build.rs
+@@ -249,12 +249,21 @@ fn main() {
+     {
+         // 32-bit targets need to link libatomic.
+         println!("cargo:rustc-link-lib=atomic");
++        println!("cargo:rustc-link-lib=z");
+     } else if target.contains("windows-gnu") {
+         println!("cargo:rustc-link-lib=shell32");
+         println!("cargo:rustc-link-lib=uuid");
+     } else if target.contains("haiku") || target.contains("darwin") {
+         println!("cargo:rustc-link-lib=z");
+     } else if target.contains("netbsd") {
++        // We build for i486, and then need -latomic for 64-bit atomics
++        if target.starts_with("i386")
++           || target.starts_with("i486")
++           || target.starts_with("i586")
++           || target.starts_with("i686")
++        {
++          println!("cargo:rustc-link-lib=atomic");
++        }
+         println!("cargo:rustc-link-lib=z");
+         println!("cargo:rustc-link-lib=execinfo");
+     }
+@@ -343,7 +352,13 @@ fn main() {
+         "c++"
+     } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
+         // NetBSD uses a separate library when relocation is required
+-        "stdc++_p"
++	if env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
++            "c++_pic"
++	} else {
++            "stdc++_pic"
++	}
++    } else if env::var_os("PKGSRC_HAVE_LIBCPP").is_some() {
++	"c++"
+     } else if llvm_use_libcxx.is_some() {
+         "c++"
+     } else {
diff --git a/rust173/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs b/rust173/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs
new file mode 100644
index 0000000000..3e786a4b62
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Add an i586 / pentium variant, in an effort to support AMD Geode etc.
+
+--- compiler/rustc_target/src/spec/i586_unknown_netbsd.rs.orig	2022-12-21 19:11:11.452711494 +0000
++++ compiler/rustc_target/src/spec/i586_unknown_netbsd.rs
+@@ -0,0 +1,23 @@
++use crate::spec::{Cc, Lld, LinkerFlavor, StackProbeType, Target, TargetOptions};
++
++pub fn target() -> Target {
++    let mut base = super::netbsd_base::opts();
++    base.cpu = "pentium".into();
++    base.max_atomic_width = Some(64);
++    base.pre_link_args
++        .entry(LinkerFlavor::Gnu(Cc::Yes, Lld::No))
++        .or_default()
++        .push("-m32".into());
++    // don't use probe-stack=inline-asm until rust-lang/rust#83139 is resolved.
++    base.stack_probes = StackProbeType::Call;
++
++    Target {
++        llvm_target: "i586-unknown-netbsdelf".into(),
++        pointer_width: 32,
++        data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
++            f64:32:64-f80:32-n8:16:32-S128"
++            .into(),
++        arch: "x86".into(),
++        options: TargetOptions { mcount: "__mcount".into(), ..base },
++    }
++}
diff --git a/rust173/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs b/rust173/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs
new file mode 100644
index 0000000000..aea9becd9b
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__target_src_spec_mips64el__unknown__netbsd.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Provide a mips64el target with N32, suitable for NetBSD/mips64el.
+
+--- compiler/rustc_target/src/spec/mips64el_unknown_netbsd.rs.orig	2022-12-29 22:55:00.640217876 +0000
++++ compiler/rustc_target/src/spec/mips64el_unknown_netbsd.rs
+@@ -0,0 +1,22 @@
++use crate::abi::Endian;
++use crate::spec::{Target, TargetOptions};
++
++pub fn target() -> Target {
++    let mut base = super::netbsd_base::opts();
++    base.max_atomic_width = Some(32);
++    base.cpu = "mips32".into();
++
++    Target {
++        llvm_target: "mipsel-unknown-netbsd".into(),
++        pointer_width: 32,
++        data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
++        arch: "mips".into(),
++        options: TargetOptions {
++            abi: "n32".into(),
++            features: "+soft-float,+abi=n32".into(),
++            endian: Endian::Little,
++            mcount: "__mcount".into(),
++            ..base
++        },
++    }
++}
diff --git a/rust173/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs b/rust173/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs
new file mode 100644
index 0000000000..cdee1caa6f
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__target_src_spec_mipsel__unknown__netbsd.rs
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Add target spec for NetBSD/mipsel.
+This one uses mips32 (mips1 llvm fails), so this one is not universally
+usable on NetBSD's supported 32-bit MIPS processors.
+
+--- compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs.orig	2022-11-06 18:16:59.750850353 +0000
++++ compiler/rustc_target/src/spec/mipsel_unknown_netbsd.rs	2022-11-06 18:14:10.846209169 +0000
+@@ -0,0 +1,21 @@
++use crate::abi::Endian;
++use crate::spec::{Target, TargetOptions};
++
++pub fn target() -> Target {
++    let mut base = super::netbsd_base::opts();
++    base.max_atomic_width = Some(32);
++    base.cpu = "mips32".into();
++
++    Target {
++	llvm_target: "mipsel-unknown-netbsd".into(),
++	pointer_width: 32,
++	data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".into(),
++	arch: "mips".into(),
++	options: TargetOptions {
++	    features: "+soft-float".into(),
++	    mcount: "__mcount".into(),
++	    endian: Endian::Little,
++	    ..base
++	},
++    }
++}
diff --git a/rust173/patches/patch-compiler_rustc__target_src_spec_mod.rs b/rust173/patches/patch-compiler_rustc__target_src_spec_mod.rs
new file mode 100644
index 0000000000..05f500b8da
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__target_src_spec_mod.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Add i586(pentium) and mipsel NetBSD targets.
+
+--- compiler/rustc_target/src/spec/mod.rs.orig	2021-03-23 16:15:10.000000000 +0000
++++ compiler/rustc_target/src/spec/mod.rs
+@@ -1324,6 +1324,8 @@ supported_targets! {
+     ("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
+     ("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
+     ("i686-unknown-netbsd", i686_unknown_netbsd),
++    ("i586-unknown-netbsd", i586_unknown_netbsd),
++    ("mipsel-unknown-netbsd", mipsel_unknown_netbsd),
+     ("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
+     ("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),
+     ("sparc64-unknown-netbsd", sparc64_unknown_netbsd),
diff --git a/rust173/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs b/rust173/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs
new file mode 100644
index 0000000000..3297c3f2f9
--- /dev/null
+++ b/rust173/patches/patch-compiler_rustc__target_src_spec_netbsd__base.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+For the benefit of powerpc, when libatomic-links is installed,
+search the directory containing the symlinks to -latomic.
+
+--- compiler/rustc_target/src/spec/netbsd_base.rs.orig	2022-12-12 16:02:12.000000000 +0000
++++ compiler/rustc_target/src/spec/netbsd_base.rs
+@@ -1,12 +1,20 @@
+-use crate::spec::{cvs, RelroLevel, TargetOptions};
++use crate::spec::{cvs, Cc, Lld, RelroLevel, LinkerFlavor, TargetOptions};
+ 
+ pub fn opts() -> TargetOptions {
++    let pre_link_args = TargetOptions::link_args(
++        LinkerFlavor::Gnu(Cc::Yes, Lld::No),
++       &[
++            // For the benefit of powerpc, when libatomic-links is installed,
++            "-Wl,-L@PREFIX@/lib/libatomic".into(),
++        ],
++    );
+     TargetOptions {
+         os: "netbsd".into(),
+         dynamic_linking: true,
+         families: cvs!["unix"],
+         no_default_libraries: false,
+         has_rpath: true,
++        pre_link_args,
+         position_independent_executables: true,
+         relro_level: RelroLevel::Full,
+         use_ctors_section: true,
diff --git a/rust173/patches/patch-library_backtrace_src_symbolize_gimli.rs b/rust173/patches/patch-library_backtrace_src_symbolize_gimli.rs
new file mode 100644
index 0000000000..0ed9af7822
--- /dev/null
+++ b/rust173/patches/patch-library_backtrace_src_symbolize_gimli.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add NetBSD to the family who is in the unix class.
+
+--- library/backtrace/src/symbolize/gimli.rs.orig	2022-04-04 09:41:26.000000000 +0000
++++ library/backtrace/src/symbolize/gimli.rs
+@@ -38,6 +38,7 @@ cfg_if::cfg_if! {
+         target_os = "ios",
+         target_os = "linux",
+         target_os = "macos",
++        target_os = "netbsd",
+         target_os = "openbsd",
+         target_os = "solaris",
+         target_os = "illumos",
diff --git a/rust173/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs b/rust173/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
new file mode 100644
index 0000000000..ff9292e2b0
--- /dev/null
+++ b/rust173/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Make NetBSD also find its debug libraries, if present.
+
+--- library/backtrace/src/symbolize/gimli/elf.rs.orig	2022-04-04 09:41:26.000000000 +0000
++++ library/backtrace/src/symbolize/gimli/elf.rs
+@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output:
+     }
+ }
+ 
++#[cfg(target_os = "netbsd")]
++const DEBUG_PATH: &[u8] = b"/usr/libdata/debug";
++#[cfg(not(target_os = "netbsd"))]
+ const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
+ 
+ fn debug_path_exists() -> bool {
+     cfg_if::cfg_if! {
+-        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
++        if #[cfg(any(target_os = "freebsd", 
++		     target_os = "netbsd",
++                     target_os = "linux"))] {
+             use core::sync::atomic::{AtomicU8, Ordering};
+             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
+ 
diff --git a/rust173/patches/patch-library_std_src_sys_unix_mod.rs b/rust173/patches/patch-library_std_src_sys_unix_mod.rs
new file mode 100644
index 0000000000..025b74b7b4
--- /dev/null
+++ b/rust173/patches/patch-library_std_src_sys_unix_mod.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add libexecinfo for backtrace() on NetBSD.
+
+--- library/std/src/sys/unix/mod.rs.orig	2021-02-10 17:36:44.000000000 +0000
++++ library/std/src/sys/unix/mod.rs
+@@ -269,6 +269,7 @@ cfg_if::cfg_if! {
+         #[link(name = "pthread")]
+         extern "C" {}
+     } else if #[cfg(target_os = "netbsd")] {
++        #[link(name = "execinfo")]
+         #[link(name = "pthread")]
+         #[link(name = "rt")]
+         extern "C" {}
diff --git a/rust173/patches/patch-library_std_src_sys_unix_thread.rs b/rust173/patches/patch-library_std_src_sys_unix_thread.rs
new file mode 100644
index 0000000000..f01348ffb6
--- /dev/null
+++ b/rust173/patches/patch-library_std_src_sys_unix_thread.rs
@@ -0,0 +1,56 @@
+$NetBSD$
+
+Fix stack-clash on SunOS.
+
+Undo new(ish) code (from 1.72.0) which attempts to count threads/CPUs
+on NetBSD; somehow it is causing crashes in bootstrap() on certain
+CPU architectures (i386, powerpc, armv7, but not riscv64, aarch64
+or amd64); _cpuset_isset() crashes with SEGV.  And according to
+what I hear, the code is bogus; by default threads do not have
+affinity to any specific set of CPUs in NetBSD, and trying to
+replicate this with a simple C program always results in 0.
+So rip the newish code out with prejudice, and instead fallback to
+the sysctl() method of getting "number of CPUs" which was used
+before (and is still present, following the ripped-out code).
+
+--- library/std/src/sys/unix/thread.rs.orig	2020-10-07 07:53:22.000000000 +0000
++++ library/std/src/sys/unix/thread.rs
+@@ -352,29 +352,6 @@ pub fn available_parallelism() -> io::Re
+                 }
+             }
+ 
+-            #[cfg(target_os = "netbsd")]
+-            {
+-                unsafe {
+-                    let set = libc::_cpuset_create();
+-                    if !set.is_null() {
+-                        let mut count: usize = 0;
+-                        if libc::pthread_getaffinity_np(libc::pthread_self(), libc::_cpuset_size(set), set) == 0 {
+-                            for i in 0..u64::MAX {
+-                                match libc::_cpuset_isset(i, set) {
+-                                    -1 => break,
+-                                    0 => continue,
+-                                    _ => count = count + 1,
+-                                }
+-                            }
+-                        }
+-                        libc::_cpuset_destroy(set);
+-                        if let Some(count) = NonZeroUsize::new(count) {
+-                            return Ok(count);
+-                        }
+-                    }
+-                }
+-            }
+-
+             let mut cpus: libc::c_uint = 0;
+             let mut cpus_size = crate::mem::size_of_val(&cpus);
+ 
+@@ -812,7 +789,7 @@ pub mod guard {
+         let page_size = os::page_size();
+         PAGE_SIZE.store(page_size, Ordering::Relaxed);
+ 
+-        if cfg!(all(target_os = "linux", not(target_env = "musl"))) {
++        if cfg!(any(target_os = "solaris", all(target_os = "linux", not(target_env = "musl")))) {
+             // Linux doesn't allocate the whole stack right away, and
+             // the kernel has its own stack-guard mechanism to fault
+             // when growing too close to an existing mapping. If we map
diff --git a/rust173/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs b/rust173/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs
new file mode 100644
index 0000000000..57dcc19ec1
--- /dev/null
+++ b/rust173/patches/patch-library_std_src_sys_unix_thread__parking_netbsd.rs
@@ -0,0 +1,34 @@
+$NetBSD$
+
+Try to cast to make this build, to avoid
+
+error[E0277]: the trait bound `i32: core::convert::From<u32>` is not satisfied
+  --> library/std/src/sys/unix/thread_parking/netbsd.rs:37:37
+   |
+37 |         tv_nsec: dur.subsec_nanos().into(),
+   |                                     ^^^^ the trait `core::convert::From<u32>` is not implemented for `i32`
+   |
+   = help: the following other types implement trait `core::convert::From<T>`:
+             <i32 as core::convert::From<NonZeroI32>>
+             <i32 as core::convert::From<bool>>
+             <i32 as core::convert::From<i16>>
+             <i32 as core::convert::From<i8>>
+             <i32 as core::convert::From<u16>>
+             <i32 as core::convert::From<u8>>
+   = note: required for `u32` to implement `core::convert::Into<i32>`
+
+For more information about this error, try `rustc --explain E0277`.
+
+This to un-break the 32-bit ports ... again.
+
+--- library/std/src/sys/unix/thread_parking/netbsd.rs.orig	2023-03-06 15:58:58.000000000 +0000
++++ library/std/src/sys/unix/thread_parking/netbsd.rs
+@@ -34,7 +34,7 @@ pub fn park_timeout(dur: Duration, hint:
+         // Saturate so that the operation will definitely time out
+         // (even if it is after the heat death of the universe).
+         tv_sec: dur.as_secs().try_into().ok().unwrap_or(time_t::MAX),
+-        tv_nsec: dur.subsec_nanos().into(),
++        tv_nsec: (dur.subsec_nanos() as libc::c_long).into(),
+     };
+ 
+     // Timeout needs to be mutable since it is modified on NetBSD 9.0 and
diff --git a/rust173/patches/patch-src_bootstrap_bootstrap.py b/rust173/patches/patch-src_bootstrap_bootstrap.py
new file mode 100644
index 0000000000..7bf70ddfd9
--- /dev/null
+++ b/rust173/patches/patch-src_bootstrap_bootstrap.py
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.4 2020/02/17 20:24:18 jperkin Exp $
+
+Use `uname -p` on NetBSD, as that is reliable and sensible there.
+Handle earmv[67]hf for NetBSD.
+
+--- src/bootstrap/bootstrap.py.orig	2023-07-12 03:32:40.000000000 +0000
++++ src/bootstrap/bootstrap.py
+@@ -268,6 +268,10 @@ def default_build_triple(verbose):
+         'NetBSD': 'unknown-netbsd',
+         'OpenBSD': 'unknown-openbsd'
+     }
++    # For NetBSD, use `uname -p`, as there it is reliable & sensible
++    if kernel == 'NetBSD':
++        cputype = subprocess.check_output(
++            ['uname', '-p']).strip().decode(default_encoding)
+ 
+     # Consider the direct transformation first and then the special cases
+     if kernel in kerneltype_mapper:
+@@ -362,10 +366,16 @@ def default_build_triple(verbose):
+             kernel = 'linux-androideabi'
+         else:
+             kernel += 'eabihf'
+-    elif cputype in {'armv7l', 'armv8l'}:
++    elif cputype in {'armv6hf', 'earmv6hf'}:
++        cputype = 'armv6'
++        if kernel == 'unknown-netbsd':
++            kernel += '-eabihf'
++    elif cputype in {'armv7l', 'earmv7hf', 'armv8l'}:
+         cputype = 'armv7'
+         if kernel == 'linux-android':
+             kernel = 'linux-androideabi'
++        elif kernel == 'unknown-netbsd':
++            kernel += '-eabihf'
+         else:
+             kernel += 'eabihf'
+     elif cputype == 'mips':
diff --git a/rust173/patches/patch-src_bootstrap_builder.rs b/rust173/patches/patch-src_bootstrap_builder.rs
new file mode 100644
index 0000000000..799eafa8b4
--- /dev/null
+++ b/rust173/patches/patch-src_bootstrap_builder.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_bootstrap_builder.rs,v 1.11 2020/07/06 13:56:32 he Exp $
+
+Use @PREFIX@, not $ORIGIN in rpath.
+
+--- src/bootstrap/builder.rs.orig	2023-10-03 02:52:17.000000000 +0000
++++ src/bootstrap/builder.rs
+@@ -1637,7 +1637,7 @@ impl<'a> Builder<'a> {
+                 Some(format!("-Wl,-rpath,@loader_path/../{libdir}"))
+             } else if !target.contains("windows") && !target.contains("aix") {
+                 rustflags.arg("-Clink-args=-Wl,-z,origin");
+-                Some(format!("-Wl,-rpath,$ORIGIN/../{libdir}"))
++                Some(format!("-Wl,-rpath,@PREFIX@/lib"))
+             } else {
+                 None
+             };
diff --git a/rust173/patches/patch-src_bootstrap_compile.rs b/rust173/patches/patch-src_bootstrap_compile.rs
new file mode 100644
index 0000000000..d8362e84fd
--- /dev/null
+++ b/rust173/patches/patch-src_bootstrap_compile.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_bootstrap_compile.rs,v 1.1 2020/03/14 08:02:46 jperkin Exp $
+
+On Darwin, do not use @rpath for internal libraries.
+
+--- src/bootstrap/compile.rs.orig	2022-12-12 16:02:12.000000000 +0000
++++ src/bootstrap/compile.rs
+@@ -488,7 +488,7 @@ fn copy_sanitizers(
+             || target == "x86_64-apple-ios"
+         {
+             // Update the library’s install name to reflect that it has been renamed.
+-            apple_darwin_update_library_name(&dst, &format!("@rpath/{}", &runtime.name));
++            apple_darwin_update_library_name(&dst, &format!("@PREFIX@/lib/{}", &runtime.name));
+             // Upon renaming the install name, the code signature of the file will invalidate,
+             // so we will sign it again.
+             apple_darwin_sign_file(&dst);
diff --git a/rust173/patches/patch-src_bootstrap_lib.rs b/rust173/patches/patch-src_bootstrap_lib.rs
new file mode 100644
index 0000000000..5a21ea08f8
--- /dev/null
+++ b/rust173/patches/patch-src_bootstrap_lib.rs
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_bootstrap_lib.rs,v 1.7 2020/03/13 18:34:53 jperkin Exp $
+
+Don't filter out optimization flags.
+FreeBSD has a particular C++ runtime library name
+
+--- src/bootstrap/lib.rs.orig	2021-09-06 18:42:35.000000000 +0000
++++ src/bootstrap/lib.rs
+@@ -954,14 +954,13 @@ impl Build {
+             .args()
+             .iter()
+             .map(|s| s.to_string_lossy().into_owned())
+-            .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
+             .collect::<Vec<String>>();
+ 
+         // If we're compiling on macOS then we add a few unconditional flags
+         // indicating that we want libc++ (more filled out than libstdc++) and
+         // we want to compile for 10.7. This way we can ensure that
+         // LLVM/etc are all properly compiled.
+-        if target.contains("apple-darwin") {
++        if target.contains("apple-darwin") || target.contains("freebsd") {
+             base.push("-stdlib=libc++".into());
+         }
+ 
diff --git a/rust173/patches/patch-src_bootstrap_llvm.rs b/rust173/patches/patch-src_bootstrap_llvm.rs
new file mode 100644
index 0000000000..0f3d31b6de
--- /dev/null
+++ b/rust173/patches/patch-src_bootstrap_llvm.rs
@@ -0,0 +1,21 @@
+$NetBSD$
+
+Add NetBSD to the list of riscv's which don't need -latomic.
+Try to force use of -latomic on mips* on NetBSD.
+
+--- src/bootstrap/llvm.rs.orig	2023-08-03 12:13:07.000000000 +0000
++++ src/bootstrap/llvm.rs
+@@ -396,6 +396,13 @@ impl Step for Llvm {
+             ldflags.shared.push(" -latomic");
+         }
+ 
++        if target.starts_with("mips") && target.contains("netbsd")
++        {
++            // try to force this here, should possibly go elsewhere...
++            ldflags.exe.push(" -latomic");
++            ldflags.shared.push(" -latomic");
++        }
++
+         if target.contains("msvc") {
+             cfg.define("LLVM_USE_CRT_DEBUG", "MT");
+             cfg.define("LLVM_USE_CRT_RELEASE", "MT");
diff --git a/rust173/patches/patch-src_llvm-project_llvm_CMakeLists.txt b/rust173/patches/patch-src_llvm-project_llvm_CMakeLists.txt
new file mode 100644
index 0000000000..2477a555c8
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_CMakeLists.txt
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_llvm-project_llvm_CMakeLists.txt,v 1.1 2019/04/14 12:42:03 he Exp $
+
+Don't implement sys/regset.h workaround, fix source instead.
+
+--- src/llvm-project/llvm/CMakeLists.txt.orig	2018-03-10 02:51:13.000000000 +0000
++++ src/llvm-project/llvm/CMakeLists.txt
+@@ -939,11 +939,6 @@ if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
+ # (this is a variable that CrossCompile sets on recursive invocations)
+ endif()
+ 
+-if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
+-   # special hack for Solaris to handle crazy system sys/regset.h
+-   include_directories("${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/Solaris")
+-endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
+-
+ # Make sure we don't get -rdynamic in every binary. For those that need it,
+ # use export_executable_symbols(target).
+ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
diff --git a/rust173/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake b/rust173/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
new file mode 100644
index 0000000000..b213c40364
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
@@ -0,0 +1,49 @@
+$NetBSD: patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake,v 1.3 2020/08/06 11:42:56 jperkin Exp $
+
+On Darwin, use correct install-name for shared libraries.
+
+Undo some of the RPATH magic so that cross-building
+works inside pkgsrc again (indirectly eliminates $ORIGIN rpath
+handling / editing, $ORIGIN handling is partially undone by cwrappers
+in pkgsrc).
+
+--- src/llvm-project/llvm/cmake/modules/AddLLVM.cmake.orig	2023-07-12 03:33:01.000000000 +0000
++++ src/llvm-project/llvm/cmake/modules/AddLLVM.cmake
+@@ -2311,7 +2311,7 @@ function(llvm_setup_rpath name)
+   endif()
+ 
+   if (APPLE)
+-    set(_install_name_dir INSTALL_NAME_DIR "@rpath")
++    set(_install_name_dir INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+     set(_install_rpath "@loader_path/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+   elseif(${CMAKE_SYSTEM_NAME} MATCHES "AIX" AND BUILD_SHARED_LIBS)
+     # $ORIGIN is not interpreted at link time by aix ld.
+@@ -2320,8 +2320,7 @@ function(llvm_setup_rpath name)
+     # FIXME: update this when there is better solution.
+     set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+   elseif(UNIX)
+-    set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+-    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
++    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+       set_property(TARGET ${name} APPEND_STRING PROPERTY
+                    LINK_FLAGS " -Wl,-z,origin ")
+@@ -2335,16 +2334,9 @@ function(llvm_setup_rpath name)
+     return()
+   endif()
+ 
+-  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not
+-  # building for macOS or AIX, as those platforms seemingly require it.
+-  # On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF
+-  # on install at the moment, so BUILD_WITH_INSTALL_RPATH is required.
++  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
+   if("${CMAKE_BUILD_RPATH}" STREQUAL "")
+-    if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX")
+-      set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+-    else()
+-      set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")
+-    endif()
++    set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+   endif()
+ 
+   set_target_properties(${name} PROPERTIES
diff --git a/rust173/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h b/rust173/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
new file mode 100644
index 0000000000..7250a1f149
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h,v 1.1 2019/04/14 12:42:03 he Exp $
+
+Don't implement sys/regset.h workaround, fix source instead.
+
+--- src/llvm-project/llvm/include/llvm-c/DataTypes.h.orig	2021-04-17 01:50:37.000000000 +0000
++++ src/llvm-project/llvm/include/llvm-c/DataTypes.h
+@@ -77,4 +77,27 @@ typedef signed int ssize_t;
+ # define UINT64_MAX 0xffffffffffffffffULL
+ #endif
+ 
++#if defined(__sun)
++#include <sys/regset.h>
++#undef CS
++#undef DS
++#undef ES
++#undef FS
++#undef GS
++#undef SS
++#undef EAX
++#undef ECX
++#undef EDX
++#undef EBX
++#undef ESP
++#undef EBP
++#undef ESI
++#undef EDI
++#undef EIP
++#undef UESP
++#undef EFL
++#undef ERR
++#undef TRAPNO
++#endif
++
+ #endif /* LLVM_C_DATATYPES_H */
diff --git a/rust173/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h b/rust173/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
new file mode 100644
index 0000000000..37d491478d
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h,v 1.1 2019/04/14 12:42:03 he Exp $
+
+Fix SunOS CS conflict not handled by include/llvm-c/DataTypes.h
+
+--- src/llvm-project/llvm/include/llvm/Analysis/ConstantFolding.h.orig	2018-08-01 16:32:37.000000000 +0000
++++ src/llvm-project/llvm/include/llvm/Analysis/ConstantFolding.h
+@@ -19,6 +19,10 @@
+ #ifndef LLVM_ANALYSIS_CONSTANTFOLDING_H
+ #define LLVM_ANALYSIS_CONSTANTFOLDING_H
+ 
++#ifdef __sun
++#undef CS
++#endif
++
+ #include <stdint.h>
+ 
+ namespace llvm {
diff --git a/rust173/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h b/rust173/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h
new file mode 100644
index 0000000000..dbd66f923d
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_lib_Support_BLAKE3_blake3__impl.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+Do not try to use neon on big-endian aarch64, as we have
+an #error waiting there.
+
+--- src/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h.orig	2022-09-02 08:17:54.000000000 +0000
++++ src/llvm-project/llvm/lib/Support/BLAKE3/blake3_impl.h
+@@ -64,7 +64,11 @@ enum blake3_flags {
+ #if !defined(BLAKE3_USE_NEON) 
+   // If BLAKE3_USE_NEON not manually set, autodetect based on AArch64ness
+   #if defined(IS_AARCH64)
+-    #define BLAKE3_USE_NEON 1
++    #if defined(__ARM_BIG_ENDIAN)
++      #define BLAKE3_USE_NEON 0
++    #else
++      #define BLAKE3_USE_NEON 1
++    #endif
+   #else
+     #define BLAKE3_USE_NEON 0
+   #endif
diff --git a/rust173/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp b/rust173/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp
new file mode 100644
index 0000000000..a368af1663
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_lib_Target_PowerPC_PPCISelLowering.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+Backport change from LLVM 17.0.3, so that rust builds
+with the embedded LLVM.
+Ref. https://github.com/rust-lang/rust/issues/116845.
+
+--- src/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp.orig	2023-10-03 02:52:40.000000000 +0000
++++ src/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+@@ -15527,7 +15527,7 @@ SDValue PPCTargetLowering::PerformDAGCom
+       break;
+     SDValue ConstOp = DAG.getConstant(Imm, dl, MVT::i32);
+     SDValue NarrowAnd = DAG.getNode(ISD::AND, dl, MVT::i32, NarrowOp, ConstOp);
+-    return DAG.getAnyExtOrTrunc(NarrowAnd, dl, N->getValueType(0));
++    return DAG.getZExtOrTrunc(NarrowAnd, dl, N->getValueType(0));
+   }
+   case ISD::SHL:
+     return combineSHL(N, DCI);
diff --git a/rust173/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp b/rust173/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
new file mode 100644
index 0000000000..02c93ff2ec
--- /dev/null
+++ b/rust173/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp,v 1.2 2019/10/02 12:51:43 he Exp $
+
+Avoid ambiguous function call.
+
+--- src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp.orig	2019-02-12 15:22:48.000000000 +0000
++++ src/llvm-project/llvm/utils/FileCheck/FileCheck.cpp
+@@ -592,7 +592,7 @@ static void DumpAnnotatedInput(raw_ostre
+   unsigned LineCount = InputFileText.count('\n');
+   if (InputFileEnd[-1] != '\n')
+     ++LineCount;
+-  unsigned LineNoWidth = std::log10(LineCount) + 1;
++  unsigned LineNoWidth = std::log10((float)LineCount) + 1;
+   // +3 below adds spaces (1) to the left of the (right-aligned) line numbers
+   // on input lines and (2) to the right of the (left-aligned) labels on
+   // annotation lines so that input lines and annotation lines are more
diff --git a/rust173/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs b/rust173/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
new file mode 100644
index 0000000000..ac9ad7239c
--- /dev/null
+++ b/rust173/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
@@ -0,0 +1,17 @@
+$NetBSD: patch-src_tools_cargo_src_cargo_core_profiles.rs,v 1.3 2019/03/07 20:19:11 jperkin Exp $
+
+Turn off incremental builds for sparc64, ref.
+https://sources.debian.org/patches/cargo/0.29.0-1/2007_sparc64_disable_incremental_build.patch/
+
+--- src/tools/cargo/src/cargo/core/profiles.rs.orig	2023-07-12 03:33:05.000000000 +0000
++++ src/tools/cargo/src/cargo/core/profiles.rs
+@@ -681,6 +681,9 @@ impl Profile {
+             debuginfo: DebugInfo::Resolved(TomlDebugInfo::Full),
+             debug_assertions: true,
+             overflow_checks: true,
++            #[cfg(target_arch = "sparc64")]
++            incremental: false,
++            #[cfg(not(target_arch = "sparc64"))]
+             incremental: true,
+             ..Profile::default()
+         }
diff --git a/rust173/patches/patch-src_tools_cargo_tests_testsuite_build.rs b/rust173/patches/patch-src_tools_cargo_tests_testsuite_build.rs
new file mode 100644
index 0000000000..7ffba0f965
--- /dev/null
+++ b/rust173/patches/patch-src_tools_cargo_tests_testsuite_build.rs
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_tools_cargo_tests_testsuite_build.rs,v 1.5 2019/08/29 14:09:57 he Exp $
+
+Don't attempt incremental operations on sparc64, ref.
+https://sources.debian.org/patches/cargo/0.29.0-1/2007_sparc64_disable_incremental_build.patch/
+
+--- src/tools/cargo/tests/testsuite/build.rs.orig	2019-08-13 06:27:40.000000000 +0000
++++ src/tools/cargo/tests/testsuite/build.rs
+@@ -47,6 +47,7 @@ fn cargo_fail_with_no_stderr() {
+ 
+ /// Checks that the `CARGO_INCREMENTAL` environment variable results in
+ /// `rustc` getting `-C incremental` passed to it.
++#[cfg(not(target_arch = "sparc64"))]
+ #[cargo_test]
+ fn cargo_compile_incremental() {
+     let p = project()
+@@ -69,6 +70,7 @@ fn cargo_compile_incremental() {
+         .run();
+ }
+ 
++#[cfg(not(target_arch = "sparc64"))]
+ #[cargo_test]
+ fn incremental_profile() {
+     let p = project()
+@@ -111,6 +113,7 @@ fn incremental_profile() {
+         .run();
+ }
+ 
++#[cfg(not(target_arch = "sparc64"))]
+ #[cargo_test]
+ fn incremental_config() {
+     let p = project()
diff --git a/rust173/patches/patch-src_tools_rust-installer_install-template.sh b/rust173/patches/patch-src_tools_rust-installer_install-template.sh
new file mode 100644
index 0000000000..e6f15d3a65
--- /dev/null
+++ b/rust173/patches/patch-src_tools_rust-installer_install-template.sh
@@ -0,0 +1,168 @@
+$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.5 2021/06/09 13:42:30 adam Exp $
+
+No logging to 'install.log'.
+Do not create 'uninstall.sh'.
+
+Rewrite to not use a whole lot of subprocesses just for doing
+pattern matching and substitution in the install phase using "grep"
+and "sed" when shell builtin "case" and "omit shortest match" ops
+should do just fine.
+
+--- src/tools/rust-installer/install-template.sh.orig	2021-05-09 02:52:58.000000000 +0000
++++ src/tools/rust-installer/install-template.sh
+@@ -6,20 +6,12 @@ set -u
+ init_logging() {
+     local _abs_libdir="$1"
+     local _logfile="$_abs_libdir/$TEMPLATE_REL_MANIFEST_DIR/install.log"
+-    rm -f "$_logfile"
+-    need_ok "failed to remove old installation log"
+-    touch "$_logfile"
+-    need_ok "failed to create installation log"
+     LOGFILE="$_logfile"
+ }
+ 
+ log_line() {
+     local _line="$1"
+ 
+-    if [ -n "${LOGFILE-}" -a -e "${LOGFILE-}" ]; then
+-    echo "$_line" >> "$LOGFILE"
+-    # Ignore errors, which may happen e.g. after the manifest dir is deleted
+-    fi
+ }
+ 
+ msg() {
+@@ -433,8 +425,8 @@ uninstall_components() {
+             local _directive
+             while read _directive; do
+ 
+-            local _command=`echo $_directive | cut -f1 -d:`
+-            local _file=`echo $_directive | cut -f2 -d:`
++            local _command=${_directive%%:*}
++            local _file=${_directive#*:}
+ 
+             # Sanity checks
+             if [ ! -n "$_command" ]; then critical_err "malformed installation directive"; fi
+@@ -541,8 +533,8 @@ install_components() {
+     local _directive
+     while read _directive; do
+ 
+-        local _command=`echo $_directive | cut -f1 -d:`
+-        local _file=`echo $_directive | cut -f2 -d:`
++        local _command=${_directive%%:*}
++        local _file=${_directive#*:}
+ 
+         # Sanity checks
+         if [ ! -n "$_command" ]; then critical_err "malformed installation directive"; fi
+@@ -551,36 +543,24 @@ install_components() {
+         # Decide the destination of the file
+         local _file_install_path="$_dest_prefix/$_file"
+ 
+-        if echo "$_file" | grep "^etc/" > /dev/null
+-        then
+-        local _f="$(echo "$_file" | sed 's/^etc\///')"
+-        _file_install_path="$CFG_SYSCONFDIR/$_f"
+-        fi
+-
+-        if echo "$_file" | grep "^bin/" > /dev/null
+-        then
+-        local _f="$(echo "$_file" | sed 's/^bin\///')"
+-        _file_install_path="$CFG_BINDIR/$_f"
+-        fi
+-
+-        if echo "$_file" | grep "^lib/" > /dev/null
+-        then
+-        local _f="$(echo "$_file" | sed 's/^lib\///')"
+-        _file_install_path="$CFG_LIBDIR/$_f"
+-        fi
+-
+-        if echo "$_file" | grep "^share" > /dev/null
+-        then
+-        local _f="$(echo "$_file" | sed 's/^share\///')"
+-        _file_install_path="$CFG_DATADIR/$_f"
+-        fi
+-
+-        if echo "$_file" | grep "^share/man/" > /dev/null
+-        then
+-        local _f="$(echo "$_file" | sed 's/^share\/man\///')"
+-        _file_install_path="$CFG_MANDIR/$_f"
+-        fi
+-
++        case "$_file" in
++            etc/*)
++                local _f=${_file#"etc/"}
++                _file_install_path="$CFG_DESTDIR_PREFIX/share/doc/cargo/$_f"
++                ;;
++            bin/*)
++                local _f=${_file#"bin/"}
++                _file_install_path="$CFG_BINDIR/$_f"
++                ;;
++            lib/*)
++                local _f=${_file#"lib/"}
++                _file_install_path="$CFG_LIBDIR/$_f"
++                ;;
++            share/man/*)
++                local _f=${_file#"share/man/"}
++                _file_install_path="$CFG_MANDIR/$_f"
++                ;;
++            share/doc/*)
+             # HACK: Try to support overriding --docdir.  Paths with the form
+             # "share/doc/$product/" can be redirected to a single --docdir
+             # path. If the following detects that --docdir has been specified
+@@ -591,14 +571,17 @@ install_components() {
+             # contents of those directories are _not_ disjoint. Since this feature
+             # is almost entirely to support 'make install' anyway I don't expect
+             # this problem to be a big deal in practice.
+-            if [ "$CFG_DOCDIR" != "<default>" ]
+-            then
+-            if echo "$_file" | grep "^share/doc/" > /dev/null
+-            then
+-            local _f="$(echo "$_file" | sed 's/^share\/doc\/[^/]*\///')"
+-            _file_install_path="$CFG_DOCDIR/$_f"
+-            fi
+-            fi
++                if [ "$CFG_DOCDIR" != "<default>" ]; then
++                    local _f=${_file#"share/doc/"*/}
++                    _file_install_path="$CFG_DOCDIR/$_f"
++                fi
++                ;;
++            share/*)
++                local _f=${_file#"share/"}
++                _file_install_path="$CFG_DATADIR/$_f"
++                ;;
++        esac
++
+ 
+         # Make sure there's a directory for it
+         make_dir_recursive "$(dirname "$_file_install_path")"
+@@ -617,14 +600,16 @@ install_components() {
+ 
+             maybe_backup_path "$_file_install_path"
+ 
+-            if echo "$_file" | grep "^bin/" > /dev/null || test -x "$_src_dir/$_component/$_file"
+-            then
+-            run cp "$_src_dir/$_component/$_file" "$_file_install_path"
+-            run chmod 755 "$_file_install_path"
+-            else
++            local mode=644
++            if test -x "$_src_dir/$_component/$_file"; then
++                mode=755
++            fi
++            case "$_file" in
++                bin/*) mode=755
++                       ;;
++            esac
+             run cp "$_src_dir/$_component/$_file" "$_file_install_path"
+-            run chmod 644 "$_file_install_path"
+-            fi
++            run chmod $mode "$_file_install_path"
+             critical_need_ok "file creation failed"
+ 
+             # Update the manifest
+@@ -986,7 +971,6 @@ write_to_file "$TEMPLATE_RUST_INSTALLER_
+ critical_need_ok "failed to write installer version"
+ 
+ # Install the uninstaller
+-install_uninstaller "$src_dir" "$src_basename" "$abs_libdir"
+ 
+ # Install each component
+ install_components "$src_dir" "$abs_libdir" "$dest_prefix" "$components"
diff --git a/rust173/patches/patch-vendor_backtrace_src_symbolize_gimli.rs b/rust173/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
new file mode 100644
index 0000000000..367e90786a
--- /dev/null
+++ b/rust173/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Do mmap on NetBSD as well.
+
+--- ./vendor/backtrace/src/symbolize/gimli.rs.orig	2022-04-04 11:10:55.000000000 +0000
++++ ./vendor/backtrace/src/symbolize/gimli.rs
+@@ -38,6 +38,7 @@ cfg_if::cfg_if! {
+         target_os = "ios",
+         target_os = "linux",
+         target_os = "macos",
++        target_os = "netbsd",
+         target_os = "openbsd",
+         target_os = "solaris",
+         target_os = "illumos",
diff --git a/rust173/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs b/rust173/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
new file mode 100644
index 0000000000..ad3afcd8d1
--- /dev/null
+++ b/rust173/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Make NetBSD also find its debug libraries, if present.
+
+--- vendor/backtrace/src/symbolize/gimli/elf.rs.orig	2022-04-04 11:10:55.000000000 +0000
++++ vendor/backtrace/src/symbolize/gimli/elf.rs
+@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output:
+     }
+ }
+ 
++#[cfg(target_os = "netbsd")]
++const DEBUG_PATH: &[u8] = b"/usr/libdata/debug";
++#[cfg(target_os != "netbsd")]
+ const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
+ 
+ fn debug_path_exists() -> bool {
+     cfg_if::cfg_if! {
+-        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
++        if #[cfg(any(target_os = "freebsd", 
++                     target_os = "netbsd",
++                     target_os = "linux"))] {
+             use core::sync::atomic::{AtomicU8, Ordering};
+             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
+ 
diff --git a/rust173/patches/patch-vendor_cc-1.0.73_src_lib.rs b/rust173/patches/patch-vendor_cc-1.0.73_src_lib.rs
new file mode 100644
index 0000000000..864beacf10
--- /dev/null
+++ b/rust173/patches/patch-vendor_cc-1.0.73_src_lib.rs
@@ -0,0 +1,16 @@
+$NetBSD$
+
+Use correct ABI on NetBSD/riscv64.
+
+--- vendor/cc-1.0.73/src/lib.rs.orig	2023-05-31 21:44:47.000000000 +0000
++++ vendor/cc-1.0.73/src/lib.rs
+@@ -1830,6 +1830,9 @@ impl Build {
+                         } else if target.contains("freebsd") && arch.starts_with("64") {
+                             cmd.args.push(("-march=rv64gc").into());
+                             cmd.args.push("-mabi=lp64d".into());
++                        } else if target.contains("netbsd") && arch.starts_with("64") {
++                            cmd.args.push(("-march=rv64gc").into());
++                            cmd.args.push("-mabi=lp64d".into());
+                         } else if target.contains("openbsd") && arch.starts_with("64") {
+                             cmd.args.push(("-march=rv64gc").into());
+                             cmd.args.push("-mabi=lp64d".into());
diff --git a/rust173/patches/patch-vendor_cc_src_lib.rs b/rust173/patches/patch-vendor_cc_src_lib.rs
new file mode 100644
index 0000000000..a4baec163b
--- /dev/null
+++ b/rust173/patches/patch-vendor_cc_src_lib.rs
@@ -0,0 +1,40 @@
+$NetBSD$
+
+Add aarch64_eb, mipsel and riscv64 for NetBSD.
+
+--- vendor/cc/src/lib.rs.orig	2023-10-03 04:12:09.000000000 +0000
++++ vendor/cc/src/lib.rs
+@@ -1946,6 +1946,9 @@ impl Build {
+                         } else if target.contains("freebsd") && arch.starts_with("64") {
+                             cmd.args.push(("-march=rv64gc").into());
+                             cmd.args.push("-mabi=lp64d".into());
++                        } else if target.contains("netbsd") && arch.starts_with("64") {
++                            cmd.args.push(("-march=rv64gc").into());
++                            cmd.args.push("-mabi=lp64d".into());
+                         } else if target.contains("openbsd") && arch.starts_with("64") {
+                             cmd.args.push(("-march=rv64gc").into());
+                             cmd.args.push("-mabi=lp64d".into());
+@@ -2887,6 +2890,7 @@ impl Build {
+             "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"),
+             "aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"),
+             "aarch64-unknown-netbsd" => Some("aarch64--netbsd"),
++            "aarch64_be-unknown-netbsd" => Some("aarch64_be--netbsd"),
+             "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+             "armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+             "armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"),
+@@ -2921,6 +2925,7 @@ impl Build {
+             "mips-unknown-linux-musl" => Some("mips-linux-musl"),
+             "mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"),
+             "mipsel-unknown-linux-musl" => Some("mipsel-linux-musl"),
++            "mipsel-unknown-netbsd" => Some("mipsel--netbsd"),
+             "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"),
+             "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"),
+             "mipsisa32r6-unknown-linux-gnu" => Some("mipsisa32r6-linux-gnu"),
+@@ -2963,6 +2968,7 @@ impl Build {
+                 "riscv32-unknown-elf",
+                 "riscv-none-embed",
+             ]),
++            "riscv64gc-unknown-netbsd" => Some("riscv64--netbsd"),
+             "riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"),
+             "riscv32gc-unknown-linux-gnu" => Some("riscv32-linux-gnu"),
+             "riscv64gc-unknown-linux-musl" => Some("riscv64-linux-musl"),
diff --git a/rust173/patches/patch-vendor_crossbeam-epoch_no__atomic.rs b/rust173/patches/patch-vendor_crossbeam-epoch_no__atomic.rs
new file mode 100644
index 0000000000..a05b394053
--- /dev/null
+++ b/rust173/patches/patch-vendor_crossbeam-epoch_no__atomic.rs
@@ -0,0 +1,20 @@
+$NetBSD$
+
+Add "mipsel-unknown-netbsd" to the list who don't have 
+native 64-bit atomic ops.
+Unify with crossbeam-epoch to get same after-checksum...
+
+--- vendor/crossbeam-epoch/no_atomic.rs.orig	2023-07-12 05:06:31.000000000 +0000
++++ vendor/crossbeam-epoch/no_atomic.rs
+@@ -38,10 +38,10 @@ const NO_ATOMIC_64: &[&str] = &[
+     "mips-unknown-linux-musl",
+     "mips-unknown-linux-uclibc",
+     "mipsel-sony-psp",
+-    "mipsel-sony-psx",
+     "mipsel-unknown-linux-gnu",
+     "mipsel-unknown-linux-musl",
+     "mipsel-unknown-linux-uclibc",
++    "mipsel-unknown-netbsd",
+     "mipsel-unknown-none",
+     "mipsisa32r6-unknown-linux-gnu",
+     "mipsisa32r6el-unknown-linux-gnu",
diff --git a/rust173/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs b/rust173/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs
new file mode 100644
index 0000000000..a0f384c943
--- /dev/null
+++ b/rust173/patches/patch-vendor_crossbeam-utils-0.8.14-no__atomic.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+No 64-bit atomics on NetBSD/mipsel.
+
+--- vendor/crossbeam-utils-0.8.14/no_atomic.rs.orig	2023-07-12 05:06:31.000000000 +0000
++++ vendor/crossbeam-utils-0.8.14/no_atomic.rs
+@@ -41,6 +41,7 @@ const NO_ATOMIC_64: &[&str] = &[
+     "mipsel-unknown-linux-gnu",
+     "mipsel-unknown-linux-musl",
+     "mipsel-unknown-linux-uclibc",
++    "mipsel-unknown-netbsd",
+     "mipsel-unknown-none",
+     "mipsisa32r6-unknown-linux-gnu",
+     "mipsisa32r6el-unknown-linux-gnu",
diff --git a/rust173/patches/patch-vendor_crossbeam-utils_no__atomic.rs b/rust173/patches/patch-vendor_crossbeam-utils_no__atomic.rs
new file mode 100644
index 0000000000..39278590c8
--- /dev/null
+++ b/rust173/patches/patch-vendor_crossbeam-utils_no__atomic.rs
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Add mipsel-unknown-netbsd target as not having 64-bit atomics.
+Unify with crossbeam-utils-0.8.12 by removing mipsel-sony-psx.
+
+--- vendor/crossbeam-utils/no_atomic.rs.orig	2023-07-12 05:06:31.000000000 +0000
++++ vendor/crossbeam-utils/no_atomic.rs
+@@ -38,10 +38,10 @@ const NO_ATOMIC_64: &[&str] = &[
+     "mips-unknown-linux-musl",
+     "mips-unknown-linux-uclibc",
+     "mipsel-sony-psp",
+-    "mipsel-sony-psx",
+     "mipsel-unknown-linux-gnu",
+     "mipsel-unknown-linux-musl",
+     "mipsel-unknown-linux-uclibc",
++    "mipsel-unknown-netbsd",
+     "mipsel-unknown-none",
+     "mipsisa32r6-unknown-linux-gnu",
+     "mipsisa32r6el-unknown-linux-gnu",
diff --git a/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs
new file mode 100644
index 0000000000..481c21650c
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mips.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add file for NetBSD/mips in mips32 variant.
+
+--- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-04-23 15:53:16.504282187 +0000
++++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mips.rs
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i32;
++pub type c_ulong = u32;
++pub type c_char = i8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
new file mode 100644
index 0000000000..3255ae313a
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -0,0 +1,59 @@
+$NetBSD$
+
+Add execinfo / backtrace stuff for NetBSD, and handle NetBSD/mips
+and NetBSD/riscv64.
+
+Add fix to cpuid_t definition by applying
+  https://github.com/rust-lang/libc/pull/3386
+
+--- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2023-04-16 23:32:41.000000000 +0000
++++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/mod.rs
+@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
+ pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
+ pub type lwpid_t = ::c_uint;
+ pub type shmatt_t = ::c_uint;
+-pub type cpuid_t = u64;
++pub type cpuid_t = ::c_ulong;
+ pub type cpuset_t = _cpuset;
+ pub type pthread_spin_t = ::c_uchar;
+ pub type timer_t = ::c_int;
+@@ -3049,6 +3049,22 @@ extern "C" {
+     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
+ }
+ 
++#[link(name = "execinfo")]
++extern "C" {
++    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
++    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
++    pub fn backtrace_symbols_fd(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fd: ::c_int,
++    ) -> ::c_int;
++    pub fn backtrace_symbols_fmt(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fmt: *const ::c_char,
++    ) -> *mut *mut ::c_char;
++}
++
+ cfg_if! {
+     if #[cfg(target_arch = "aarch64")] {
+         mod aarch64;
+@@ -3068,7 +3084,15 @@ cfg_if! {
+     } else if #[cfg(target_arch = "x86")] {
+         mod x86;
+         pub use self::x86::*;
++    } else if #[cfg(target_arch = "mips")] {
++	mod mips;
++	pub use self::mips::*;
++    } else if #[cfg(target_arch = "riscv64")] {
++        mod riscv64;
++        pub use self::riscv64:*;
+     } else {
+-        // Unknown target_arch
++        // Unknown target_arch, this should error out
++	mod unknown;
++	pub use self::unknown::*;
+     }
+ }
diff --git a/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..1d49d0e5ff
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.138_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Spec for riscv64.
+
+--- vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-02 18:40:59.815126792 +0000
++++ vendor/libc-0.2.138/src/unix/bsd/netbsdlike/netbsd/riscv64.rs	2023-07-02 18:38:40.729445691 +0000
+@@ -0,0 +1,24 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type c_char = u8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++// pub const _MAX_PAGE_SHIFT: u32 = 12;
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs
new file mode 100644
index 0000000000..c1c5c2a88a
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mips.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add NetBSD/mipsel (mips32 required).
+
+--- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-07-14 09:09:26.430133820 +0000
++++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mips.rs
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i32;
++pub type c_ulong = u32;
++pub type c_char = i8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs
new file mode 100644
index 0000000000..b44d69b4ba
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -0,0 +1,59 @@
+$NetBSD$
+
+Add support for NetBSD/mipsel and NetBSD/riscv64.
+Also try to enable backtrace support.
+
+Add fix to cpuid_t definition by applying
+  https://github.com/rust-lang/libc/pull/3386
+
+--- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2023-07-12 05:06:31.000000000 +0000
++++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/mod.rs
+@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
+ pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
+ pub type lwpid_t = ::c_uint;
+ pub type shmatt_t = ::c_uint;
+-pub type cpuid_t = u64;
++pub type cpuid_t = ::c_ulong;
+ pub type cpuset_t = _cpuset;
+ pub type pthread_spin_t = ::c_uchar;
+ pub type timer_t = ::c_int;
+@@ -3111,6 +3111,22 @@ extern "C" {
+     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
+ }
+ 
++#[link(name = "execinfo")]
++extern "C" {
++    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
++    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
++    pub fn backtrace_symbols_fd(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fd: ::c_int,
++    ) -> ::c_int;
++    pub fn backtrace_symbols_fmt(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fmt: *const ::c_char,
++    ) -> *mut *mut ::c_char;
++}
++
+ cfg_if! {
+     if #[cfg(target_arch = "aarch64")] {
+         mod aarch64;
+@@ -3130,7 +3146,15 @@ cfg_if! {
+     } else if #[cfg(target_arch = "x86")] {
+         mod x86;
+         pub use self::x86::*;
++    } else if #[cfg(target_arch = "mips")] {
++        mod mips;
++        pub use self::mips::*;
++    } else if #[cfg(target_arch = "riscv64")] {
++        mod riscv64;
++        pub use self::riscv64::*;
+     } else {
+-        // Unknown target_arch
++        // Unknown target_arch, this should error out
++        mod unknown;
++        pub use self::unknown::*;
+     }
+ }
diff --git a/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..fc553ba621
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add support for NetBSD/riscv64.
+
+--- vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-14 09:12:33.579150305 +0000
++++ vendor/libc-0.2.140/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type c_char = u8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust173/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs
new file mode 100644
index 0000000000..26aacb29c2
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.140_src_unix_solarish_mod.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Fix xattr build.
+
+--- vendor/libc-0.2.140/src/unix/solarish/mod.rs.orig	2023-08-23 22:08:20.000000000 +0000
++++ vendor/libc-0.2.140/src/unix/solarish/mod.rs
+@@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58;
+ pub const ENOTRECOVERABLE: ::c_int = 59;
+ pub const ENOSTR: ::c_int = 60;
+ pub const ENODATA: ::c_int = 61;
++// This is not supported but is required for xattr
++pub const ENOATTR: ::c_int = ::ENODATA;
+ pub const ETIME: ::c_int = 62;
+ pub const ENOSR: ::c_int = 63;
+ pub const ENONET: ::c_int = 64;
diff --git a/rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs
new file mode 100644
index 0000000000..714f43f385
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_mips.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add file for NetBSD/mips in mips32 variant.
+
+--- vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-04-23 16:08:32.294600810 +0000
++++ vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/mips.rs
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i32;
++pub type c_ulong = u32;
++pub type c_char = i8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..90705866f9
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.141_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Spec for riscv64.
+
+--- vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-02 18:40:59.815126792 +0000
++++ vendor/libc-0.2.141/src/unix/bsd/netbsdlike/netbsd/riscv64.rs	2023-07-02 18:38:40.729445691 +0000
+@@ -0,0 +1,24 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type c_char = u8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++// pub const _MAX_PAGE_SHIFT: u32 = 12;
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs
new file mode 100644
index 0000000000..1c653365cd
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mips.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add support for NetBSD/mipsel (needs mips32).
+
+--- vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2023-07-14 09:16:55.357761685 +0000
++++ vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mips.rs
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i32;
++pub type c_ulong = u32;
++pub type c_char = i8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs
new file mode 100644
index 0000000000..d91f3aefa1
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -0,0 +1,59 @@
+$NetBSD$
+
+Add support for NetBSD/mipsel and NetBSD/riscv64.
+Also try to enable backtrace support.
+
+Add fix to cpuid_t definition by applying
+  https://github.com/rust-lang/libc/pull/3386
+
+--- vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2023-07-12 05:06:31.000000000 +0000
++++ vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/mod.rs
+@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
+ pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
+ pub type lwpid_t = ::c_uint;
+ pub type shmatt_t = ::c_uint;
+-pub type cpuid_t = u64;
++pub type cpuid_t = ::c_ulong;
+ pub type cpuset_t = _cpuset;
+ pub type pthread_spin_t = ::c_uchar;
+ pub type timer_t = ::c_int;
+@@ -3153,6 +3153,22 @@ extern "C" {
+     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
+ }
+ 
++#[link(name = "execinfo")]
++extern "C" {
++    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
++    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
++    pub fn backtrace_symbols_fd(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fd: ::c_int,
++    ) -> ::c_int;
++    pub fn backtrace_symbols_fmt(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fmt: *const ::c_char,
++    ) -> *mut *mut ::c_char;
++}
++
+ cfg_if! {
+     if #[cfg(target_arch = "aarch64")] {
+         mod aarch64;
+@@ -3172,7 +3188,15 @@ cfg_if! {
+     } else if #[cfg(target_arch = "x86")] {
+         mod x86;
+         pub use self::x86::*;
++    } else if #[cfg(target_arch = "mips")] {
++        mod mips;
++        pub use self::mips::*;
++    } else if #[cfg(target_arch = "riscv64")] {
++        mod riscv64;
++        pub use self::riscv64::*;
+     } else {
+-        // Unknown target_arch
++        // Unknown target_arch, this should error out
++        mod unknown;
++        pub use self::unknown::*;
+     }
+ }
diff --git a/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..9b552a0f2b
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add support for NetBSD/riscv64.
+
+--- vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-07-14 09:17:03.907579820 +0000
++++ vendor/libc-0.2.146/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type c_char = u8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust173/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs
new file mode 100644
index 0000000000..1cffe4aacf
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc-0.2.146_src_unix_solarish_mod.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Fix xattr build.
+
+--- vendor/libc-0.2.146/src/unix/solarish/mod.rs.orig	2023-08-23 22:08:20.000000000 +0000
++++ vendor/libc-0.2.146/src/unix/solarish/mod.rs
+@@ -1523,6 +1523,8 @@ pub const EOWNERDEAD: ::c_int = 58;
+ pub const ENOTRECOVERABLE: ::c_int = 59;
+ pub const ENOSTR: ::c_int = 60;
+ pub const ENODATA: ::c_int = 61;
++// This is not supported but is required for xattr
++pub const ENOATTR: ::c_int = ::ENODATA;
+ pub const ETIME: ::c_int = 62;
+ pub const ENOSR: ::c_int = 63;
+ pub const ENONET: ::c_int = 64;
diff --git a/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs b/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs
new file mode 100644
index 0000000000..514e6518ca
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mips.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Add mips support.
+
+--- vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs.orig	2022-11-06 22:14:03.866753983 +0000
++++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs	2022-11-06 22:07:15.448812020 +0000
+@@ -0,0 +1,22 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i32;
++pub type c_ulong = u32;
++pub type c_char = i8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs b/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
new file mode 100644
index 0000000000..90d1171191
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -0,0 +1,59 @@
+$NetBSD$
+
+Copy execinfo function definitions from openbsd's mod.rs.
+Add entries for NetBSD/mipsel and NetBSD/riscv64.
+
+Add fix to cpuid_t definition by applying
+  https://github.com/rust-lang/libc/pull/3386
+
+--- vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig	2022-05-10 20:59:35.217463943 +0000
++++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_loc
+ pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
+ pub type lwpid_t = ::c_uint;
+ pub type shmatt_t = ::c_uint;
+-pub type cpuid_t = u64;
++pub type cpuid_t = ::c_ulong;
+ pub type cpuset_t = _cpuset;
+ pub type pthread_spin_t = ::c_uchar;
+ pub type timer_t = ::c_int;
+@@ -3153,6 +3153,22 @@ extern "C" {
+     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
+ }
+ 
++#[link(name = "execinfo")]
++extern "C" {
++    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
++    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
++    pub fn backtrace_symbols_fd(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fd: ::c_int,
++    ) -> ::c_int;
++    pub fn backtrace_symbols_fmt(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fmt: *const ::c_char,
++    ) -> *mut *mut ::c_char;
++}
++
+ cfg_if! {
+     if #[cfg(target_arch = "aarch64")] {
+         mod aarch64;
+@@ -3172,7 +3188,15 @@ cfg_if! {
+     } else if #[cfg(target_arch = "x86")] {
+         mod x86;
+         pub use self::x86::*;
++    } else if #[cfg(target_arch = "mips")] {
++        mod mips;
++        pub use self::mips::*;
++    } else if #[cfg(target_arch = "riscv64")] {
++        mod riscv64;
++        pub use self::riscv64::*;
+     } else {
+-        // Unknown target_arch
++        // Unknown target_arch, this should error out
++        mod unknown;
++        pub use self::unknown::*;
+     }
+ }
diff --git a/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs b/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
new file mode 100644
index 0000000000..4be5badc1c
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc_src_unix_bsd_netbsdlike_netbsd_riscv64.rs
@@ -0,0 +1,31 @@
+$NetBSD$
+
+Spec for riscv64.
+
+--- vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs.orig	2023-10-06 16:39:21.061468733 +0000
++++ vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
+@@ -0,0 +1,24 @@
++use PT_FIRSTMACH;
++
++pub type c_long = i64;
++pub type c_ulong = u64;
++pub type c_char = u8;
++pub type __cpu_simple_lock_nv_t = ::c_int;
++
++// should be pub(crate), but that requires Rust 1.18.0
++cfg_if! {
++    if #[cfg(libc_const_size_of)] {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
++    } else {
++        #[doc(hidden)]
++        pub const _ALIGNBYTES: usize = 8 - 1;
++    }
++}
++
++// pub const _MAX_PAGE_SHIFT: u32 = 12;
++
++pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
++pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
++pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
++pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/rust173/patches/patch-vendor_libc_src_unix_solarish_mod.rs b/rust173/patches/patch-vendor_libc_src_unix_solarish_mod.rs
new file mode 100644
index 0000000000..bcf64dadb2
--- /dev/null
+++ b/rust173/patches/patch-vendor_libc_src_unix_solarish_mod.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-vendor_libc_src_unix_solarish_mod.rs,v 1.1 2019/05/31 14:11:23 jperkin Exp $
+
+Fix xattr build.
+
+--- vendor/libc/src/unix/solarish/mod.rs.orig	2019-05-20 13:47:24.000000000 +0000
++++ vendor/libc/src/unix/solarish/mod.rs
+@@ -1215,6 +1215,8 @@ pub const EOWNERDEAD: ::c_int = 58;
+ pub const ENOTRECOVERABLE: ::c_int = 59;
+ pub const ENOSTR: ::c_int = 60;
+ pub const ENODATA: ::c_int = 61;
++// This is not supported but is required for xattr
++pub const ENOATTR: ::c_int = ::ENODATA;
+ pub const ETIME: ::c_int = 62;
+ pub const ENOSR: ::c_int = 63;
+ pub const ENONET: ::c_int = 64;
diff --git a/rust173/patches/patch-vendor_lzma-sys_config.h b/rust173/patches/patch-vendor_lzma-sys_config.h
new file mode 100644
index 0000000000..67963cec47
--- /dev/null
+++ b/rust173/patches/patch-vendor_lzma-sys_config.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-vendor_lzma-sys_config.h,v 1.1 2019/10/28 00:42:21 jperkin Exp $
+
+Fix SunOS builds with newer compilers.
+
+--- vendor/lzma-sys/config.h.orig	2020-10-07 09:33:31.000000000 +0000
++++ vendor/lzma-sys/config.h
+@@ -35,7 +35,11 @@
+     // change to `MYTHREAD_WIN95` if targeting Windows XP or earlier
+     #define MYTHREAD_VISTA 1
+ #else
++#if !defined(__sun) || (__STDC_VERSION__-0 < 199901L)
+     #define _POSIX_C_SOURCE 199506L
++#else
++    #define _POSIX_C_SOURCE 200112L
++#endif
+     #define MYTHREAD_POSIX 1
+ #endif
+ 
diff --git a/rust173/patches/patch-vendor_nix_src_sys_signal.rs b/rust173/patches/patch-vendor_nix_src_sys_signal.rs
new file mode 100644
index 0000000000..7bac2daf6c
--- /dev/null
+++ b/rust173/patches/patch-vendor_nix_src_sys_signal.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Narrow the conditional on mips to only apply to Linux.
+
+--- vendor/nix/src/sys/signal.rs.orig	2023-01-25 01:49:16.000000000 +0000
++++ vendor/nix/src/sys/signal.rs
+@@ -1069,7 +1069,7 @@ mod sigevent {
+                 SigevNotify::SigevThreadId{..} => libc::SIGEV_THREAD_ID,
+                 #[cfg(all(target_os = "linux", target_env = "uclibc"))]
+                 SigevNotify::SigevThreadId{..} => libc::SIGEV_THREAD_ID,
+-                #[cfg(any(all(target_os = "linux", target_env = "musl"), target_arch = "mips"))]
++                #[cfg(all(target_os = "linux", target_env = "musl", target_arch = "mips"))]
+                 SigevNotify::SigevThreadId{..} => 4  // No SIGEV_THREAD_ID defined
+             };
+             sev.sigev_signo = match sigev_notify {
diff --git a/rust173/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf b/rust173/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf
new file mode 100644
index 0000000000..17def504e5
--- /dev/null
+++ b/rust173/patches/patch-vendor_openssl-src_openssl_Configurations_10-main.conf
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Replicate part of
+https://github.com/openssl/openssl/pull/15086
+
+--- vendor/openssl-src/openssl/Configurations/10-main.conf.orig	2023-08-03 13:47:25.000000000 +0000
++++ vendor/openssl-src/openssl/Configurations/10-main.conf
+@@ -950,6 +950,10 @@ my %targets = (
+         shared_cflag     => "-fPIC",
+         shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
+     },
++    "NetBSD-generic32" => {
++        inherit_from     => [ "BSD-generic32" ],
++        ex_libs          => add("-latomic"),
++    },
+     "BSD-generic64" => {
+         inherit_from     => [ "BSD-generic32" ],
+         bn_ops           => "SIXTY_FOUR_BIT_LONG",
diff --git a/rust173/patches/patch-vendor_openssl-src_src_lib.rs b/rust173/patches/patch-vendor_openssl-src_src_lib.rs
new file mode 100644
index 0000000000..7c72ce5edf
--- /dev/null
+++ b/rust173/patches/patch-vendor_openssl-src_src_lib.rs
@@ -0,0 +1,64 @@
+$NetBSD: patch-vendor_openssl-src_src_lib.rs,v 1.1 2021/01/01 20:44:48 he Exp $
+
+Provide defaults for the various NetBSD targets.
+
+--- vendor/openssl-src/src/lib.rs.orig	2023-07-12 05:06:32.000000000 +0000
++++ vendor/openssl-src/src/lib.rs
+@@ -239,6 +239,8 @@ impl Build {
+             "aarch64-unknown-freebsd" => "BSD-generic64",
+             "aarch64-unknown-linux-gnu" => "linux-aarch64",
+             "aarch64-unknown-linux-musl" => "linux-aarch64",
++            "aarch64-unknown-netbsd" => "BSD-generic64",
++            "aarch64_be-unknown-netbsd" => "BSD-generic64",
+             "aarch64-pc-windows-msvc" => "VC-WIN64-ARM",
+             "arm-linux-androideabi" => "linux-armv4",
+             "armv7-linux-androideabi" => "linux-armv4",
+@@ -249,14 +251,17 @@ impl Build {
+             "armv5te-unknown-linux-gnueabi" => "linux-armv4",
+             "armv5te-unknown-linux-musleabi" => "linux-armv4",
+             "armv6-unknown-freebsd" => "BSD-generic32",
++            "armv6-unknown-netbsd-eabihf" => "BSD-generic32",
+             "armv7-unknown-freebsd" => "BSD-generic32",
+             "armv7-unknown-linux-gnueabi" => "linux-armv4",
+             "armv7-unknown-linux-musleabi" => "linux-armv4",
+             "armv7-unknown-linux-gnueabihf" => "linux-armv4",
+             "armv7-unknown-linux-musleabihf" => "linux-armv4",
++            "armv7-unknown-netbsd-eabihf" => "BSD-generic32",
+             "asmjs-unknown-emscripten" => "gcc",
+             "i586-unknown-linux-gnu" => "linux-elf",
+             "i586-unknown-linux-musl" => "linux-elf",
++            "i586-unknown-netbsd" => "BSD-x86-elf",
+             "i686-apple-darwin" => "darwin-i386-cc",
+             "i686-linux-android" => "linux-elf",
+             "i686-pc-windows-gnu" => "mingw",
+@@ -264,6 +269,7 @@ impl Build {
+             "i686-unknown-freebsd" => "BSD-x86-elf",
+             "i686-unknown-linux-gnu" => "linux-elf",
+             "i686-unknown-linux-musl" => "linux-elf",
++            "i686-unknown-netbsd" => "BSD-x86-elf",
+             "loongarch64-unknown-linux-gnu" => "linux64-loongarch64",
+             "mips-unknown-linux-gnu" => "linux-mips32",
+             "mips-unknown-linux-musl" => "linux-mips32",
+@@ -273,9 +279,11 @@ impl Build {
+             "mips64el-unknown-linux-muslabi64" => "linux64-mips64",
+             "mipsel-unknown-linux-gnu" => "linux-mips32",
+             "mipsel-unknown-linux-musl" => "linux-mips32",
++            "mipsel-unknown-netbsd" => "NetBSD-generic32",
+             "powerpc-unknown-freebsd" => "BSD-generic32",
+             "powerpc-unknown-linux-gnu" => "linux-ppc",
+             "powerpc-unknown-linux-gnuspe" => "linux-ppc",
++            "powerpc-unknown-netbsd" => "BSD-generic32",
+             "powerpc64-unknown-freebsd" => "BSD-generic64",
+             "powerpc64-unknown-linux-gnu" => "linux-ppc64",
+             "powerpc64-unknown-linux-musl" => "linux-ppc64",
+@@ -283,8 +291,10 @@ impl Build {
+             "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
+             "powerpc64le-unknown-linux-musl" => "linux-ppc64le",
+             "riscv64gc-unknown-linux-gnu" => "linux-generic64",
++            "riscv64gc-unknown-netbsd" => "BSD-generic64",
+             "s390x-unknown-linux-gnu" => "linux64-s390x",
+             "s390x-unknown-linux-musl" => "linux64-s390x",
++            "sparc64-unknown-netbsd" => "BSD-generic64",
+             "x86_64-apple-darwin" => "darwin64-x86_64-cc",
+             "x86_64-linux-android" => "linux-x86_64",
+             "x86_64-pc-windows-gnu" => "mingw64",
diff --git a/rust173/patches/patch-vendor_openssl-sys_build_find__normal.rs b/rust173/patches/patch-vendor_openssl-sys_build_find__normal.rs
new file mode 100644
index 0000000000..05d96b1783
--- /dev/null
+++ b/rust173/patches/patch-vendor_openssl-sys_build_find__normal.rs
@@ -0,0 +1,30 @@
+$NetBSD: patch-vendor_openssl-sys_build_find__normal.rs,v 1.1 2023/06/19 14:46:47 bsiegert Exp $
+
+Add hack for Darwin when homebrew is installed.
+
+--- vendor/openssl-sys/build/find_normal.rs.orig	2023-05-31 21:44:49.000000000 +0000
++++ vendor/openssl-sys/build/find_normal.rs
+@@ -72,23 +72,6 @@ fn resolve_with_wellknown_location(dir:
+ fn find_openssl_dir(target: &str) -> OsString {
+     let host = env::var("HOST").unwrap();
+ 
+-    if host == target && target.ends_with("-apple-darwin") {
+-        let homebrew_dir = match target {
+-            "aarch64-apple-darwin" => "/opt/homebrew",
+-            _ => "/usr/local",
+-        };
+-
+-        if let Some(dir) = resolve_with_wellknown_homebrew_location(homebrew_dir) {
+-            return dir.into();
+-        } else if let Some(dir) = resolve_with_wellknown_location("/opt/pkg") {
+-            // pkgsrc
+-            return dir.into();
+-        } else if let Some(dir) = resolve_with_wellknown_location("/opt/local") {
+-            // MacPorts
+-            return dir.into();
+-        }
+-    }
+-
+     try_pkg_config();
+     try_vcpkg();
+ 
diff --git a/rust173/patches/patch-vendor_openssl-sys_build_main.rs b/rust173/patches/patch-vendor_openssl-sys_build_main.rs
new file mode 100644
index 0000000000..7433a659c2
--- /dev/null
+++ b/rust173/patches/patch-vendor_openssl-sys_build_main.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Patterned after Linux and Android, on 32-bit NetBSD ports
+include -latomic.  Parts of this inspired by
+https://github.com/sfackler/rust-openssl/commit/a0a1d1d29263abb7c47fc2e58cef8dab13762a45
+
+--- vendor/openssl-sys/build/main.rs.orig	2022-11-02 16:21:42.000000000 +0000
++++ vendor/openssl-sys/build/main.rs
+@@ -122,6 +122,15 @@ fn main() {
+         println!("cargo:rustc-link-lib={}={}", kind, lib);
+     }
+ 
++    // Patterned of the above, make sure we include -latomic
++    // on ilp32 ports (yes, this only tests the "p32" part).
++    if kind == "static"
++	&& env::var("CARGO_CFG_TARGET_OS").unwrap() == "netbsd"
++	&& env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32"
++    {
++	println!("cargo:rustc-link-lib=dylib=atomic");
++    }
++
+     if kind == "static" && target.contains("windows") {
+         println!("cargo:rustc-link-lib=dylib=gdi32");
+         println!("cargo:rustc-link-lib=dylib=user32");
diff --git a/rust173/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs b/rust173/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
new file mode 100644
index 0000000000..98a1d9cb7b
--- /dev/null
+++ b/rust173/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Add aarch64_be NetBSD target.
+
+--- /dev/null	2021-04-26 00:02:43.147970692 +0200
++++ vendor/rustc-ap-rustc_target/src/spec/aarch64_be_unknown_netbsd.rs	2021-04-26 00:07:44.657579025 +0200
+@@ -0,0 +1,20 @@
++use crate::abi::Endian;
++use crate::spec::{Target, TargetOptions};
++
++pub fn target() -> Target {
++    let mut base = super::netbsd_base::opts();
++    base.max_atomic_width = Some(128);
++    base.unsupported_abis = super::arm_base::unsupported_abis();
++
++    Target {
++        llvm_target: "aarch64_be-unknown-netbsd".to_string(),
++        pointer_width: 64,
++        data_layout: "E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
++        arch: "aarch64".to_string(),
++        options: TargetOptions {
++            mcount: "__mcount".to_string(),
++            endian: Endian::Big,
++            ..base
++        },
++    }
++}
diff --git a/rust173/patches/patch-vendor_stacker_src_lib.rs b/rust173/patches/patch-vendor_stacker_src_lib.rs
new file mode 100644
index 0000000000..dfd1589f54
--- /dev/null
+++ b/rust173/patches/patch-vendor_stacker_src_lib.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-vendor_stacker_src_lib.rs,v 1.1 2020/08/06 11:42:56 jperkin Exp $
+
+Avoid missing pthread_* on older SunOS.
+
+--- vendor/stacker/src/lib.rs.orig	2020-07-13 18:18:17.000000000 +0000
++++ vendor/stacker/src/lib.rs
+@@ -407,7 +407,7 @@ cfg_if! {
+             );
+             Some(mi.assume_init().AllocationBase as usize + get_thread_stack_guarantee() + 0x1000)
+         }
+-    } else if #[cfg(any(target_os = "linux", target_os="solaris", target_os = "netbsd"))] {
++    } else if #[cfg(any(target_os = "linux", target_os = "netbsd"))] {
+         unsafe fn guess_os_stack_limit() -> Option<usize> {
+             let mut attr = std::mem::MaybeUninit::<libc::pthread_attr_t>::uninit();
+             assert_eq!(libc::pthread_attr_init(attr.as_mut_ptr()), 0);
diff --git a/rust173/patches/patch-vendor_target-lexicon_src_targets.rs b/rust173/patches/patch-vendor_target-lexicon_src_targets.rs
new file mode 100644
index 0000000000..7771d25feb
--- /dev/null
+++ b/rust173/patches/patch-vendor_target-lexicon_src_targets.rs
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Add aarch64_eb, mipsel and riscv64gc for NetBSD.
+
+--- vendor/target-lexicon/src/targets.rs.orig	2021-05-03 21:35:46.000000000 +0000
++++ vendor/target-lexicon/src/targets.rs
+@@ -1357,6 +1357,7 @@ mod tests {
+             "aarch64-unknown-linux-gnu_ilp32",
+             "aarch64-unknown-linux-musl",
+             "aarch64-unknown-netbsd",
++            "aarch64_be-unknown-netbsd",
+             "aarch64-unknown-none",
+             "aarch64-unknown-none-softfloat",
+             "aarch64-unknown-openbsd",
+@@ -1441,6 +1442,7 @@ mod tests {
+             "mipsel-unknown-linux-gnu",
+             "mipsel-unknown-linux-musl",
+             "mipsel-unknown-linux-uclibc",
++            "mipsel-unknown-netbsd",
+             "mipsel-unknown-none",
+             "mipsisa32r6el-unknown-linux-gnu",
+             "mipsisa32r6-unknown-linux-gnu",
+@@ -1478,6 +1480,7 @@ mod tests {
+             "riscv64gc-unknown-freebsd",
+             "riscv64gc-unknown-linux-gnu",
+             "riscv64gc-unknown-linux-musl",
++            "riscv64gc-unknown-netbsd",
+             "riscv64gc-unknown-none-elf",
+             "riscv64gc-unknown-openbsd",
+             "riscv64imac-unknown-none-elf",
diff --git a/rust173/patches/patch-vendor_valuable_no__atomic.rs b/rust173/patches/patch-vendor_valuable_no__atomic.rs
new file mode 100644
index 0000000000..f485c63d9d
--- /dev/null
+++ b/rust173/patches/patch-vendor_valuable_no__atomic.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add mipsel-unknown-netbsd.
+
+--- vendor/valuable/no_atomic.rs.orig	2022-09-19 15:35:03.000000000 +0000
++++ vendor/valuable/no_atomic.rs
+@@ -30,6 +30,7 @@ const NO_ATOMIC_64: &[&str] = &[
+     "mipsel-unknown-linux-musl",
+     "mipsel-unknown-linux-uclibc",
+     "mipsel-unknown-none",
++    "mipsel-unknown-netbsd",
+     "mipsisa32r6-unknown-linux-gnu",
+     "mipsisa32r6el-unknown-linux-gnu",
+     "powerpc-unknown-freebsd",
diff --git a/rust173/platform.mk b/rust173/platform.mk
new file mode 100644
index 0000000000..cc75fd55ab
--- /dev/null
+++ b/rust173/platform.mk
@@ -0,0 +1,26 @@
+# $NetBSD: platform.mk,v 1.6 2020/12/26 10:04:51 nia Exp $
+
+# This file encodes whether a given platform has support for rust.
+
+# Platforms where rust ought to work but does not require a link to an
+# open PR.
+
+.if !defined(PLATFORM_SUPPORTS_RUST)
+
+# Rust needs NetBSD>7
+.for rust_arch in aarch64 earmv7hf i386 powerpc riscv64 sparc64 x86_64
+.  for rust_os in Darwin FreeBSD Linux NetBSD SunOS
+.    if ${OPSYS} != "NetBSD" || empty(OS_VERSION:M[0-7].*)
+RUST_PLATFORMS+=	${rust_os}-*-${rust_arch}
+.    endif
+.  endfor
+.endfor
+
+.for rust_platform in ${RUST_PLATFORMS}
+.  if !empty(MACHINE_PLATFORM:M${rust_platform})
+PLATFORM_SUPPORTS_RUST=		yes
+.  endif
+.endfor
+PLATFORM_SUPPORTS_RUST?=	no
+
+.endif # !defined(PLATFORM_SUPPORTS_RUST)
diff --git a/rust173/rust.mk b/rust173/rust.mk
new file mode 100644
index 0000000000..d930124865
--- /dev/null
+++ b/rust173/rust.mk
@@ -0,0 +1,55 @@
+# $NetBSD: rust.mk,v 1.7 2020/10/14 08:23:49 triaxx Exp $
+#
+# This file determines the type of rust package to use.
+#
+# It should be included by rust-dependent packages that don't use
+# cargo.mk.
+#
+# === User-settable variables ===
+#
+# RUST_TYPE
+#	The preferred type of Rust release to use -
+#	either bootstrap-from-source or an official binary.
+#
+#	Official Rust binaries are only published for certain platforms,
+#	including Darwin, FreeBSD, Linux, and NetBSD x86_64.
+#
+#	Possible values: src bin
+#	Default: src
+#
+# === Package-settable variables ===
+#
+# RUST_REQ
+#	The minimum version of Rust required by the package.
+#
+#	Default: 1.56.1
+#
+# RUST_RUNTIME
+#	Whether rust is a runtime dependency.
+#	Usually it is only needed to build.
+#
+#	Possible values: yes no
+#	Default: no
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+RUST_REQ?=	1.56.1
+RUST_RUNTIME?=	no
+
+RUST_TYPE?=	src
+
+.if ${RUST_TYPE} == "bin"
+.  if ${RUST_RUNTIME} == "no"
+BUILDLINK_DEPMETHOD.rust-bin?=		build
+.  endif
+BUILDLINK_API_DEPENDS.rust-bin+=	rust-bin>=${RUST_REQ}
+.  include "../../lang/rust-bin/buildlink3.mk"
+.endif
+
+.if ${RUST_TYPE} == "src"
+.  if ${RUST_RUNTIME} == "no"
+BUILDLINK_DEPMETHOD.rust?=		build
+.  endif
+BUILDLINK_API_DEPENDS.rust+=		rust>=${RUST_REQ}
+.  include "../../lang/rust/buildlink3.mk"
+.endif



Home | Main Index | Thread Index | Old Index