Home | History | Annotate | Download | only in android
      1 # Copyright 2013 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 import("//build/config/sysroot.gni")  # Imports android/config.gni.
      6 import("//build/toolchain/clang.gni")
      7 import("//build/toolchain/goma.gni")
      8 import("//build/toolchain/gcc_toolchain.gni")
      9 
     10 # The Android GCC toolchains share most of the same parameters, so we have this
     11 # wrapper around gcc_toolchain to avoid duplication of logic.
     12 #
     13 # Parameters:
     14 #  - android_ndk_sysroot
     15 #      Sysroot for this architecture.
     16 #  - android_ndk_lib_dir
     17 #      Subdirectory inside of android_ndk_sysroot where libs go.
     18 #  - tool_prefix
     19 #      Prefix to be added to the tool names.
     20 #  - toolchain_cpu_arch
     21 #      Same as gcc_toolchain
     22 template("android_gcc_toolchain") {
     23   gcc_toolchain(target_name) {
     24     # Make our manually injected libs relative to the build dir.
     25     android_ndk_lib = rebase_path(
     26       invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir,
     27       root_build_dir)
     28 
     29     libs_section_prefix = "$android_ndk_lib/crtbegin_dynamic.o"
     30     libs_section_postfix = "$android_ndk_lib/crtend_android.o"
     31 
     32     # The tools should be run relative to the build dir.
     33     tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir)
     34 
     35     cc = tool_prefix + "gcc"
     36     cxx = tool_prefix + "g++"
     37     ar = tool_prefix + "ar"
     38     ld = cxx
     39 
     40     toolchain_os = "android"
     41     toolchain_cpu_arch = invoker.toolchain_cpu_arch
     42   }
     43 }
     44 
     45 android_gcc_toolchain("x86") {
     46   android_ndk_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir"
     47   android_ndk_lib_dir = "usr/lib"
     48 
     49   tool_prefix = "$x86_android_toolchain_root/bin/i686-linux-android-"
     50   toolchain_cpu_arch = "x86"
     51 }
     52 
     53 android_gcc_toolchain("arm") {
     54   android_ndk_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir"
     55   android_ndk_lib_dir = "usr/lib"
     56 
     57   tool_prefix = "$arm_android_toolchain_root/bin/arm-linux-androideabi-"
     58   toolchain_cpu_arch = "arm"
     59 }
     60 
     61 android_gcc_toolchain("mipsel") {
     62   android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir"
     63   android_ndk_lib_dir = "usr/lib"
     64 
     65   tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-"
     66   toolchain_cpu_arch = "mipsel"
     67 }
     68