pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Add a package for rust version 1.82.0.
Module Name: pkgsrc-wip
Committed By: Havard Eidnes <he%NetBSD.org@localhost>
Pushed By: he
Date: Sun Oct 27 19:38:48 2024 +0000
Changeset: bcbbdff0875d4798a85eb7477f10ddeca741369a
Added Files:
rust182/DESCR
rust182/HOWTO-BOOTSTRAP
rust182/Makefile
rust182/buildlink3.mk
rust182/cargo.mk
rust182/cross.mk
rust182/distinfo
rust182/do-cross.mk
rust182/files/gcc-wrap
rust182/options.mk
rust182/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
rust182/patches/patch-compiler_rustc__llvm_build.rs
rust182/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs
rust182/patches/patch-compiler_rustc__target_src_spec_mod.rs
rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs
rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs
rust182/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs
rust182/patches/patch-compiler_rustc__target_src_spec_targets_mipsel__unknown__netbsd.rs
rust182/patches/patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs
rust182/patches/patch-config.example.toml
rust182/patches/patch-library_backtrace_src_symbolize_gimli.rs
rust182/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
rust182/patches/patch-library_std_src_sys_pal_unix_mod.rs
rust182/patches/patch-src_bootstrap_bootstrap.py
rust182/patches/patch-src_bootstrap_src_core_build__steps_compile.rs
rust182/patches/patch-src_bootstrap_src_core_build__steps_dist.rs
rust182/patches/patch-src_bootstrap_src_core_build__steps_install.rs
rust182/patches/patch-src_bootstrap_src_core_builder.rs
rust182/patches/patch-src_bootstrap_src_core_config_config.rs
rust182/patches/patch-src_bootstrap_src_lib.rs
rust182/patches/patch-src_llvm-project_llvm_CMakeLists.txt
rust182/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
rust182/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
rust182/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
rust182/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
rust182/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
rust182/patches/patch-src_tools_cargo_tests_testsuite_build.rs
rust182/patches/patch-src_tools_rust-installer_install-template.sh
rust182/patches/patch-tools_rust-analyzer_lib_line-index-src_lib.rs
rust182/patches/patch-vendor_bytecount-0.6.8_src_lib.rs
rust182/patches/patch-vendor_cc-1.0.73_src_lib.rs
rust182/patches/patch-vendor_crossbeam-utils-0.8.18_no__atomic.rs
rust182/patches/patch-vendor_libc-0.2.155_src_unix_solarish_mod.rs
rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_memchr.rs
rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_mod.rs
rust182/patches/patch-vendor_memchr-2.7.4_src_memchr.rs
rust182/patches/patch-vendor_memchr-2.7.4_src_memmem_searcher.rs
rust182/patches/patch-vendor_memchr-2.7.4_src_vector.rs
rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_openssl_Configurations_10-main.conf
rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_src_lib.rs
rust182/patches/patch-vendor_openssl-sys-0.9.102_build_find__normal.rs
rust182/patches/patch-vendor_openssl-sys-0.9.102_build_main.rs
rust182/patches/patch-vendor_openssl-sys-0.9.92_build_find__normal.rs
rust182/patches/patch-vendor_openssl-sys-0.9.92_build_main.rs
rust182/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
rust182/patches/patch-vendor_zerocopy-0.7.32_src_lib.rs
rust182/patches/patch-vendor_zerocopy-0.7.35_src_lib.rs
rust182/platform.mk
rust182/rust.mk
Log Message:
Add a package for rust version 1.82.0.
Pkgsrc changes:
* Adapt patches, apply to new vendored crates where needed.
* Back-port rust pull request 130110, "make dist vendoring configurable"
* Disable "dist vendoring", otherwise cargo would try to access
the network during the build phase.
Upstream changes:
Version 1.82.0 (2024-10-17)
==========================
Language
--------
- [Don't make statement nonterminals match pattern nonterminals]
(https://github.com/rust-lang/rust/pull/120221/)
- [Patterns matching empty types can now be omitted in common cases]
(https://github.com/rust-lang/rust/pull/122792)
- [Enforce supertrait outlives obligations when using trait impls]
(https://github.com/rust-lang/rust/pull/124336)
- [`addr_of(_mut)!` macros and the newly stabilized `&raw (const|mut)`
are now safe to use with all static items]
(https://github.com/rust-lang/rust/pull/125834)
- [size_of_val_raw: for length 0 this is safe to call]
(https://github.com/rust-lang/rust/pull/126152/)
- [Reorder trait bound modifiers *after* `for<...>` binder in trait bounds]
(https://github.com/rust-lang/rust/pull/127054/)
- [Stabilize opaque type precise capturing (RFC 3617)]
(https://github.com/rust-lang/rust/pull/127672)
- [Stabilize `&raw const` and `&raw mut` operators (RFC 2582)]
(https://github.com/rust-lang/rust/pull/127679)
- [Stabilize unsafe extern blocks (RFC 3484)]
(https://github.com/rust-lang/rust/pull/127921)
- [Stabilize nested field access in `offset_of!`]
(https://github.com/rust-lang/rust/pull/128284)
- [Do not require `T` to be live when dropping `[T; 0]`]
(https://github.com/rust-lang/rust/pull/128438)
- [Stabilize `const` operands in inline assembly]
(https://github.com/rust-lang/rust/pull/128570)
- [Stabilize floating-point arithmetic in `const fn`]
(https://github.com/rust-lang/rust/pull/128596)
- [Stabilize explicit opt-in to unsafe attributes]
(https://github.com/rust-lang/rust/pull/128771)
- [Document NaN bit patterns guarantees]
(https://github.com/rust-lang/rust/pull/129559)
Compiler
--------
- [Promote riscv64gc-unknown-linux-musl to tier 2]
(https://github.com/rust-lang/rust/pull/122049)
- [Promote Mac Catalyst targets `aarch64-apple-ios-macabi` and
`x86_64-apple-ios-macabi` to Tier 2, and ship them with rustup]
(https://github.com/rust-lang/rust/pull/126450)
- [Add tier 3 NuttX based targets for RISC-V and ARM]
(https://github.com/rust-lang/rust/pull/127755)
- [Add tier 3 powerpc-unknown-linux-muslspe target]
(https://github.com/rust-lang/rust/pull/127905)
- [Improved diagnostics to explain why a pattern is unreachable]
(https://github.com/rust-lang/rust/pull/128034)
- [The compiler now triggers the unreachable code warning properly
for async functions that don't return/are `-> !`]
(https://github.com/rust-lang/rust/pull/128443)
- [Promote `aarch64-apple-darwin` to Tier 1]
(https://github.com/rust-lang/rust/pull/128592)
- [Add Trusty OS target `aarch64-unknown-trusty` and `armv7-unknown-trusty`
as tier 3 targets] (https://github.com/rust-lang/rust/pull/129490)
- [Promote `wasm32-wasip2` to Tier 2.]
(https://github.com/rust-lang/rust/pull/126967/)
Libraries
---------
- [Generalize `{Rc,Arc}::make_mut()` to `Path`, `OsStr`, and `CStr`.]
(https://github.com/rust-lang/rust/pull/126877)
Stabilized APIs
---------------
- [`std::thread::Builder::spawn_unchecked`]
(https://doc.rust-lang.org/stable/std/thread/struct.Builder.html#method.spawn_unchecked)
- [`std::str::CharIndices::offset`]
(https://doc.rust-lang.org/nightly/std/str/struct.CharIndices.html#method.offset)
- [`std::option::Option::is_none_or`]
(https://doc.rust-lang.org/nightly/std/option/enum.Option.html#method.is_none_or)
- [`[T]::is_sorted`]
(https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted)
- [`[T]::is_sorted_by`]
(https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted_by)
- [`[T]::is_sorted_by_key`]
(https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted_by_key)
- [`Iterator::is_sorted`]
(https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.is_sorted)
- [`Iterator::is_sorted_by`]
(https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.is_sorted_by)
- [`Iterator::is_sorted_by_key`]
(https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.is_sorted_by_key)
- [`std::future::Ready::into_inner`]
(https://doc.rust-lang.org/nightly/std/future/struct.Ready.html#method.into_inner)
- [`std::iter::repeat_n`]
(https://doc.rust-lang.org/nightly/std/iter/fn.repeat_n.html)
- [`impl<T: Clone> DoubleEndedIterator for Take<Repeat<T>>`]
(https://doc.rust-lang.org/nightly/std/iter/struct.Take.html#impl-DoubleEndedIterator-for-Take%3CRepeat%3CT%3E%3E)
- [`impl<T: Clone> ExactSizeIterator for Take<Repeat<T>>`]
(https://doc.rust-lang.org/nightly/std/iter/struct.Take.html#impl-ExactSizeIterator-for-Take%3CRepeat%3CT%3E%3E)
- [`impl<T: Clone> ExactSizeIterator for Take<RepeatWith<T>>`]
(https://doc.rust-lang.org/nightly/std/iter/struct.Take.html#impl-ExactSizeIterator-for-Take%3CRepeatWith%3CF%3E%3E)
- [`impl Default for std::collections::binary_heap::Iter`]
(https://doc.rust-lang.org/nightly/std/collections/binary_heap/struct.Iter.html#impl-Default-for-Iter%3C'_,+T%3E)
- [`impl Default for std::collections::btree_map::RangeMut`]
(https://doc.rust-lang.org/nightly/std/collections/btree_map/struct.RangeMut.html#impl-Default-for-RangeMut%3C'_,+K,+V%3E)
- [`impl Default for std::collections::btree_map::ValuesMut`]
(https://doc.rust-lang.org/nightly/std/collections/btree_map/struct.ValuesMut.html#impl-Default-for-ValuesMut%3C'_,+K,+V%3E)
- [`impl Default for std::collections::vec_deque::Iter`]
(https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.Iter.html#impl-Default-for-Iter%3C'_,+T%3E)
- [`impl Default for std::collections::vec_deque::IterMut`]
(https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.IterMut.html#impl-Default-for-IterMut%3C'_,+T%3E)
- [`Rc<T>::new_uninit`]
(https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit)
- [`Rc<T>::assume_init`]
(https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init)
- [`Rc<[T]>::new_uninit_slice`]
(https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit_slice)
- [`Rc<[MaybeUninit<T>]>::assume_init`]
(https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init-1)
- [`Arc<T>::new_uninit`]
(https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit)
- [`Arc<T>::assume_init`]
(https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init)
- [`Arc<[T]>::new_uninit_slice`]
(https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit_slice)
- [`Arc<[MaybeUninit<T>]>::assume_init`]
(https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init-1)
- [`Box<T>::new_uninit`]
(https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit)
- [`Box<T>::assume_init`]
(https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init)
- [`Box<[T]>::new_uninit_slice`]
(https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit_slice)
- [`Box<[MaybeUninit<T>]>::assume_init`]
(https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init-1)
- [`core::arch::x86_64::_bextri_u64`]
(https://doc.rust-lang.org/stable/core/arch/x86_64/fn._bextri_u64.html)
- [`core::arch::x86_64::_bextri_u32`]
(https://doc.rust-lang.org/stable/core/arch/x86_64/fn._bextri_u32.html)
- [`core::arch::x86::_mm_broadcastsi128_si256`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_broadcastsi128_si256.html)
- [`core::arch::x86::_mm256_stream_load_si256`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm256_stream_load_si256.html)
- [`core::arch::x86::_tzcnt_u16`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._tzcnt_u16.html)
- [`core::arch::x86::_mm_extracti_si64`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_extracti_si64.html)
- [`core::arch::x86::_mm_inserti_si64`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_inserti_si64.html)
- [`core::arch::x86::_mm_storeu_si16`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_storeu_si16.html)
- [`core::arch::x86::_mm_storeu_si32`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_storeu_si32.html)
- [`core::arch::x86::_mm_storeu_si64`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_storeu_si64.html)
- [`core::arch::x86::_mm_loadu_si16`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_loadu_si16.html)
- [`core::arch::x86::_mm_loadu_si32`]
(https://doc.rust-lang.org/stable/core/arch/x86/fn._mm_loadu_si32.html)
- [`core::arch::wasm32::u8x16_relaxed_swizzle`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u8x16_relaxed_swizzle.html)
- [`core::arch::wasm32::i8x16_relaxed_swizzle`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i8x16_relaxed_swizzle.html)
- [`core::arch::wasm32::i32x4_relaxed_trunc_f32x4`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4_relaxed_trunc_f32x4.html)
- [`core::arch::wasm32::u32x4_relaxed_trunc_f32x4`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4_relaxed_trunc_f32x4.html)
- [`core::arch::wasm32::i32x4_relaxed_trunc_f64x2_zero`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4_relaxed_trunc_f64x2_zero.html)
- [`core::arch::wasm32::u32x4_relaxed_trunc_f64x2_zero`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4_relaxed_trunc_f64x2_zero.html)
- [`core::arch::wasm32::f32x4_relaxed_madd`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4_relaxed_madd.html)
- [`core::arch::wasm32::f32x4_relaxed_nmadd`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4_relaxed_nmadd.html)
- [`core::arch::wasm32::f64x2_relaxed_madd`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2_relaxed_madd.html)
- [`core::arch::wasm32::f64x2_relaxed_nmadd`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2_relaxed_nmadd.html)
- [`core::arch::wasm32::i8x16_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i8x16_relaxed_laneselect.html)
- [`core::arch::wasm32::u8x16_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u8x16_relaxed_laneselect.html)
- [`core::arch::wasm32::i16x8_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i16x8_relaxed_laneselect.html)
- [`core::arch::wasm32::u16x8_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u16x8_relaxed_laneselect.html)
- [`core::arch::wasm32::i32x4_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4_relaxed_laneselect.html)
- [`core::arch::wasm32::u32x4_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4_relaxed_laneselect.html)
- [`core::arch::wasm32::i64x2_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i64x2_relaxed_laneselect.html)
- [`core::arch::wasm32::u64x2_relaxed_laneselect`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u64x2_relaxed_laneselect.html)
- [`core::arch::wasm32::f32x4_relaxed_min`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4_relaxed_min.html)
- [`core::arch::wasm32::f32x4_relaxed_max`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4_relaxed_max.html)
- [`core::arch::wasm32::f64x2_relaxed_min`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2_relaxed_min.html)
- [`core::arch::wasm32::f64x2_relaxed_max`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2_relaxed_max.html)
- [`core::arch::wasm32::i16x8_relaxed_q15mulr`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i16x8_relaxed_q15mulr.html)
- [`core::arch::wasm32::u16x8_relaxed_q15mulr`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u16x8_relaxed_q15mulr.html)
- [`core::arch::wasm32::i16x8_relaxed_dot_i8x16_i7x16`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i16x8_relaxed_dot_i8x16_i7x16.html)
- [`core::arch::wasm32::u16x8_relaxed_dot_i8x16_i7x16`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u16x8_relaxed_dot_i8x16_i7x16.html)
- [`core::arch::wasm32::i32x4_relaxed_dot_i8x16_i7x16_add`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4_relaxed_dot_i8x16_i7x16_add.html)
- [`core::arch::wasm32::u32x4_relaxed_dot_i8x16_i7x16_add`]
(https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4_relaxed_dot_i8x16_i7x16_add.html)
These APIs are now stable in const contexts:
- [`std::task::Waker::from_raw`]
(https://doc.rust-lang.org/nightly/std/task/struct.Waker.html#method.from_raw)
- [`std::task::Waker::waker`]
(https://doc.rust-lang.org/nightly/std/task/struct.Waker.html#method.from_raw)
- [`std::task::Context::from_waker`]
(https://doc.rust-lang.org/nightly/std/task/struct.Context.html#method.from_waker)
- [`std::task::Context::waker`]
(https://doc.rust-lang.org/nightly/std/task/struct.Context.html#method.waker)
- [`$integer::from_str_radix`]
(https://doc.rust-lang.org/nightly/std/primitive.u32.html#method.from_str_radix)
- [`std::num::ParseIntError::kind`]
(https://doc.rust-lang.org/nightly/std/num/struct.ParseIntError.html#method.kind)
Cargo
-----
- [feat: Add `info` cargo subcommand]
(https://github.com/rust-lang/cargo/pull/14141/)
Compatibility Notes
-------------------
- We now [disallow setting some built-in cfgs via the
command-line](https://github.com/rust-lang/rust/pull/126158) with
the newly added
[`explicit_builtin_cfgs_in_flags`]
(https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#explicit-builtin-cfgs-in-flags)
lint in order to prevent incoherent state, eg. `windows` cfg active
but target is Linux based. The appropriate [`rustc` flag]
(https://doc.rust-lang.org/rustc/command-line-arguments.html)
should be used instead.
- The standard library has a new implementation of `binary_search`
which is significantly improves performance
([#128254](https://github.com/rust-lang/rust/pull/128254)). However
when a sorted slice has multiple values which compare equal, the
new implementation may select a different value among the equal
ones than the old implementation.
- [illumos/Solaris now sets `MSG_NOSIGNAL` when writing to
sockets](https://github.com/rust-lang/rust/pull/128259). This avoids
killing the process with SIGPIPE when writing to a closed socket,
which matches the existing behavior on other UNIX targets.
- [Removes a problematic hack that always passed the --whole-archive
linker flag for tests, which may cause linker errors for code
accidentally relying on it.]
(https://github.com/rust-lang/rust/pull/128400)
- The WebAssembly target features `multivalue` and `reference-types`
are now both enabled by default. These two features both have
subtle changes implied for generated WebAssembly binaries. For
the `multivalue` feature, WebAssembly target support has changed
when upgrading to LLVM 19. Support for generating functions with
multiple returns no longer works and `-Ctarget-feature=+multivalue`
has a different meaning than it did in LLVM 18 and prior. There
is no longer any supported means to generate a module that has
a function with multiple returns in WebAssembly from Rust source
code. For the `reference-types` feature the encoding of immediates
in the `call_indirect`, a commonly used instruction by the
WebAssembly backend, has changed. Validators and parsers which
don't understand the `reference-types` proposal will no longer
accept modules produced by LLVM due to this change in encoding
of immediates. Additionally these features being enabled are
encoded in the `target_features` custom section and may affect
downstream tooling such as `wasm-opt` consuming the module.
Generating a WebAssembly module that disables default features
requires `-Zbuild-std` support from Cargo and more information
can be found at
[rust-lang/rust#128511](https://github.com/rust-lang/rust/pull/128511).
- [Rust now raises unsafety errors for union patterns in parameter-position]
(https://github.com/rust-lang/rust/pull/130531)
Internal Changes
----------------
These changes do not affect any public interfaces of Rust, but they
represent significant improvements to the performance or internals
of rustc and related tools.
- [Update to LLVM 19]
(https://github.com/rust-lang/rust/pull/127513)
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=bcbbdff0875d4798a85eb7477f10ddeca741369a
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
rust182/DESCR | 13 +
rust182/HOWTO-BOOTSTRAP | 85 +++
rust182/Makefile | 690 +++++++++++++++++++++
rust182/buildlink3.mk | 17 +
rust182/cargo.mk | 110 ++++
rust182/cross.mk | 83 +++
rust182/distinfo | 157 +++++
rust182/do-cross.mk | 107 ++++
rust182/files/gcc-wrap | 199 ++++++
rust182/options.mk | 78 +++
...compiler_rustc__codegen__ssa_src_back_linker.rs | 27 +
.../patches/patch-compiler_rustc__llvm_build.rs | 50 ++
...-compiler_rustc__target_src_spec_base_netbsd.rs | 32 +
.../patch-compiler_rustc__target_src_spec_mod.rs | 14 +
...rc_spec_targets_aarch64__be__unknown__netbsd.rs | 17 +
...et_src_spec_targets_aarch64__unknown__netbsd.rs | 17 +
...t_src_spec_targets_mips64el__unknown__netbsd.rs | 35 ++
...get_src_spec_targets_mipsel__unknown__netbsd.rs | 14 +
...et_src_spec_targets_sparc64__unknown__netbsd.rs | 29 +
rust182/patches/patch-config.example.toml | 14 +
.../patch-library_backtrace_src_symbolize_gimli.rs | 14 +
...ch-library_backtrace_src_symbolize_gimli_elf.rs | 25 +
.../patch-library_std_src_sys_pal_unix_mod.rs | 14 +
rust182/patches/patch-src_bootstrap_bootstrap.py | 46 ++
...-src_bootstrap_src_core_build__steps_compile.rs | 15 +
...tch-src_bootstrap_src_core_build__steps_dist.rs | 20 +
...-src_bootstrap_src_core_build__steps_install.rs | 13 +
.../patch-src_bootstrap_src_core_builder.rs | 28 +
.../patch-src_bootstrap_src_core_config_config.rs | 45 ++
rust182/patches/patch-src_bootstrap_src_lib.rs | 23 +
.../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 +
...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 | 39 ++
...ch-src_tools_rust-installer_install-template.sh | 179 ++++++
...h-tools_rust-analyzer_lib_line-index-src_lib.rs | 47 ++
.../patch-vendor_bytecount-0.6.8_src_lib.rs | 45 ++
rust182/patches/patch-vendor_cc-1.0.73_src_lib.rs | 16 +
...tch-vendor_crossbeam-utils-0.8.18_no__atomic.rs | 14 +
...ch-vendor_libc-0.2.155_src_unix_solarish_mod.rs | 15 +
...-vendor_memchr-2.7.4_src_arch_aarch64_memchr.rs | 24 +
...tch-vendor_memchr-2.7.4_src_arch_aarch64_mod.rs | 15 +
.../patch-vendor_memchr-2.7.4_src_memchr.rs | 128 ++++
...atch-vendor_memchr-2.7.4_src_memmem_searcher.rs | 78 +++
.../patch-vendor_memchr-2.7.4_src_vector.rs | 15 +
...28.2+1.1.1w_openssl_Configurations_10-main.conf | 18 +
...h-vendor_openssl-src-111.28.2+1.1.1w_src_lib.rs | 62 ++
...endor_openssl-sys-0.9.102_build_find__normal.rs | 30 +
.../patch-vendor_openssl-sys-0.9.102_build_main.rs | 23 +
...vendor_openssl-sys-0.9.92_build_find__normal.rs | 30 +
.../patch-vendor_openssl-sys-0.9.92_build_main.rs | 23 +
...target_src_spec_aarch64__be__unknown__netbsd.rs | 27 +
.../patch-vendor_zerocopy-0.7.32_src_lib.rs | 25 +
.../patch-vendor_zerocopy-0.7.35_src_lib.rs | 25 +
rust182/platform.mk | 31 +
rust182/rust.mk | 56 ++
59 files changed, 3146 insertions(+)
diffs:
diff --git a/rust182/DESCR b/rust182/DESCR
new file mode 100644
index 0000000000..6dc90a671e
--- /dev/null
+++ b/rust182/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/rust182/HOWTO-BOOTSTRAP b/rust182/HOWTO-BOOTSTRAP
new file mode 100644
index 0000000000..81133db2ec
--- /dev/null
+++ b/rust182/HOWTO-BOOTSTRAP
@@ -0,0 +1,85 @@
+How to build a rust bootstrap kit using pkgsrc
+----------------------------------------------
+
+A rust bootstrap kit is simply a pre-compiled binary of rust and
+the rust standard library, and contains the "rust" and "rust-std"
+build results, found in
+
+ work/rustc-<version>/build/dist/
+as
+ rust-<version>-<target>.tar.xz
+and
+ rust-std-<version>-<target>.tar.xz
+
+These result files are produced when the "dist" build target is
+used, ref. BUILD_TARGET. For a normal native build of the rust
+pkgsrc package, the default BUILD_TARGET is "build", not "dist".
+
+There are two possible ways to produce a bootstrap kit:
+
+1) a native build. This requires minimum preparation, except
+ possibly for setting rust.BUILD_TARGET to "dist" via e.g.
+ /etc/mk.conf. Note that on NetBSD, using the "BUILD_TARGET" ==
+ "dist" results in the "rust-cargo-static" option being set, ref.
+ options.mk. This is so that the resulting bootstrap kits are
+ built with mostly-static linking, reducing the run-time dependencies
+ of the bootstrap kits.
+
+2) a cross-build. This requires a bit of preparation:
+
+ For each target you want to cross-build rust for, you need
+ - the cross toolchain resulting from "build.sh tools" for
+ the intended target
+ - an OS distribution extracted, including the comp.tgz
+ set so that the target's include files can be used
+ - for 32-bit ports, the "libatomic" package needs to be
+ available. I'm sure there's a clever and long-winded
+ use of pkg_install which can be used to effect this;
+ I on my hand have always just extracted the tgz file
+ and done the minimal cleanup of the "cruft" files
+ which are part of the package meta-data.
+ - Pick a root directory for the target, e.g. /u/i386.
+ Below this directory place the "tools" containing
+ the cross-compiler in a "tools" sub-directory.
+ Similarly, the extracted OS distribution in the "dest"
+ sub-directory.
+
+ There are two methods available for doing the cross-compile:
+
+ a) Using the "cross.mk" file. For an i386 build against i586, the
+ following settings should be active:
+
+CROSS_ROOT= /u/i386
+MAKE_ENV+= CROSS_ROOT=${CROSS_ROOT}
+GNU_CROSS_TARGET= i486--netbsdelf
+MAKE_ENV+= GNU_CROSS_TARGET=${GNU_CROSS_TARGET}
+TARGET= i586-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
+CONFIGURE_ARGS+= --set=target.${TARGET}.ar=${CROSS_ROOT}/tools/bin/${GNU_CROSS_TARGET}-ar
+
+ Then doing a "make" will cross-build rust, including the LLVM
+ embedded in the rust distribution, ref. the defaulting of that
+ option when TARGET is defined ref. options.mk.
+
+ Note that when TARGET is set, the default build target for
+ the rust makefile becomes "dist", so there's no need to set
+ rust.BUILD_TARGET for cross-builds.
+
+ b) Using the "do-cross.mk" Makefile. This will attempt to
+ cross-build rust for all the targets listed in the SHORT_TARGETS
+ variable in that file. Overriding the root directories for
+ the various targets can be done by making your own "local-roots.mk"
+ file, ref. "do-cross.mk".
+
+ This will create a "dist" subdirectory in the rust pkgsrc
+ directory, and the bootstrap kits for each architecture, plus
+ the library source kit will be placed in this directory.
+
+The bootstrap kits can then be placed in /usr/pkgsrc/distfiles, and
+be used by the "next" rust version, where you can use "make makesum"
+to compute the updated checksums for the bootstrap kits.
diff --git a/rust182/Makefile b/rust182/Makefile
new file mode 100644
index 0000000000..b2b1621cbe
--- /dev/null
+++ b/rust182/Makefile
@@ -0,0 +1,690 @@
+# $NetBSD: Makefile,v 1.316 2024/07/31 12:30:43 he Exp $
+
+DISTNAME= rustc-1.82.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++
+USE_LIBTOOL= yes
+USE_TOOLS+= bash grep gmake perl:build pkg-config
+
+# This is a bug:
+# https://github.com/rust-lang/rust/issues/130708
+# "Building rust 1.81.0 does network access in the "build" phase"
+# but set it for now to allow progress in finding other build issues.
+#ALLOW_NETWORK_ACCESS= yes
+# Ref. dist.vendor below.
+
+# The NetBSD bootstraps are built for NetBSD 9 (because rust doesn't
+# build on 8 or earlier), or because the target didn't exist in 8
+# or 9 (as in riscv64). Therefore, mark earlier versions as broken.
+BROKEN_ON_PLATFORM+= NetBSD-[1-8].*-*
+
+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
+# Ref. issue #130708 & backport of pull-request 130110
+CONFIGURE_ARGS+= --set dist.vendor=false
+
+# 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}
+
+# 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
+
+# Debugging of crate resolution
+# Annoyingly, this makes the powerpc build succeed...
+#MAKE_ENV+= RUSTC_LOG=rustc_metadata
+
+UNLIMIT_RESOURCES+= cputime stacksize datasize virtualsize
+
+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/*.sh
+CHECK_INTERPRETER_SKIP+= lib/rustlib/src/rust/library/core/src/unicode/printable.py
+CHECK_INTERPRETER_SKIP+= lib/rustlib/src/rust/library/stdarch/ci/*.sh
+CHECK_PORTABILITY_SKIP+= tests/run-make/dump-ice-to-disk/check.sh
+CHECK_PORTABILITY_SKIP+= vendor/libdbus-sys-0.2.5/vendor/dbus/tools/cmake-format
+
+.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" && ${OPSYS_VERSION} > 090999 && ${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}
+
+NB=
+
+.if ${MACHINE_PLATFORM:MDarwin-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER= 1.81.0
+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.81.0
+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.81.0
+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.81.0
+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.81.0
+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.81.0
+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.81.0
+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.80.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.81.0
+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.81.0
+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.81.0
+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.81.0
+RUST_ARCH= powerpc-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-*-aarch64} || make(distinfo) || make (makesum) || make(mdi)
+RUST_STAGE0_VER= 1.81.0
+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.81.0
+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.81.0
+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.81.0
+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.81.0
+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.81.0
+#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.81.0
+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+= prefix
+SUBST_STAGE.prefix= pre-configure
+SUBST_FILES.prefix+= compiler/rustc_codegen_ssa/src/back/linker.rs
+SUBST_FILES.prefix+= compiler/rustc_target/src/spec/base/netbsd.rs
+SUBST_FILES.prefix+= src/bootstrap/src/core/build_steps/compile.rs
+SUBST_FILES.prefix+= src/bootstrap/src/core/builder.rs
+SUBST_FILES.prefix+= src/bootstrap/bootstrap.py
+SUBST_VARS.prefix= 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/crossbeam-utils-0.8.18
+CKSUMS+= 31a8276afd38e39987a169eeb02e9bed32670de5ca36d7eb74aab7e506cf9dc4
+CKSUMS+= ead4bda23c322bde8c01e48d4cd19b70e7b7e473a56466218d279f88463ab466
+
+CKSUM_CRATES+= vendor/openssl-sys-0.9.92
+CKSUMS+= 33f814dba4ac9942266157cbe3dc8eadf5e477090370a92c36c53f916fa45d48
+CKSUMS+= f78ddd9b03c31a03350aa152d6f707c6cbb21b2ea0b493d05238aa473b80af09
+CKSUMS+= b2cbaa5bfac5e7d5550aa0eb8e5c65a9f7e86a3692b759fb13330ef6e3b26b30
+CKSUMS+= b303bf9ceae9fcffa4a0420ea858675d827fc2d75c358f8236e44274d58be1a0
+
+CKSUM_CRATES+= vendor/openssl-src-111.28.2+1.1.1w/
+CKSUMS+= 090744f85cf99a9b8412c23fca1eabb61eb45d830f0f9f0e7309be2572c1e827
+CKSUMS+= e8ca5ea1808323cd9f0cc9d53c7258bb2f3112e5eafc11dd457e010a80a9c8d8
+CKSUMS+= cf331474674b6c4fff7e361d592c14131c97918d6f756b36698a7ac8ec845adb
+CKSUMS+= bec36eddcf41c8639903ea7593751c92251100168241bc5696f8a776a55651fb
+
+CKSUM_CRATES+= vendor/libc-0.2.155
+CKSUMS+= 3e550d95419169febf094c425451ca86b12821fa17839b4b0ba7520b145a5820
+CKSUMS+= 1cf38d9ddeca5295821b4234e17e1fc749f35b00307bdfdacb24c6892a288ad6
+
+CKSUM_CRATES+= vendor/zerocopy-0.7.32
+CKSUMS+= 2f21f18a4ca1d4be2d997f037158cb21a7421b2ba2cc52f3e4c5f9410197ed27
+CKSUMS+= abe079743c2b2dea5b2c42564f98741a5eb9e24ff019e01742ace5581e53c06f
+
+CKSUM_CRATES+= vendor/zerocopy-0.7.35
+CKSUMS+= eb5033d1f2f3d5314625bc63353b1d105cb414d4bc68edf8700b401e4055d669
+CKSUMS+= bd504cc95f722a296a5f221c3a3068c9eaa946258beff163581d9492de6ccdce
+
+CKSUM_CRATES+= vendor/memchr-2.7.4
+CKSUMS+= 5bb70f915084e629d940dbc322f5b9096b2e658cf63fea8a2f6e7550412e73a0
+CKSUMS+= 34aaa34eb7048e8bba49d390942ab707990380952f37f388f3cca30970c53450
+CKSUMS+= 7763472d43c66df596ca0697c07db0b4666d38a6a14f64f9f298aaf756c4a715
+CKSUMS+= 1b26fca824c410077780fbc2f4c53c1d195ba3bdf6785b529ceb0a11f039cec2
+CKSUMS+= 3b15d5cb9715f26e655598eacbb8bbba74cbe8ddb2fb969d13aa75f216a118dd
+CKSUMS+= 8844a2cd5e71abb8efdf8fc3ee54d9c66f3fedb529cdaf5984c279177f5f90af
+CKSUMS+= 6ae779ec5d00f443075316e0105edf30b489a38e2e96325bec14ccecd014145b
+CKSUMS+= 28d66e566b73f6f0f7add4092874dc967ce133bfb6dcbd81f03c9a04b6e4e1d0
+CKSUMS+= 44cd1a614bd66f1e66fc86c541d3c3b8d3a14a644c13e8bf816df3f555eac2d4
+CKSUMS+= 27f9bff08b24828e1a611b10a0282f5457d12e9e7254202040144d392297d720
+
+CKSUM_CRATES+= vendor/bytecount-0.6.8
+CKSUMS+= 01cd755a128d8a5892f3edda195b26bb461be375be17dd72e6e4f061169e6dff
+CKSUMS+= a6750c0e2a6c385ec902cd7f87de7835fe2b4171b9c83da64122274ee20a77c6
+
+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
+
+# Rust builds some bundled components with strict version requirements, ensure
+# that any conflicting packages pulled in via dependencies are not buildlinked.
+BUILDLINK_FILES_CMD.xz= ${TRUE}
+MAKE_ENV+= LZMA_API_STATIC=1
+pre-configure:
+ ${RM} -rf ${BUILDLINK_DIR}/include/libssh2*
+
+#
+# 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}
+
+SUBST_CLASSES+= destdir
+SUBST_STAGE.destdir= post-install
+SUBST_FILES.destdir= ${DESTDIR}${PREFIX}/lib/rustlib/manifest-*
+SUBST_SED.destdir= -e 's|file:${DESTDIR}${PREFIX}|file:${PREFIX}|'
+
+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-17.so libcrypto.so.3 libcurl.so.4 \
+ libssl.so.3 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/rust182/buildlink3.mk b/rust182/buildlink3.mk
new file mode 100644
index 0000000000..b8eeb79834
--- /dev/null
+++ b/rust182/buildlink3.mk
@@ -0,0 +1,17 @@
+# $NetBSD: buildlink3.mk,v 1.14 2023/10/25 05:50:43 pin 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/rust182/cargo.mk b/rust182/cargo.mk
new file mode 100644
index 0000000000..b57d01de95
--- /dev/null
+++ b/rust182/cargo.mk
@@ -0,0 +1,110 @@
+# $NetBSD: cargo.mk,v 1.37 2024/05/04 20:06:55 tnn 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 digest
+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} ${WRKDIR}/.cargo
+ ${RUN}${PRINTF} "[source.crates-io]\nreplace-with = \"vendored-sources\"\n[source.vendored-sources]\ndirectory = \"${CARGO_VENDOR_DIR}\"\n" > ${WRKDIR}/.cargo/config.toml
+ ${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}
+ALL_ENV+= CARGO_HOME=${WRKDIR}
+
+.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
+
+.if ${OPSYS} == "Darwin"
+.PHONY: do-cargo-post-install-darwin-fix-rpath
+post-install: do-cargo-post-install-darwin-fix-rpath
+do-cargo-post-install-darwin-fix-rpath:
+ ${RUN} cd ${DESTDIR}; \
+ for i in $$(${FIND} .${PREFIX}/lib -name '*.so' | ${SED} -e 's|^\./||'); do \
+ install_name_tool -id /$$i $$i; \
+ done
+.endif
diff --git a/rust182/cross.mk b/rust182/cross.mk
new file mode 100644
index 0000000000..47f2b3e006
--- /dev/null
+++ b/rust182/cross.mk
@@ -0,0 +1,83 @@
+# $NetBSD: cross.mk,v 1.11 2023/07/10 12:01:24 he 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-armv7hf-10.0
+#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/rust182/distinfo b/rust182/distinfo
new file mode 100644
index 0000000000..fea0aaa9a9
--- /dev/null
+++ b/rust182/distinfo
@@ -0,0 +1,157 @@
+$NetBSD: distinfo,v 1.159 2023/06/19 14:46:47 bsiegert Exp $
+
+BLAKE2s (rust-1.80.1-x86_64-unknown-illumos.tar.gz) = 19a7088bf5df1ea978f34c00d59ca6a6997d1757daf0ab290241291aa7bd2cc7
+SHA512 (rust-1.80.1-x86_64-unknown-illumos.tar.gz) = b39e2aa68d3c9b8a241c3b0c2a49c5377e092487c116930ce06834cddba6270e66c494fdb8a4928096f654724a592520c6f7fb4f45da4a22b8fb3058ed74b721
+Size (rust-1.80.1-x86_64-unknown-illumos.tar.gz) = 218858660 bytes
+BLAKE2s (rust-1.81.0-aarch64-apple-darwin.tar.gz) = aa033b8af1b7cf6a08476da3f74fa4634bc82224fb170cda4683aa6b5fde0916
+SHA512 (rust-1.81.0-aarch64-apple-darwin.tar.gz) = 542be316f94beaf12d2c87f67acaaf41273a7fe2117768a46d02cef30522dd1c1fd4eeff22e516b77d5b173a435ff4140433b23327561318fbe4a0b1519f2ab9
+Size (rust-1.81.0-aarch64-apple-darwin.tar.gz) = 342382518 bytes
+BLAKE2s (rust-1.81.0-aarch64-unknown-linux-gnu.tar.gz) = 39c710c66162a654ca5fe27e651c43d753a2cf5be09ab259f985195a4b7a4949
+SHA512 (rust-1.81.0-aarch64-unknown-linux-gnu.tar.gz) = 456ea7e345ad856e27c0fa94b1e3c642eeb34cbfe6ffd34cc67622ce222ab17259913c329ee59a91b69b52bf447a85fc4c3141898080961a9de4094b4e1a17dd
+Size (rust-1.81.0-aarch64-unknown-linux-gnu.tar.gz) = 488236376 bytes
+BLAKE2s (rust-1.81.0-aarch64-unknown-netbsd.tar.xz) = d06db0dad290d162959052e44d6cb609c36a2851f92dc8aaad1b4ae08b3fa458
+SHA512 (rust-1.81.0-aarch64-unknown-netbsd.tar.xz) = 5517e60c488998f0ad18080e52850510100263bd92d8e9f8254742f75bf1a774d46e5c9bddfcfc185fcd51bafe59f24a24d38b1347ef599398e29f3147c66d60
+Size (rust-1.81.0-aarch64-unknown-netbsd.tar.xz) = 199857236 bytes
+BLAKE2s (rust-1.81.0-aarch64_be-unknown-netbsd.tar.xz) = f90a8038a4931ab11682f5ab93224702d4f4ef6583ef57ebca3ff596a0abdee3
+SHA512 (rust-1.81.0-aarch64_be-unknown-netbsd.tar.xz) = 1047c5f32c9a0ad5480238dc4c1c61061030639bdcb1e7853cb4401ad3ff5b9bca45d2d042aba040b2f86504835caddfc6c8eb4c60c6b023847ebcebd1578e21
+Size (rust-1.81.0-aarch64_be-unknown-netbsd.tar.xz) = 198057028 bytes
+BLAKE2s (rust-1.81.0-arm-unknown-linux-gnueabihf.tar.gz) = 9b503d5b2a2428a7f6657202b042f3655f859791585c55a80e0ed7c369f5ba6d
+SHA512 (rust-1.81.0-arm-unknown-linux-gnueabihf.tar.gz) = 0e9719f2b72e25eae21a7d34c3c5cdd655646b5fcacc4427e4c45db4e40f9d53db82bb631e4807984b280f31dfe90f81637fe32e72536f0b01e92b923fb637aa
+Size (rust-1.81.0-arm-unknown-linux-gnueabihf.tar.gz) = 372178843 bytes
+BLAKE2s (rust-1.81.0-armv6-unknown-netbsd-eabihf.tar.xz) = de41c01933b7016c83caab00d9105b5bb46996fec037d5b8f8f0caee856d44eb
+SHA512 (rust-1.81.0-armv6-unknown-netbsd-eabihf.tar.xz) = 9e2f0ea2852409e12c9ea0b8ed69d3ca2d50e06fd4879511a680c57ceefc8e2c038bff73538a7cd1547dcb71944d69383137ce3df5aa890504df18c117aa59ad
+Size (rust-1.81.0-armv6-unknown-netbsd-eabihf.tar.xz) = 169411036 bytes
+BLAKE2s (rust-1.81.0-armv7-unknown-linux-gnueabihf.tar.gz) = 615f19c752bc9db052e282e11b344137ced86ada54b918aea0e844ad321f3520
+SHA512 (rust-1.81.0-armv7-unknown-linux-gnueabihf.tar.gz) = 1fbfcdf94e48047ee7d6fa2553ae5adc7d2257fdbfdebf0a5379b856e75ea04d49c5f49f4d694324bcd66166d64849d46c302279bda7ba31ce4bff20f0de4d65
+Size (rust-1.81.0-armv7-unknown-linux-gnueabihf.tar.gz) = 360463528 bytes
+BLAKE2s (rust-1.81.0-armv7-unknown-netbsd-eabihf.tar.xz) = 49e09d97f2adb9161d10ac38df4e2f02ba5d99866aa1ead5090099a18ae6f02b
+SHA512 (rust-1.81.0-armv7-unknown-netbsd-eabihf.tar.xz) = de7a5c8746f941efce91fc82dd3775bf9e00b831581a201808b6baef061da8d1592ed91fdf0e29ba86feac6843f51c6ab105bae0079be9a72fcdc10d7494ef2a
+Size (rust-1.81.0-armv7-unknown-netbsd-eabihf.tar.xz) = 171194260 bytes
+BLAKE2s (rust-1.81.0-i586-unknown-netbsd.tar.xz) = 10ebe3f58b5cd33bd16eb5ef00e34759abf446d2b7c3ec044a9f66e070c8b28c
+SHA512 (rust-1.81.0-i586-unknown-netbsd.tar.xz) = 771ad395071b89e1c6163bdb75bfe3e8a62c009046e525c49b83aa29b732f7627571cc6c10104cc489cc805518a232095714f032a8e10726c990657d4ffbfa21
+Size (rust-1.81.0-i586-unknown-netbsd.tar.xz) = 217261872 bytes
+BLAKE2s (rust-1.81.0-i686-unknown-linux-gnu.tar.gz) = 831e8265e0a81a18c33482a04ab4ccf3aa376d44e63ff61c2d817cee36a430ff
+SHA512 (rust-1.81.0-i686-unknown-linux-gnu.tar.gz) = 7ca73bdf5393b57700c9273df99b02fc59c0cbb8e08dea29da8ed2e9f6816eafdc427202c4aa42fbd155dd138ec39106fe9a8502129fefecbd47a37d769af343
+Size (rust-1.81.0-i686-unknown-linux-gnu.tar.gz) = 439375569 bytes
+BLAKE2s (rust-1.81.0-powerpc-unknown-netbsd.tar.xz) = 70f5e9e8afd218b7d6421970d8b767aedb4c40cb0d4f57b0ff73bfdbcd21e7ac
+SHA512 (rust-1.81.0-powerpc-unknown-netbsd.tar.xz) = 2ac0493a5ae06525628b5655731fd18b9d1bb3f6bd483e603413ee63ac6b5dfbc26f6f16905cf0e3502a04170644802a4f66dee1c6a42409b03a4b0ee8274bb8
+Size (rust-1.81.0-powerpc-unknown-netbsd.tar.xz) = 230224080 bytes
+BLAKE2s (rust-1.81.0-riscv64gc-unknown-netbsd.tar.xz) = 66047ffe66e5cbbfd96243a881c0f892d5297967870233389cbb124ef76cdef7
+SHA512 (rust-1.81.0-riscv64gc-unknown-netbsd.tar.xz) = 77285720dfd91c09c5e5581c8db85cd7258e01a18473fa803c07263ebc09a78b2431bcbcbb6badd4465a8d9f168d3a7bbf70498a1c271dd86a56f7e1156b6324
+Size (rust-1.81.0-riscv64gc-unknown-netbsd.tar.xz) = 219678696 bytes
+BLAKE2s (rust-1.81.0-sparc64-unknown-netbsd.tar.xz) = 6dd09b88f3de7e71f580c75f81da5bebb31a19d1e111806f0d984507c6ee65a1
+SHA512 (rust-1.81.0-sparc64-unknown-netbsd.tar.xz) = 3799752690ad0a0c80000ca284c8198fe8db46757f579e697dc77a0183ed7360d46355917dbed4c37dcc8debd55e7ee842d851054128b7e4ad4bee466ab3b788
+Size (rust-1.81.0-sparc64-unknown-netbsd.tar.xz) = 193855168 bytes
+BLAKE2s (rust-1.81.0-x86_64-apple-darwin.tar.gz) = 3ce64f23c508cc24929b0bd9d96e338a0fa2e6924cf7cefbb6cb9aace13b989e
+SHA512 (rust-1.81.0-x86_64-apple-darwin.tar.gz) = 06acf3a19beae8166622830d79799be61d80b8864e83aabe7a7b6e852d4e6ad0af9cb74278b6d703b8378739d8ed49e42cf771d75ef6789726fc491dd9ce35e1
+Size (rust-1.81.0-x86_64-apple-darwin.tar.gz) = 346755530 bytes
+BLAKE2s (rust-1.81.0-x86_64-unknown-freebsd.tar.gz) = ea20d7a67bed2b1a37b8ad31f92e121a2110f02311888b85cf0a03ec6320723b
+SHA512 (rust-1.81.0-x86_64-unknown-freebsd.tar.gz) = 3617c5054f0f8f6657c5cae0dfc49644cb83a28b1741bafb916f16d6681ef3697f09a0f892e24b629b720206ac4eda31fa7618ea647ab4dc29f31dd024dfb3dc
+Size (rust-1.81.0-x86_64-unknown-freebsd.tar.gz) = 329217094 bytes
+BLAKE2s (rust-1.81.0-x86_64-unknown-linux-gnu.tar.gz) = 64140ced76a7a2230bc710bd2ca562fd3e4c4deb0dff194a71a17a2675911a4c
+SHA512 (rust-1.81.0-x86_64-unknown-linux-gnu.tar.gz) = b6eb16fcb109e6c60a80d63999dce969e7abfed936d6e68c563d212db0cd9ec5d6874d45a185157838878b0ed68e52796d763192656c12496cd7572757292b8c
+Size (rust-1.81.0-x86_64-unknown-linux-gnu.tar.gz) = 340154798 bytes
+BLAKE2s (rust-1.81.0-x86_64-unknown-netbsd.tar.xz) = 74ede561486232e00ddae0119ed776d47d3e8aece14b86bd1510dbd01edd94af
+SHA512 (rust-1.81.0-x86_64-unknown-netbsd.tar.xz) = 05b6274d279a7498143a3632a85201a62bdde1bded70ff24a0b812093eb48758fcfbf27ccde5e65272b27985f24794922d01164c8cf1fdd7f14c674f64f5edd2
+Size (rust-1.81.0-x86_64-unknown-netbsd.tar.xz) = 189273736 bytes
+BLAKE2s (rust-std-1.81.0-aarch64-apple-darwin.tar.gz) = 8ed47dcb59bc50d4450ab4d425cc955b58b7829109aaffc397d75ed687bdbcc1
+SHA512 (rust-std-1.81.0-aarch64-apple-darwin.tar.gz) = 39dda9eea3f3f7b1967cc0a8de0b1be13147ba669134fc5ab3cd6780f8a8fb6072dab42dae2a61bc461709d218253257772a8f2520b7f737c6e0964028e90e5a
+Size (rust-std-1.81.0-aarch64-apple-darwin.tar.gz) = 40942716 bytes
+BLAKE2s (rust-std-1.81.0-aarch64-unknown-linux-gnu.tar.gz) = 6577ee264d45ae3fa78e56be44ec2580ce3193e6cbd42546e5ecf2dc844612f6
+SHA512 (rust-std-1.81.0-aarch64-unknown-linux-gnu.tar.gz) = b169c386746ac1af1254fe7bd6dd9c83fb259bb8749ece7db7feb7f2f18e85f84ff2fbec5e4d7721010388a0fa30dc941b4730c90980bba74caee389652ce355
+Size (rust-std-1.81.0-aarch64-unknown-linux-gnu.tar.gz) = 57042816 bytes
+BLAKE2s (rust-std-1.81.0-aarch64-unknown-netbsd.tar.xz) = caf19d678e536fc64865c83612858fcb2bbb92e4df93af7988da660c00d49f22
+SHA512 (rust-std-1.81.0-aarch64-unknown-netbsd.tar.xz) = 27f1da8d2be1d6a93fd126b5dc54063600ff855c97f1f2bf16b2e1e6d7c56f8ce233963b4a6b8707d218a7a6de48a0f184c58bcf9f8f4f2b4a7c097570b6e45f
+Size (rust-std-1.81.0-aarch64-unknown-netbsd.tar.xz) = 23243712 bytes
+BLAKE2s (rust-std-1.81.0-aarch64_be-unknown-netbsd.tar.xz) = 8943bda365466ce352ecdfcbffd62f0307a2ff90916e8f613ac75cfb4d552b44
+SHA512 (rust-std-1.81.0-aarch64_be-unknown-netbsd.tar.xz) = 1a87788b66828b66fb40c8675bfe267bb0cc0dcc817ccb32c6d3f6509717bcca730c5ae424dfdd851ee696316209a00a057532bb138bd2dbdfd04c9bce8d3014
+Size (rust-std-1.81.0-aarch64_be-unknown-netbsd.tar.xz) = 21856844 bytes
+BLAKE2s (rust-std-1.81.0-arm-unknown-linux-gnueabihf.tar.gz) = 07e7b077f156da9c8a9d90abcdf7c77cc0a28299911c2633daa05d1a186a6585
+SHA512 (rust-std-1.81.0-arm-unknown-linux-gnueabihf.tar.gz) = eb91e62805b62f92904f6ee48f237843b210c8b09c9c109ffe17ff466054184ed285427a8ff67e0280c87e26933424060cfc22175185395a4b73d33adc18c088
+Size (rust-std-1.81.0-arm-unknown-linux-gnueabihf.tar.gz) = 37638920 bytes
+BLAKE2s (rust-std-1.81.0-armv6-unknown-netbsd-eabihf.tar.xz) = 753e2af4a71e5658739819e21af09130891b9ef85d33f772b83848dd6d731101
+SHA512 (rust-std-1.81.0-armv6-unknown-netbsd-eabihf.tar.xz) = 26f99382fd36624f7a1e2ad8835d40d669cbd0577a2cbb7f4841f78e115fed1f73d8e6624c8f48590f37b0b6ba9661617e247af7eedf09f77e4fe8e9715c4ee2
+Size (rust-std-1.81.0-armv6-unknown-netbsd-eabihf.tar.xz) = 21899440 bytes
+BLAKE2s (rust-std-1.81.0-armv7-unknown-linux-gnueabihf.tar.gz) = cf3fb73fa3781cbd107bb1136e45fd31c8f7d684377880d569b045cc22c3422a
+SHA512 (rust-std-1.81.0-armv7-unknown-linux-gnueabihf.tar.gz) = ca8b50ab0cc99bc85fdbddbedb7e328d960143a2e26e42ffde71a1f9faca1710116580043874b64856dcb5ffc87c21826dd8f3cdc534d34ff031c65b0a003c9f
+Size (rust-std-1.81.0-armv7-unknown-linux-gnueabihf.tar.gz) = 39178697 bytes
+BLAKE2s (rust-std-1.81.0-armv7-unknown-netbsd-eabihf.tar.xz) = 30d1d2fccac13a96c3c6014d4fa4e446808048ea16d631a3dc092b60f6952c91
+SHA512 (rust-std-1.81.0-armv7-unknown-netbsd-eabihf.tar.xz) = 621798a1294aa084f99fc13aeb5865d72926a55e95773cb9b6a9d5e9842ef287ad0c53af0729d1189b108ef28214d4b119f67fffb6552f23b5d1b68c7a166386
+Size (rust-std-1.81.0-armv7-unknown-netbsd-eabihf.tar.xz) = 22860184 bytes
+BLAKE2s (rust-std-1.81.0-i586-unknown-netbsd.tar.xz) = 35e760c34fb238ce9f2a0383fc5543f9516fbab914050def953d43e8be5b428e
+SHA512 (rust-std-1.81.0-i586-unknown-netbsd.tar.xz) = 0fdb3e2b5b2885686ec130df9133927092cc6f5f44f29255accfecc78f675f8335f0e6610119a7e849a96e7086603cb3fdd09e108af126fa96f1d17fd916d655
+Size (rust-std-1.81.0-i586-unknown-netbsd.tar.xz) = 23867944 bytes
+BLAKE2s (rust-std-1.81.0-i686-unknown-linux-gnu.tar.gz) = 572f9dd807d373b0b66867e13307e3e3de86cbd0b7cd1fefcd2051de3a2e6876
+SHA512 (rust-std-1.81.0-i686-unknown-linux-gnu.tar.gz) = 0119ad7e92654c52629bb0dcf4b7a938bc322e8956772e3420b47eeaedb010168e94b30a048295952506d658f2dcbcc8bfc3e08aeaf1f504d6dbc74b0134f156
+Size (rust-std-1.81.0-i686-unknown-linux-gnu.tar.gz) = 40598854 bytes
+BLAKE2s (rust-std-1.81.0-powerpc-unknown-netbsd.tar.xz) = 50bc72a21c295c22815f3e0d58210de9ee53bea961974d56608db8f5e138f578
+SHA512 (rust-std-1.81.0-powerpc-unknown-netbsd.tar.xz) = 556cff52c2d801eb45b4bca71d6910ed31830bc36f7cb48e292a3628297214283b2095f1a253f34ab027525af912df233da2e6b04122e519a52059884e79d02c
+Size (rust-std-1.81.0-powerpc-unknown-netbsd.tar.xz) = 21941180 bytes
+BLAKE2s (rust-std-1.81.0-riscv64gc-unknown-netbsd.tar.xz) = b65ae1c73da50c93ab2d0cf239994cfb2daf68a66b00e4651123db52dccca0c7
+SHA512 (rust-std-1.81.0-riscv64gc-unknown-netbsd.tar.xz) = c56bd2c7438385124f26c27861ee9c98d37a4461d4643c184b775ebb2afecb2f3f4be42f7ca949a407b3f75833c3773362166c174697f5937123a52f1da663f3
+Size (rust-std-1.81.0-riscv64gc-unknown-netbsd.tar.xz) = 22077648 bytes
+BLAKE2s (rust-std-1.81.0-sparc64-unknown-netbsd.tar.xz) = b3c072c7298fd4a7f65b977c3337cd53fbbb405adb043203e5c9aab8b198a572
+SHA512 (rust-std-1.81.0-sparc64-unknown-netbsd.tar.xz) = 2c65b5d46775abe785e2c99c3e32155948c7c80fad43f616fa95c6d9ec550acc0c7249e77ea3b3d87b8229793a1b0bc8b2ed548945a19d9ea063693e43272082
+Size (rust-std-1.81.0-sparc64-unknown-netbsd.tar.xz) = 21714816 bytes
+BLAKE2s (rust-std-1.81.0-x86_64-apple-darwin.tar.gz) = e1c6e4b07c89ba1c93cd12755b3af07a20ecb0c966a1743282bbcb2d7ce92d43
+SHA512 (rust-std-1.81.0-x86_64-apple-darwin.tar.gz) = f2ddcd679cba8ed4c14db371a73dbe2ecd03d7a2aaad235ef69cda798c11625c0e63fd39c79fe735db529a03ac0d6f9df34df7cbb6e96acd965c1c37471625aa
+Size (rust-std-1.81.0-x86_64-apple-darwin.tar.gz) = 42635280 bytes
+BLAKE2s (rust-std-1.81.0-x86_64-unknown-freebsd.tar.gz) = 026227ace5af06800bd3bfde717115d4116b7bd8f4a0a4a198f825d145d96d2a
+SHA512 (rust-std-1.81.0-x86_64-unknown-freebsd.tar.gz) = c93f32f59a25183486516d3428da083172f96b1e92f8474630e0c90114c28663b27c8a7bd9f10c5ecf5d5b6bf8e19f355cf6d30ca20be8e75358b4c2e914aa3e
+Size (rust-std-1.81.0-x86_64-unknown-freebsd.tar.gz) = 43610502 bytes
+BLAKE2s (rust-std-1.81.0-x86_64-unknown-linux-gnu.tar.gz) = 5c6c04ed4901779296231a2580a2cfa3486240056c9ec065e54bdc9749f7a633
+SHA512 (rust-std-1.81.0-x86_64-unknown-linux-gnu.tar.gz) = b49036caeae10ec4093e645be07c81001f28369389ba27f776a8636b84be65874a80880740198a7a82fa27e2c66a6db318b65bd5b3fcff6802a14ead19a4a4e1
+Size (rust-std-1.81.0-x86_64-unknown-linux-gnu.tar.gz) = 46105479 bytes
+BLAKE2s (rust-std-1.81.0-x86_64-unknown-netbsd.tar.xz) = 75f018b2373b86569e8413fa755445bf9bb2fab2d8836a71c5e8accca96bf16d
+SHA512 (rust-std-1.81.0-x86_64-unknown-netbsd.tar.xz) = 3fa73320a09c669196f5acd36cd200bdbbdba59947782fc99dfa1ea4e4496ae14c3b39ec142af1ed068d1511536fdb82bac23046343a3b26c6dcfff55c6a9320
+Size (rust-std-1.81.0-x86_64-unknown-netbsd.tar.xz) = 26259400 bytes
+BLAKE2s (rustc-1.82.0-src.tar.gz) = 5240e949251d8016c35102ab8254d0aba05ff459570ef4097443ff098b417f3d
+SHA512 (rustc-1.82.0-src.tar.gz) = 0a4b4aeffe02fae35bafd64429d15009c23e5f698c0c596c6250c4de6c0dfc4fa7af5b2662c33a6fc511b1f1f2f253e5a6f2967c10ab41347c6a7f1d31bbb303
+Size (rustc-1.82.0-src.tar.gz) = 434309696 bytes
+SHA1 (patch-compiler_rustc__codegen__ssa_src_back_linker.rs) = a11f894d87516da6a8e3faaa4425c8212ff5899f
+SHA1 (patch-compiler_rustc__llvm_build.rs) = a4a66d449fc9eb99d648d02a041778a68f4f7ce8
+SHA1 (patch-compiler_rustc__target_src_spec_base_netbsd.rs) = 7d910631f49acf2c33fdd191fd3e0f261efae234
+SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = a22b5d28997ed9a5565deec9c34322165d563d00
+SHA1 (patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs) = 620eaf74c1dd030973af53dfe4f9aa998be5b123
+SHA1 (patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs) = 1a02f2dd61a5f9cc4be1f66ac3404c961810c731
+SHA1 (patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs) = e97b7978cc525db7eadf967d51f4818a3c145754
+SHA1 (patch-compiler_rustc__target_src_spec_targets_mipsel__unknown__netbsd.rs) = 7deeb7d1d3306e96891dec144ac90398b88c6ad4
+SHA1 (patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs) = 847022a9c02d277f39e2c842f23a9ed401bc5534
+SHA1 (patch-config.example.toml) = 520ad7a26249780ae79a5dc1d2b534a8c6aef0a5
+SHA1 (patch-library_backtrace_src_symbolize_gimli.rs) = 9d5ef634c5a454e474ea5fee76da9bb768f5b3d9
+SHA1 (patch-library_backtrace_src_symbolize_gimli_elf.rs) = 3b84a462c6bc8245d579452e4c37e3ce13314952
+SHA1 (patch-library_std_src_sys_pal_unix_mod.rs) = bfc59ae4568547e3ed71c8b31ba5b5b5363d5d40
+SHA1 (patch-src_bootstrap_bootstrap.py) = 6f1d3068da49f19c3e092230ba1c7d99af628d3a
+SHA1 (patch-src_bootstrap_src_core_build__steps_compile.rs) = e928203ed4734c93cc33c5a3f7879cf18dcecc83
+SHA1 (patch-src_bootstrap_src_core_build__steps_dist.rs) = 22e37d6260cbd93ca3c6d119b58e48750836b17c
+SHA1 (patch-src_bootstrap_src_core_build__steps_install.rs) = cc6558df42c9c9ac28fdb2ff180bdaa7f22ce816
+SHA1 (patch-src_bootstrap_src_core_builder.rs) = 6d76366201097adc56e494fa05ebbc1696bb2d98
+SHA1 (patch-src_bootstrap_src_core_config_config.rs) = fa9d93602693bce064aa155ad0a204b176b47d99
+SHA1 (patch-src_bootstrap_src_lib.rs) = d29bc3c0b335d5e788eecbb02fc08966beef0fb1
+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_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) = 84dfc091a152b83938e8706917d692a329b70393
+SHA1 (patch-src_tools_rust-installer_install-template.sh) = 6984546c34a2e4d55a6dbe59baa0d4958184e0b7
+SHA1 (patch-tools_rust-analyzer_lib_line-index-src_lib.rs) = 4ed527174447ee23fa81dd6840e18b9949d5a273
+SHA1 (patch-vendor_bytecount-0.6.8_src_lib.rs) = d7610f2ae957d085a465f8c75549e5a11586a8b0
+SHA1 (patch-vendor_cc-1.0.73_src_lib.rs) = 690b3feaa619050512254d7c18fd4f51da98e279
+SHA1 (patch-vendor_crossbeam-utils-0.8.18_no__atomic.rs) = d4d9288cb199af9bc7e321fbd2b42860aed954ec
+SHA1 (patch-vendor_libc-0.2.155_src_unix_solarish_mod.rs) = 97505b88875aa80fa2b5589b6090237c3786e143
+SHA1 (patch-vendor_memchr-2.7.4_src_arch_aarch64_memchr.rs) = 3e17e9f068afe5e812d10bf57fd3f6d4c21baf0b
+SHA1 (patch-vendor_memchr-2.7.4_src_arch_aarch64_mod.rs) = 24bbd69c8b571e5652d5306989b6598b58ec1966
+SHA1 (patch-vendor_memchr-2.7.4_src_memchr.rs) = 4c2f4fa4911f38acd3b36c311abd14d3c9751672
+SHA1 (patch-vendor_memchr-2.7.4_src_memmem_searcher.rs) = a5038873015004ab0c8769dda84edc16a9c55f24
+SHA1 (patch-vendor_memchr-2.7.4_src_vector.rs) = 50a901d061cf58a745b0c387a1c45ff2f0c54e89
+SHA1 (patch-vendor_openssl-src-111.28.2+1.1.1w_openssl_Configurations_10-main.conf) = ac2963bca8d1dc4e196693d9f5a264f38355314a
+SHA1 (patch-vendor_openssl-src-111.28.2+1.1.1w_src_lib.rs) = c87435bef2899b30b5cdb1b525193489988b2476
+SHA1 (patch-vendor_openssl-sys-0.9.102_build_find__normal.rs) = 2cf1432ed2be79677d41f267f9a08ff3082e9cbc
+SHA1 (patch-vendor_openssl-sys-0.9.102_build_main.rs) = 8861b7d3acc1643f7fe6f494b18d452ac70cf810
+SHA1 (patch-vendor_openssl-sys-0.9.92_build_find__normal.rs) = 91ad0d3e78055a5a205d55cd2c260cde70233bfe
+SHA1 (patch-vendor_openssl-sys-0.9.92_build_main.rs) = a47c0b7144466592aca3b622cb77498d59c5dfc4
+SHA1 (patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = 4e86aec4c89db9a331950a12f8ec7b8aaa50eed7
+SHA1 (patch-vendor_zerocopy-0.7.32_src_lib.rs) = d683e48900f427327f4ed518fe62b593e82c13d7
+SHA1 (patch-vendor_zerocopy-0.7.35_src_lib.rs) = b4b910405172f5653db4bf3286974b9410e77fab
diff --git a/rust182/do-cross.mk b/rust182/do-cross.mk
new file mode 100644
index 0000000000..8d866ed96f
--- /dev/null
+++ b/rust182/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/rust182/files/gcc-wrap b/rust182/files/gcc-wrap
new file mode 100644
index 0000000000..957ebfa032
--- /dev/null
+++ b/rust182/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/rust182/options.mk b/rust182/options.mk
new file mode 100644
index 0000000000..3a6b4659ac
--- /dev/null
+++ b/rust182/options.mk
@@ -0,0 +1,78 @@
+# $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
+
+# 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"
+
+# NetBSD/sparc64 when using the internal LLVM needs
+# to not use gcc 10.4 or 10.5 (as found in 10.0_BETA or 10.0), ref.
+# https://github.com/rust-lang/rust/issues/117231
+# (however, gcc from 9.x produces a working LLVM, go figure).
+.if ${MACHINE_PLATFORM:MNetBSD-10.*-sparc64}
+. if !empty(PKG_OPTIONS:Mrust-internal-llvm)
+# Require GCC 12 (from pkgsrc) to correctly build the embedded LLVM (17.x).
+GCC_REQD+= 12
+. endif
+.endif
+
+#
+# Use the internal copy of LLVM or the external one?
+#
+.if empty(PKG_OPTIONS:Mrust-internal-llvm)
+.include "../../lang/libunwind/buildlink3.mk"
+.include "../../lang/llvm/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-llvm-link-shared
+CONFIGURE_ARGS+= --llvm-libunwind=system
+CONFIGURE_ARGS+= --llvm-root=${BUILDLINK_PREFIX.llvm}
+# Also turn off build of the internal LLD, as the external LLVM
+# may be older (e.g. 17) than the internal LLD (now 18.x), ref.
+# https://github.com/rust-lang/rust/issues/131291
+CONFIGURE_ARGS+= --set rust.lld=false
+.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/rust182/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs b/rust182/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
new file mode 100644
index 0000000000..d35a82f2b0
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__codegen__ssa_src_back_linker.rs
@@ -0,0 +1,27 @@
+$NetBSD: patch-compiler_rustc__codegen__ssa_src_back_linker.rs,v 1.17 2024/07/27 02:35:24 tnn Exp $
+
+Do not use @rpath on Darwin.
+Find external libunwind on Linux.
+
+--- compiler/rustc_codegen_ssa/src/back/linker.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ compiler/rustc_codegen_ssa/src/back/linker.rs
+@@ -402,7 +402,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.link_arg("-install_name").link_arg(rpath);
+ }
+@@ -880,6 +880,10 @@ impl<'a> Linker for MsvcLinker<'a> {
+
+ fn link_dylib_by_name(&mut self, name: &str, verbatim: bool, _as_needed: bool) {
+ self.link_arg(format!("{}{}", name, if verbatim { "" } else { ".lib" }));
++ if self.sess.target.os.contains("linux") && name == "unwind" {
++ self.link_arg("-rpath,@PREFIX@/lib");
++ self.link_arg("-L@PREFIX@/lib");
++ }
+ }
+
+ fn link_dylib_by_path(&mut self, path: &Path, _as_needed: bool) {
diff --git a/rust182/patches/patch-compiler_rustc__llvm_build.rs b/rust182/patches/patch-compiler_rustc__llvm_build.rs
new file mode 100644
index 0000000000..4edd1eebea
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__llvm_build.rs
@@ -0,0 +1,50 @@
+$NetBSD: patch-compiler_rustc__llvm_build.rs,v 1.17 2024/04/18 09:29:42 pin Exp $
+
+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,6 +249,10 @@ fn main() {
+ {
+ // 32-bit targets need to link libatomic.
+ println!("cargo:rustc-link-lib=atomic");
++ if target.contains("netbsd")
++ {
++ println!("cargo:rustc-link-lib=z");
++ }
+ } else if target.contains("windows-gnu") {
+ println!("cargo:rustc-link-lib=shell32");
+ println!("cargo:rustc-link-lib=uuid");
+@@ -261,7 +265,11 @@ fn main() {
+ // On NetBSD/i386, gcc and g++ is built for i486 (to maximize backward compat)
+ // However, LLVM insists on using 64-bit atomics.
+ // This gives rise to a need to link rust itself with -latomic for these targets
+- if target.starts_with("i586") || target.starts_with("i686") {
++ 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");
+@@ -352,7 +360,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/rust182/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs
new file mode 100644
index 0000000000..c1ed446d2f
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_base_netbsd.rs
@@ -0,0 +1,32 @@
+$NetBSD$
+
+For the benefit of powerpc, when libatomic-links is installed,
+search the directory containing the symlinks to -latomic.
+
+--- compiler/rustc_target/src/spec/base/netbsd.rs.orig 2024-01-06 19:57:14.887897867 +0000
++++ compiler/rustc_target/src/spec/base/netbsd.rs
+@@ -1,12 +1,23 @@
+-use crate::spec::{cvs, RelroLevel, TargetOptions};
++use crate::spec::{cvs, Cc, Lld, RelroLevel, LinkerFlavor, TargetOptions};
+
+ pub fn opts() -> TargetOptions {
++ let add_linker_paths =
++ &[
++ // For the benefit of powerpc, when libatomic-links is installed,
++ "-Wl,-R@PREFIX@/lib/libatomic",
++ "-Wl,-L@PREFIX@/lib/libatomic",
++ ];
++ let pre_link_args = TargetOptions::link_args(
++ LinkerFlavor::Gnu(Cc::Yes, Lld::No),
++ add_linker_paths
++ );
+ 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,
+ has_thread_local: true,
diff --git a/rust182/patches/patch-compiler_rustc__target_src_spec_mod.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_mod.rs
new file mode 100644
index 0000000000..48bba380a5
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_mod.rs
@@ -0,0 +1,14 @@
+$NetBSD: patch-compiler_rustc__target_src_spec_mod.rs,v 1.17 2024/04/18 09:29:42 pin Exp $
+
+Add entry for NetBSD/mips64el.
+
+--- compiler/rustc_target/src/spec/mod.rs.orig 2024-01-13 14:20:59.236278792 +0000
++++ compiler/rustc_target/src/spec/mod.rs
+@@ -1532,6 +1532,7 @@ supported_targets! {
+ ("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
+ ("i586-unknown-netbsd", i586_unknown_netbsd),
+ ("i686-unknown-netbsd", i686_unknown_netbsd),
++ ("mips64el-unknown-netbsd", mips64el_unknown_netbsd),
+ ("mipsel-unknown-netbsd", mipsel_unknown_netbsd),
+ ("powerpc-unknown-netbsd", powerpc_unknown_netbsd),
+ ("riscv64gc-unknown-netbsd", riscv64gc_unknown_netbsd),
diff --git a/rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs
new file mode 100644
index 0000000000..64f75d7aa0
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs
@@ -0,0 +1,17 @@
+$NetBSD$
+
+NetBSD aarch64 has a bug in the thread-local storage implementation,
+ref. PR#58154. Turn it off for now.
+Ideally should check whether the version has the fix or not, but
+e.g. __NetBSD_Version__ isn't easily available here that I know...
+
+--- compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs.orig 2024-07-23 19:21:34.344805113 +0000
++++ compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
+@@ -18,6 +18,7 @@ pub fn target() -> Target {
+ max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
+ endian: Endian::Big,
++ has_thread_local: false, // ref. NetBSD PR#58154
+ ..base::netbsd::opts()
+ },
+ }
diff --git a/rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs
new file mode 100644
index 0000000000..870b6f0931
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs
@@ -0,0 +1,17 @@
+$NetBSD$
+
+NetBSD aarch64 has a bug in the thread-local storage implementation,
+ref. PR#58154. Turn it off for now.
+Ideally should check whether the version has the fix or not, but
+e.g. __NetBSD_Version__ isn't easily available here that I know...
+
+--- compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs.orig 2024-07-23 19:18:44.116841966 +0000
++++ compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
+@@ -17,6 +17,7 @@ pub fn target() -> Target {
+ mcount: "__mcount".into(),
+ max_atomic_width: Some(128),
+ stack_probes: StackProbeType::Inline,
++ has_thread_local: false, // ref. NetBSD PR#58154
+ ..base::netbsd::opts()
+ },
+ }
diff --git a/rust182/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs
new file mode 100644
index 0000000000..e4ff43501d
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs
@@ -0,0 +1,35 @@
+$NetBSD$
+
+Provide a mips64el target with N32, suitable for NetBSD/mips64el.
+
+--- compiler/rustc_target/src/spec/targets/mips64el_unknown_netbsd.rs.orig 2024-01-13 14:16:30.122042614 +0000
++++ compiler/rustc_target/src/spec/targets/mips64el_unknown_netbsd.rs
+@@ -0,0 +1,28 @@
++use crate::abi::Endian;
++use crate::spec::{base, Target, TargetOptions};
++
++pub fn target() -> Target {
++ let mut base = base::netbsd::opts();
++ base.max_atomic_width = Some(32);
++ base.cpu = "mips32".into();
++
++ Target {
++ llvm_target: "mipsel-unknown-netbsd".into(),
++ metadata: crate::spec::TargetMetadata {
++ description: None,
++ tier: None,
++ host_tools: None,
++ std: None,
++ },
++ 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/rust182/patches/patch-compiler_rustc__target_src_spec_targets_mipsel__unknown__netbsd.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_mipsel__unknown__netbsd.rs
new file mode 100644
index 0000000000..9f9b89dbe0
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_mipsel__unknown__netbsd.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Let's see if turning off thread local storage makes a difference...
+
+--- compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs.orig 2024-08-05 20:02:56.368978562 +0000
++++ compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs
+@@ -21,6 +21,7 @@ pub fn target() -> Target {
+ features: "+soft-float".into(),
+ mcount: "__mcount".into(),
+ endian: Endian::Little,
++ has_thread_local: false, // Let's see if there's a difference...
+ ..base
+ },
+ }
diff --git a/rust182/patches/patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs
new file mode 100644
index 0000000000..c7ab248900
--- /dev/null
+++ b/rust182/patches/patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs
@@ -0,0 +1,29 @@
+$NetBSD$
+
+Make more similar to other sparc64 target specs.
+
+--- compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs
+@@ -1,11 +1,13 @@
+ use crate::abi::Endian;
+-use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
++use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
+
+ pub fn target() -> Target {
+ let mut base = base::netbsd::opts();
+ base.cpu = "v9".into();
+ base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
+ base.max_atomic_width = Some(64);
++ base.endian = Endian::Big;
++ base.mcount = "__mcount".into();
+
+ Target {
+ llvm_target: "sparc64-unknown-netbsd".into(),
+@@ -18,6 +20,6 @@ pub fn target() -> Target {
+ pointer_width: 64,
+ data_layout: "E-m:e-i64:64-n32:64-S128".into(),
+ arch: "sparc64".into(),
+- options: TargetOptions { endian: Endian::Big, mcount: "__mcount".into(), ..base },
++ options: base,
+ }
+ }
diff --git a/rust182/patches/patch-config.example.toml b/rust182/patches/patch-config.example.toml
new file mode 100644
index 0000000000..d0a943bd6b
--- /dev/null
+++ b/rust182/patches/patch-config.example.toml
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Backport https://github.com/rust-lang/rust/pull/130110/
+"make dist vendoring configurable"
+
+--- config.example.toml.orig 2024-09-22 17:59:03.580913638 +0000
++++ config.example.toml
+@@ -918,3 +918,6 @@
+ # Copy the linker, DLLs, and various libraries from MinGW into the Rust toolchain.
+ # Only applies when the host or target is pc-windows-gnu.
+ #include-mingw-linker = true
++
++# Whether to vendor dependencies for the dist tarball.
++#vendor = if "is a tarball source" || "is a git repository" { true } else { false }
diff --git a/rust182/patches/patch-library_backtrace_src_symbolize_gimli.rs b/rust182/patches/patch-library_backtrace_src_symbolize_gimli.rs
new file mode 100644
index 0000000000..9084324dd8
--- /dev/null
+++ b/rust182/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 2006-07-24 01:21:28.000000000 +0000
++++ library/backtrace/src/symbolize/gimli.rs
+@@ -40,6 +40,7 @@ cfg_if::cfg_if! {
+ target_os = "haiku",
+ target_os = "hurd",
+ target_os = "linux",
++ target_os = "netbsd",
+ target_os = "openbsd",
+ target_os = "solaris",
+ target_os = "illumos",
diff --git a/rust182/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs b/rust182/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
new file mode 100644
index 0000000000..a262257884
--- /dev/null
+++ b/rust182/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
@@ -0,0 +1,25 @@
+$NetBSD: patch-library_backtrace_src_symbolize_gimli_elf.rs,v 1.8 2024/04/18 09:29:42 pin Exp $
+
+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
+@@ -304,11 +304,17 @@ 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 = "hurd", target_os = "linux"))] {
++ if #[cfg(any(target_os = "freebsd",
++ target_os = "netbsd",
++ target_os = "hurd",
++ target_os = "linux"))] {
+ use core::sync::atomic::{AtomicU8, Ordering};
+ static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
+
diff --git a/rust182/patches/patch-library_std_src_sys_pal_unix_mod.rs b/rust182/patches/patch-library_std_src_sys_pal_unix_mod.rs
new file mode 100644
index 0000000000..403ccd725e
--- /dev/null
+++ b/rust182/patches/patch-library_std_src_sys_pal_unix_mod.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add libexecinfo for backtrace() on NetBSD.
+
+--- library/std/src/sys/pal/unix/mod.rs.orig 2024-03-22 12:47:54.470537834 +0000
++++ library/std/src/sys/pal/unix/mod.rs
+@@ -384,6 +384,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/rust182/patches/patch-src_bootstrap_bootstrap.py b/rust182/patches/patch-src_bootstrap_bootstrap.py
new file mode 100644
index 0000000000..f9671c8d80
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_bootstrap.py
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_bootstrap_bootstrap.py,v 1.23 2024/04/18 09:29:42 pin Exp $
+
+Use `uname -p` on NetBSD, as that is reliable and sensible there.
+Handle earmv[67]hf for NetBSD.
+Also use @PREFIX@ and not $ORIGIN in rpath.
+
+--- src/bootstrap/bootstrap.py.orig 2023-07-12 03:32:40.000000000 +0000
++++ src/bootstrap/bootstrap.py
+@@ -270,6 +270,11 @@ def default_build_triple(verbose):
+ 'GNU': 'unknown-hurd',
+ }
+
++ # 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:
+ kernel = kerneltype_mapper[kernel]
+@@ -373,10 +378,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':
+@@ -734,6 +745,7 @@ class RustBuild(object):
+
+ patchelf = "{}/bin/patchelf".format(nix_deps_dir)
+ rpath_entries = [
++ "@PREFIX@/lib",
+ os.path.join(os.path.realpath(nix_deps_dir), "lib")
+ ]
+ patchelf_args = ["--add-rpath", ":".join(rpath_entries)]
diff --git a/rust182/patches/patch-src_bootstrap_src_core_build__steps_compile.rs b/rust182/patches/patch-src_bootstrap_src_core_build__steps_compile.rs
new file mode 100644
index 0000000000..92eee78647
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_src_core_build__steps_compile.rs
@@ -0,0 +1,15 @@
+$NetBSD: patch-src_bootstrap_src_core_build__steps_compile.rs,v 1.2 2024/04/18 09:29:42 pin Exp $
+
+On Darwin, do not use @rpath for internal libraries.
+
+--- src/bootstrap/src/core/build_steps/compile.rs.orig 2024-01-06 20:42:20.028206400 +0000
++++ src/bootstrap/src/core/build_steps/compile.rs
+@@ -695,7 +695,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(builder, &dst, &format!("@rpath/{}", runtime.name));
++ apple_darwin_update_library_name(builder, &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(builder, &dst);
diff --git a/rust182/patches/patch-src_bootstrap_src_core_build__steps_dist.rs b/rust182/patches/patch-src_bootstrap_src_core_build__steps_dist.rs
new file mode 100644
index 0000000000..481c45e07c
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_src_core_build__steps_dist.rs
@@ -0,0 +1,20 @@
+$NetBSD$
+
+Backport https://github.com/rust-lang/rust/pull/130110/
+"make dist vendoring configurable"
+
+--- src/bootstrap/src/core/build_steps/dist.rs.orig 2024-10-27 17:40:23.944923750 +0000
++++ src/bootstrap/src/core/build_steps/dist.rs
+@@ -1011,11 +1011,7 @@ impl Step for PlainSourceTarball {
+ write_git_info(builder.rust_info().info(), plain_dst_src);
+ write_git_info(builder.cargo_info.info(), &plain_dst_src.join("./src/tools/cargo"));
+
+- // If we're building from git or tarball sources, we need to vendor
+- // a complete distribution.
+- if builder.rust_info().is_managed_git_subrepository()
+- || builder.rust_info().is_from_tarball()
+- {
++ if builder.config.dist_vendor {
+ builder.require_and_update_all_submodules();
+
+ // Vendor all Cargo dependencies
diff --git a/rust182/patches/patch-src_bootstrap_src_core_build__steps_install.rs b/rust182/patches/patch-src_bootstrap_src_core_build__steps_install.rs
new file mode 100644
index 0000000000..8fa745ac41
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_src_core_build__steps_install.rs
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/bootstrap/src/core/build_steps/install.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ src/bootstrap/src/core/build_steps/install.rs
+@@ -200,7 +200,7 @@ macro_rules! install {
+ install!((self, builder, _config),
+ Docs, path = "src/doc", _config.docs, only_hosts: false, {
+ let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs");
+- install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
++ install_sh(builder, "rust", self.compiler.stage, Some(self.target), &tarball);
+ };
+ Std, path = "library/std", true, only_hosts: false, {
+ // `expect` should be safe, only None when host != build, but this
diff --git a/rust182/patches/patch-src_bootstrap_src_core_builder.rs b/rust182/patches/patch-src_bootstrap_src_core_builder.rs
new file mode 100644
index 0000000000..1f281b7ed6
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_src_core_builder.rs
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_bootstrap_src_core_builder.rs,v 1.5 2024/07/27 02:35:24 tnn Exp $
+
+Find external libunwind on Linux.
+Use @PREFIX@, not $ORIGIN in rpath.
+
+--- src/bootstrap/src/core/builder.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ src/bootstrap/src/core/builder.rs
+@@ -2211,6 +2211,11 @@ impl<'a> Builder<'a> {
+ rustdocflags.arg("--cfg=parallel_compiler");
+ }
+
++ // added for pkgsrc libunwind
++ if target.contains("linux") {
++ rustflags.arg("-Clink-args=-Wl,-rpath,@PREFIX@/lib,-L@PREFIX@/lib");
++ }
++
+ Cargo {
+ command: cargo,
+ compiler,
+@@ -2557,7 +2562,7 @@ impl Cargo {
+ Some(format!("-Wl,-rpath,@loader_path/../{libdir}"))
+ } else if !target.is_windows() && !target.contains("aix") && !target.contains("xous") {
+ self.rustflags.arg("-Clink-args=-Wl,-z,origin");
+- Some(format!("-Wl,-rpath,$ORIGIN/../{libdir}"))
++ Some(format!("-Wl,-rpath,@PREFIX@/{libdir}"))
+ } else {
+ None
+ };
diff --git a/rust182/patches/patch-src_bootstrap_src_core_config_config.rs b/rust182/patches/patch-src_bootstrap_src_core_config_config.rs
new file mode 100644
index 0000000000..c8071a8edf
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_src_core_config_config.rs
@@ -0,0 +1,45 @@
+$NetBSD$
+
+Backport
+https://github.com/rust-lang/rust/pull/130110/
+"make dist vendoring configurable"
+
+--- src/bootstrap/src/core/config/config.rs.orig 2024-09-22 17:38:21.382609357 +0000
++++ src/bootstrap/src/core/config/config.rs
+@@ -300,6 +300,7 @@ pub struct Config {
+ pub dist_compression_formats: Option<Vec<String>>,
+ pub dist_compression_profile: String,
+ pub dist_include_mingw_linker: bool,
++ pub dist_vendor: bool,
+
+ // libstd features
+ pub backtrace: bool, // support for RUST_BACKTRACE
+@@ -904,6 +905,7 @@ define_config! {
+ compression_formats: Option<Vec<String>> = "compression-formats",
+ compression_profile: Option<String> = "compression-profile",
+ include_mingw_linker: Option<bool> = "include-mingw-linker",
++ vendor: Option<bool> = "vendor",
+ }
+ }
+
+@@ -1965,13 +1967,19 @@ impl Config {
+ compression_formats,
+ compression_profile,
+ include_mingw_linker,
++ vendor,
+ } = dist;
+ config.dist_sign_folder = sign_folder.map(PathBuf::from);
+ config.dist_upload_addr = upload_addr;
+ config.dist_compression_formats = compression_formats;
+ set(&mut config.dist_compression_profile, compression_profile);
+ set(&mut config.rust_dist_src, src_tarball);
+- set(&mut config.dist_include_mingw_linker, include_mingw_linker)
++ set(&mut config.dist_include_mingw_linker, include_mingw_linker);
++ config.dist_vendor = vendor.unwrap_or_else(|| {
++ // If we're building from git or tarball sources, enable it by default.
++ config.rust_info.is_managed_git_subrepository()
++ || config.rust_info.is_from_tarball()
++ });
+ }
+
+ if let Some(r) = rustfmt {
diff --git a/rust182/patches/patch-src_bootstrap_src_lib.rs b/rust182/patches/patch-src_bootstrap_src_lib.rs
new file mode 100644
index 0000000000..d3d2e25ffb
--- /dev/null
+++ b/rust182/patches/patch-src_bootstrap_src_lib.rs
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_bootstrap_src_lib.rs,v 1.2 2024/04/18 09:29:42 pin Exp $
+
+Don't filter out optimization flags.
+FreeBSD has a particular C++ runtime library name
+
+--- src/bootstrap/src/lib.rs.orig 2024-01-06 20:52:50.892941220 +0000
++++ src/bootstrap/src/lib.rs
+@@ -1195,13 +1195,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 C++ on macOS then we add a flag indicating that
+ // we want libc++ (more filled out than libstdc++), ensuring that
+ // LLVM/etc are all properly compiled.
+- if matches!(c, CLang::Cxx) && target.contains("apple-darwin") {
++ if matches!(c, CLang::Cxx) &&
++ (target.contains("apple-darwin") || target.contains("freebsd")) {
+ base.push("-stdlib=libc++".into());
+ }
+
diff --git a/rust182/patches/patch-src_llvm-project_llvm_CMakeLists.txt b/rust182/patches/patch-src_llvm-project_llvm_CMakeLists.txt
new file mode 100644
index 0000000000..d0dfe4e6da
--- /dev/null
+++ b/rust182/patches/patch-src_llvm-project_llvm_CMakeLists.txt
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_llvm-project_llvm_CMakeLists.txt,v 1.14 2024/04/18 09:29:42 pin 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/rust182/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake b/rust182/patches/patch-src_llvm-project_llvm_cmake_modules_AddLLVM.cmake
new file mode 100644
index 0000000000..6a701cd3aa
--- /dev/null
+++ b/rust182/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.15 2024/04/18 09:29:42 pin 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/rust182/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h b/rust182/patches/patch-src_llvm-project_llvm_include_llvm-c_DataTypes.h
new file mode 100644
index 0000000000..8722fdfe38
--- /dev/null
+++ b/rust182/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.8 2024/04/18 09:29:42 pin 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/rust182/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h b/rust182/patches/patch-src_llvm-project_llvm_include_llvm_Analysis_ConstantFolding.h
new file mode 100644
index 0000000000..159d4a70de
--- /dev/null
+++ b/rust182/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.10 2024/04/18 09:29:42 pin 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/rust182/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp b/rust182/patches/patch-src_llvm-project_llvm_utils_FileCheck_FileCheck.cpp
new file mode 100644
index 0000000000..e255aa5af9
--- /dev/null
+++ b/rust182/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.13 2024/04/18 09:29:42 pin 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/rust182/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs b/rust182/patches/patch-src_tools_cargo_src_cargo_core_profiles.rs
new file mode 100644
index 0000000000..0d2e97d952
--- /dev/null
+++ b/rust182/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.17 2024/04/18 09:29:42 pin 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/rust182/patches/patch-src_tools_cargo_tests_testsuite_build.rs b/rust182/patches/patch-src_tools_cargo_tests_testsuite_build.rs
new file mode 100644
index 0000000000..661fa594fb
--- /dev/null
+++ b/rust182/patches/patch-src_tools_cargo_tests_testsuite_build.rs
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_tools_cargo_tests_testsuite_build.rs,v 1.14 2024/04/18 09:29:42 pin 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
+@@ -41,6 +41,7 @@ i am foo
+ .run();
+ }
+
++#[cfg(not(target_arch = "sparc64"))]
+ #[cargo_test]
+ fn build_with_symlink_to_path_dependency_with_build_script_in_git() {
+ if !symlink_supported() {
+@@ -103,6 +104,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()
+@@ -132,6 +134,7 @@ fn cargo_compile_incremental() {
+ .run();
+ }
+
++#[cfg(not(target_arch = "sparc64"))]
+ #[allow(deprecated)]
+ #[cargo_test]
+ fn incremental_profile() {
+@@ -176,6 +179,7 @@ fn incremental_profile() {
+ .run();
+ }
+
++#[cfg(not(target_arch = "sparc64"))]
+ #[allow(deprecated)]
+ #[cargo_test]
+ fn incremental_config() {
diff --git a/rust182/patches/patch-src_tools_rust-installer_install-template.sh b/rust182/patches/patch-src_tools_rust-installer_install-template.sh
new file mode 100644
index 0000000000..556cade057
--- /dev/null
+++ b/rust182/patches/patch-src_tools_rust-installer_install-template.sh
@@ -0,0 +1,179 @@
+$NetBSD: patch-src_tools_rust-installer_install-template.sh,v 1.14 2024/04/18 09:29:42 pin Exp $
+
+No logging to 'install.log'.
+Do not create 'uninstall.sh'.
+Do not make file backups (filename.old), so these will not end up in the final package.
+
+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 2023-12-21 16:55:28.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")"
+@@ -615,16 +598,16 @@ install_components() {
+
+ verbose_msg "copying file $_file_install_path"
+
+- 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
+@@ -637,7 +620,6 @@ install_components() {
+
+ verbose_msg "copying directory $_file_install_path"
+
+- maybe_backup_path "$_file_install_path"
+
+ run cp -R "$_src_dir/$_component/$_file" "$_file_install_path"
+ critical_need_ok "failed to copy directory"
+@@ -986,7 +968,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/rust182/patches/patch-tools_rust-analyzer_lib_line-index-src_lib.rs b/rust182/patches/patch-tools_rust-analyzer_lib_line-index-src_lib.rs
new file mode 100644
index 0000000000..8b4f9fe0d2
--- /dev/null
+++ b/rust182/patches/patch-tools_rust-analyzer_lib_line-index-src_lib.rs
@@ -0,0 +1,47 @@
+$NetBSD$
+
+Try to avoid using neon for big-endian aarch64.
+Ref. https://github.com/rust-lang/rust/issues/129819
+
+--- src/tools/rust-analyzer/lib/line-index/src/lib.rs.orig 2024-09-01 14:12:57.016998002 +0000
++++ src/tools/rust-analyzer/lib/line-index/src/lib.rs
+@@ -227,7 +227,7 @@ fn analyze_source_file_dispatch(
+ }
+ }
+
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ fn analyze_source_file_dispatch(
+ src: &str,
+ lines: &mut Vec<TextSize>,
+@@ -339,7 +339,7 @@ unsafe fn analyze_source_file_sse2(
+ }
+
+ #[target_feature(enable = "neon")]
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ #[inline]
+ // See https://community.arm.com/arm-community-blogs/b/infrastructure-solutions-blog/posts/porting-x86-vector-bitmask-optimizations-to-arm-neon
+ //
+@@ -354,7 +354,7 @@ unsafe fn move_mask(v: std::arch::aarch6
+ }
+
+ #[target_feature(enable = "neon")]
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ unsafe fn analyze_source_file_neon(
+ src: &str,
+ lines: &mut Vec<TextSize>,
+@@ -433,7 +433,11 @@ unsafe fn analyze_source_file_neon(
+ }
+ }
+
+-#[cfg(not(any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")))]
++#[cfg(not(any(
++ target_arch = "x86",
++ target_arch = "x86_64",
++ all(target_arch = "aarch64", target_endian = "little")
++)))]
+ // The target (or compiler version) does not support SSE2 ...
+ fn analyze_source_file_dispatch(
+ src: &str,
diff --git a/rust182/patches/patch-vendor_bytecount-0.6.8_src_lib.rs b/rust182/patches/patch-vendor_bytecount-0.6.8_src_lib.rs
new file mode 100644
index 0000000000..8726eb0b2e
--- /dev/null
+++ b/rust182/patches/patch-vendor_bytecount-0.6.8_src_lib.rs
@@ -0,0 +1,45 @@
+$NetBSD$
+
+Avoid using neon on big-endian aarch64.
+Ref. https://github.com/rust-lang/rust/issues/129819
+
+--- vendor/bytecount-0.6.8/src/lib.rs.orig 2024-09-01 16:29:37.478735730 +0000
++++ vendor/bytecount-0.6.8/src/lib.rs
+@@ -50,7 +50,10 @@ mod integer_simd;
+ feature = "runtime-dispatch-simd",
+ any(target_arch = "x86", target_arch = "x86_64")
+ ),
+- target_arch = "aarch64",
++ all(
++ target_arch = "aarch64",
++ target_endian = "little"
++ ),
+ target_arch = "wasm32",
+ feature = "generic-simd"
+ ))]
+@@ -93,7 +96,11 @@ pub fn count(haystack: &[u8], needle: u8
+ }
+ }
+ }
+- #[cfg(all(target_arch = "aarch64", not(feature = "generic_simd")))]
++ #[cfg(all(
++ target_arch = "aarch64",
++ target_endian = "little",
++ not(feature = "generic_simd")
++ ))]
+ {
+ unsafe {
+ return simd::aarch64::chunk_count(haystack, needle);
+@@ -155,7 +162,11 @@ pub fn num_chars(utf8_chars: &[u8]) -> u
+ }
+ }
+ }
+- #[cfg(all(target_arch = "aarch64", not(feature = "generic_simd")))]
++ #[cfg(all(
++ target_arch = "aarch64",
++ target_endian = "little",
++ not(feature = "generic_simd")
++ ))]
+ {
+ unsafe {
+ return simd::aarch64::chunk_num_chars(utf8_chars);
diff --git a/rust182/patches/patch-vendor_cc-1.0.73_src_lib.rs b/rust182/patches/patch-vendor_cc-1.0.73_src_lib.rs
new file mode 100644
index 0000000000..5a7ac7e4b6
--- /dev/null
+++ b/rust182/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.79/src/lib.rs.orig 2024-08-29 17:57:16.678636324 +0000
++++ vendor/cc-1.0.79/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());
diff --git a/rust182/patches/patch-vendor_crossbeam-utils-0.8.18_no__atomic.rs b/rust182/patches/patch-vendor_crossbeam-utils-0.8.18_no__atomic.rs
new file mode 100644
index 0000000000..8a7b3793fa
--- /dev/null
+++ b/rust182/patches/patch-vendor_crossbeam-utils-0.8.18_no__atomic.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add NetBSD/mipsel to non-atomic targets.
+
+--- vendor/crossbeam-utils-0.8.18/no_atomic.rs.orig 2024-05-03 22:53:42.558166596 +0000
++++ vendor/crossbeam-utils-0.8.18/no_atomic.rs
+@@ -5,6 +5,7 @@ const NO_ATOMIC: &[&str] = &[
+ "bpfeb-unknown-none",
+ "bpfel-unknown-none",
+ "mipsel-sony-psx",
++ "mipsel-unknown-netbsd",
+ "msp430-none-elf",
+ "riscv32i-unknown-none-elf",
+ "riscv32im-unknown-none-elf",
diff --git a/rust182/patches/patch-vendor_libc-0.2.155_src_unix_solarish_mod.rs b/rust182/patches/patch-vendor_libc-0.2.155_src_unix_solarish_mod.rs
new file mode 100644
index 0000000000..ee6548b217
--- /dev/null
+++ b/rust182/patches/patch-vendor_libc-0.2.155_src_unix_solarish_mod.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Fix xattr build.
+
+--- vendor/libc-0.2.155/src/unix/solarish/mod.rs.orig 2024-08-29 18:03:17.866520790 +0000
++++ vendor/libc-0.2.155/src/unix/solarish/mod.rs
+@@ -1524,6 +1524,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/rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_memchr.rs b/rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_memchr.rs
new file mode 100644
index 0000000000..06fbbc1f87
--- /dev/null
+++ b/rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_memchr.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Don't try to do neon / SIMD on big-endian aarch64.
+
+--- vendor/memchr-2.7.4/src/arch/aarch64/memchr.rs.orig 2024-09-22 14:55:32.455792108 +0000
++++ vendor/memchr-2.7.4/src/arch/aarch64/memchr.rs
+@@ -8,7 +8,7 @@ available for `aarch64` targets.)
+
+ macro_rules! defraw {
+ ($ty:ident, $find:ident, $start:ident, $end:ident, $($needles:ident),+) => {{
+- #[cfg(target_feature = "neon")]
++ #[cfg(all(target_feature = "neon", target_endian = "little"))]
+ {
+ use crate::arch::aarch64::neon::memchr::$ty;
+
+@@ -19,7 +19,7 @@ macro_rules! defraw {
+ // enabled.
+ $ty::new_unchecked($($needles),+).$find($start, $end)
+ }
+- #[cfg(not(target_feature = "neon"))]
++ #[cfg(not(all(target_feature = "neon", target_endian = "little")))]
+ {
+ use crate::arch::all::memchr::$ty;
+
diff --git a/rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_mod.rs b/rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_mod.rs
new file mode 100644
index 0000000000..3fa3ec8c4d
--- /dev/null
+++ b/rust182/patches/patch-vendor_memchr-2.7.4_src_arch_aarch64_mod.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Don't try to do neon / SIMD on big-endian aarch64.
+
+--- vendor/memchr-2.7.4/src/arch/aarch64/mod.rs.orig 2024-09-22 19:17:13.167426584 +0000
++++ vendor/memchr-2.7.4/src/arch/aarch64/mod.rs
+@@ -2,6 +2,8 @@
+ Vector algorithms for the `aarch64` target.
+ */
+
++#[cfg(target_endian = "little")]
+ pub mod neon;
+
++#[cfg(target_endian = "little")]
+ pub(crate) mod memchr;
diff --git a/rust182/patches/patch-vendor_memchr-2.7.4_src_memchr.rs b/rust182/patches/patch-vendor_memchr-2.7.4_src_memchr.rs
new file mode 100644
index 0000000000..da85596fc1
--- /dev/null
+++ b/rust182/patches/patch-vendor_memchr-2.7.4_src_memchr.rs
@@ -0,0 +1,128 @@
+$NetBSD$
+
+Don't try to do neon / SIMD on big-endian aarch64.
+
+--- vendor/memchr-2.7.4/src/memchr.rs.orig 2024-09-22 14:50:24.931022916 +0000
++++ vendor/memchr-2.7.4/src/memchr.rs
+@@ -518,14 +518,14 @@ unsafe fn memchr_raw(
+ {
+ crate::arch::wasm32::memchr::memchr_raw(needle, start, end)
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::memchr_raw(needle, start, end)
+ }
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::One::new(needle).find_raw(start, end)
+@@ -551,14 +551,14 @@ unsafe fn memrchr_raw(
+ {
+ crate::arch::wasm32::memchr::memrchr_raw(needle, start, end)
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::memrchr_raw(needle, start, end)
+ }
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::One::new(needle).rfind_raw(start, end)
+@@ -585,14 +585,14 @@ unsafe fn memchr2_raw(
+ {
+ crate::arch::wasm32::memchr::memchr2_raw(needle1, needle2, start, end)
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::memchr2_raw(needle1, needle2, start, end)
+ }
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::Two::new(needle1, needle2)
+@@ -620,7 +620,7 @@ unsafe fn memrchr2_raw(
+ {
+ crate::arch::wasm32::memchr::memrchr2_raw(needle1, needle2, start, end)
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::memrchr2_raw(
+ needle1, needle2, start, end,
+@@ -629,7 +629,7 @@ unsafe fn memrchr2_raw(
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::Two::new(needle1, needle2)
+@@ -662,7 +662,7 @@ unsafe fn memchr3_raw(
+ needle1, needle2, needle3, start, end,
+ )
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::memchr3_raw(
+ needle1, needle2, needle3, start, end,
+@@ -671,7 +671,7 @@ unsafe fn memchr3_raw(
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::Three::new(needle1, needle2, needle3)
+@@ -704,7 +704,7 @@ unsafe fn memrchr3_raw(
+ needle1, needle2, needle3, start, end,
+ )
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::memrchr3_raw(
+ needle1, needle2, needle3, start, end,
+@@ -713,7 +713,7 @@ unsafe fn memrchr3_raw(
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::Three::new(needle1, needle2, needle3)
+@@ -736,14 +736,14 @@ unsafe fn count_raw(needle: u8, start: *
+ {
+ crate::arch::wasm32::memchr::count_raw(needle, start, end)
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ crate::arch::aarch64::memchr::count_raw(needle, start, end)
+ }
+ #[cfg(not(any(
+ target_arch = "x86_64",
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ crate::arch::all::memchr::One::new(needle).count_raw(start, end)
diff --git a/rust182/patches/patch-vendor_memchr-2.7.4_src_memmem_searcher.rs b/rust182/patches/patch-vendor_memchr-2.7.4_src_memmem_searcher.rs
new file mode 100644
index 0000000000..743d4886ee
--- /dev/null
+++ b/rust182/patches/patch-vendor_memchr-2.7.4_src_memmem_searcher.rs
@@ -0,0 +1,78 @@
+$NetBSD$
+
+Don't try to use neon / SIMD on big-endian aarch64.
+
+--- vendor/memchr-2.7.4/src/memmem/searcher.rs.orig 2024-09-22 14:44:21.224731060 +0000
++++ vendor/memchr-2.7.4/src/memmem/searcher.rs
+@@ -3,7 +3,7 @@ use crate::arch::all::{
+ rabinkarp, twoway,
+ };
+
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ use crate::arch::aarch64::neon::packedpair as neon;
+ #[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
+ use crate::arch::wasm32::simd128::packedpair as simd128;
+@@ -129,7 +129,7 @@ impl Searcher {
+ Searcher::twoway(needle, rabinkarp, prestrat)
+ }
+ }
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ {
+ if let Some(pp) = neon::Finder::with_pair(needle, pair) {
+ if do_packed_search(needle) {
+@@ -152,7 +152,7 @@ impl Searcher {
+ #[cfg(not(any(
+ all(target_arch = "x86_64", target_feature = "sse2"),
+ all(target_arch = "wasm32", target_feature = "simd128"),
+- target_arch = "aarch64"
++ all(target_arch = "aarch64", target_endian = "little")
+ )))]
+ {
+ if prefilter.is_none() {
+@@ -253,7 +253,7 @@ union SearcherKind {
+ avx2: crate::arch::x86_64::avx2::packedpair::Finder,
+ #[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
+ simd128: crate::arch::wasm32::simd128::packedpair::Finder,
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ neon: crate::arch::aarch64::neon::packedpair::Finder,
+ }
+
+@@ -421,7 +421,7 @@ unsafe fn searcher_kind_simd128(
+ /// # Safety
+ ///
+ /// Callers must ensure that the `searcher.kind.neon` union field is set.
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ unsafe fn searcher_kind_neon(
+ searcher: &Searcher,
+ _prestate: &mut PrefilterState,
+@@ -686,7 +686,7 @@ impl Prefilter {
+ }
+
+ /// Return a prefilter using a aarch64 neon vector algorithm.
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ #[inline]
+ fn neon(finder: neon::Finder, needle: &[u8]) -> Prefilter {
+ trace!("building aarch64 neon prefilter");
+@@ -763,7 +763,7 @@ union PrefilterKind {
+ avx2: crate::arch::x86_64::avx2::packedpair::Finder,
+ #[cfg(all(target_arch = "wasm32", target_feature = "simd128"))]
+ simd128: crate::arch::wasm32::simd128::packedpair::Finder,
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ neon: crate::arch::aarch64::neon::packedpair::Finder,
+ }
+
+@@ -852,7 +852,7 @@ unsafe fn prefilter_kind_simd128(
+ /// # Safety
+ ///
+ /// Callers must ensure that the `strat.kind.neon` union field is set.
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ unsafe fn prefilter_kind_neon(
+ strat: &Prefilter,
+ haystack: &[u8],
diff --git a/rust182/patches/patch-vendor_memchr-2.7.4_src_vector.rs b/rust182/patches/patch-vendor_memchr-2.7.4_src_vector.rs
new file mode 100644
index 0000000000..6851a4a4fd
--- /dev/null
+++ b/rust182/patches/patch-vendor_memchr-2.7.4_src_vector.rs
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Don't try to do neon / SIMD on big-endian aarch64.
+
+--- vendor/memchr-2.7.4/src/vector.rs.orig 2024-09-22 14:16:06.473207292 +0000
++++ vendor/memchr-2.7.4/src/vector.rs
+@@ -289,7 +289,7 @@ mod x86avx2 {
+ }
+ }
+
+-#[cfg(target_arch = "aarch64")]
++#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ mod aarch64neon {
+ use core::arch::aarch64::*;
+
diff --git a/rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_openssl_Configurations_10-main.conf b/rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_openssl_Configurations_10-main.conf
new file mode 100644
index 0000000000..d7eb270fd1
--- /dev/null
+++ b/rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_openssl_Configurations_10-main.conf
@@ -0,0 +1,18 @@
+$NetBSD$
+
+Replicate part of
+https://github.com/openssl/openssl/pull/15086
+
+--- vendor/openssl-src-111.28.2+1.1.1w/openssl/Configurations/10-main.conf.orig 2024-08-29 18:07:36.845484717 +0000
++++ vendor/openssl-src-111.28.2+1.1.1w/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(threads("-latomic")),
++ },
+ "BSD-generic64" => {
+ inherit_from => [ "BSD-generic32" ],
+ bn_ops => "SIXTY_FOUR_BIT_LONG",
diff --git a/rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_src_lib.rs b/rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_src_lib.rs
new file mode 100644
index 0000000000..5924303d05
--- /dev/null
+++ b/rust182/patches/patch-vendor_openssl-src-111.28.2+1.1.1w_src_lib.rs
@@ -0,0 +1,62 @@
+$NetBSD$
+
+--- vendor/openssl-src-111.28.2+1.1.1w/src/lib.rs.orig 2024-08-29 18:09:29.494697634 +0000
++++ vendor/openssl-src-111.28.2+1.1.1w/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" => "linux-generic64",
+ "loongarch64-unknown-linux-musl" => "linux-generic64",
+ "mips-unknown-linux-gnu" => "linux-mips32",
+@@ -274,9 +280,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",
+@@ -284,8 +292,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/rust182/patches/patch-vendor_openssl-sys-0.9.102_build_find__normal.rs b/rust182/patches/patch-vendor_openssl-sys-0.9.102_build_find__normal.rs
new file mode 100644
index 0000000000..80d98e247b
--- /dev/null
+++ b/rust182/patches/patch-vendor_openssl-sys-0.9.102_build_find__normal.rs
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Add hack for Darwin when homebrew is installed.
+
+--- vendor/openssl-sys-0.9.102/build/find_normal.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ vendor/openssl-sys-0.9.102/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/rust182/patches/patch-vendor_openssl-sys-0.9.102_build_main.rs b/rust182/patches/patch-vendor_openssl-sys-0.9.102_build_main.rs
new file mode 100644
index 0000000000..a15188f472
--- /dev/null
+++ b/rust182/patches/patch-vendor_openssl-sys-0.9.102_build_main.rs
@@ -0,0 +1,23 @@
+$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-0.9.102/build/main.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ vendor/openssl-sys-0.9.102/build/main.rs
+@@ -142,6 +142,14 @@ fn main() {
+ println!("cargo:rustc-link-lib=atomic");
+ }
+
++ // Patterned of the above, make sure we include -latomic
++ // on ilp32 ports (yes, this only tests the "p32" part).
++ if env::var("CARGO_CFG_TARGET_OS").unwrap() == "netbsd"
++ && env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32"
++ {
++ println!("cargo:rustc-link-lib=atomic");
++ }
++
+ if kind == "static" && target.contains("windows") {
+ println!("cargo:rustc-link-lib=dylib=gdi32");
+ println!("cargo:rustc-link-lib=dylib=user32");
diff --git a/rust182/patches/patch-vendor_openssl-sys-0.9.92_build_find__normal.rs b/rust182/patches/patch-vendor_openssl-sys-0.9.92_build_find__normal.rs
new file mode 100644
index 0000000000..99108643b7
--- /dev/null
+++ b/rust182/patches/patch-vendor_openssl-sys-0.9.92_build_find__normal.rs
@@ -0,0 +1,30 @@
+$NetBSD$
+
+Add hack for Darwin when homebrew is installed.
+
+--- vendor/openssl-sys-0.9.92/build/find_normal.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ vendor/openssl-sys-0.9.92/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/rust182/patches/patch-vendor_openssl-sys-0.9.92_build_main.rs b/rust182/patches/patch-vendor_openssl-sys-0.9.92_build_main.rs
new file mode 100644
index 0000000000..0a70272949
--- /dev/null
+++ b/rust182/patches/patch-vendor_openssl-sys-0.9.92_build_main.rs
@@ -0,0 +1,23 @@
+$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-0.9.92/build/main.rs.orig 2006-07-24 01:21:28.000000000 +0000
++++ vendor/openssl-sys-0.9.92/build/main.rs
+@@ -115,6 +115,14 @@ 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 env::var("CARGO_CFG_TARGET_OS").unwrap() == "netbsd"
++ && env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32"
++ {
++ println!("cargo:rustc-link-lib=atomic");
++ }
++
+ if kind == "static" && target.contains("windows") {
+ println!("cargo:rustc-link-lib=dylib=gdi32");
+ println!("cargo:rustc-link-lib=dylib=user32");
diff --git a/rust182/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs b/rust182/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
new file mode 100644
index 0000000000..6c90dec84c
--- /dev/null
+++ b/rust182/patches/patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs
@@ -0,0 +1,27 @@
+$NetBSD: patch-vendor_rustc-ap-rustc__target_src_spec_aarch64__be__unknown__netbsd.rs,v 1.9 2024/04/18 09:29:43 pin Exp $
+
+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/rust182/patches/patch-vendor_zerocopy-0.7.32_src_lib.rs b/rust182/patches/patch-vendor_zerocopy-0.7.32_src_lib.rs
new file mode 100644
index 0000000000..35ab52f6cb
--- /dev/null
+++ b/rust182/patches/patch-vendor_zerocopy-0.7.32_src_lib.rs
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Attempt at skipping SIMD / neon on big-endian aarch64,
+ref. https://github.com/rust-lang/rust/issues/129819.
+
+--- vendor/zerocopy-0.7.32/src/lib.rs.orig 2024-09-01 12:56:49.837065351 +0000
++++ vendor/zerocopy-0.7.32/src/lib.rs
+@@ -3715,7 +3715,7 @@ mod simd {
+ powerpc64, powerpc64, vector_bool_long, vector_double, vector_signed_long, vector_unsigned_long
+ );
+ simd_arch_mod!(
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ aarch64, aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
+ int8x8x3_t, int8x8x4_t, int8x16_t, int8x16x2_t, int8x16x3_t, int8x16x4_t, int16x4_t,
+ int16x8_t, int32x2_t, int32x4_t, int64x1_t, int64x2_t, poly8x8_t, poly8x8x2_t, poly8x8x3_t,
+@@ -7998,7 +7998,7 @@ mod tests {
+ vector_signed_long,
+ vector_unsigned_long
+ );
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ #[rustfmt::skip]
+ test_simd_arch_mod!(
+ aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
diff --git a/rust182/patches/patch-vendor_zerocopy-0.7.35_src_lib.rs b/rust182/patches/patch-vendor_zerocopy-0.7.35_src_lib.rs
new file mode 100644
index 0000000000..d71d7d0924
--- /dev/null
+++ b/rust182/patches/patch-vendor_zerocopy-0.7.35_src_lib.rs
@@ -0,0 +1,25 @@
+$NetBSD$
+
+Attempt at skipping SIMD / neon on big-endian aarch64,
+ref. https://github.com/rust-lang/rust/issues/129819.
+
+--- vendor/zerocopy-0.7.35/src/lib.rs.orig 2024-08-31 21:15:29.602997509 +0000
++++ vendor/zerocopy-0.7.35/src/lib.rs
+@@ -3727,7 +3727,7 @@ mod simd {
+ powerpc64, powerpc64, vector_bool_long, vector_double, vector_signed_long, vector_unsigned_long
+ );
+ simd_arch_mod!(
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ aarch64, aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
+ int8x8x3_t, int8x8x4_t, int8x16_t, int8x16x2_t, int8x16x3_t, int8x16x4_t, int16x4_t,
+ int16x8_t, int32x2_t, int32x4_t, int64x1_t, int64x2_t, poly8x8_t, poly8x8x2_t, poly8x8x3_t,
+@@ -8020,7 +8020,7 @@ mod tests {
+ vector_signed_long,
+ vector_unsigned_long
+ );
+- #[cfg(target_arch = "aarch64")]
++ #[cfg(all(target_arch = "aarch64", target_endian = "little"))]
+ #[rustfmt::skip]
+ test_simd_arch_mod!(
+ aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
diff --git a/rust182/platform.mk b/rust182/platform.mk
new file mode 100644
index 0000000000..c6a01214d8
--- /dev/null
+++ b/rust182/platform.mk
@@ -0,0 +1,31 @@
+# $NetBSD: platform.mk,v 1.27 2024/08/01 15:24:39 tnn 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>8
+.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-8].*)
+RUST_PLATFORMS+= ${rust_os}-*-${rust_arch}
+. endif
+. endfor
+.endfor
+
+.if ${MACHINE_PLATFORM:MNetBSD-*-earm*} && ${OPSYS_VERSION} < 100000
+RUST_DIR?= ../../lang/rust176
+.endif
+RUST_DIR?= ../../lang/rust
+
+.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/rust182/rust.mk b/rust182/rust.mk
new file mode 100644
index 0000000000..2a29bc959e
--- /dev/null
+++ b/rust182/rust.mk
@@ -0,0 +1,56 @@
+# $NetBSD: rust.mk,v 1.9 2024/07/07 11:00:37 wiz 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"
+.include "platform.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 "${RUST_DIR}-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 "${RUST_DIR}/buildlink3.mk"
+.endif
Home |
Main Index |
Thread Index |
Old Index