Skip to content

Commit 3bccc94

Browse files
committed
zos: support platform
* recognize a zos system * use correct cp arguments for zos * add zos compile options * add zos makedep arguments * use export file in link step on zos
1 parent 7245415 commit 3bccc94

File tree

5 files changed

+65
-3
lines changed

5 files changed

+65
-3
lines changed

addon.gypi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@
8989
'-Wl,-bimport:<(node_exp_file)'
9090
],
9191
}],
92+
[ 'OS=="os390"', {
93+
'cflags': [
94+
'-q64',
95+
'-Wc,DLL',
96+
'-qlonglong'
97+
],
98+
'ldflags': [
99+
'-q64',
100+
'<(node_exp_file)'
101+
],
102+
}],
92103
[ 'OS=="win"', {
93104
'conditions': [
94105
['node_engine=="chakracore"', {

gyp/pylib/gyp/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ def GetFlavor(params):
429429
return 'netbsd'
430430
if sys.platform.startswith('aix'):
431431
return 'aix'
432+
if sys.platform.startswith('os390'):
433+
return 'os390'
432434

433435
return 'linux'
434436

gyp/pylib/gyp/generator/make.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,25 @@ def CalculateGeneratorInputInfo(params):
227227
"""
228228

229229

230+
LINK_COMMANDS_OS390 = """\
231+
quiet_cmd_alink = AR($(TOOLSET)) $@
232+
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
233+
234+
quiet_cmd_alink_thin = AR($(TOOLSET)) $@
235+
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
236+
237+
quiet_cmd_link = LINK($(TOOLSET)) $@
238+
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS)
239+
240+
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
241+
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) -Wl,DLL
242+
243+
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
244+
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL
245+
246+
"""
247+
248+
230249
# Header of toplevel Makefile.
231250
# This should go into the build tree, but it's easier to keep it here for now.
232251
SHARED_HEADER = ("""\
@@ -310,7 +329,7 @@ def CalculateGeneratorInputInfo(params):
310329
# We write to a dep file on the side first and then rename at the end
311330
# so we can't end up with a broken dep file.
312331
depfile = $(depsdir)/$(call replace_spaces,$@).d
313-
DEPFLAGS = -MMD -MF $(depfile).raw
332+
DEPFLAGS = %(makedep_args)s -MF $(depfile).raw
314333
315334
# We have to fixup the deps output in a few ways.
316335
# (1) the file output should mention the proper .o file.
@@ -2013,6 +2032,7 @@ def CalculateMakefilePath(build_file, base_name):
20132032

20142033
flock_command= 'flock'
20152034
copy_archive_arguments = '-af'
2035+
makedep_arguments = '-MMD'
20162036
header_params = {
20172037
'default_target': default_target,
20182038
'builddir': builddir_name,
@@ -2023,6 +2043,7 @@ def CalculateMakefilePath(build_file, base_name):
20232043
'extra_commands': '',
20242044
'srcdir': srcdir,
20252045
'copy_archive_args': copy_archive_arguments,
2046+
'makedep_args': makedep_arguments,
20262047
}
20272048
if flavor == 'mac':
20282049
flock_command = './gyp-mac-tool flock'
@@ -2036,6 +2057,14 @@ def CalculateMakefilePath(build_file, base_name):
20362057
header_params.update({
20372058
'link_commands': LINK_COMMANDS_ANDROID,
20382059
})
2060+
elif flavor == 'os390':
2061+
copy_archive_arguments = '-fPR'
2062+
makedep_arguments = '-qmakedep=gcc'
2063+
header_params.update({
2064+
'copy_archive_args': copy_archive_arguments,
2065+
'makedep_args': makedep_arguments,
2066+
'link_commands': LINK_COMMANDS_OS390,
2067+
})
20392068
elif flavor == 'solaris':
20402069
header_params.update({
20412070
'flock': './gyp-flock-tool flock',

gyp/pylib/gyp/generator/ninja.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2250,7 +2250,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
22502250
master_ninja.rule(
22512251
'copy',
22522252
description='COPY $in $out',
2253-
command='rm -rf $out && cp -af $in $out')
2253+
if sys.platform in ('os390'):
2254+
command='rm -rf $out && cp -fRP $in $out')
2255+
else:
2256+
command='rm -rf $out && cp -af $in $out')
22542257
master_ninja.newline()
22552258

22562259
all_targets = set()

lib/configure.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,23 @@ function configure (gyp, argv, callback) {
270270
return callback(new Error(msg))
271271
}
272272
}
273+
else if (process.platform === 'os390') {
274+
var node_root_dir = findNodeDirectory()
275+
var candidates = ['include/node/node.x',
276+
'out/Release/node.x',
277+
'out/Debug/node.x',
278+
'node.x']
279+
for (var next = 0; next < candidates.length; next++) {
280+
node_exp_file = path.resolve(node_root_dir, candidates[next])
281+
try {
282+
fs.accessSync(node_exp_file, fs.R_OK)
283+
// exp file found, stop looking
284+
break
285+
} catch (exception) {
286+
// this candidate was not found or not readable, do nothing
287+
}
288+
}
289+
}
273290

274291
// this logic ported from the old `gyp_addon` python file
275292
var gyp_script = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
@@ -294,7 +311,7 @@ function configure (gyp, argv, callback) {
294311
argv.push('-Dlibrary=shared_library')
295312
argv.push('-Dvisibility=default')
296313
argv.push('-Dnode_root_dir=' + nodeDir)
297-
if (process.platform === 'aix') {
314+
if (process.platform === 'aix' || process.platform === 'os390') {
298315
argv.push('-Dnode_exp_file=' + node_exp_file)
299316
}
300317
argv.push('-Dnode_gyp_dir=' + nodeGypDir)

0 commit comments

Comments
 (0)