aboutsummaryrefslogtreecommitdiff
path: root/checkbuild.py
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2018-10-04 15:30:09 -0700
committerDan Albert <danalbert@google.com>2018-10-04 16:01:53 -0700
commitfb47f8d06f7741b68e2f2443ec84b84ee0aa264a (patch)
treea33a2666f9042abe956b9024cd43dae4fbef3336 /checkbuild.py
parent1f7ecba9778c5476b06c7f4d78b53f9d7c1d8961 (diff)
downloadndk-fb47f8d06f7741b68e2f2443ec84b84ee0aa264a.tar.gz
Pass -gcc-toolchain in the GCC wrappers.
Test: arm-linux-androideabi-gcc -v foo.c is only as broken as r17's Bug: https://github.com/android-ndk/ndk/issues/805 Change-Id: Id4eab102b4ef2736d048f97dac5786ea197152e3
Diffstat (limited to 'checkbuild.py')
-rwxr-xr-xcheckbuild.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/checkbuild.py b/checkbuild.py
index 7c2818230..65cd1a81e 100755
--- a/checkbuild.py
+++ b/checkbuild.py
@@ -34,6 +34,7 @@ import inspect
import json
import logging
import multiprocessing
+import ntpath
import os
import pipes
import re
@@ -565,7 +566,15 @@ class Binutils(ndk.builds.Module):
self.install_sh_clang_shortcut(gcc, clang, triple)
def install_cmd_clang_shortcut(self, gcc, clang, triple):
- clang = clang.replace('/', '\\')
+ clang = ntpath.normpath(clang)
+
+ flags = [
+ '-target',
+ triple,
+ '-gcc-toolchain',
+ '%_BIN_DIR%..',
+ ]
+
with open(gcc, 'w') as gcc_script:
gcc_script.write(
textwrap.dedent("""\
@@ -573,7 +582,7 @@ class Binutils(ndk.builds.Module):
setlocal
call :find_bin
- set "_BIN_DIR=" && %_BIN_DIR%{clang} -target {triple} %*
+ set "_BIN_DIR=" && %_BIN_DIR%{clang} {flags} %*
if ERRORLEVEL 1 exit /b 1
goto :done
@@ -584,15 +593,22 @@ class Binutils(ndk.builds.Module):
exit /b
:done
- """.format(clang=clang, triple=triple)))
+ """.format(clang=clang, flags=' '.join(flags))))
def install_sh_clang_shortcut(self, gcc, clang, triple):
+ flags = [
+ '-target',
+ triple,
+ '-gcc-toolchain',
+ '`dirname $0`/..',
+ ]
+
with open(gcc, 'w') as gcc_script:
gcc_script.write(
textwrap.dedent("""\
#!/bin/bash
- exec `dirname $0`/{clang} -target {triple} "$@"
- """.format(clang=clang, triple=triple)))
+ exec `dirname $0`/{clang} {flags} "$@"
+ """.format(clang=clang, flags=' '.join(flags))))
mode = os.stat(gcc).st_mode
os.chmod(gcc, mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)