build: add --libdir flag to configure

This will allow distribution packages to select an alternative
location for the unofficial libnode.so. For example, on Fedora it
will install into /usr/lib64 on 64-bit systems.

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/44361
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Stephen Gallagher 2022-08-28 04:12:42 -04:00 committed by GitHub
parent 3a6003aea8
commit 8a1aa55598
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -706,6 +706,14 @@ parser.add_argument('--shared',
help='compile shared library for embedding node in another project. ' + help='compile shared library for embedding node in another project. ' +
'(This mode is not officially supported for regular applications)') '(This mode is not officially supported for regular applications)')
parser.add_argument('--libdir',
action='store',
dest='libdir',
default='lib',
help='a directory to install the shared library into relative to the '
'prefix. This is a no-op if --shared is not specified. ' +
'(This mode is not officially supported for regular applications)')
parser.add_argument('--without-v8-platform', parser.add_argument('--without-v8-platform',
action='store_true', action='store_true',
dest='without_v8_platform', dest='without_v8_platform',
@ -1323,6 +1331,7 @@ def configure_node(o):
o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
o['variables']['node_shared'] = b(options.shared) o['variables']['node_shared'] = b(options.shared)
o['variables']['libdir'] = options.libdir
node_module_version = getmoduleversion.get_version() node_module_version = getmoduleversion.get_version()
if options.dest_os == 'android': if options.dest_os == 'android':

View File

@ -169,14 +169,14 @@ def files(action):
# install libnode.version.so # install libnode.version.so
so_name = 'libnode.' + re.sub(r'\.x$', '.so', variables.get('shlib_suffix')) so_name = 'libnode.' + re.sub(r'\.x$', '.so', variables.get('shlib_suffix'))
action([output_prefix + so_name], 'lib/' + so_name) action([output_prefix + so_name], variables.get('libdir') + '/' + so_name)
# create symlink of libnode.so -> libnode.version.so (C++ addons compat) # create symlink of libnode.so -> libnode.version.so (C++ addons compat)
link_path = abspath(install_path, 'lib/libnode.so') link_path = abspath(install_path, 'lib/libnode.so')
try_symlink(so_name, link_path) try_symlink(so_name, link_path)
else: else:
output_lib = 'libnode.' + variables.get('shlib_suffix') output_lib = 'libnode.' + variables.get('shlib_suffix')
action([output_prefix + output_lib], 'lib/' + output_lib) action([output_prefix + output_lib], variables.get('libdir') + '/' + output_lib)
action(['deps/v8/tools/gdbinit'], 'share/doc/node/') action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/') action(['deps/v8/tools/lldb_commands.py'], 'share/doc/node/')