Skip to content

Commit 37c6a1f

Browse files
tools: update gyp-next to 0.22.4
PR-URL: #66988 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 26b9200 commit 37c6a1f

13 files changed

Lines changed: 189 additions & 15 deletions

File tree

β€Žtools/gyp/CHANGELOG.mdβ€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [0.22.4](https://github.com/nodejs/gyp-next/compare/v0.22.3...v0.22.4) (2026-10-20)
4+
5+
6+
### Bug Fixes
7+
8+
* avoid deprecated os.path.commonprefix() in RelativePath ([#365](https://github.com/nodejs/gyp-next/issues/365)) ([428343e](https://github.com/nodejs/gyp-next/commit/428343ee58c05e7b817d3603688fe7cdb7a10846)), closes [#364](https://github.com/nodejs/gyp-next/issues/364)
9+
* build precompiled headers after generated inputs ([#360](https://github.com/nodejs/gyp-next/issues/360)) ([d8888e9](https://github.com/nodejs/gyp-next/commit/d8888e932040eae90604b77ec6030a25714f0077))
10+
* include the prefix header itself in assembly sources ([#360](https://github.com/nodejs/gyp-next/issues/360)) ([d8888e9](https://github.com/nodejs/gyp-next/commit/d8888e932040eae90604b77ec6030a25714f0077))
11+
* **make:** compile the C prefix header with CFLAGS ([#360](https://github.com/nodejs/gyp-next/issues/360)) ([d8888e9](https://github.com/nodejs/gyp-next/commit/d8888e932040eae90604b77ec6030a25714f0077))
12+
313
## [0.22.3](https://github.com/nodejs/gyp-next/compare/v0.22.2...v0.22.3) (2026-09-29)
414

515

β€Žtools/gyp/pylib/gyp/common.pyβ€Ž

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,12 @@ def RelativePath(path, relative_to, follow_path_symlink=True):
157157
path_split = path.split(os.path.sep)
158158
relative_to_split = relative_to.split(os.path.sep)
159159

160-
# Determine how much of the prefix the two paths share.
161-
prefix_len = len(os.path.commonprefix([path_split, relative_to_split]))
160+
# Determine how much of the path prefix the two paths share.
161+
prefix_len = 0
162+
for path_part, relative_to_part in zip(path_split, relative_to_split):
163+
if path_part != relative_to_part:
164+
break
165+
prefix_len += 1
162166

163167
# Put enough ".." components to back up out of relative_to to the common
164168
# prefix, and then append the part of path_split after the common prefix.

β€Žtools/gyp/pylib/gyp/common_test.pyβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,17 @@ def mock_run(env, defines_stdout, expected_cmd, throws=False):
182182
assert flavor6 == "wasi"
183183

184184

185+
class TestRelativePath(unittest.TestCase):
186+
def test_common_parent(self):
187+
assert gyp.common.RelativePath("/a/b", "/a/c") == os.path.join("..", "b")
188+
189+
def test_only_root_in_common(self):
190+
"""Paths whose only common ancestor is the filesystem root."""
191+
assert gyp.common.RelativePath("/a/b", "/c") == os.path.join("..", "a", "b")
192+
193+
def test_same_path(self):
194+
assert gyp.common.RelativePath("/a/b", "/a/b") == ""
195+
196+
185197
if __name__ == "__main__":
186198
unittest.main()

β€Žtools/gyp/pylib/gyp/generator/make.pyβ€Ž

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def CalculateGeneratorInputInfo(params):
603603
604604
# Commands for precompiled header files.
605605
quiet_cmd_pch_c = CXX($(TOOLSET)) $@
606-
cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
606+
cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $<
607607
quiet_cmd_pch_cc = CXX($(TOOLSET)) $@
608608
cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $<
609609
quiet_cmd_pch_m = CXX($(TOOLSET)) $@
@@ -1485,13 +1485,29 @@ def WriteSources(
14851485
# See "Target-specific Variable Values" in the GNU Make manual."""
14861486
)
14871487
self.WriteLn("$(OBJS): TOOLSET := $(TOOLSET)")
1488-
self.WriteLn(
1489-
"$(OBJS): GYP_CFLAGS := "
1488+
gyp_cflags = (
14901489
"$(DEFS_$(BUILDTYPE)) "
14911490
"$(INCS_$(BUILDTYPE)) "
1492-
"%s " % precompiled_header.GetInclude("c") + "$(CFLAGS_$(BUILDTYPE)) "
1491+
"%s "
1492+
"$(CFLAGS_$(BUILDTYPE)) "
14931493
"$(CFLAGS_C_$(BUILDTYPE))"
14941494
)
1495+
self.WriteLn(
1496+
"$(OBJS): GYP_CFLAGS := "
1497+
+ gyp_cflags % precompiled_header.GetInclude("c")
1498+
)
1499+
asm_objs = [
1500+
obj
1501+
for source, obj in zip(compilable, objs)
1502+
if source.endswith((".s", ".S"))
1503+
]
1504+
if asm_objs and precompiled_header.compile_headers:
1505+
# Assembly is compiled with GYP_CFLAGS too, but without a gch
1506+
# for it, the -include of the C one fails.
1507+
self.WriteLn(
1508+
"%s: GYP_CFLAGS := " % " ".join(asm_objs)
1509+
+ gyp_cflags % precompiled_header.GetInclude("asm")
1510+
)
14951511
self.WriteLn(
14961512
"$(OBJS): GYP_CXXFLAGS := "
14971513
"$(DEFS_$(BUILDTYPE)) "
@@ -1521,16 +1537,23 @@ def WriteSources(
15211537
"$(CFLAGS_OBJCC_$(BUILDTYPE))"
15221538
)
15231539

1524-
self.WritePchTargets(precompiled_header.GetPchBuildCommands())
1540+
self.WritePchTargets(
1541+
precompiled_header.GetPchBuildCommands(), deps + extra_outputs
1542+
)
15251543

15261544
# If there are any object files in our input file list, link them into our
15271545
# output.
15281546
extra_link_deps += [source for source in sources if Linkable(source)]
15291547

15301548
self.WriteLn()
15311549

1532-
def WritePchTargets(self, pch_commands):
1533-
"""Writes make rules to compile prefix headers."""
1550+
def WritePchTargets(self, pch_commands, order_only_deps):
1551+
"""Writes make rules to compile prefix headers.
1552+
1553+
A prefix header may include generated headers, so like the object files,
1554+
the gch files are built after |order_only_deps|: the target's dependencies
1555+
and the outputs of its actions and rules.
1556+
"""
15341557
if not pch_commands:
15351558
return
15361559

@@ -1547,6 +1570,9 @@ def WritePchTargets(self, pch_commands):
15471570
"m": "GYP_PCH_OBJCFLAGS",
15481571
"mm": "GYP_PCH_OBJCXXFLAGS",
15491572
}[lang]
1573+
if order_only_deps:
1574+
self.WriteMakeRule([gch], order_only_deps, order_only=True)
1575+
self.WriteLn(f"{gch}: TOOLSET := $(TOOLSET)")
15501576
self.WriteLn(
15511577
f"{gch}: {var_name} := {lang_flag} " + "$(DEFS_$(BUILDTYPE)) "
15521578
"$(INCS_$(BUILDTYPE)) "

β€Žtools/gyp/pylib/gyp/generator/ninja.pyβ€Ž

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,12 @@ def WriteSourcesForArch(
12531253
cflags_cc,
12541254
self.ExpandSpecial,
12551255
)
1256+
elif ext in ("s", "S") and precompiled_header.compile_headers:
1257+
# Assembly gets $cflags_pch_c too, but without a gch for it, the
1258+
# -include of the C one fails.
1259+
variables = [
1260+
("cflags_pch_c", precompiled_header.GetInclude("asm", arch))
1261+
]
12561262
ninja_file.build(
12571263
output,
12581264
command,
@@ -1274,13 +1280,17 @@ def WriteSourcesForArch(
12741280
],
12751281
)
12761282

1277-
self.WritePchTargets(ninja_file, pch_commands)
1283+
self.WritePchTargets(ninja_file, pch_commands, predepends)
12781284

12791285
ninja_file.newline()
12801286
return outputs
12811287

1282-
def WritePchTargets(self, ninja_file, pch_commands):
1283-
"""Writes ninja rules to compile prefix headers."""
1288+
def WritePchTargets(self, ninja_file, pch_commands, predepends):
1289+
"""Writes ninja rules to compile prefix headers.
1290+
1291+
A prefix header may include generated headers, so like the object files,
1292+
the gch files are built after |predepends|.
1293+
"""
12841294
if not pch_commands:
12851295
return
12861296

@@ -1299,7 +1309,13 @@ def WritePchTargets(self, ninja_file, pch_commands):
12991309
"mm": "objcxx",
13001310
}
13011311
cmd = map.get(lang)
1302-
ninja_file.build(gch, cmd, input, variables=[(var_name, lang_flag)])
1312+
ninja_file.build(
1313+
gch,
1314+
cmd,
1315+
input,
1316+
order_only=predepends,
1317+
variables=[(var_name, lang_flag)],
1318+
)
13031319

13041320
def WriteLink(self, spec, config_name, config, link_deps, compile_deps):
13051321
"""Write out a link step. Fills out target.binary."""

β€Žtools/gyp/pylib/gyp/xcode_emulation.pyβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,10 @@ def _CompiledHeader(self, lang, arch):
14291429
return h
14301430

14311431
def GetInclude(self, lang, arch=None):
1432-
"""Gets the cflags to include the prefix header for language |lang|."""
1432+
"""Gets the cflags to include the prefix header for language |lang|.
1433+
1434+
There is no compiled header for assembly ('asm'), which includes the
1435+
prefix header itself."""
14331436
if self.compile_headers and lang in self.compiled_headers:
14341437
return "-include %s" % self._CompiledHeader(lang, arch)
14351438
elif self.header:

β€Žtools/gyp/pyproject.tomlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "gyp-next"
7-
version = "0.22.3"
7+
version = "0.22.4"
88
authors = [
99
{ name="Node.js contributors", email="ryzokuken@disroot.org" },
1010
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "action_generated.h"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Assembly gets the prefix header too, but has no precompiled header.
2+
.text

0 commit comments

Comments
Β (0)