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 Sep 5, 2017
1 parent 7245415 commit a273968
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 12 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
15 changes: 11 additions & 4 deletions gyp/pylib/gyp/generator/ninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -2238,15 +2238,22 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
'stamp',
description='STAMP $out',
command='%s gyp-win-tool stamp $out' % sys.executable)
master_ninja.rule(
'copy',
description='COPY $in $out',
command='%s gyp-win-tool recursive-mirror $in $out' % sys.executable)
else:
master_ninja.rule(
'stamp',
description='STAMP $out',
command='${postbuilds}touch $out')
if flavor == 'win':
master_ninja.rule(
'copy',
description='COPY $in $out',
command='%s gyp-win-tool recursive-mirror $in $out' % sys.executable)
elif flavor == 'os390':
master_ninja.rule(
'copy',
description='COPY $in $out',
command='rm -rf $out && cp -fRP $in $out')
else:
master_ninja.rule(
'copy',
description='COPY $in $out',
Expand Down
17 changes: 10 additions & 7 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,21 @@ function configure (gyp, argv, callback) {
// - the out/Debug directory
// - the root directory
var node_exp_file = undefined
if (process.platform === 'aix') {
if (process.platform === 'aix' || process.platform === 'os390') {
var ext = process.platform === 'aix' ? 'exp' : 'x'
var node_root_dir = findNodeDirectory()
var candidates = ['include/node/node.exp',
'out/Release/node.exp',
'out/Debug/node.exp',
'node.exp']
var candidates = ['include/node/node',
'out/Release/node',
'out/Debug/node',
'node'].map(function(file) {
return '' + file + '.' + ext
})
var logprefix = 'find exports file'
node_exp_file = findAccessibleSync(logprefix, node_root_dir, candidates)
if (node_exp_file !== undefined) {
log.verbose(logprefix, 'Found exports file: %s', node_exp_file)
} else {
var msg = msgFormat('Could not find node.exp file in %s', node_root_dir)
var msg = msgFormat('Could not find node.%s file in %s', ext, node_root_dir)
log.error(logprefix, 'Could not find exports file')
return callback(new Error(msg))
}
Expand Down Expand Up @@ -294,7 +297,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
3 changes: 3 additions & 0 deletions test/fixtures/test-charmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

def main():
encoding = locale.getdefaultlocale()[1]
if not encoding:
return False

sys.setdefaultencoding(encoding)
textmap = {
'cp936': u'\u4e2d\u6587',
Expand Down

0 comments on commit a273968

Please sign in to comment.