$NetBSD: patch-build_config_rust.gni,v 1.12 2025/12/13 14:53:47 kikadf Exp $ * Part of patchset to build chromium on NetBSD * Based on OpenBSD's chromium patches, and pkgsrc's qt5-qtwebengine patches --- build/config/rust.gni.orig 2025-11-19 21:40:05.000000000 +0000 +++ build/config/rust.gni @@ -62,7 +62,8 @@ declare_args() { # set this to the output of `rustc -V`. Changing this string will cause all # Rust targets to be rebuilt, which allows you to update your toolchain and # not break incremental builds. - rustc_version = "" + rustc_version = exec_script("//build/gn_run_binary.py", + [ "@PREFIX@/bin/rustc", "-V" ], "trim string") # Whether artifacts produced by the Rust compiler can participate in ThinLTO. # @@ -177,7 +178,7 @@ if (is_linux || is_chromeos) { if (current_cpu == "arm64") { rust_abi_target = "aarch64-unknown-linux-gnu" } else if (current_cpu == "x86") { - rust_abi_target = "i686-unknown-linux-gnu" + rust_abi_target = "i586-unknown-linux-gnu" } else if (current_cpu == "x64") { rust_abi_target = "x86_64-unknown-linux-gnu" } else if (current_cpu == "arm") { @@ -326,7 +327,11 @@ if (is_linux || is_chromeos) { } } -if (toolchain_has_rust) { +if (is_bsd) { + rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os) +} + +if (toolchain_has_rust && !is_bsd) { assert(rust_abi_target != "") _known_rust_target_triples_filepath = "//build/rust/known-target-triples.txt"