def ConfigureAndBuildArmCXX(config=False): arch = 'arm' project = 'libstdc++' tcpath = os.path.join(TOOLCHAIN, 'linux_$ARCH_bionic') tcpath = ReplaceArch(tcpath, arch) # Prep work path workpath = os.path.join(TOOLCHAIN_BUILD_OUT, 'cxx_$GCC_bionic_work') workpath = ReplaceArch(workpath, arch) Mkdir(workpath) Symlink('../gcc_libs_arm_work/gcc', os.path.join(workpath, 'gcc')) # Prep install path inspath = os.path.join(TOOLCHAIN_BUILD_OUT, 'cxx_$GCC_bionic_install') inspath = ReplaceArch(inspath, arch) dstpath = ReplaceArch(os.path.join(workpath, '$NACL-nacl/libstdc++-v3'), arch) Mkdir(dstpath) cfg = [ '../../../../src/gcc_libs/libstdc++-v3/configure', '--host=arm-nacl', '--build=i686-linux', '--target=arm-nacl', '--enable-shared', '--with-newlib', '--disable-libstdcxx-pch', '--enable-shared-libgcc', '--with-dwarf3', '--prefix=' + inspath, 'CFLAGS=-I../../../gcc_lib_arm_work' ] ConfigureAndInstallForGCC(arch, project, cfg, dstpath, inspath) UpdateFromTo(os.path.join(inspath, 'lib'), os.path.join(tcpath, 'arm-nacl', 'lib')) UpdateFromTo(os.path.join(inspath, 'include'), os.path.join(tcpath, 'arm-nacl', 'include'))
def ConfigureAndBuildTests(clobber=False): for arch in ARCHES: workpath = os.path.join(TOOLCHAIN_BUILD_OUT, ReplaceArch('bionic_$GCC_test_work', arch)) inspath = os.path.join(TOOLCHAIN_BUILD_OUT, ReplaceArch('bionic_$GCC_test_install', arch)) if clobber: print 'Clobbering' Rmdir(workpath) Rmdir(inspath) Mkdir(workpath) Mkdir(inspath) ConfigureAndBuild(arch, 'bionic/tests', workpath, inspath)
def CreateProject(arch, project, clobber=False): paths = GetProjectPaths(arch, project) MAKEFILE_TEMPLATE = """ # Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # GNU Makefile based on shared rules provided by the Native Client SDK. # See README.Makefiles for more details. NATIVE_CLIENT_PATH?=$(nacl_path) TOOLCHAIN_PATH?=$(tc_path) TOOLCHAIN_PREFIX:=$(TOOLCHAIN_PATH)/bin/$GCC-nacl- CC:=$(TOOLCHAIN_PREFIX)gcc CXX:=$(TOOLCHAIN_PREFIX)g++ AR:=$(TOOLCHAIN_PREFIX)ar SRC_ROOT=$(src_path) DST_ROOT=$(dst_path) INS_ROOT=$(ins_path) NACL_ARCH=$NACL GCC_ARCH=$GCC MAKEFILE_DEPS:=$(build_tc_path)/tc_bionic.mk MAKEFILE_DEPS+=$(src_path)/Makefile include $(build_tc_path)/tc_bionic.mk include $(src_path)/Makefile """ remap = { '$(src_path)': paths['src'], '$(dst_path)': paths['work'], '$(ins_path)': paths['ins'], '$(tc_path)': GetBionicBuildPath(arch), '$(build_tc_path)': TOOLCHAIN_BUILD, '$(nacl_path)': NATIVE_CLIENT, } text = ReplaceText(MAKEFILE_TEMPLATE, [remap]) text = ReplaceArch(text, arch) if clobber: print 'Clobbering Bionic project directory: ' + paths['work'] Rmdir(paths['work']) Mkdir(paths['work']) Mkdir(paths['ins']) UpdateText(os.path.join(paths['work'], 'Makefile'), text)
def ConfigureAndBuild_libstdcpp(): arch = 'arm' project = 'libstdc++' tcpath = GetToolchainPath(arch, 'bionic') # Prep work path workpath = os.path.join(TOOLCHAIN_BUILD_OUT, 'gcc_$GCC_bionic_work') workpath = ReplaceArch(workpath, arch) # Prep install path inspath = os.path.join(TOOLCHAIN_BUILD_OUT, 'gcc_$GCC_bionic_install') inspath = ReplaceArch(inspath, arch) dstpath = ReplaceArch(os.path.join(workpath, '$NACL-nacl/libstdc++-v3'), arch) Mkdir(dstpath) cfg = [ '../../../../src/gcc_libs/libstdc++-v3/configure', '--host=arm-nacl', '--build=i686-linux', '--target=arm-nacl', '--enable-shared', '--with-newlib', '--disable-libstdcxx-pch', '--enable-shared-libgcc', '--with-dwarf3', '--prefix=' + inspath, 'CFLAGS=-I../../../gcc_lib_arm_work' ] ConfigureGCCProject(arch, project, cfg, dstpath, inspath) MakeGCCProject(arch, project, dstpath) MakeGCCProject(arch, project, dstpath, ['install']) UpdateFromTo(os.path.join(inspath, 'lib'), os.path.join(tcpath, 'arm-nacl', 'lib')) UpdateFromTo(os.path.join(inspath, 'include'), os.path.join(tcpath, 'arm-nacl', 'include'))
def ConfigureAndBuild_libgcc(config=False): arch = 'arm' project = 'libgcc' tcpath = GetToolchainPath(arch, 'bionic') # Prep work path workpath = os.path.join(TOOLCHAIN_BUILD_OUT, 'gcc_$GCC_bionic_work') workpath = ReplaceArch(workpath, arch) Mkdir(workpath) Symlink('../gcc_libs_arm_work/gcc', os.path.join(workpath, 'gcc')) # Prep install path inspath = os.path.join(TOOLCHAIN_BUILD_OUT, 'gcc_$GCC_bionic_install') inspath = ReplaceArch(inspath, arch) dstpath = ReplaceArch(os.path.join(workpath, '$NACL-nacl/libgcc'), arch) cfg = [ '../../../../src/gcc_libs/libgcc/configure', '--host=arm-nacl', '--build=i686-linux', '--target=arm-nacl', '--enable-shared', '--enable-shared-libgcc', '--with-dwarf3', '--with-newlib', '--prefix=' + inspath, 'CFLAGS=-I../../../gcc_lib_arm_work' ] ConfigureGCCProject(arch, project, cfg, dstpath, inspath) MakeGCCProject(arch, project, dstpath, ['libgcc.a']) # Copy temp version of libgcc.a for linking libc.so UpdateFromTo(os.path.join(dstpath, 'libgcc.a'), os.path.join(tcpath, 'arm-nacl', 'lib', 'libgcc.a'))
def CreateProject(arch, src, dst, ins=None): MAKEFILE_TEMPLATE = """ # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # GNU Makefile based on shared rules provided by the Native Client SDK. # See README.Makefiles for more details. TOOLCHAIN_PATH?=$(tc_path)/linux_$ARCH_bionic TOOLCHAIN_PREFIX:=$(TOOLCHAIN_PATH)/bin/$GCC-nacl- CC:=$(TOOLCHAIN_PREFIX)gcc CXX:=$(TOOLCHAIN_PREFIX)g++ AR:=$(TOOLCHAIN_PREFIX)ar SRC_ROOT=$(src_path) DST_ROOT=$(dst_path) INS_ROOT=$(ins_path) NACL_ARCH=$NACL GCC_ARCH=$GCC include $(build_tc_path)/tc_bionic.mk include $(src_path)/Makefile """ remap = { '$(src_path)': src, '$(dst_path)': dst, '$(ins_path)': ins or dst, '$(tc_path)': TOOLCHAIN, '$(build_tc_path)': TOOLCHAIN_BUILD } text = ReplaceText(MAKEFILE_TEMPLATE, [remap]) text = ReplaceArch(text, arch) print 'Create dst dir: ' + dst Mkdir(dst) if ins: print 'Create ins dir: ' + ins Mkdir(ins) UpdateText(os.path.join(dst, 'Makefile'), text)
def ConfigureAndBuildX86GCC(config=False): arch = 'x86' project = 'libgcc' tcpath = os.path.join(TOOLCHAIN, 'linux_$ARCH_bionic') tcpath = ReplaceArch(tcpath, arch) # Prep work path workpath = os.path.join(TOOLCHAIN_BUILD_OUT, 'gcc_$GCC_bionic_work') workpath = ReplaceArch(workpath, arch) Mkdir(workpath) Symlink('../gcc_libs_arm_work/gcc', os.path.join(workpath, 'gcc')) # Prep install path inspath = os.path.join(TOOLCHAIN_BUILD_OUT, 'gcc_$GCC_bionic_install') inspath = ReplaceArch(inspath, arch) dstpath = ReplaceArch(os.path.join(workpath, '$NACL-nacl/libgcc'), arch) cfg = [ '../../../../SRC/gcc/libgcc/configure', '--target=x86_64-nacl', '--enable-shared', '--enable-shared-libgcc', '--host=x86_64-nacl', ',--build=i686-linux' ]