$NetBSD$ * Part of patchset to build electron on NetBSD * Based on OpenBSD's chromium patches, and FreeBSD's electron patches --- build/toolchain/gcc_toolchain.gni.orig 2025-02-24 19:59:26.000000000 +0000 +++ build/toolchain/gcc_toolchain.gni @@ -56,6 +56,13 @@ if (enable_resource_allowlist_generation "enable_resource_allowlist_generation=true does not work for target_os=$target_os") } +declare_args() { + extra_cflags = "" + extra_cppflags = "" + extra_cxxflags = "" + extra_ldflags = "" +} + # This template defines a toolchain for something that works like gcc # (including clang). # @@ -617,7 +624,7 @@ template("single_gcc_toolchain") { # We need to specify link groups, at least, for single pass linkers. I.e. # Rust libraries are alpha-sorted instead of by dependencies so they fail # to link if not properly ordered or grouped. - link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" $end_group_flag {{solibs}} {{libs}} $start_group_flag {{rlibs}} $end_group_flag" + link_command = "$ld $start_group_flag {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" @\"$rspfile\" {{solibs}} {{libs}} {{rlibs}} $end_group_flag" # Generate a map file to be used for binary size analysis. # Map file adds ~10% to the link time on a z620. @@ -904,22 +911,12 @@ template("gcc_toolchain") { # actually just be doing a native compile. template("clang_toolchain") { gcc_toolchain(target_name) { - _path = "$clang_base_path/bin" - _is_path_absolute = get_path_info(_path, "abspath") == _path - - # Preserve absolute paths for tools like distcc. - if (_is_path_absolute && filter_include([ _path ], [ "//*" ]) == []) { - prefix = _path - } else { - prefix = rebase_path(_path, root_build_dir) - } - - cc = "${prefix}/clang" - cxx = "${prefix}/clang++" + cc = "cc" + cxx = "c++" ld = cxx - readelf = "${prefix}/llvm-readelf" - ar = "${prefix}/llvm-ar" - nm = "${prefix}/llvm-nm" + readelf = "readelf" + ar = "ar" + nm = "nm" forward_variables_from(invoker, "*", [ "toolchain_args" ])