Skip to content

Commit

Permalink
zos: support platform
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jBarz committed Aug 24, 2017
1 parent 7245415 commit 3bccc94
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 3 deletions.
11 changes: 11 additions & 0 deletions addon.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@
'-Wl,-bimport:<(node_exp_file)'
],
}],
[ 'OS=="os390"', {
'cflags': [
'-q64',
'-Wc,DLL',
'-qlonglong'
],
'ldflags': [
'-q64',
'<(node_exp_file)'
],
}],
[ 'OS=="win"', {
'conditions': [
['node_engine=="chakracore"', {
Expand Down
2 changes: 2 additions & 0 deletions gyp/pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,8 @@ def GetFlavor(params):
return 'netbsd'
if sys.platform.startswith('aix'):
return 'aix'
if sys.platform.startswith('os390'):
return 'os390'

return 'linux'

Expand Down
31 changes: 30 additions & 1 deletion gyp/pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,25 @@ def CalculateGeneratorInputInfo(params):
"""


LINK_COMMANDS_OS390 = """\
quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS)
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS) -Wl,DLL
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL
"""


# Header of toplevel Makefile.
# This should go into the build tree, but it's easier to keep it here for now.
SHARED_HEADER = ("""\
Expand Down Expand Up @@ -310,7 +329,7 @@ def CalculateGeneratorInputInfo(params):
# We write to a dep file on the side first and then rename at the end
# so we can't end up with a broken dep file.
depfile = $(depsdir)/$(call replace_spaces,$@).d
DEPFLAGS = -MMD -MF $(depfile).raw
DEPFLAGS = %(makedep_args)s -MF $(depfile).raw
# We have to fixup the deps output in a few ways.
# (1) the file output should mention the proper .o file.
Expand Down Expand Up @@ -2013,6 +2032,7 @@ def CalculateMakefilePath(build_file, base_name):

flock_command= 'flock'
copy_archive_arguments = '-af'
makedep_arguments = '-MMD'
header_params = {
'default_target': default_target,
'builddir': builddir_name,
Expand All @@ -2023,6 +2043,7 @@ def CalculateMakefilePath(build_file, base_name):
'extra_commands': '',
'srcdir': srcdir,
'copy_archive_args': copy_archive_arguments,
'makedep_args': makedep_arguments,
}
if flavor == 'mac':
flock_command = './gyp-mac-tool flock'
Expand All @@ -2036,6 +2057,14 @@ def CalculateMakefilePath(build_file, base_name):
header_params.update({
'link_commands': LINK_COMMANDS_ANDROID,
})
elif flavor == 'os390':
copy_archive_arguments = '-fPR'
makedep_arguments = '-qmakedep=gcc'
header_params.update({
'copy_archive_args': copy_archive_arguments,
'makedep_args': makedep_arguments,
'link_commands': LINK_COMMANDS_OS390,
})
elif flavor == 'solaris':
header_params.update({
'flock': './gyp-flock-tool flock',
Expand Down
5 changes: 4 additions & 1 deletion gyp/pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -2250,7 +2250,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
master_ninja.rule(
'copy',
description='COPY $in $out',
command='rm -rf $out && cp -af $in $out')
if sys.platform in ('os390'):
command='rm -rf $out && cp -fRP $in $out')
else:
command='rm -rf $out && cp -af $in $out')
master_ninja.newline()

all_targets = set()
Expand Down
19 changes: 18 additions & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,23 @@ function configure (gyp, argv, callback) {
return callback(new Error(msg))
}
}
else if (process.platform === 'os390') {
var node_root_dir = findNodeDirectory()
var candidates = ['include/node/node.x',
'out/Release/node.x',
'out/Debug/node.x',
'node.x']
for (var next = 0; next < candidates.length; next++) {
node_exp_file = path.resolve(node_root_dir, candidates[next])
try {
fs.accessSync(node_exp_file, fs.R_OK)
// exp file found, stop looking
break
} catch (exception) {
// this candidate was not found or not readable, do nothing
}
}
}

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

0 comments on commit 3bccc94

Please sign in to comment.