Skip to content

Commit

Permalink
fix: duplicate ninja rules for v8 (cross-compiling)
Browse files Browse the repository at this point in the history
avoids duplicate ninja rules for v8 used in host and target

From: minrk/node@5e533cb
Signed-off-by: Thomas Petazzoni <[email protected]>

Reported in nodejs/node#46690
and nodejs/node#37441

Minor refactoring as recommended by Christian Clauss.

Signed-off-by: Tim Orling <[email protected]>
  • Loading branch information
minrk authored and moto-timo committed Feb 20, 2023
1 parent 9f38221 commit 09e3ad8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# the start of a string, while $| is used for variables that can appear
# anywhere in a string.
"INTERMEDIATE_DIR": "$!INTERMEDIATE_DIR",
"SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/gen",
"SHARED_INTERMEDIATE_DIR": "$!PRODUCT_DIR/$|OBJ/gen",
"PRODUCT_DIR": "$!PRODUCT_DIR",
"CONFIGURATION_NAME": "$|CONFIGURATION_NAME",
# Special variables that may be used by gyp 'rule' targets.
Expand Down Expand Up @@ -285,7 +285,8 @@ def ExpandSpecial(self, path, product_dir=None):
CONFIGURATION_NAME = "$|CONFIGURATION_NAME"
path = path.replace(CONFIGURATION_NAME, self.config_name)

return path
obj = "obj" if self.toolset == "target" else f"obj.{self.toolset}"
return path.replace("$|OBJ", obj)

def ExpandRuleVariables(self, path, root, dirname, source, ext, name):
if self.flavor == "win":
Expand Down

0 comments on commit 09e3ad8

Please sign in to comment.