summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-10-12 05:40:07 +0530
committerDylan Baker <dylan@pnwbakers.com>2023-10-12 09:31:04 -0700
commit4ebe03713dd5bd240efe0198907f4662bb730c8c (patch)
tree56ae6dc6e4cf524b5a1f0248997e42f35c08a29d
parent4ae75eef16ce821e8d551fd8f0eb70ab6e194553 (diff)
downloadmeson-4ebe03713dd5bd240efe0198907f4662bb730c8c.tar.gz
ninjabackend: Use the right ranlib for static linker rules
Fixes https://github.com/mesonbuild/meson/issues/12349
-rw-r--r--mesonbuild/backend/ninjabackend.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 3477b0a14..b0fec89b3 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -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'