build: search for libnode.so in multiple places

As the actual location of built libnode.so may differ depending on which
system was used to orchestrate the build (ninja or make),
multiple places should be searched for it's location.

PR-URL: https://github.com/nodejs/node/pull/58213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Jan Staněk 2025-05-22 14:16:25 +02:00 committed by GitHub
parent 5ffcf6bca1
commit cb88e99bfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -181,9 +181,19 @@ def files(options, action):
link_path = abspath(options.install_path, 'lib/libnode.so') link_path = abspath(options.install_path, 'lib/libnode.so')
try_symlink(options, so_name, link_path) try_symlink(options, so_name, link_path)
else: else:
output_lib = 'libnode.' + options.variables.get('shlib_suffix') # Ninja and Makefile generators output the library in different directories;
action(options, [os.path.join(options.build_dir, output_lib)], # find out which one we have, and install first found
os.path.join(options.variables.get('libdir'), output_lib)) output_lib_name = 'libnode.' + options.variables.get('shlib_suffix')
output_lib_candidate_paths = [
os.path.join(options.build_dir, output_lib_name),
os.path.join(options.build_dir, "lib", output_lib_name),
]
try:
output_lib = next(filter(os.path.exists, output_lib_candidate_paths))
except StopIteration as not_found:
raise RuntimeError("No libnode.so to install!") from not_found
action(options, [output_lib],
os.path.join(options.variables.get('libdir'), output_lib_name))
action(options, [os.path.join(options.v8_dir, 'tools/gdbinit')], 'share/doc/node/') action(options, [os.path.join(options.v8_dir, 'tools/gdbinit')], 'share/doc/node/')
action(options, [os.path.join(options.v8_dir, 'tools/lldb_commands.py')], 'share/doc/node/') action(options, [os.path.join(options.v8_dir, 'tools/lldb_commands.py')], 'share/doc/node/')