Skip to content

Commit 7c3883c

Browse files
khardixaduh95
authored andcommitted
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: #58213 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent b11b9cd commit 7c3883c

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tools/install.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,19 @@ def files(options, action):
181181
link_path = abspath(options.install_path, 'lib/libnode.so')
182182
try_symlink(options, so_name, link_path)
183183
else:
184-
output_lib = 'libnode.' + options.variables.get('shlib_suffix')
185-
action(options, [os.path.join(options.build_dir, output_lib)],
186-
os.path.join(options.variables.get('libdir'), output_lib))
184+
# Ninja and Makefile generators output the library in different directories;
185+
# find out which one we have, and install first found
186+
output_lib_name = 'libnode.' + options.variables.get('shlib_suffix')
187+
output_lib_candidate_paths = [
188+
os.path.join(options.build_dir, output_lib_name),
189+
os.path.join(options.build_dir, "lib", output_lib_name),
190+
]
191+
try:
192+
output_lib = next(filter(os.path.exists, output_lib_candidate_paths))
193+
except StopIteration as not_found:
194+
raise RuntimeError("No libnode.so to install!") from not_found
195+
action(options, [output_lib],
196+
os.path.join(options.variables.get('libdir'), output_lib_name))
187197

188198
action(options, [os.path.join(options.v8_dir, 'tools/gdbinit')], 'share/doc/node/')
189199
action(options, [os.path.join(options.v8_dir, 'tools/lldb_commands.py')], 'share/doc/node/')

0 commit comments

Comments
 (0)