1diff --git a/build/tools/make_standalone_toolchain.py b/build/tools/make_standalone_toolchain.py
2index daba3351..424b7fef 100755
3--- a/build/tools/make_standalone_toolchain.py
4+++ b/build/tools/make_standalone_toolchain.py
5@@ -421,7 +421,9 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
6 platforms_path, stl, host_tag):
7 """Create a standalone toolchain."""
8 copy_directory_contents(gcc_path, install_path)
9+ os.system('chmod -R +w "{}"'.format(install_path))
10 copy_directory_contents(clang_path, install_path)
11+ os.system('chmod -R +w "{}"'.format(install_path))
12 triple = get_triple(arch)
13 make_clang_scripts(
14 install_path, triple, api, host_tag.startswith('windows'))
15@@ -432,9 +434,11 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
16 install_headers = os.path.join(install_sysroot, 'usr/include')
17 os.makedirs(os.path.dirname(install_headers))
18 shutil.copytree(headers, install_headers)
19+ os.system('chmod -R +w "{}"'.format(install_path))
20
21 arch_headers = os.path.join(sysroot, 'usr/include', triple)
22 copy_directory_contents(arch_headers, os.path.join(install_headers))
23+ os.system('chmod -R +w "{}"'.format(install_path))
24
25 for lib_suffix in ('', '64'):
26 lib_path = os.path.join(platforms_path, 'usr/lib{}'.format(lib_suffix))
27@@ -442,20 +446,24 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
28 install_sysroot, 'usr/lib{}'.format(lib_suffix))
29 if os.path.exists(lib_path):
30 shutil.copytree(lib_path, lib_install)
31+ os.system('chmod -R +w "{}"'.format(install_path))
32
33 static_lib_path = os.path.join(sysroot, 'usr/lib', triple)
34 static_lib_install = os.path.join(install_sysroot, 'usr/lib')
35 if arch == 'x86_64':
36 static_lib_install += '64'
37 copy_directory_contents(static_lib_path, static_lib_install)
38+ os.system('chmod -R +w "{}"'.format(install_path))
39
40 prebuilt_path = os.path.join(NDK_DIR, 'prebuilt', host_tag)
41 copy_directory_contents(prebuilt_path, install_path)
42+ os.system('chmod -R +w "{}"'.format(install_path))
43
44 gdbserver_path = os.path.join(
45 NDK_DIR, 'prebuilt', 'android-' + arch, 'gdbserver')
46 gdbserver_install = os.path.join(install_path, 'share', 'gdbserver')
47 shutil.copytree(gdbserver_path, gdbserver_install)
48+ os.system('chmod -R +w "{}"'.format(install_path))
49
50 toolchain_lib_dir = os.path.join(gcc_path, 'lib/gcc', triple)
51 dirs = os.listdir(toolchain_lib_dir)
52@@ -481,26 +489,33 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
53 for abi in get_abis(arch):
54 copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver, triple,
55 abi)
56+ os.system('chmod -R +w "{}"'.format(install_path))
57 copy_gnustl_libs(gnustl_dir, install_path, triple, abi)
58+ os.system('chmod -R +w "{}"'.format(install_path))
59 if arch == 'arm':
60 copy_gnustl_abi_headers(gnustl_dir, install_path, gcc_ver,
61 triple, abi, thumb=True)
62+ os.system('chmod -R +w "{}"'.format(install_path))
63 copy_gnustl_libs(gnustl_dir, install_path, triple, abi,
64 thumb=True)
65+ os.system('chmod -R +w "{}"'.format(install_path))
66 elif stl == 'libc++':
67 libcxx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++')
68 libcxxabi_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/llvm-libc++abi')
69 copy_directory_contents(os.path.join(libcxx_dir, 'include'),
70 cxx_headers)
71+ os.system('chmod -R +w "{}"'.format(install_path))
72 if api < 21:
73 support_dir = os.path.join(NDK_DIR, 'sources/android/support')
74 copy_directory_contents(os.path.join(support_dir, 'include'),
75 support_headers)
76+ os.system('chmod -R +w "{}"'.format(install_path))
77
78 # I have no idea why we need this, but the old one does it too.
79 copy_directory_contents(
80 os.path.join(libcxxabi_dir, 'include'),
81 os.path.join(install_path, 'include/llvm-libc++abi/include'))
82+ os.system('chmod -R +w "{}"'.format(install_path))
83
84 headers = [
85 'cxxabi.h',
86@@ -515,21 +530,25 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
87 src_libdir = get_src_libdir(libcxx_dir, abi)
88 dest_libdir = get_dest_libdir(install_path, triple, abi)
89 copy_libcxx_libs(src_libdir, dest_libdir, abi, api)
90+ os.system('chmod -R +w "{}"'.format(install_path))
91 if arch == 'arm':
92 thumb_libdir = os.path.join(dest_libdir, 'thumb')
93 copy_libcxx_libs(src_libdir, thumb_libdir, abi, api)
94+ os.system('chmod -R +w "{}"'.format(install_path))
95 elif stl == 'stlport':
96 stlport_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/stlport')
97 gabixx_dir = os.path.join(NDK_DIR, 'sources/cxx-stl/gabi++')
98
99 copy_directory_contents(
100 os.path.join(stlport_dir, 'stlport'), cxx_headers)
101+ os.system('chmod -R +w "{}"'.format(install_path))
102
103 # Same as for libc++. Not sure why we have this extra directory, but
104 # keep the cruft for diff.
105 copy_directory_contents(
106 os.path.join(gabixx_dir, 'include'),
107 os.path.join(install_path, 'include/gabi++/include'))
108+ os.system('chmod -R +w "{}"'.format(install_path))
109
110 headers = [
111 'cxxabi.h',
112@@ -548,6 +567,7 @@ def create_toolchain(install_path, arch, api, gcc_path, clang_path,
113 if arch == 'arm':
114 copy_stlport_libs(stlport_dir, install_path, triple, abi,
115 thumb=True)
116+ os.system('chmod -R +w "{}"'.format(install_path))
117 else:
118 raise ValueError(stl)
119