# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/chromium/hotfix-bindgen-paths.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- chromium-151.0.7922.75/build/rust/rust_bindgen_generator.gni.vanilla +++ chromium-151.0.7922.75/build/rust/rust_bindgen_generator.gni @@ -16,7 +16,7 @@ _bindgen_path = "${_bindgen_path}.exe" } -_rustfmt_path = "${rust_bindgen_root}/bin/rustfmt" +_rustfmt_path = "/bin/true" if (!use_chromium_rust_toolchain && (host_cpu == "ppc64" || host_cpu == "s390x")) { _rustfmt_path = rust_sysroot_absolute + "/bin/rustfmt" @@ -36,6 +45,10 @@ _libclang_path += "/lib" } +if (t2_libclang_path != "") { + _libclang_path = t2_libclang_path +} + # Template to build Rust/C bindings with bindgen. # # If you're developing first-party code then consider using `rust_bindgen` @@ -225,6 +246,10 @@ args += [ "{{cflags_c}}" ] } + if (current_toolchain == default_toolchain && t2_bindgen_sysroot != "") { + args += [ "--sysroot=" + t2_bindgen_sysroot ] + } + # libclang will run the system `clang` to find the "resource dir" which it # places before the directory specified in `-isysroot`. # https://github.com/llvm/llvm-project/blob/699e0bed4bfead826e210025bf33e5a1997c018b/clang/lib/Tooling/Tooling.cpp#L499-L510 @@ -233,9 +271,11 @@ # says the wrong thing. We point it to our clang's resource dir which will # make it behave consistently with our other command line flags and allows # system headers to be found. - clang_resource_dir = - rebase_path(clang_base_path + "/lib/clang/" + clang_version, - root_build_dir) + _t2_clang_resource_dir = clang_base_path + "/lib/clang/" + clang_version + if (t2_clang_resource_dir != "") { + _t2_clang_resource_dir = t2_clang_resource_dir + } + clang_resource_dir = rebase_path(_t2_clang_resource_dir, root_build_dir) args += [ "-resource-dir", clang_resource_dir,