aboutsummaryrefslogtreecommitdiff
path: root/build/tools
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2018-11-27 14:59:03 -0800
committerDan Albert <danalbert@google.com>2018-11-27 14:59:03 -0800
commit716ba14de9aeac231783a9e7d405d76cdd2f75cc (patch)
treecef5cd3785f978dc752b864d76aeea64182b3bc7 /build/tools
parent158397ffb62fd8847191e629701ea62d34b957ff (diff)
downloadndk-716ba14de9aeac231783a9e7d405d76cdd2f75cc.tar.gz
Fix the make_standalone_toolchain stdlib fix.
Fix Windows... Test: Inspect Linux *and* Windows scripts Bug: https://github.com/android-ndk/ndk/issues/849 Change-Id: Ica2c11d147c0d254150196655be520448ecb90ee
Diffstat (limited to 'build/tools')
-rwxr-xr-xbuild/tools/make_standalone_toolchain.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py
index 29ea2b726..0849cdc88 100755
--- a/build/tools/make_standalone_toolchain.py
+++ b/build/tools/make_standalone_toolchain.py
@@ -130,6 +130,8 @@ def make_clang_scripts(install_dir, triple, api, windows):
if arch == 'i686' and api < 24:
flags += ' -mstackrealign'
+ cxx_flags = flags + ' -stdlib=libc++'
+
clang_path = os.path.join(install_dir, 'bin/clang')
with open(clang_path, 'w') as clang:
clang.write(textwrap.dedent("""\
@@ -150,12 +152,12 @@ def make_clang_scripts(install_dir, triple, api, windows):
clangpp.write(textwrap.dedent("""\
#!/bin/bash
if [ "$1" != "-cc1" ]; then
- `dirname $0`/clang{version}++ -stdlib=libc++ {flags} "$@"
+ `dirname $0`/clang{version}++ {flags} "$@"
else
# target/triple already spelled out.
`dirname $0`/clang{version}++ "$@"
fi
- """.format(version=version_number, flags=flags)))
+ """.format(version=version_number, flags=cxx_flags)))
mode = os.stat(clangpp_path).st_mode
os.chmod(clangpp_path, mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
@@ -167,6 +169,7 @@ def make_clang_scripts(install_dir, triple, api, windows):
if windows:
for pp_suffix in ('', '++'):
+ is_cpp = pp_suffix == '++'
exe_name = 'clang{}{}.exe'.format(version_number, pp_suffix)
clangbat_text = textwrap.dedent("""\
@echo off
@@ -191,7 +194,7 @@ def make_clang_scripts(install_dir, triple, api, windows):
exit /b
:done
- """.format(exe=exe_name, flags=flags))
+ """.format(exe=exe_name, flags=cxx_flags if is_cpp else flags))
for triple_prefix in ('', triple + '-'):
clangbat_path = os.path.join(