mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
zos: support platform
Initial work to add z/OS support to node-gyp. PR-URL: https://github.com/nodejs/node-gyp/pull/1276 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
90d86512f4
commit
b2024dee7b
6 changed files with 69 additions and 12 deletions
11
addon.gypi
11
addon.gypi
|
@ -89,6 +89,17 @@
|
|||
'-Wl,-bimport:<(node_exp_file)'
|
||||
],
|
||||
}],
|
||||
[ 'OS=="zos"', {
|
||||
'cflags': [
|
||||
'-q64',
|
||||
'-Wc,DLL',
|
||||
'-qlonglong'
|
||||
],
|
||||
'ldflags': [
|
||||
'-q64',
|
||||
'<(node_exp_file)'
|
||||
],
|
||||
}],
|
||||
[ 'OS=="win"', {
|
||||
'conditions': [
|
||||
['node_engine=="chakracore"', {
|
||||
|
|
|
@ -429,6 +429,10 @@ def GetFlavor(params):
|
|||
return 'netbsd'
|
||||
if sys.platform.startswith('aix'):
|
||||
return 'aix'
|
||||
if sys.platform.startswith('zos'):
|
||||
return 'zos'
|
||||
if sys.platform.startswith('os390'):
|
||||
return 'zos'
|
||||
|
||||
return 'linux'
|
||||
|
||||
|
|
|
@ -227,6 +227,25 @@ cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSE
|
|||
"""
|
||||
|
||||
|
||||
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) $(LIBS)
|
||||
|
||||
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 = ("""\
|
||||
|
@ -310,7 +329,7 @@ dirx = $(call unreplace_spaces,$(dir $(call replace_spaces,$1)))
|
|||
# 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.
|
||||
|
@ -2013,6 +2032,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
|||
|
||||
flock_command= 'flock'
|
||||
copy_archive_arguments = '-af'
|
||||
makedep_arguments = '-MMD'
|
||||
header_params = {
|
||||
'default_target': default_target,
|
||||
'builddir': builddir_name,
|
||||
|
@ -2023,6 +2043,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
|||
'extra_commands': '',
|
||||
'srcdir': srcdir,
|
||||
'copy_archive_args': copy_archive_arguments,
|
||||
'makedep_args': makedep_arguments,
|
||||
}
|
||||
if flavor == 'mac':
|
||||
flock_command = './gyp-mac-tool flock'
|
||||
|
@ -2036,6 +2057,14 @@ def GenerateOutput(target_list, target_dicts, data, params):
|
|||
header_params.update({
|
||||
'link_commands': LINK_COMMANDS_ANDROID,
|
||||
})
|
||||
elif flavor == 'zos':
|
||||
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',
|
||||
|
|
|
@ -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 == 'zos':
|
||||
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',
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
@ -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)
|
||||
|
|
3
test/fixtures/test-charmap.py
vendored
3
test/fixtures/test-charmap.py
vendored
|
@ -5,6 +5,9 @@ reload(sys)
|
|||
|
||||
def main():
|
||||
encoding = locale.getdefaultlocale()[1]
|
||||
if not encoding:
|
||||
return False
|
||||
|
||||
sys.setdefaultencoding(encoding)
|
||||
textmap = {
|
||||
'cp936': u'\u4e2d\u6587',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue