def test_standalone_toolchain(arch, toolchain, install_dir): if toolchain == '4.9': triple = build_support.arch_to_triple(arch) # x86 toolchain names are dumb: http://b/25800583 if arch == 'x86': triple = 'i686-linux-android' compiler_name = triple + '-g++' elif toolchain == 'clang': compiler_name = 'clang++' else: raise ValueError compiler = os.path.join(install_dir, 'bin', compiler_name) test_source = 'foo.cpp' proc = subprocess.Popen([compiler, '-shared', test_source], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) out, _ = proc.communicate() return proc.returncode == 0, out
def expand_packages(package, host, arches): """Expands package definition tuple into list of full package names. >>> expand_packages('gcc-{arch}-{host}', 'linux', ['arm64', 'x86_64']) ['gcc-arm64-linux-x86_64', 'gcc-x86_64-linux-x86_64'] >>> expand_packages('gcclibs-{arch}', 'linux', ['arm64', 'x86_64']) ['gcclibs-arm64', 'gcclibs-x86_64'] >>> expand_packages('llvm-{host}', 'linux', ['arm']) ['llvm-linux-x86_64'] >>> expand_packages('platforms', 'linux', ['arm']) ['platforms'] >>> expand_packages('libc++-{abi}', 'linux', ['arm']) ['libc++-armeabi', 'libc++-armeabi-v7a'] >>> expand_packages('binutils/{triple}', 'linux', ['arm', 'x86_64']) ['binutils/arm-linux-androideabi', 'binutils/x86_64-linux-android'] >> expand_packages('toolchains/{toolchain}-4.9', 'linux', ['arm', 'x86']) ['toolchains/arm-linux-androideabi-4.9', 'toolchains/x86-4.9'] """ host_tag = build_support.host_to_tag(host) seen_packages = set() packages = [] for arch in arches: triple = build_support.arch_to_triple(arch) toolchain = build_support.arch_to_toolchain(arch) for abi in build_support.arch_to_abis(arch): expanded = package.format(abi=abi, arch=arch, host=host_tag, triple=triple, toolchain=toolchain) if expanded not in seen_packages: packages.append(expanded) seen_packages.add(expanded) return packages
def expand_packages(package, host, arches): """Expands package definition tuple into list of full package names. >>> expand_packages('gcc-{arch}-{host}', 'linux', ['arm64', 'x86_64']) ['gcc-arm64-linux-x86_64', 'gcc-x86_64-linux-x86_64'] >>> expand_packages('gcclibs-{arch}', 'linux', ['arm64', 'x86_64']) ['gcclibs-arm64', 'gcclibs-x86_64'] >>> expand_packages('llvm-{host}', 'linux', ['arm']) ['llvm-linux-x86_64'] >>> expand_packages('platforms', 'linux', ['arm']) ['platforms'] >>> expand_packages('libc++-{abi}', 'linux', ['arm']) ['libc++-armeabi', 'libc++-armeabi-v7a', 'libc++-armeabi-v7a-hard'] >>> expand_packages('binutils/{triple}', 'linux', ['arm', 'x86_64']) ['binutils/arm-linux-androideabi', 'binutils/x86_64-linux-android'] >> expand_packages('toolchains/{toolchain}-4.9', 'linux', ['arm', 'x86']) ['toolchains/arm-linux-androideabi-4.9', 'toolchains/x86-4.9'] """ host_tag = build_support.host_to_tag(host) seen_packages = set() packages = [] for arch in arches: triple = build_support.arch_to_triple(arch) toolchain = build_support.arch_to_toolchain(arch) for abi in build_support.arch_to_abis(arch): expanded = package.format( abi=abi, arch=arch, host=host_tag, triple=triple, toolchain=toolchain) if expanded not in seen_packages: packages.append(expanded) seen_packages.add(expanded) return packages