Skip to content

Commit 934a49d

Browse files
committed
env2mfile: Extend available binary tools for android
1 parent 3f19331 commit 934a49d

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

mesonbuild/scripts/env2mfile.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,14 +495,21 @@ def process_ndk(self, ndk: pathlib.Path) -> None:
495495
bindir = toolchain_root / 'bin'
496496
if not bindir.is_dir():
497497
sys.exit(f'Could not detect toolchain in {toolchain_root}.')
498-
ar_path = bindir / f'llvm-ar{self.exe_suffix}'
499-
if not ar_path.is_file():
500-
sys.exit(f'Could not detect llvm-ar in {toolchain_root}.')
501-
ar_str = str(ar_path).replace('\\', '/')
502-
strip_path = bindir / f'llvm-strip{self.exe_suffix}'
503-
if not strip_path.is_file():
504-
sys.exit(f'Could not detect llvm-strip n {toolchain_root}.')
505-
strip_str = str(strip_path).replace('\\', '/')
498+
499+
bin_tools = {
500+
'ar': 'llvm-ar',
501+
'as': 'llvm-as',
502+
'ranlib': 'llvm-ranlib',
503+
'ld': 'ld',
504+
'strip': 'llvm-strip',
505+
}
506+
bin_mappings = {}
507+
for name, tool in bin_tools.items():
508+
path = bindir / f'{tool}{self.exe_suffix}'
509+
if not path.is_file():
510+
sys.exit(f'Could not detect {tool} in {toolchain_root}.')
511+
bin_mappings[name] = str(path).replace('\\', '/')
512+
506513
for compiler in bindir.glob('*-clang++'):
507514
parts = compiler.parts[-1].split('-')
508515
assert len(parts) == 4
@@ -518,8 +525,8 @@ def process_ndk(self, ndk: pathlib.Path) -> None:
518525
ofile.write('[binaries]\n')
519526
ofile.write(f"c = '{c_compiler_str}'\n")
520527
ofile.write(f"cpp = '{cpp_compiler_str}'\n")
521-
ofile.write(f"ar = '{ar_str}'\n")
522-
ofile.write(f"strip = '{strip_str}'\n")
528+
for name, path in bin_mappings.items():
529+
ofile.write(f"{name} = '{path}'\n")
523530

524531
ofile.write('\n[host_machine]\n')
525532
ofile.write("system = 'android'\n")

0 commit comments

Comments
 (0)