def host_gcc_toolchain_flags(host: hosts.Host, is_32_bit=False): cflags: List[str] = [debug_prefix_flag()] ldflags: List[str] = [] if host.is_darwin: return cflags, ldflags # GCC toolchain flags for Linux and Windows if host.is_linux: gccRoot = utils.android_path('prebuilts/gcc', hosts.build_host().os_tag, 'host/x86_64-linux-glibc2.17-4.8') gccTriple = 'x86_64-linux' gccVersion = '4.8.3' elif host.is_windows: gccRoot = utils.android_path('prebuilts/gcc', hosts.build_host().os_tag, 'host/x86_64-w64-mingw32-4.8') gccTriple = 'x86_64-w64-mingw32' gccVersion = '4.8.3' cflags.append(f'-B{gccRoot}/{gccTriple}/bin') gccLibDir = f'{gccRoot}/lib/gcc/{gccTriple}/{gccVersion}' gccBuiltinDir = f'{gccRoot}/{gccTriple}/lib64' if is_32_bit: gccLibDir += '/32' gccBuiltinDir = gccBuiltinDir.replace('lib64', 'lib32') ldflags.extend(('-B' + gccLibDir, '-L' + gccLibDir, '-B' + gccBuiltinDir, '-L' + gccBuiltinDir, '-fuse-ld=lld', )) return cflags, ldflags
def setup_sources(source_dir, build_llvm_next): """Setup toolchain sources into source_dir. Copy toolchain/llvm-project into source_dir. Apply patches per the specification in toolchain/llvm_android/patches/PATCHES.json. The function overwrites source_dir only if necessary to avoid recompiles during incremental builds. """ copy_from = utils.android_path('toolchain', 'llvm-project') # Copy llvm source tree to a temporary directory. tmp_source_dir = source_dir.rstrip('/') + '.tmp' if os.path.exists(tmp_source_dir): utils.rm_tree(tmp_source_dir) # mkdir parent of tmp_source_dir if necessary - so we can call 'cp' below. tmp_source_parent = os.path.dirname(tmp_source_dir) if not os.path.exists(tmp_source_parent): os.makedirs(tmp_source_parent) # Use 'cp' instead of shutil.copytree. The latter uses copystat and retains # timestamps from the source. We instead use rsync below to only update # changed files into source_dir. Using 'cp' will ensure all changed files # get a newer timestamp than files in $source_dir. # Note: Darwin builds don't copy symlinks with -r. Use -R instead. subprocess.check_call(['cp', '-Rf', copy_from, tmp_source_dir]) # patch source tree patch_dir = utils.android_path('toolchain', 'llvm_android', 'patches') patch_json = os.path.join(patch_dir, 'PATCHES.json') svn_version = android_version.get_svn_revision(build_llvm_next) # strip the leading 'r' and letter suffix, e.g., r377782b => 377782 svn_version = svn_version[1:].rstrip(string.ascii_lowercase) apply_patches(tmp_source_dir, svn_version, patch_json, patch_dir) # Copy tmp_source_dir to source_dir if they are different. This avoids # invalidating prior build outputs. if not os.path.exists(source_dir): os.rename(tmp_source_dir, source_dir) else: # Without a trailing '/' in $SRC, rsync copies $SRC to # $DST/BASENAME($SRC) instead of $DST. tmp_source_dir = tmp_source_dir.rstrip('/') + '/' # rsync to update only changed files. Use '-c' to use checksums to find # if files have changed instead of only modification time and size - # which could have inconsistencies. Use '--delete' to ensure files not # in tmp_source_dir are deleted from $source_dir. subprocess.check_call([ 'rsync', '-r', '--delete', '--links', '-c', tmp_source_dir, source_dir ]) utils.rm_tree(tmp_source_dir)
def install_license_files(install_dir): projects = ( 'llvm', 'compiler-rt', 'libcxx', 'libcxxabi', 'openmp', 'clang', 'clang-tools-extra', 'lld', ) # Get generic MODULE_LICENSE_* files from our android subdirectory. llvm_android_path = utils.android_path('toolchain', 'llvm_android') license_pattern = os.path.join(llvm_android_path, 'MODULE_LICENSE_*') for license_file in glob.glob(license_pattern): install_file(license_file, install_dir) # Fetch all the LICENSE.* files under our projects and append them into a # single NOTICE file for the resulting prebuilts. notices = [] for project in projects: license_pattern = utils.llvm_path(project, 'LICENSE.*') for license_file in glob.glob(license_pattern): with open(license_file) as notice_file: notices.append(notice_file.read()) with open(os.path.join(install_dir, 'NOTICE'), 'w') as notice_file: notice_file.write('\n'.join(notices))
def trim_patches_json(): """Invoke patch_manager.py with failure_mode=remove_patches """ source_dir = utils.android_path('toolchain', 'llvm-project') output = source_manager.apply_patches(source_dir, _SVN_REVISION, _PATCH_JSON, _PATCH_DIR, 'remove_patches') return get_removed_patches(output)
def install_wrappers(llvm_install_path): wrapper_path = utils.out_path('llvm_android_wrapper') wrapper_build_script = utils.android_path('external', 'toolchain-utils', 'compiler_wrapper', 'build.py') # Note: The build script automatically determines the architecture # based on the host. go_env = dict(os.environ) go_env['PATH'] = go_bin_dir() + ':' + go_env['PATH'] utils.check_call([sys.executable, wrapper_build_script, '--config=android', '--use_ccache=false', '--use_llvm_next=' + str(BUILD_LLVM_NEXT).lower(), '--output_file=' + wrapper_path], env=go_env) bisect_path = utils.android_path('toolchain', 'llvm_android', 'bisect_driver.py') bin_path = os.path.join(llvm_install_path, 'bin') clang_path = os.path.join(bin_path, 'clang') clangxx_path = os.path.join(bin_path, 'clang++') clang_tidy_path = os.path.join(bin_path, 'clang-tidy') # Rename clang and clang++ to clang.real and clang++.real. # clang and clang-tidy may already be moved by this script if we use a # prebuilt clang. So we only move them if clang.real and clang-tidy.real # doesn't exist. if not os.path.exists(clang_path + '.real'): shutil.move(clang_path, clang_path + '.real') if not os.path.exists(clang_tidy_path + '.real'): shutil.move(clang_tidy_path, clang_tidy_path + '.real') utils.remove(clang_path) utils.remove(clangxx_path) utils.remove(clang_tidy_path) utils.remove(clangxx_path + '.real') os.symlink('clang.real', clangxx_path + '.real') shutil.copy2(wrapper_path, clang_path) shutil.copy2(wrapper_path, clangxx_path) shutil.copy2(wrapper_path, clang_tidy_path) install_file(bisect_path, bin_path)
def install_winpthreads(bin_dir, lib_dir): """Installs the winpthreads runtime to the Windows bin and lib directory.""" lib_name = 'libwinpthread-1.dll' mingw_dir = utils.android_path( 'prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8', 'x86_64-w64-mingw32') lib_path = os.path.join(mingw_dir, 'bin', lib_name) lib_install = os.path.join(lib_dir, lib_name) install_file(lib_path, lib_install) bin_install = os.path.join(bin_dir, lib_name) install_file(lib_path, bin_install)
def libcxx_header_dirs(ndk_cxx): if ndk_cxx: return [ ndk_libcxx_headers(), ndk_libcxxabi_headers(), support_headers() ] else: # <prebuilts>/include/c++/v1 includes the cxxabi headers return [ clang_prebuilt_libcxx_headers(), utils.android_path('bionic', 'libc', 'include') ]
def main(): args = ArgParser().parse_args() bug_id = args.bug use_cbr = args.use_current_branch version = args.version hosts = ['darwin-x86', 'linux-x86'] for host in hosts: prebuilt_dir = utils.android_path('prebuilts/clang/host', host) update_binutils_symlink(host, prebuilt_dir, version) do_commit(prebuilt_dir, use_cbr, version, bug_id) return 0
def apply_patches(source_dir, svn_version, patch_json, patch_dir): """Apply patches in $patch_dir/$patch_json to $source_dir. Invokes external/toolchain-utils/llvm_tools/patch_manager.py to apply the patches. """ patch_manager_cmd = [ sys.executable, utils.android_path('external', 'toolchain-utils', 'llvm_tools', 'patch_manager.py'), '--svn_version', svn_version, '--patch_metadata_file', patch_json, '--filesdir_path', patch_dir, '--src_path', source_dir, '--use_src_head', '--failure_mode', 'fail' ] subprocess.check_call(patch_manager_cmd)
def main(): args = ArgParser().parse_args() logging.basicConfig(level=logging.INFO) do_fetch = not args.skip_fetch do_cleanup = not args.skip_cleanup download_dir = os.path.realpath('.download') if do_fetch: if os.path.isdir(download_dir): shutil.rmtree(download_dir) os.makedirs(download_dir) os.chdir(download_dir) targets = ['darwin_mac', 'linux', 'windows_x86_64'] hosts = ['darwin-x86', 'linux-x86', 'windows-x86'] clang_pattern = 'clang-*.tar.bz2' manifest = f'manifest_{args.build}.xml' branch = args.branch if branch is None: git_dir = utils.android_path('toolchain', 'llvm_android', '.git') o = utils.check_output(['git', '--git-dir=' + git_dir, 'branch', '-av']) branch = o.split(' ')[-1].strip().replace('/', '-') # aosp/llvm-toolchain uses the branch 'aosp-master', but we really only # pull prebuilts from 'aosp-llvm-toolchain' or other release branches. if branch == 'aosp-master': branch = 'aosp-llvm-toolchain' logger().info('Using branch: %s', branch) try: if do_fetch: fetch_artifact(branch, targets[0], args.build, manifest) for target in targets: fetch_artifact(branch, target, args.build, clang_pattern) for host in hosts: update_clang(host, args.build, args.use_current_branch, download_dir, args.bug, manifest, args.overwrite, not args.no_sanity_check) finally: if do_cleanup: shutil.rmtree(download_dir) return 0
def update_lldb(target, build_number, use_current_branch, download_dir, bug): prebuilt_dir = utils.android_path('prebuilts/clang/host', target[1] + '-x86') os.chdir(prebuilt_dir) install_subdir = os.path.join(prebuilt_dir, 'lldb') if not use_current_branch: branch_name = 'update-lldb-{}'.format(build_number) unchecked_call(['repo', 'abandon', branch_name, '.']) check_call(['repo', 'start', branch_name, '.']) package = os.path.join(download_dir, get_lldb_package(target, build_number)) if os.path.isdir(install_subdir): shutil.rmtree(install_subdir) os.makedirs(install_subdir) extract_package(package, install_subdir) android_package = os.path.join(download_dir, get_android_package(build_number)) android_dir = os.path.join(install_subdir, "android") os.makedirs(android_dir) extract_package(android_package, android_dir) manifest = os.path.join(download_dir, get_manifest(build_number)) shutil.copy(manifest, install_subdir) check_call(['git', 'add', install_subdir]) # If there is no difference with the new files, we are already done. diff = unchecked_call(['git', 'diff', '--cached', '--quiet']) if diff == 0: logger().info('Bypassed commit with no diff') return message_lines = [ 'Update prebuilt LLDB to build {}.'.format(build_number), ] if bug is not None: message_lines.append('') message_lines.append('Bug: http://b/{}'.format(bug)) message_lines.append('Test: N/A') message = '\n'.join(message_lines) check_call(['git', 'commit', '-m', message])
def clang_prebuilt_bin_dir(): return utils.android_path(clang_prebuilt_base_dir(), 'bin')
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import os import string import subprocess import android_version import hosts import utils import source_manager _LLVM_ANDROID_PATH = utils.android_path('toolchain', 'llvm_android') _PATCH_DIR = os.path.join(_LLVM_ANDROID_PATH, 'patches') _PATCH_JSON = os.path.join(_PATCH_DIR, 'PATCHES.json') # strip the leading 'r' and letter suffix, e.g., r377782b => 377782 _SVN_REVISION = (android_version.get_svn_revision()[1:].rstrip( string.ascii_lowercase)) def get_removed_patches(output): """Parse the list of removed patches from patch_manager.py's output. """ marker = 'removed from the patch metadata file:\n' marker_start = output.find(marker) if marker_start == -1: return None
def clang_prebuilt_libcxx_headers(): return utils.android_path(clang_prebuilt_base_dir(), 'include', 'c++', 'v1')
def ndk_base(): ndk_version = 'r20' return utils.android_path('toolchain/prebuilts/ndk', ndk_version)
def update_clang(host, build_number, use_current_branch, download_dir, bug, manifest, overwrite, do_sanity_check): prebuilt_dir = utils.android_path('prebuilts/clang/host', host) os.chdir(prebuilt_dir) if not use_current_branch: branch_name = f'update-clang-{build_number}' utils.unchecked_call( ['repo', 'abandon', branch_name, '.']) utils.check_call( ['repo', 'start', branch_name, '.']) package = f'{download_dir}/clang-{build_number}-{host}.tar.bz2' # Handle legacy versions of packages (like those from aosp/llvm-r365631). if not os.path.exists(package) and host == 'windows-x86': package = f'{download_dir}/clang-{build_number}-windows-x86-64.tar.bz2' manifest_file = f'{download_dir}/{manifest}' extract_package(package, prebuilt_dir) extract_subdir = 'clang-' + build_number clang_version, svn_revision = extract_clang_info(extract_subdir) # Install into clang-<svn_revision>. Suffixes ('a', 'b', 'c' etc.), if any, # are included in the svn_revision. install_subdir = 'clang-' + svn_revision if os.path.exists(install_subdir): if overwrite: logger().info('Removing/overwriting existing path: %s', install_subdir) shutil.rmtree(install_subdir) else: logger().info('Cannot remove/overwrite existing path: %s', install_subdir) sys.exit(1) os.rename(extract_subdir, install_subdir) # Some platform tests (e.g. system/bt/profile/sdp) build directly with # coverage instrumentation and rely on the driver to pick the correct # profile runtime. Symlink the Linux resource dir from the Linux toolchain # into the Darwin toolchain so the runtime is found by the Darwin Clang # driver. if host == 'darwin-x86': symlink_to_linux_resource_dir(install_subdir) if do_sanity_check: if not sanity_check(host, install_subdir, clang_version.split('.')[0]): sys.exit(1) shutil.copy(manifest_file, prebuilt_dir + '/' + install_subdir) utils.check_call(['git', 'add', install_subdir]) # If there is no difference with the new files, we are already done. diff = utils.unchecked_call(['git', 'diff', '--cached', '--quiet']) if diff == 0: logger().info('Bypassed commit with no diff') return message_lines = [ f'Update prebuilt Clang to {svn_revision}.', '', f'clang {clang_version} (based on {svn_revision}) from build {build_number}.' ] if bug is not None: message_lines.append('') message_lines.append(f'Bug: {format_bug(bug)}') message_lines.append('Test: N/A') message = '\n'.join(message_lines) utils.check_call(['git', 'commit', '-m', message])
def package_toolchain(build_dir, build_name, host: hosts.Host, dist_dir, strip=True, create_tar=True): package_name = 'clang-' + build_name version = extract_clang_version(build_dir) install_dir = get_package_install_path(host, package_name) install_host_dir = os.path.realpath(os.path.join(install_dir, '../')) # Remove any previously installed toolchain so it doesn't pollute the # build. if os.path.exists(install_host_dir): shutil.rmtree(install_host_dir) # First copy over the entire set of output objects. shutil.copytree(build_dir, install_dir, symlinks=True) ext = '.exe' if host.is_windows else '' shlib_ext = '.dll' if host.is_windows else '.so' if host.is_linux else '.dylib' # Next, we remove unnecessary binaries. necessary_bin_files = { 'clang' + ext, 'clang++' + ext, 'clang-' + version.major_version() + ext, 'clang-check' + ext, 'clang-cl' + ext, 'clang-format' + ext, 'clang-tidy' + ext, 'dsymutil' + ext, 'git-clang-format', # No extension here 'ld.lld' + ext, 'ld64.lld' + ext, 'lld' + ext, 'lld-link' + ext, 'llvm-addr2line' + ext, 'llvm-ar' + ext, 'llvm-as' + ext, 'llvm-cfi-verify' + ext, 'llvm-config' + ext, 'llvm-cov' + ext, 'llvm-dis' + ext, 'llvm-dwarfdump' + ext, 'llvm-lib' + ext, 'llvm-link' + ext, 'llvm-modextract' + ext, 'llvm-nm' + ext, 'llvm-objcopy' + ext, 'llvm-objdump' + ext, 'llvm-profdata' + ext, 'llvm-ranlib' + ext, 'llvm-rc' + ext, 'llvm-readelf' + ext, 'llvm-readobj' + ext, 'llvm-size' + ext, 'llvm-strings' + ext, 'llvm-strip' + ext, 'llvm-symbolizer' + ext, 'sancov' + ext, 'sanstats' + ext, 'scan-build' + ext, 'scan-view' + ext, } if BUILD_LLDB: necessary_bin_files.update({ 'lldb-argdumper' + ext, 'lldb' + ext, }) if host.is_windows: windows_blacklist_bin_files = { 'clang-' + version.major_version() + ext, 'scan-build' + ext, 'scan-view' + ext, } necessary_bin_files -= windows_blacklist_bin_files if BUILD_LLDB: install_lldb_deps(Path(install_dir), host) if host.is_windows: windows_additional_bin_files = { 'liblldb' + shlib_ext, 'python38' + shlib_ext } necessary_bin_files |= windows_additional_bin_files # scripts that should not be stripped script_bins = { 'git-clang-format', 'scan-build', 'scan-view', } bin_dir = os.path.join(install_dir, 'bin') lib_dir = os.path.join(install_dir, 'lib64') strip_cmd = toolchains.get_runtime_toolchain().strip for bin_filename in os.listdir(bin_dir): binary = os.path.join(bin_dir, bin_filename) if os.path.isfile(binary): if bin_filename not in necessary_bin_files: remove(binary) elif strip and bin_filename not in script_bins: # Strip all non-global symbols and debug info. # These specific flags prevent Darwin executables from being # stripped of additional global symbols that might be used # by plugins. utils.check_call([strip_cmd, '-S', '-x', binary]) # FIXME: check that all libs under lib64/clang/<version>/ are created. for necessary_bin_file in necessary_bin_files: if not os.path.isfile(os.path.join(bin_dir, necessary_bin_file)): raise RuntimeError('Did not find %s in %s' % (necessary_bin_file, bin_dir)) necessary_lib_files = { 'libc++.a', 'libc++abi.a', } if host.is_windows: necessary_lib_files |= { 'LLVMgold' + shlib_ext, 'libwinpthread-1' + shlib_ext, } # For Windows, add other relevant libraries. install_winpthreads(bin_dir, lib_dir) # Remove unnecessary static libraries. remove_static_libraries(lib_dir, necessary_lib_files) if not host.is_windows: install_wrappers(install_dir) normalize_llvm_host_libs(install_dir, host, version) # Check necessary lib files exist. for necessary_lib_file in necessary_lib_files: if not os.path.isfile(os.path.join(lib_dir, necessary_lib_file)): raise RuntimeError('Did not find %s in %s' % (necessary_lib_file, lib_dir)) # Next, we copy over stdatomic.h and bits/stdatomic.h from bionic. libc_include_path = utils.android_path('bionic', 'libc', 'include') resdir_top = os.path.join(lib_dir, 'clang') header_path = os.path.join(resdir_top, version.long_version(), 'include') stdatomic_path = utils.android_path(libc_include_path, 'stdatomic.h') install_file(stdatomic_path, header_path) bits_install_path = os.path.join(header_path, 'bits') if not os.path.isdir(bits_install_path): os.mkdir(bits_install_path) bits_stdatomic_path = utils.android_path(libc_include_path, 'bits', 'stdatomic.h') install_file(bits_stdatomic_path, bits_install_path) # Install license files as NOTICE in the toolchain install dir. install_license_files(install_dir) # Add an AndroidVersion.txt file. version_file_path = os.path.join(install_dir, 'AndroidVersion.txt') with open(version_file_path, 'w') as version_file: version_file.write('{}\n'.format(version.long_version())) svn_revision = android_version.get_svn_revision(BUILD_LLVM_NEXT) version_file.write('based on {}\n'.format(svn_revision)) # Create RBE input files. if host.is_linux: with open(os.path.join(install_dir, 'bin', 'remote_toolchain_inputs'), 'w') as inputs_file: dependencies = ('clang\n' 'clang++\n' 'clang.real\n' 'clang++.real\n' 'clang-tidy\n' 'clang-tidy.real\n' '../lib64/libc++.so.1\n' 'lld\n' 'ld64.lld\n' 'ld.lld\n' ) blacklist_dir = os.path.join('../', 'lib64', 'clang', version.long_version(), 'share\n') libs_dir = os.path.join('../', 'lib64', 'clang', version.long_version(), 'lib', 'linux\n') dependencies += (blacklist_dir + libs_dir) inputs_file.write(dependencies) # Package up the resulting trimmed install/ directory. if create_tar: tarball_name = package_name + '-' + host.os_tag package_path = os.path.join(dist_dir, tarball_name) + '.tar.bz2' logger().info('Packaging %s', package_path) args = ['tar', '-cjC', install_host_dir, '-f', package_path, package_name] utils.check_call(args)
def pgo_profdata_file(profdata_file): profile = utils.android_path('prebuilts', 'clang', 'host', 'linux-x86', 'profiles', profdata_file) return profile if os.path.exists(profile) else None
def debug_prefix_flag(): return '-fdebug-prefix-map={}='.format(utils.android_path())
def clang_prebuilt_base_dir(): return utils.android_path('prebuilts/clang/host', hosts.build_host().os_tag, constants.CLANG_PREBUILT_VERSION)
def go_bin_dir(): return utils.android_path('prebuilts/go', hosts.build_host().os_tag, 'bin')
def cross_compile_configs(toolchain, platform=False, static=False): configs = [ (hosts.Arch.ARM, 'arm/arm-linux-androideabi-4.9/arm-linux-androideabi', 'arm-linux-android', '-march=armv7-a'), (hosts.Arch.AARCH64, 'aarch64/aarch64-linux-android-4.9/aarch64-linux-android', 'aarch64-linux-android', ''), (hosts.Arch.X86_64, 'x86/x86_64-linux-android-4.9/x86_64-linux-android', 'x86_64-linux-android', ''), (hosts.Arch.I386, 'x86/x86_64-linux-android-4.9/x86_64-linux-android', 'i686-linux-android', '-m32'), ] cc = os.path.join(toolchain, 'bin', 'clang') cxx = os.path.join(toolchain, 'bin', 'clang++') llvm_config = os.path.join(toolchain, 'bin', 'llvm-config') for (arch, toolchain_path, llvm_triple, extra_flags) in configs: if static: api_level = android_api(arch, platform=True) else: api_level = android_api(arch, platform) toolchain_root = utils.android_path('prebuilts/gcc', hosts.build_host().os_tag) toolchain_bin = os.path.join(toolchain_root, toolchain_path, 'bin') sysroot = get_sysroot(arch, platform) defines = {} defines['CMAKE_C_COMPILER'] = cc defines['CMAKE_CXX_COMPILER'] = cxx defines['LLVM_CONFIG_PATH'] = llvm_config # Include the directory with libgcc.a to the linker search path. toolchain_builtins = os.path.join( toolchain_root, toolchain_path, '..', 'lib', 'gcc', os.path.basename(toolchain_path), '4.9.x') # The 32-bit libgcc.a is sometimes in a separate subdir if arch == hosts.Arch.I386: toolchain_builtins = os.path.join(toolchain_builtins, '32') if arch == hosts.Arch.ARM: toolchain_lib = ndk_toolchain_lib(arch, 'arm-linux-androideabi-4.9', 'arm-linux-androideabi') elif arch in [hosts.Arch.I386, hosts.Arch.X86_64]: toolchain_lib = ndk_toolchain_lib(arch, arch.ndk_arch + '-4.9', llvm_triple) else: toolchain_lib = ndk_toolchain_lib(arch, llvm_triple + '-4.9', llvm_triple) ldflags = [ '-L' + toolchain_builtins, '-Wl,-z,defs', '-L' + toolchain_lib, '-fuse-ld=lld', '-Wl,--gc-sections', '-Wl,--build-id=sha1', '-pie', ] if static: ldflags.append('-static') if not platform: triple = 'arm-linux-androideabi' if arch == hosts.Arch.ARM else llvm_triple libcxx_libs = os.path.join(ndk_base(), 'toolchains', 'llvm', 'prebuilt', 'linux-x86_64', 'sysroot', 'usr', 'lib', triple) ldflags += ['-L', os.path.join(libcxx_libs, str(api_level))] ldflags += ['-L', libcxx_libs] defines['CMAKE_EXE_LINKER_FLAGS'] = ' '.join(ldflags) defines['CMAKE_SHARED_LINKER_FLAGS'] = ' '.join(ldflags) defines['CMAKE_MODULE_LINKER_FLAGS'] = ' '.join(ldflags) update_cmake_sysroot_flags(defines, sysroot) macro_api_level = 10000 if platform else api_level cflags = [ debug_prefix_flag(), '--target=%s' % llvm_triple, '-B%s' % toolchain_bin, '-D__ANDROID_API__=' + str(macro_api_level), '-ffunction-sections', '-fdata-sections', extra_flags, ] yield (arch, llvm_triple, defines, cflags)
def host_sysroot(): if hosts.build_host().is_darwin: return "" else: return utils.android_path('prebuilts/gcc', hosts.build_host().os_tag, 'host/x86_64-linux-glibc2.17-4.8/sysroot')