Skip to content

Commit

Permalink
Fixup GCC wrappers in make_standalone_toolchain.py.
Browse files Browse the repository at this point in the history
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: android/ndk#803

Change-Id: Ib6b223e54dd237623b837ea72ef7978d1e9b7d2a
  • Loading branch information
DanAlbert committed Oct 4, 2018
1 parent 2e68b96 commit 7214adf
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build/tools/make_standalone_toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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')
Expand Down

0 comments on commit 7214adf

Please sign in to comment.