OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 # This file is meant to be included into a target to provide a rule | 5 # This file is meant to be included into a target to provide a rule |
6 # to build Android APKs in a consistent manner. | 6 # to build Android APKs in a consistent manner. |
7 # | 7 # |
8 # To use this, create a gyp target with the following form: | 8 # To use this, create a gyp target with the following form: |
9 # { | 9 # { |
10 # 'target_name': 'my_package_apk', | 10 # 'target_name': 'my_package_apk', |
(...skipping 30 matching lines...) Expand all Loading... |
41 # native_lib_target - The target_name of the target which generates the final | 41 # native_lib_target - The target_name of the target which generates the final |
42 # shared library to be included in this apk. A stripped copy of the | 42 # shared library to be included in this apk. A stripped copy of the |
43 # library will be included in the apk. | 43 # library will be included in the apk. |
44 # resource_dir - The directory for resources. | 44 # resource_dir - The directory for resources. |
45 # R_package - A custom Java package to generate the resource file R.java in. | 45 # R_package - A custom Java package to generate the resource file R.java in. |
46 # By default, the package given in AndroidManifest.xml will be used. | 46 # By default, the package given in AndroidManifest.xml will be used. |
47 # java_strings_grd - The name of the grd file from which to generate localized | 47 # java_strings_grd - The name of the grd file from which to generate localized |
48 # strings.xml files, if any. | 48 # strings.xml files, if any. |
49 # library_manifest_paths'- Paths to additional AndroidManifest.xml files from | 49 # library_manifest_paths'- Paths to additional AndroidManifest.xml files from |
50 # libraries. | 50 # libraries. |
| 51 # use_crazy_linker - Enable the crazy linker that allows sharing the RELRO |
| 52 # section of the native libraries between the different processes. |
51 | 53 |
52 { | 54 { |
53 'variables': { | 55 'variables': { |
54 'additional_input_paths': [], | 56 'additional_input_paths': [], |
55 'input_jars_paths': [], | 57 'input_jars_paths': [], |
56 'library_dexed_jars_paths': [], | 58 'library_dexed_jars_paths': [], |
57 'additional_src_dirs': [], | 59 'additional_src_dirs': [], |
58 'generated_src_dirs': [], | 60 'generated_src_dirs': [], |
59 'app_manifest_version_name%': '<(android_app_version_name)', | 61 'app_manifest_version_name%': '<(android_app_version_name)', |
60 'app_manifest_version_code%': '<(android_app_version_code)', | 62 'app_manifest_version_code%': '<(android_app_version_code)', |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', | 111 'incomplete_apk_path': '<(intermediate_dir)/<(apk_name)-incomplete.apk', |
110 'source_dir': '<(java_in_dir)/src', | 112 'source_dir': '<(java_in_dir)/src', |
111 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', | 113 'apk_install_record': '<(intermediate_dir)/apk_install.record.stamp', |
112 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI
GURATION_NAME)', | 114 'device_intermediate_dir': '/data/local/tmp/chromium/<(_target_name)/<(CONFI
GURATION_NAME)', |
113 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', | 115 'symlink_script_host_path': '<(intermediate_dir)/create_symlinks.sh', |
114 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', | 116 'symlink_script_device_path': '<(device_intermediate_dir)/create_symlinks.sh
', |
115 'create_standalone_apk%': 1, | 117 'create_standalone_apk%': 1, |
116 'variables': { | 118 'variables': { |
117 'variables': { | 119 'variables': { |
118 'native_lib_target%': '', | 120 'native_lib_target%': '', |
| 121 'use_crazy_linker%': 0, |
119 }, | 122 }, |
120 'conditions': [ | 123 'conditions': [ |
121 ['gyp_managed_install == 1 and native_lib_target != ""', { | 124 ['gyp_managed_install == 1 and native_lib_target != ""', { |
122 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', | 125 'unsigned_standalone_apk_path': '<(intermediate_dir)/<(apk_name)-stand
alone-unsigned.apk', |
123 }, { | 126 }, { |
124 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', | 127 'unsigned_standalone_apk_path': '<(unsigned_apk_path)', |
125 }], | 128 }], |
126 ['gyp_managed_install == 1', { | 129 ['gyp_managed_install == 1', { |
127 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', | 130 'apk_package_native_libs_dir': '<(intermediate_dir)/libs.managed', |
128 }, { | 131 }, { |
129 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', | 132 'apk_package_native_libs_dir': '<(intermediate_dir)/libs', |
130 }], | 133 }], |
131 ], | 134 ], |
132 }, | 135 }, |
133 'native_lib_target%': '', | 136 'native_lib_target%': '', |
| 137 'use_crazy_linker%': 0, |
134 'emma_instrument': '<(emma_coverage)', | 138 'emma_instrument': '<(emma_coverage)', |
135 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', | 139 'apk_package_native_libs_dir': '<(apk_package_native_libs_dir)', |
136 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', | 140 'unsigned_standalone_apk_path': '<(unsigned_standalone_apk_path)', |
137 }, | 141 }, |
138 # Pass the jar path to the apk's "fake" jar target. This would be better as | 142 # Pass the jar path to the apk's "fake" jar target. This would be better as |
139 # direct_dependent_settings, but a variable set by a direct_dependent_settings | 143 # direct_dependent_settings, but a variable set by a direct_dependent_settings |
140 # cannot be lifted in a dependent to all_dependent_settings. | 144 # cannot be lifted in a dependent to all_dependent_settings. |
141 'all_dependent_settings': { | 145 'all_dependent_settings': { |
142 'variables': { | 146 'variables': { |
143 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', | 147 'apk_output_jar_path': '<(PRODUCT_DIR)/lib.java/<(jar_name)', |
(...skipping 12 matching lines...) Expand all Loading... |
156 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], | 160 'additional_res_dirs': ['<(DEPTH)/build/android/ant/empty/res'], |
157 'additional_res_packages': ['<(R_package)'], | 161 'additional_res_packages': ['<(R_package)'], |
158 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], | 162 'additional_R_text_files': ['<(PRODUCT_DIR)/<(package_name)/R.txt'], |
159 }, | 163 }, |
160 }], | 164 }], |
161 ['native_lib_target != "" and component == "shared_library"', { | 165 ['native_lib_target != "" and component == "shared_library"', { |
162 'dependencies': [ | 166 'dependencies': [ |
163 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', | 167 '<(DEPTH)/build/android/setup.gyp:copy_system_libraries', |
164 ], | 168 ], |
165 }], | 169 }], |
| 170 ['use_crazy_linker == 1', { |
| 171 'dependencies': [ |
| 172 '<(DEPTH)/base/base.gyp:crazy_linker', |
| 173 ], |
| 174 }], |
166 ['native_lib_target != ""', { | 175 ['native_lib_target != ""', { |
167 'variables': { | 176 'variables': { |
168 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], | 177 'compile_input_paths': [ '<(native_libraries_java_stamp)' ], |
169 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], | 178 'generated_src_dirs': [ '<(native_libraries_java_dir)' ], |
170 'native_libs_paths': [ | 179 'native_libs_paths': [ |
171 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' | 180 '<(SHARED_LIB_DIR)/<(native_lib_target).>(android_product_extension)' |
172 ], | 181 ], |
173 'package_input_paths': [ | 182 'package_input_paths': [ |
174 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', | 183 '<(apk_package_native_libs_dir)/<(android_app_abi)/gdbserver', |
175 ], | 184 ], |
176 }, | 185 }, |
177 'copies': [ | 186 'copies': [ |
178 { | 187 { |
179 # gdbserver is always copied into the APK's native libs dir. The ant | 188 # gdbserver is always copied into the APK's native libs dir. The ant |
180 # build scripts (apkbuilder task) will only include it in a debug | 189 # build scripts (apkbuilder task) will only include it in a debug |
181 # build. | 190 # build. |
182 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', | 191 'destination': '<(apk_package_native_libs_dir)/<(android_app_abi)', |
183 'files': [ | 192 'files': [ |
184 '<(android_gdbserver)', | 193 '<(android_gdbserver)', |
185 ], | 194 ], |
186 }, | 195 }, |
187 ], | 196 ], |
188 'actions': [ | 197 'actions': [ |
189 { | 198 { |
190 'variables': { | 199 'variables': { |
191 'input_libraries': ['<@(native_libs_paths)'], | 200 'conditions': [ |
| 201 ['use_crazy_linker == 1', { |
| 202 'variables': { |
| 203 'linker_input_libraries': [ |
| 204 '<(PRODUCT_DIR)/lib/libcrazy_linker.>(android_product_extens
ion)', |
| 205 ], |
| 206 } |
| 207 }, { |
| 208 'variables': { |
| 209 'linker_input_libraries': [], |
| 210 }, |
| 211 }], |
| 212 ], |
| 213 'input_libraries': [ |
| 214 '<@(native_libs_paths)', |
| 215 '<@(linker_input_libraries)', |
| 216 ], |
192 }, | 217 }, |
193 'includes': ['../build/android/write_ordered_libraries.gypi'], | 218 'includes': ['../build/android/write_ordered_libraries.gypi'], |
194 }, | 219 }, |
195 { | 220 { |
196 'action_name': 'native_libraries_template_data_<(_target_name)', | 221 'action_name': 'native_libraries_template_data_<(_target_name)', |
197 'message': 'Creating native_libraries_list.h for <(_target_name).', | 222 'message': 'Creating native_libraries_list.h for <(_target_name).', |
198 'inputs': [ | 223 'inputs': [ |
199 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 224 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
200 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', | 225 '<(DEPTH)/build/android/gyp/create_native_libraries_header.py', |
201 '<(ordered_libraries_file)', | 226 '<(ordered_libraries_file)', |
202 ], | 227 ], |
203 'outputs': [ | 228 'outputs': [ |
204 '<(native_libraries_template_data_stamp)', | 229 '<(native_libraries_template_data_stamp)', |
205 ], | 230 ], |
206 'action': [ | 231 'action': [ |
207 'python', '<(DEPTH)/build/android/gyp/create_native_libraries_header
.py', | 232 'python', '<(DEPTH)/build/android/gyp/create_native_libraries_header
.py', |
208 '--ordered-libraries=<(ordered_libraries_file)', | 233 '--ordered-libraries=<(ordered_libraries_file)', |
209 '--output=<(native_libraries_template_data_file)', | 234 '--output=<(native_libraries_template_data_file)', |
210 '--stamp=<(native_libraries_template_data_stamp)', | 235 '--stamp=<(native_libraries_template_data_stamp)', |
211 ], | 236 ], |
212 }, | 237 }, |
213 { | 238 { |
214 'action_name': 'native_libraries_<(_target_name)', | 239 'action_name': 'native_libraries_<(_target_name)', |
| 240 'variables': { |
| 241 'conditions': [ |
| 242 ['use_crazy_linker == 1', { |
| 243 'variables': { |
| 244 'additional_gcc_preprocess_defines': [ |
| 245 '-D', 'ENABLE_CRAZY_LINKER', |
| 246 ], |
| 247 } |
| 248 }, { |
| 249 'variables': { |
| 250 'additional_gcc_preprocess_defines': [], |
| 251 }, |
| 252 }], |
| 253 ], |
| 254 'gcc_preprocess_defines': [ |
| 255 '<@(additional_gcc_preprocess_defines)', |
| 256 ], |
| 257 }, |
215 'message': 'Creating NativeLibraries.java for <(_target_name).', | 258 'message': 'Creating NativeLibraries.java for <(_target_name).', |
216 'inputs': [ | 259 'inputs': [ |
217 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 260 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
218 '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | 261 '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
219 '<(native_libraries_template_data_stamp)', | 262 '<(native_libraries_template_data_stamp)', |
220 '<(native_libraries_template)', | 263 '<(native_libraries_template)', |
221 ], | 264 ], |
222 'outputs': [ | 265 'outputs': [ |
223 '<(native_libraries_java_stamp)', | 266 '<(native_libraries_java_stamp)', |
224 ], | 267 ], |
225 'action': [ | 268 'action': [ |
226 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', | 269 'python', '<(DEPTH)/build/android/gyp/gcc_preprocess.py', |
227 '--include-path=<(native_libraries_template_data_dir)', | 270 '--include-path=<(native_libraries_template_data_dir)', |
228 '--output=<(native_libraries_java_file)', | 271 '--output=<(native_libraries_java_file)', |
229 '--template=<(native_libraries_template)', | 272 '--template=<(native_libraries_template)', |
230 '--stamp=<(native_libraries_java_stamp)', | 273 '--stamp=<(native_libraries_java_stamp)', |
| 274 '<@(gcc_preprocess_defines)', |
231 ], | 275 ], |
232 }, | 276 }, |
233 { | 277 { |
234 'action_name': 'strip_native_libraries', | 278 'action_name': 'strip_native_libraries', |
235 'variables': { | 279 'variables': { |
236 'ordered_libraries_file%': '<(ordered_libraries_file)', | 280 'ordered_libraries_file%': '<(ordered_libraries_file)', |
237 'stripped_libraries_dir': '<(libraries_source_dir)', | 281 'stripped_libraries_dir': '<(libraries_source_dir)', |
238 'input_paths': ['<@(native_libs_paths)'], | 282 'input_paths': ['<@(native_libs_paths)'], |
239 'stamp': '<(strip_stamp)' | 283 'stamp': '<(strip_stamp)' |
240 }, | 284 }, |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 '<(DEPTH)/build/android/ant/apk-package.xml', | 709 '<(DEPTH)/build/android/ant/apk-package.xml', |
666 | 710 |
667 # Add list of inputs to the command line, so if inputs change | 711 # Add list of inputs to the command line, so if inputs change |
668 # (e.g. if a Java file is removed), the command will be re-run. | 712 # (e.g. if a Java file is removed), the command will be re-run. |
669 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. | 713 # TODO(newt): remove this once crbug.com/177552 is fixed in ninja. |
670 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', | 714 '-DTHIS_IS_IGNORED=>!(echo \'>(_inputs)\' | md5sum)', |
671 ] | 715 ] |
672 }, | 716 }, |
673 ], | 717 ], |
674 } | 718 } |
OLD | NEW |