Skip to content

Commit 93c9402

Browse files
targosjuanarbol
authored andcommitted
tools: update gyp-next to v0.12.1
PR-URL: #42625 Refs: nodejs/gyp-next@v0.10.1...v0.12.1 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent 5bc7d7f commit 93c9402

File tree

10 files changed

+143
-24
lines changed

10 files changed

+143
-24
lines changed

tools/gyp/.github/workflows/Python_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v3
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies

tools/gyp/.github/workflows/node-gyp.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
with:
2222
repository: nodejs/node-gyp
2323
path: node-gyp
24-
- uses: actions/setup-node@v2
24+
- uses: actions/setup-node@v3
2525
with:
2626
node-version: 14.x
27-
- uses: actions/setup-python@v2
27+
- uses: actions/setup-python@v3
2828
with:
2929
python-version: ${{ matrix.python }}
3030
- name: Install dependencies

tools/gyp/CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
### [0.12.1](https://www.github.com/nodejs/gyp-next/compare/v0.12.0...v0.12.1) (2022-04-06)
4+
5+
6+
### Bug Fixes
7+
8+
* **msvs:** avoid fixing path for arguments with "=" ([#143](https://www.github.com/nodejs/gyp-next/issues/143)) ([7e8f16e](https://www.github.com/nodejs/gyp-next/commit/7e8f16eb165e042e64bec98fa6c2a0232a42c26b))
9+
10+
## [0.12.0](https://www.github.com/nodejs/gyp-next/compare/v0.11.0...v0.12.0) (2022-04-04)
11+
12+
13+
### Features
14+
15+
* support building shared libraries on z/OS ([#137](https://www.github.com/nodejs/gyp-next/issues/137)) ([293bcfa](https://www.github.com/nodejs/gyp-next/commit/293bcfa4c25c6adb743377adafc45a80fee492c6))
16+
17+
## [0.11.0](https://www.github.com/nodejs/gyp-next/compare/v0.10.1...v0.11.0) (2022-03-04)
18+
19+
20+
### Features
21+
22+
* Add proper support for IBM i ([#140](https://www.github.com/nodejs/gyp-next/issues/140)) ([fdda4a3](https://www.github.com/nodejs/gyp-next/commit/fdda4a3038b8a7042ad960ce7a223687c24a21b1))
23+
324
### [0.10.1](https://www.github.com/nodejs/gyp-next/compare/v0.10.0...v0.10.1) (2021-11-24)
425

526

tools/gyp/pylib/gyp/common.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ def GetFlavor(params):
454454
return "aix"
455455
if sys.platform.startswith(("os390", "zos")):
456456
return "zos"
457+
if sys.platform == "os400":
458+
return "os400"
457459

458460
return "linux"
459461

@@ -463,9 +465,13 @@ def CopyTool(flavor, out_path, generator_flags={}):
463465
to |out_path|."""
464466
# aix and solaris just need flock emulation. mac and win use more complicated
465467
# support scripts.
466-
prefix = {"aix": "flock", "solaris": "flock", "mac": "mac", "win": "win"}.get(
467-
flavor, None
468-
)
468+
prefix = {
469+
"aix": "flock",
470+
"os400": "flock",
471+
"solaris": "flock",
472+
"mac": "mac",
473+
"win": "win",
474+
}.get(flavor, None)
469475
if not prefix:
470476
return
471477

tools/gyp/pylib/gyp/flock_tool.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def ExecFlock(self, lockfile, *cmd_list):
4141
# with EBADF, that's why we use this F_SETLK
4242
# hack instead.
4343
fd = os.open(lockfile, os.O_WRONLY | os.O_NOCTTY | os.O_CREAT, 0o666)
44-
if sys.platform.startswith("aix"):
44+
if sys.platform.startswith("aix") or sys.platform == "os400":
4545
# Python on AIX is compiled with LARGEFILE support, which changes the
4646
# struct size.
4747
op = struct.pack("hhIllqq", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)

tools/gyp/pylib/gyp/generator/make.py

+99-11
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ def CalculateVariables(default_variables, params):
9999
default_variables.setdefault("OS", operating_system)
100100
if flavor == "aix":
101101
default_variables.setdefault("SHARED_LIB_SUFFIX", ".a")
102+
elif flavor == "zos":
103+
default_variables.setdefault("SHARED_LIB_SUFFIX", ".x")
102104
else:
103105
default_variables.setdefault("SHARED_LIB_SUFFIX", ".so")
104106
default_variables.setdefault("SHARED_LIB_DIR", "$(builddir)/lib.$(TOOLSET)")
@@ -237,6 +239,24 @@ def CalculateGeneratorInputInfo(params):
237239
""" # noqa: E501
238240

239241

242+
LINK_COMMANDS_OS400 = """\
243+
quiet_cmd_alink = AR($(TOOLSET)) $@
244+
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)
245+
246+
quiet_cmd_alink_thin = AR($(TOOLSET)) $@
247+
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)
248+
249+
quiet_cmd_link = LINK($(TOOLSET)) $@
250+
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
251+
252+
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
253+
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
254+
255+
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
256+
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
257+
""" # noqa: E501
258+
259+
240260
LINK_COMMANDS_OS390 = """\
241261
quiet_cmd_alink = AR($(TOOLSET)) $@
242262
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
@@ -248,10 +268,10 @@ def CalculateGeneratorInputInfo(params):
248268
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
249269
250270
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
251-
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) -Wl,DLL
271+
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,DLL -o $(patsubst %.x,%.so,$@) $(LD_INPUTS) $(LIBS) && if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi
252272
253273
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
254-
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL
274+
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
255275
""" # noqa: E501
256276

257277

@@ -400,6 +420,9 @@ def CalculateGeneratorInputInfo(params):
400420
# send stderr to /dev/null to ignore messages when linking directories.
401421
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@")
402422
423+
quiet_cmd_symlink = SYMLINK $@
424+
cmd_symlink = ln -sf "$<" "$@"
425+
403426
%(link_commands)s
404427
""" # noqa: E501
405428
r"""
@@ -981,12 +1004,20 @@ def WriteActions(
9811004
# libraries, but until everything is made cross-compile safe, also use
9821005
# target libraries.
9831006
# TODO(piman): when everything is cross-compile safe, remove lib.target
984-
self.WriteLn(
985-
"cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:"
986-
"$(builddir)/lib.target:$$LD_LIBRARY_PATH; "
987-
"export LD_LIBRARY_PATH; "
988-
"%s%s" % (name, cd_action, command)
989-
)
1007+
if self.flavor == "zos" or self.flavor == "aix":
1008+
self.WriteLn(
1009+
"cmd_%s = LIBPATH=$(builddir)/lib.host:"
1010+
"$(builddir)/lib.target:$$LIBPATH; "
1011+
"export LIBPATH; "
1012+
"%s%s" % (name, cd_action, command)
1013+
)
1014+
else:
1015+
self.WriteLn(
1016+
"cmd_%s = LD_LIBRARY_PATH=$(builddir)/lib.host:"
1017+
"$(builddir)/lib.target:$$LD_LIBRARY_PATH; "
1018+
"export LD_LIBRARY_PATH; "
1019+
"%s%s" % (name, cd_action, command)
1020+
)
9901021
self.WriteLn()
9911022
outputs = [self.Absolutify(o) for o in outputs]
9921023
# The makefile rules are all relative to the top dir, but the gyp actions
@@ -1480,6 +1511,8 @@ def ComputeOutputBasename(self, spec):
14801511
target_prefix = "lib"
14811512
if self.flavor == "aix":
14821513
target_ext = ".a"
1514+
elif self.flavor == "zos":
1515+
target_ext = ".x"
14831516
else:
14841517
target_ext = ".so"
14851518
elif self.type == "none":
@@ -1560,6 +1593,14 @@ def ComputeDeps(self, spec):
15601593
# link_deps.extend(spec.get('libraries', []))
15611594
return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps))
15621595

1596+
def GetSharedObjectFromSidedeck(self, sidedeck):
1597+
"""Return the shared object files based on sidedeck"""
1598+
return re.sub(r"\.x$", ".so", sidedeck)
1599+
1600+
def GetUnversionedSidedeckFromSidedeck(self, sidedeck):
1601+
"""Return the shared object files based on sidedeck"""
1602+
return re.sub(r"\.\d+\.x$", ".x", sidedeck)
1603+
15631604
def WriteDependencyOnExtraOutputs(self, target, extra_outputs):
15641605
self.WriteMakeRule(
15651606
[self.output_binary],
@@ -1798,6 +1839,11 @@ def WriteTarget(
17981839
part_of_all,
17991840
postbuilds=postbuilds,
18001841
)
1842+
# z/OS has a .so target as well as a sidedeck .x target
1843+
if self.flavor == "zos":
1844+
self.WriteLn('%s: %s' % (
1845+
QuoteSpaces(self.GetSharedObjectFromSidedeck(self.output_binary)),
1846+
QuoteSpaces(self.output_binary)))
18011847
elif self.type == "loadable_module":
18021848
for link_dep in link_deps:
18031849
assert " " not in link_dep, (
@@ -1855,7 +1901,9 @@ def WriteTarget(
18551901
else:
18561902
file_desc = "executable"
18571903
install_path = self._InstallableTargetInstallPath()
1858-
installable_deps = [self.output]
1904+
installable_deps = []
1905+
if self.flavor != "zos":
1906+
installable_deps.append(self.output)
18591907
if (
18601908
self.flavor == "mac"
18611909
and "product_dir" not in spec
@@ -1880,15 +1928,42 @@ def WriteTarget(
18801928
comment="Copy this to the %s output path." % file_desc,
18811929
part_of_all=part_of_all,
18821930
)
1883-
installable_deps.append(install_path)
1931+
if self.flavor != "zos":
1932+
installable_deps.append(install_path)
1933+
if self.flavor == 'zos' and self.type == 'shared_library':
1934+
# lib.target/libnode.so has a dependency on $(obj).target/libnode.so
1935+
self.WriteDoCmd([self.GetSharedObjectFromSidedeck(install_path)],
1936+
[self.GetSharedObjectFromSidedeck(self.output)], 'copy',
1937+
comment='Copy this to the %s output path.' %
1938+
file_desc, part_of_all=part_of_all)
1939+
# Create a symlink of libnode.x to libnode.version.x
1940+
self.WriteDoCmd([self.GetUnversionedSidedeckFromSidedeck(install_path)],
1941+
[install_path], 'symlink',
1942+
comment='Symlnk this to the %s output path.' %
1943+
file_desc, part_of_all=part_of_all)
1944+
# Place libnode.version.so and libnode.x symlink in lib.target dir
1945+
installable_deps.append(self.GetSharedObjectFromSidedeck(install_path))
1946+
installable_deps.append(
1947+
self.GetUnversionedSidedeckFromSidedeck(install_path))
18841948
if self.output != self.alias and self.alias != self.target:
18851949
self.WriteMakeRule(
18861950
[self.alias],
18871951
installable_deps,
18881952
comment="Short alias for building this %s." % file_desc,
18891953
phony=True,
18901954
)
1891-
if part_of_all:
1955+
if self.flavor == 'zos' and self.type == 'shared_library':
1956+
# Make sure that .x symlink target is run
1957+
self.WriteMakeRule(
1958+
['all'],
1959+
[
1960+
self.GetUnversionedSidedeckFromSidedeck(install_path),
1961+
self.GetSharedObjectFromSidedeck(install_path)
1962+
],
1963+
comment='Add %s to "all" target.' % file_desc,
1964+
phony=True,
1965+
)
1966+
elif part_of_all:
18921967
self.WriteMakeRule(
18931968
["all"],
18941969
[install_path],
@@ -2184,6 +2259,9 @@ def _InstallableTargetInstallPath(self):
21842259
# # Install all shared libs into a common directory (per toolset) for
21852260
# # convenient access with LD_LIBRARY_PATH.
21862261
# return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias)
2262+
if self.flavor == "zos" and self.type == "shared_library":
2263+
return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias)
2264+
21872265
return "$(builddir)/" + self.alias
21882266

21892267

@@ -2351,6 +2429,16 @@ def CalculateMakefilePath(build_file, base_name):
23512429
"flock_index": 2,
23522430
}
23532431
)
2432+
elif flavor == "os400":
2433+
copy_archive_arguments = "-pPRf"
2434+
header_params.update(
2435+
{
2436+
"copy_archive_args": copy_archive_arguments,
2437+
"link_commands": LINK_COMMANDS_OS400,
2438+
"flock": "./gyp-flock-tool flock",
2439+
"flock_index": 2,
2440+
}
2441+
)
23542442

23552443
build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
23562444
make_global_settings_array = data[build_file].get("make_global_settings", [])

tools/gyp/pylib/gyp/generator/msvs.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,15 @@ def _BuildCommandLineForRuleRaw(
423423
command.insert(0, "call")
424424
# Fix the paths
425425
# TODO(quote): This is a really ugly heuristic, and will miss path fixing
426-
# for arguments like "--arg=path" or "/opt:path".
427-
# If the argument starts with a slash or dash, it's probably a command line
428-
# switch
426+
# for arguments like "--arg=path", arg=path, or "/opt:path".
427+
# If the argument starts with a slash or dash, or contains an equal sign,
428+
# it's probably a command line switch.
429429
# Return the path with forward slashes because the command using it might
430430
# not support backslashes.
431-
arguments = [i if (i[:1] in "/-") else _FixPath(i, "/") for i in cmd[1:]]
431+
arguments = [
432+
i if (i[:1] in "/-" or "=" in i) else _FixPath(i, "/")
433+
for i in cmd[1:]
434+
]
432435
arguments = [i.replace("$(InputDir)", "%INPUTDIR%") for i in arguments]
433436
arguments = [MSVSSettings.FixVCMacroSlashes(i) for i in arguments]
434437
if quote_cmd:

tools/gyp/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setup(
1717
name="gyp-next",
18-
version="0.10.1",
18+
version="0.12.1",
1919
description="A fork of the GYP build system for use in the Node.js projects",
2020
long_description=long_description,
2121
long_description_content_type="text/markdown",

tools/gyp/test_gyp.py

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def main(argv=None):
116116
else:
117117
format_list = {
118118
"aix5": ["make"],
119+
"os400": ["make"],
119120
"freebsd7": ["make"],
120121
"freebsd8": ["make"],
121122
"openbsd5": ["make"],

tools/gyp/tools/pretty_gyp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def count_braces(line):
9090
"""
9191
open_braces = ["[", "(", "{"]
9292
close_braces = ["]", ")", "}"]
93-
closing_prefix_re = re.compile(r"(.*?[^\s\]\}\)]+.*?)([\]\}\)],?)\s*$")
93+
closing_prefix_re = re.compile(r"[^\s\]\}\)]\s*[\]\}\)]+,?\s*$")
9494
cnt = 0
9595
stripline = COMMENT_RE.sub(r"", line)
9696
stripline = QUOTE_RE.sub(r"''", stripline)

0 commit comments

Comments
 (0)