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 authored and Michaël Zasso committed 2025-05-31 13:23:27 +02:00
1 parent 89fdfdedc1
commit 22e97362f3
1 file changed
+13 -3
+13 -3
View File
@@ -181,9 +181,19 @@ def files(options, action):
link_path = abspath(options.install_path, 'lib/libnode.so')
try_symlink(options, so_name, link_path)
else:
output_lib = 'libnode.' + options.variables.get('shlib_suffix')
action(options, [os.path.join(options.build_dir, output_lib)],
os.path.join(options.variables.get('libdir'), output_lib))
# Ninja and Makefile generators output the library in different directories;
# find out which one we have, and install first found
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/lldb_commands.py')], 'share/doc/node/')