ninjabackend: Use the right ranlib for static linker rules

Fixes https://github.com/mesonbuild/meson/issues/12349
This commit is contained in:
Nirbheek Chauhan 2023-10-12 05:40:07 +05:30 committed by Dylan Baker
parent 4ae75eef16
commit 4ebe03713d
1 changed files with 6 additions and 1 deletions

View File

@ -2355,7 +2355,12 @@ class NinjaBackend(backends.Backend):
# ranlib, not to ar
cmdlist.extend(args)
args = []
cmdlist.extend(['&&', 'ranlib', '-c', '$out'])
# Ensure that we use the user-specified ranlib if any, and
# fallback to just picking up some ranlib otherwise
ranlib = self.environment.lookup_binary_entry(for_machine, 'ranlib')
if ranlib is None:
ranlib = ['ranlib']
cmdlist.extend(['&&'] + ranlib + ['-c', '$out'])
description = 'Linking static target $out'
if num_pools > 0:
pool = 'pool = link_pool'