From b2f6362a31cc323452ff169b54e70c98db70365e Mon Sep 17 00:00:00 2001 From: Adrian Taylor Date: Mon, 14 Mar 2022 23:12:31 +0000 Subject: [PATCH] Update Mac build for crate location changes. A recent CL altered location of Rust build outputs on Linux only. Mac builds do not work unless we add corresponding changes. Bug: 1296669 Change-Id: I405a028b9488563ee8cd24eae922396f01e8c4f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3522635 Reviewed-by: Nico Weber Commit-Queue: Adrian Taylor Cr-Commit-Position: refs/heads/main@{#980832} --- build/toolchain/apple/toolchain.gni | 10 +++++----- build/toolchain/win/BUILD.gn | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build/toolchain/apple/toolchain.gni b/build/toolchain/apple/toolchain.gni index e837b981e12d11..7221c80277bc72 100644 --- a/build/toolchain/apple/toolchain.gni +++ b/build/toolchain/apple/toolchain.gni @@ -230,7 +230,7 @@ template("apple_toolchain") { # However, it seems -fuse-ld=lld causes difficulties. tool("rust_staticlib") { - rust_outfile = "{{target_out_dir}}/{{crate_name}}.a" + rust_outfile = "{{output_dir}}/{{target_output_name}}.a" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" @@ -241,7 +241,7 @@ template("apple_toolchain") { } tool("rust_rlib") { - rust_outfile = "{{target_out_dir}}/lib{{crate_name}}.rlib" + rust_outfile = "{{output_dir}}/lib{{target_output_name}}.rlib" depfile = "{{output}}.d" # Do not use rsp files in this (common) case because they occupy the @@ -255,7 +255,7 @@ template("apple_toolchain") { if (toolchain_args.rustc_can_link) { tool("rust_bin") { - rust_outfile = "{{root_out_dir}}/{{crate_name}}" + rust_outfile = "{{root_out_dir}}/{{target_output_name}}" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" @@ -266,7 +266,7 @@ template("apple_toolchain") { } tool("rust_cdylib") { - rust_outfile = "{{target_out_dir}}/lib{{crate_name}}.dylib" + rust_outfile = "{{output_dir}}/lib{{target_output_name}}.dylib" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" @@ -277,7 +277,7 @@ template("apple_toolchain") { } tool("rust_macro") { - rust_outfile = "{{target_out_dir}}/lib{{crate_name}}.dylib" + rust_outfile = "{{output_dir}}/lib{{target_output_name}}.dylib" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn index 96a914bb8272c3..254855d538255c 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn @@ -307,7 +307,7 @@ template("msvc_toolchain") { rustc = rebase_path("${rust_sysroot}/bin/rustc", root_build_dir) rust_sysroot_relative_to_out = rebase_path(rust_sysroot, root_out_dir) tool("rust_staticlib") { - rust_outfile = "{{target_out_dir}}/{{crate_name}}.lib" + rust_outfile = "{{output_dir}}/{{target_output_name}}.lib" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" @@ -318,8 +318,9 @@ template("msvc_toolchain") { } tool("rust_rlib") { - rust_outfile = "{{target_out_dir}}/lib{{crate_name}}.rlib" + rust_outfile = "{{output_dir}}/lib{{target_output_name}}.rlib" depfile = "{{output}}.d" + # Do not use rsp files in this (common) case because they occupy the # ninja main thread, and {{rlibs}} have shorter command lines than # fully linked targets. @@ -331,7 +332,7 @@ template("msvc_toolchain") { if (toolchain_args.rustc_can_link) { tool("rust_bin") { - rust_outfile = "{{root_out_dir}}/{{crate_name}}.exe" + rust_outfile = "{{root_out_dir}}/{{target_output_name}}.exe" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" @@ -342,7 +343,7 @@ template("msvc_toolchain") { } tool("rust_cdylib") { - rust_outfile = "{{target_out_dir}}/lib{{crate_name}}.dll" + rust_outfile = "{{output_dir}}/lib{{target_output_name}}.dll" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}" @@ -353,7 +354,7 @@ template("msvc_toolchain") { } tool("rust_macro") { - rust_outfile = "{{target_out_dir}}/{{crate_name}}.dll" + rust_outfile = "{{output_dir}}/{{target_output_name}}.dll" depfile = "{{output}}.d" rspfile = "$rust_outfile.rsp" rspfile_content = "{{rustdeps}} {{externs}}"