summaryrefslogtreecommitdiff
path: root/tools/install.py
diff options
context:
space:
mode:
authoralexcfyung <alexcfyung@hotmail.com>2022-03-08 13:20:20 -0500
committerMichael Dawson <mdawson@devrus.com>2022-07-20 20:51:29 -0400
commited7b6764c285c88d701958f96ccded76f02aedc0 (patch)
treea3e43c6a92ae977a281e5bf8e0bb37fd4a85292d /tools/install.py
parentc45c7784733bcb8f4b378060f99b00b7d352b20d (diff)
downloadnode-new-ed7b6764c285c88d701958f96ccded76f02aedc0.tar.gz
tools: support versioned node shared libs on z/OS
The shared libraries will now be stores in lib.target as opposed to obj.target, libnode.version.so, libnode.x (for npm backwards compat and testing), and libnode.version.x (for builds). The install will also include libnode.so link that points to libnode.version.so (this will be used by native npms for backwards compat). PR-URL: https://github.com/nodejs/node/pull/42256 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Co-authored-by: Gaby Baghdadi <baghdadi@ca.ibm.com> Co-authored-by: Wayne Zhang <shuowang.zhang@ibm.com>
Diffstat (limited to 'tools/install.py')
-rwxr-xr-xtools/install.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/install.py b/tools/install.py
index bf8f5673fa..ebf4b8afbf 100755
--- a/tools/install.py
+++ b/tools/install.py
@@ -7,6 +7,7 @@ import errno
import os
import shutil
import sys
+import re
# set at init time
node_prefix = '/usr/local' # PREFIX variable from Makefile
@@ -120,6 +121,17 @@ def corepack_files(action):
# 'pnpx': 'dist/pnpx.js',
})
+ # On z/OS, we install node-gyp for convenience, as some vendors don't have
+ # external access and may want to build native addons.
+ if sys.platform == 'zos':
+ link_path = abspath(install_path, 'bin/node-gyp')
+ if action == uninstall:
+ action([link_path], 'bin/node-gyp')
+ elif action == install:
+ try_symlink('../lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js', link_path)
+ else:
+ assert 0 # unhandled action type
+
def subdir_files(path, dest, action):
ret = {}
for dirpath, dirnames, filenames in os.walk(path):
@@ -141,6 +153,27 @@ def files(action):
if is_windows:
action([output_prefix + 'libnode.dll'], 'bin/libnode.dll')
action([output_prefix + 'libnode.lib'], 'lib/libnode.lib')
+ elif sys.platform == 'zos':
+ # GYP will output to lib.target; see _InstallableTargetInstallPath
+ # function in tools/gyp/pylib/gyp/generator/make.py
+ output_prefix += 'lib.target/'
+
+ output_lib = 'libnode.' + variables.get('shlib_suffix')
+ action([output_prefix + output_lib], 'lib/' + output_lib)
+
+ # create libnode.x that references libnode.so (C++ addons compat)
+ os.system(os.path.dirname(os.path.realpath(__file__)) +
+ '/zos/modifysidedeck.sh ' +
+ abspath(install_path, 'lib/' + output_lib) + ' ' +
+ abspath(install_path, 'lib/libnode.x') + ' libnode.so')
+
+ # install libnode.version.so
+ so_name = 'libnode.' + re.sub(r'\.x$', '.so', variables.get('shlib_suffix'))
+ action([output_prefix + so_name], 'lib/' + so_name)
+
+ # create symlink of libnode.so -> libnode.version.so (C++ addons compat)
+ link_path = abspath(install_path, 'lib/libnode.so')
+ try_symlink(so_name, link_path)
else:
output_lib = 'libnode.' + variables.get('shlib_suffix')
action([output_prefix + output_lib], 'lib/' + output_lib)