Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: enable support for zoslib on z/OS #2600

Merged
merged 1 commit into from Jul 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions lib/configure.js
Expand Up @@ -213,6 +213,44 @@ function configure (gyp, argv, callback) {
}
}

// For z/OS we need to set up the path to zoslib include directory,
// which contains headers included in v8config.h.
var zoslibIncDir
if (process.platform === 'os390') {
logprefix = "find zoslib's zos-base.h:"
let msg
var zoslibIncPath = process.env.ZOSLIB_INCLUDES
if (zoslibIncPath) {
zoslibIncPath = findAccessibleSync(logprefix, zoslibIncPath, ['zos-base.h'])
if (zoslibIncPath === undefined) {
msg = msgFormat('Could not find zos-base.h file in the directory set ' +
'in ZOSLIB_INCLUDES environment variable: %s; set it ' +
'to the correct path, or unset it to search %s', process.env.ZOSLIB_INCLUDES, nodeRootDir)
}
} else {
candidates = [
'include/node/zoslib/zos-base.h',
'include/zoslib/zos-base.h',
'zoslib/include/zos-base.h',
'install/include/node/zoslib/zos-base.h'
]
zoslibIncPath = findAccessibleSync(logprefix, nodeRootDir, candidates)
if (zoslibIncPath === undefined) {
msg = msgFormat('Could not find any of %s in directory %s; set ' +
'environmant variable ZOSLIB_INCLUDES to the path ' +
'that contains zos-base.h', candidates.toString(), nodeRootDir)
}
}
if (zoslibIncPath !== undefined) {
zoslibIncDir = path.dirname(zoslibIncPath)
log.verbose(logprefix, "Found zoslib's zos-base.h in: %s", zoslibIncDir)
} else if (release.version.split('.')[0] >= 16) {
// zoslib is only shipped in Node v16 and above.
log.error(logprefix, msg)
return callback(new Error(msg))
}
}

// this logic ported from the old `gyp_addon` python file
var gypScript = path.resolve(__dirname, '..', 'gyp', 'gyp_main.py')
var addonGypi = path.resolve(__dirname, '..', 'addon.gypi')
Expand Down Expand Up @@ -240,6 +278,9 @@ function configure (gyp, argv, callback) {
argv.push('-Dnode_root_dir=' + nodeDir)
if (process.platform === 'aix' || process.platform === 'os390') {
argv.push('-Dnode_exp_file=' + nodeExpFile)
if (process.platform === 'os390' && zoslibIncDir) {
argv.push('-Dzoslib_include_dir=' + zoslibIncDir)
}
}
argv.push('-Dnode_gyp_dir=' + nodeGypDir)

Expand Down