$NetBSD$ * 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 2026-03-11 22:12:25.000000000 +0000 +++ build/config/rust.gni @@ -67,7 +67,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. # @@ -180,6 +181,24 @@ if (enable_rust) { } else { toolchain_has_rust = custom_toolchain_supports_platform rustc_revision = rustc_version + # Example: + # rustc 1.88.0 c8f94230282a8e8c1148f3e657f0199aad909228 (c8f94230282a8e8c1148f3e657f0199aad909228-1-llvmorg-21-init-9266-g09006611 chromium) + # Trim it down as much as we can using GN. + rustc_revision = string_replace(rustc_revision, "rustc ", "") + rustc_revision = string_replace(rustc_revision, " chromium", "") + rustc_revision = string_replace(rustc_revision, "init-", "") + rustc_revision = string_replace(rustc_revision, "llvmorg-", "") + rustc_revision = string_replace(rustc_revision, " ", "") + rustc_revision = string_replace(rustc_revision, ".", "") + rustc_revision = string_replace(rustc_revision, "(", "-") + rustc_revision = string_replace(rustc_revision, ")", "") + rust_revision_pieces = string_split(rustc_version, " ") + rust_version_pieces = string_split(rust_revision_pieces[1], ".") + if (rust_version_pieces[1] == "85") { + rustc_nightly_capability = false + } else { + rustc_nightly_capability = true + } } } @@ -215,7 +234,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") { @@ -355,7 +374,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"