OLD | NEW |
(Empty) | |
| 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/gcc_toolchain.gni") |
| 7 |
| 8 # The Android GCC toolchains share most of the same parameters, so we have this |
| 9 # wrapper around gcc_toolchain to avoid duplication of logic. |
| 10 # |
| 11 # Parameters: |
| 12 # - android_ndk_sysroot |
| 13 # Sysroot for this architecture. |
| 14 # - android_ndk_lib_dir |
| 15 # Subdirectory inside of android_ndk_sysroot where libs go. |
| 16 # - toolchain_cpu |
| 17 # Same as gcc_toolchain |
| 18 template("android_gcc_toolchain") { |
| 19 gcc_toolchain(target_name) { |
| 20 # Make our manually injected libs relative to the build dir. |
| 21 android_ndk_lib = rebase_path( |
| 22 invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir, |
| 23 root_build_dir) |
| 24 |
| 25 libs_section_prefix = "$android_ndk_lib/crtbegin_dynamic.o" |
| 26 libs_section_postfix = "$android_ndk_lib/crtend_android.o" |
| 27 |
| 28 solink_libs_section_prefix = "$android_ndk_lib/crtbegin_so.o" |
| 29 solink_libs_section_postfix = "$android_ndk_lib/crtend_so.o" |
| 30 |
| 31 # The tools should be run relative to the build dir. |
| 32 tool_prefix = rebase_path("$android_tool_prefix", root_build_dir) |
| 33 |
| 34 is_clang = invoker.is_clang |
| 35 if (is_clang) { |
| 36 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
| 37 root_build_dir) |
| 38 cc = "$prefix/clang" |
| 39 cxx = "$prefix/clang++" |
| 40 } else { |
| 41 cc = "${tool_prefix}gcc" |
| 42 cxx = "${tool_prefix}g++" |
| 43 } |
| 44 ar = tool_prefix + "ar" |
| 45 ld = cxx |
| 46 readelf = tool_prefix + "readelf" |
| 47 nm = tool_prefix + "nm" |
| 48 strip = "${tool_prefix}strip" |
| 49 |
| 50 # Don't use .cr.so for loadable_modules since they are always loaded via |
| 51 # absolute path. |
| 52 loadable_module_extension = ".so" |
| 53 |
| 54 toolchain_os = "android" |
| 55 toolchain_cpu = invoker.toolchain_cpu |
| 56 } |
| 57 } |
| 58 |
| 59 template("android_gcc_toolchains_helper") { |
| 60 android_gcc_toolchain(target_name) { |
| 61 android_ndk_sysroot = invoker.android_ndk_sysroot |
| 62 android_ndk_lib_dir = invoker.android_ndk_lib_dir |
| 63 toolchain_cpu = invoker.toolchain_cpu |
| 64 } |
| 65 |
| 66 android_gcc_toolchain("clang_$target_name") { |
| 67 android_ndk_sysroot = invoker.android_ndk_sysroot |
| 68 android_ndk_lib_dir = invoker.android_ndk_lib_dir |
| 69 toolchain_cpu = invoker.toolchain_cpu |
| 70 is_clang = true |
| 71 } |
| 72 } |
| 73 |
| 74 android_gcc_toolchains_helper("x86") { |
| 75 android_ndk_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" |
| 76 android_ndk_lib_dir = "usr/lib" |
| 77 |
| 78 toolchain_cpu = "x86" |
| 79 } |
| 80 |
| 81 android_gcc_toolchains_helper("arm") { |
| 82 android_ndk_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" |
| 83 android_ndk_lib_dir = "usr/lib" |
| 84 |
| 85 toolchain_cpu = "arm" |
| 86 } |
| 87 |
| 88 android_gcc_toolchains_helper("mipsel") { |
| 89 android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" |
| 90 android_ndk_lib_dir = "usr/lib" |
| 91 |
| 92 toolchain_cpu = "mipsel" |
| 93 } |
| 94 |
| 95 android_gcc_toolchains_helper("x64") { |
| 96 android_ndk_sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" |
| 97 android_ndk_lib_dir = "usr/lib64" |
| 98 |
| 99 toolchain_cpu = "x86_64" |
| 100 } |
| 101 |
| 102 android_gcc_toolchains_helper("arm64") { |
| 103 android_ndk_sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" |
| 104 android_ndk_lib_dir = "usr/lib" |
| 105 |
| 106 toolchain_cpu = "aarch64" |
| 107 } |
| 108 |
| 109 android_gcc_toolchains_helper("mips64el") { |
| 110 android_ndk_sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" |
| 111 android_ndk_lib_dir = "usr/lib64" |
| 112 |
| 113 toolchain_cpu = "mips64el" |
| 114 } |
OLD | NEW |