From 7214adf2dcad30d17d38c33352d930607b8a9851 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 4 Oct 2018 15:08:18 -0700 Subject: [PATCH] Fixup GCC wrappers in make_standalone_toolchain.py. Test: make_standalone_toolchain.py --arch arm --install-dir foo && \ cat foo/bin/arm-linux-androideabi-gcc && foo/bin/arm-linux-androideabi-gcc -c foo.c Bug: https://github.com/android-ndk/ndk/issues/803 Change-Id: Ib6b223e54dd237623b837ea72ef7978d1e9b7d2a --- build/tools/make_standalone_toolchain.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py index 0d19f84f..b8172b28 100755 --- a/build/tools/make_standalone_toolchain.py +++ b/build/tools/make_standalone_toolchain.py @@ -337,6 +337,18 @@ def copy_libcxx_libs(src_dir, dst_dir, abi, api): os.path.join(dst_dir, 'libstdc++.so')) +def replace_gcc_wrappers(install_path, triple, is_windows): + cmd = '.cmd' if is_windows else '' + + gcc = os.path.join(install_path, 'bin', triple + '-gcc' + cmd) + clang = os.path.join(install_path, 'bin', 'clang' + cmd) + shutil.copy2(clang, gcc) + + gpp = os.path.join(install_path, 'bin', triple + '-g++' + cmd) + clangpp = os.path.join(install_path, 'bin', 'clang++' + cmd) + shutil.copy2(clangpp, gpp) + + def create_toolchain(install_path, arch, api, gcc_path, clang_path, platforms_path, host_tag): """Create a standalone toolchain.""" @@ -345,6 +357,7 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path, triple = get_triple(arch) make_clang_scripts( install_path, triple, api, host_tag.startswith('windows')) + replace_gcc_wrappers(install_path, triple, host_tag.startswith('windows')) sysroot = os.path.join(NDK_DIR, 'sysroot') headers = os.path.join(sysroot, 'usr/include')