OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/sysroot.gni") # Imports android/config.gni. | 5 import("//build/config/sysroot.gni") # Imports android/config.gni. |
6 import("//build/toolchain/clang.gni") | 6 import("//build/toolchain/clang.gni") |
7 import("//build/toolchain/goma.gni") | 7 import("//build/toolchain/goma.gni") |
8 import("//build/toolchain/gcc_toolchain.gni") | 8 import("//build/toolchain/gcc_toolchain.gni") |
9 | 9 |
10 # The Android GCC toolchains share most of the same parameters, so we have this | 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. | 11 # wrapper around gcc_toolchain to avoid duplication of logic. |
12 # | 12 # |
13 # Parameters: | 13 # Parameters: |
14 # - android_ndk_sysroot | 14 # - android_ndk_sysroot |
15 # Sysroot for this architecture. | 15 # Sysroot for this architecture. |
16 # - android_ndk_lib_dir | 16 # - android_ndk_lib_dir |
17 # Subdirectory inside of android_ndk_sysroot where libs go. | 17 # Subdirectory inside of android_ndk_sysroot where libs go. |
18 # - tool_prefix | 18 # - tool_prefix |
19 # Prefix to be added to the tool names. | 19 # Prefix to be added to the tool names. |
20 # - toolchain_cpu_arch | 20 # - toolchain_cpu_arch |
21 # Same as gcc_toolchain | 21 # Same as gcc_toolchain |
22 template("android_gcc_toolchain") { | 22 template("android_gcc_toolchain") { |
23 gcc_toolchain(target_name) { | 23 gcc_toolchain(target_name) { |
24 # Make our manually injected libs relative to the build dir. | 24 # Make our manually injected libs relative to the build dir. |
25 android_ndk_lib = rebase_path( | 25 android_ndk_lib = rebase_path( |
26 invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir, | 26 invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir, |
27 root_build_dir) | 27 root_build_dir) |
28 | 28 |
29 libs_section_prefix = "$android_ndk_lib/crtbegin_dynamic.o" | 29 libs_section_prefix = "$android_ndk_lib/crtbegin_dynamic.o" |
30 libs_section_postfix = "$android_ndk_lib/crtend_android.o" | 30 libs_section_postfix = "$android_ndk_lib/crtend_android.o" |
31 | 31 |
32 solink_libs_section_prefix = "$android_ndk_lib/crtbegin_so.o" | 32 solink_libs_section_prefix = "$android_ndk_lib/crtbegin_so.o" |
33 solink_libs_section_postfix = "$android_ndk_lib/crtend_so.o" | 33 solink_libs_section_postfix = "$android_ndk_lib/crtend_so.o" |
34 | 34 |
35 # The tools should be run relative to the build dir. | 35 # The tools should be run relative to the build dir. |
36 tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir) | 36 tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir) |
37 | 37 |
(...skipping 14 matching lines...) Expand all Loading... |
52 # We make the assumption that the gcc_toolchain will produce a soname with | 52 # We make the assumption that the gcc_toolchain will produce a soname with |
53 # the following definition. | 53 # the following definition. |
54 soname = "{{target_output_name}}{{output_extension}}" | 54 soname = "{{target_output_name}}{{output_extension}}" |
55 | 55 |
56 stripped_soname = "lib.stripped/${soname}" | 56 stripped_soname = "lib.stripped/${soname}" |
57 temp_stripped_soname = "${stripped_soname}.tmp" | 57 temp_stripped_soname = "${stripped_soname}.tmp" |
58 | 58 |
59 android_strip = "${tool_prefix}strip" | 59 android_strip = "${tool_prefix}strip" |
60 | 60 |
61 mkdir_command = "mkdir -p lib.stripped" | 61 mkdir_command = "mkdir -p lib.stripped" |
62 strip_command = "$android_strip --strip-unneeded -o $temp_stripped_soname $s
oname" | 62 strip_command = |
63 replace_command = "if ! cmp -s $temp_stripped_soname $stripped_soname; then
mv $temp_stripped_soname $stripped_soname; fi" | 63 "$android_strip --strip-unneeded -o $temp_stripped_soname $soname" |
| 64 replace_command = |
| 65 "if ! cmp -s $temp_stripped_soname $stripped_soname; then mv $temp_strip
ped_soname $stripped_soname; fi" |
64 postsolink = "$mkdir_command && $strip_command && $replace_command" | 66 postsolink = "$mkdir_command && $strip_command && $replace_command" |
65 solink_outputs = [ stripped_soname ] | 67 solink_outputs = [ stripped_soname ] |
66 | 68 |
67 # We make the assumption that the gcc_toolchain will produce an exe with | 69 # We make the assumption that the gcc_toolchain will produce an exe with |
68 # the following definition. | 70 # the following definition. |
69 exe = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" | 71 exe = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" |
70 stripped_exe = "exe.stripped/$exe" | 72 stripped_exe = "exe.stripped/$exe" |
71 mkdir_command = "mkdir -p exe.stripped" | 73 mkdir_command = "mkdir -p exe.stripped" |
72 strip_command = "$android_strip --strip-unneeded -o $stripped_exe $exe" | 74 strip_command = "$android_strip --strip-unneeded -o $stripped_exe $exe" |
73 postlink = "$mkdir_command && $strip_command" | 75 postlink = "$mkdir_command && $strip_command" |
(...skipping 17 matching lines...) Expand all Loading... |
91 toolchain_cpu_arch = "arm" | 93 toolchain_cpu_arch = "arm" |
92 } | 94 } |
93 | 95 |
94 android_gcc_toolchain("mipsel") { | 96 android_gcc_toolchain("mipsel") { |
95 android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" | 97 android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" |
96 android_ndk_lib_dir = "usr/lib" | 98 android_ndk_lib_dir = "usr/lib" |
97 | 99 |
98 tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-" | 100 tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-" |
99 toolchain_cpu_arch = "mipsel" | 101 toolchain_cpu_arch = "mipsel" |
100 } | 102 } |
OLD | NEW |