1From af47d317e5ae12978c1cdc40627008ada144f98b Mon Sep 17 00:00:00 2001
2From: Min RK <benjaminrk@gmail.com>
3Date: Fri, 19 Feb 2021 11:57:04 +0100
4Subject: [PATCH] include obj name in shared intermediate
5
6avoids duplicate ninja rules for v8 used in host and target
7
8From: https://github.com/minrk/node/commit/5e533cb943eef68b270f55f0cba02c0ec67c699d
9Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
10---
11 tools/gyp/pylib/gyp/generator/ninja.py | 8 +++++++-
12 1 file changed, 7 insertions(+), 1 deletion(-)
13
14diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py
15index 3db3771ac9..2e0a021703 100644
16--- a/tools/gyp/pylib/gyp/generator/ninja.py
17+++ b/tools/gyp/pylib/gyp/generator/ninja.py
18@@ -42,7 +42,7 @@ generator_default_variables = {
19     # the start of a string, while $| is used for variables that can appear
20     # anywhere in a string.
21     "INTERMEDIATE_DIR": "$!INTERMEDIATE_DIR",
22-    "SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/gen",
23+    "SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/$|OBJ/gen",
24     "PRODUCT_DIR": "$!PRODUCT_DIR",
25     "CONFIGURATION_NAME": "$|CONFIGURATION_NAME",
26     # Special variables that may be used by gyp 'rule' targets.
27@@ -285,6 +285,12 @@ class NinjaWriter:
28         CONFIGURATION_NAME = "$|CONFIGURATION_NAME"
29         path = path.replace(CONFIGURATION_NAME, self.config_name)
30
31+        obj = "obj"
32+        if self.toolset != "target":
33+            obj += "." + self.toolset
34+
35+        path = path.replace("$|OBJ", obj)
36+
37         return path
38
39     def ExpandRuleVariables(self, path, root, dirname, source, ext, name):
40--
412.37.3
42
43