aboutsummarylogtreecommitdiffstats
path: root/chromium-150-fix-ar-unbundle.patch
blob: bbc67eeb6d534fada0b4dc20c0d15249deb5bf6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 60f987d8d5f7272793a40290d060b8f50933f825 Mon Sep 17 00:00:00 2001
From: Takuto Ikuta <tikuta@chromium.org>
Date: Mon, 08 Jun 2026 19:43:20 -0700
Subject: [PATCH] build: Omit ar from inputs when resolved via $PATH

The GN build configuration previously added the `ar` tool to the inputs
list unconditionally. However, if the `ar` tool is specified simply by
its filename and is resolved via the system `$PATH`, it should not be
tracked as a direct input dependency.

This change adds a condition to verify if `ar` is an explicit path
rather than just a filename. It only includes `ar` in the action's
inputs list when it is not resolved from `$PATH`.

This is to address
https://crrev.com/c/7835150/8/build/toolchain/gcc_toolchain.gni#406

Bug: 358521078
Change-Id: I096ac4aa7f3b697c58c94af1349159b9c87f4201
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7904982
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Matt Stark <msta@google.com>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1643634}
---

diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index 51433d4..ec66ab3 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -408,8 +408,12 @@
         command = "cmd /s /c \"\"$python_path\" $tool_wrapper_path delete-file {{output}} && $command\""
       } else {
         command = "rm -f {{output}} && $command"
-        inputs =
-            [ get_path_info(rebase_path(ar, ".", root_out_dir), "abspath") ]
+
+        # Add ar to inputs if it's not from $PATH.
+        if (get_path_info(ar, "file") != ar) {
+          inputs =
+              [ get_path_info(rebase_path(ar, ".", root_out_dir), "abspath") ]
+        }
       }
 
       # Almost all targets build with //build/config/compiler:thin_archive which
From 7d6555b11f181bdc24ba56577f753a07add6e8c7 Mon Sep 17 00:00:00 2001
From: Matt Jolly <kangie@gentoo.org>
Date: Tue, 16 Jun 2026 21:57:07 -0700
Subject: [PATCH] build: Fix get_path_info on empty ar in unbundle toolchain

Some toolchains leave ar empty during initial setup, causing GN to error
when get_path_info() is called with an empty string. Guard the check to
only run when ar is not empty.

Signed-off-by: Matt Jolly <kangie@gentoo.org>
Change-Id: I87615806ddfda6f262a7500b0c5b6fed1f452985
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7949777
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Matt Stark <msta@google.com>
Cr-Commit-Position: refs/heads/main@{#1648076}
---

diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index ec66ab3..d8457bfa 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -409,8 +409,9 @@
       } else {
         command = "rm -f {{output}} && $command"
 
-        # Add ar to inputs if it's not from $PATH.
-        if (get_path_info(ar, "file") != ar) {
+        # Add ar to inputs if it's not from $PATH. Some toolchains leave
+        # |ar| empty during toolchain setup, so guard get_path_info() here.
+        if (ar != "" && get_path_info(ar, "file") != ar) {
           inputs =
               [ get_path_info(rebase_path(ar, ".", root_out_dir), "abspath") ]
         }