Files

34 lines
2.4 KiB
Plaintext

Rust for the NetBSD target, built on this Linux host -- what the tree says (t0084)
Source: pkgsrc/lang/rust (Makefile, cross.mk, do-cross.mk, files/gcc-wrap),
pkgsrc/lang/rust-bin; https://static.rust-lang.org/dist/. Read 2026-11-15.
1. pkgsrc's own way (lang/rust/cross.mk): "These settings may be used to
cross-build rust." The cross-root "assumes dest/ and tools/ as a result of a
cross-build of NetBSD" (files/gcc-wrap: "This script assumes target tools in
$root/tools and target's destdir in $root/dest, the result of a NetBSD
build.sh"). Makronix has that: build/obj/tooldir.* and build/obj/destdir.amd64
are tools/ and dest/ of build.sh. The variables: CROSS_ROOT, GNU_CROSS_TARGET
(x86_64--netbsd), TARGET (Rust's name, x86_64-unknown-netbsd; lang/rust/
Makefile:346 RUST_ARCH), CONFIGURE_ARGS target.${TARGET}.cc/.cxx/.linker =
gcc-wrap, .ar = tools/bin/${GNU_CROSS_TARGET}-ar. do-cross.mk builds the
NetBSD bootstrap kits that way (SHORT_TARGETS armv7 armv6 sparc64 powerpc
arm64 arm64_be i386 riscv64 mipsel; amd64 is not in the list: pkgsrc has a
binary bootstrap for it). That compiles LLVM and rustc: hours and ~10 GB.
2. A shorter way, to be verified: Rust publishes the standard library for the
target as a component. HTTP 200 on 2026-11-15 for
https://static.rust-lang.org/dist/rust-std-1.98.1-x86_64-unknown-netbsd.tar.xz
https://static.rust-lang.org/dist/rust-1.98.1-x86_64-unknown-linux-gnu.tar.xz
(1.98.1 is what pkgsrc/lang/rust builds). A Linux rustc/cargo with that
rust-std can `cargo build --target x86_64-unknown-netbsd'; only the linker
is ours: [target.x86_64-unknown-netbsd] linker = x86_64--netbsd-gcc with the
sysroot build/obj/destdir.amd64. Packages built that way are crates and
programs, not pkgsrc's Firefox: Firefox's own build wants its target's
Rust through pkgsrc (lang/rust as a TOOL_DEPENDS of the target), so for
www/firefox the pkgsrc way (1.) or a pkgsrc rust-bin for the host plus the
std component is the route to test.
3. Decision (2026-11-15): nothing is built yet. Firefox, Thunderbird and
pavucontrol are the NetBSD project's binaries (packages.list, fetch) and
Makronix patches none of them. When Makronix needs a Rust package of its
own (a patch, a platform without binaries: macppc, evbarm), first try 2.
with a small crate (devel/cargo-c is the packages.list candidate), then 1.