OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 an action to provide a rule that | 5 # This file is meant to be included into an action to provide a rule that |
6 # packs ARM relative relocations in Release builds of native libraries. | 6 # packs relocations in Release builds of native libraries. |
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 # 'action_name': 'pack_arm_relocations', | 10 # 'action_name': 'pack_arm_relocations', |
11 # 'actions': [ | 11 # 'actions': [ |
12 # 'variables': { | 12 # 'variables': { |
13 # 'enable_packing': 'pack relocations if 1, plain file copy if 0' | 13 # 'enable_packing': 'pack relocations if 1, plain file copy if 0' |
14 # 'exclude_packing_list': 'names of libraries explicitly not packed', | 14 # 'exclude_packing_list': 'names of libraries explicitly not packed', |
15 # 'ordered_libraries_file': 'file generated by write_ordered_libraries' | 15 # 'ordered_libraries_file': 'file generated by write_ordered_libraries' |
16 # 'input_paths': 'files to be added to the list of inputs' | 16 # 'input_paths': 'files to be added to the list of inputs' |
17 # 'stamp': 'file to touch when the action is complete' | 17 # 'stamp': 'file to touch when the action is complete' |
18 # 'stripped_libraries_dir': 'directory holding stripped libraries', | 18 # 'stripped_libraries_dir': 'directory holding stripped libraries', |
19 # 'packed_libraries_dir': 'directory holding packed libraries', | 19 # 'packed_libraries_dir': 'directory holding packed libraries', |
20 # 'includes': [ '../../build/android/pack_arm_relocations.gypi' ], | 20 # 'includes': [ '../../build/android/pack_arm_relocations.gypi' ], |
21 # ], | 21 # ], |
22 # }, | 22 # }, |
23 # | 23 # |
24 | 24 |
25 { | 25 { |
26 'variables': { | 26 'variables': { |
27 'input_paths': [], | 27 'input_paths': [], |
28 'conditions': [ | |
29 ['target_arch == "arm64"', { | |
30 'has_relocations_with_addends': 1, | |
31 }, { | |
32 'has_relocations_with_addends': 0, | |
33 }], | |
34 ], | |
35 }, | 28 }, |
36 'inputs': [ | 29 'inputs': [ |
37 '<(DEPTH)/build/android/gyp/util/build_utils.py', | 30 '<(DEPTH)/build/android/gyp/util/build_utils.py', |
38 '<(DEPTH)/build/android/gyp/pack_arm_relocations.py', | 31 '<(DEPTH)/build/android/gyp/pack_arm_relocations.py', |
39 '<(ordered_libraries_file)', | 32 '<(ordered_libraries_file)', |
40 '>@(input_paths)', | 33 '>@(input_paths)', |
41 ], | 34 ], |
42 'outputs': [ | 35 'outputs': [ |
43 '<(stamp)', | 36 '<(stamp)', |
44 ], | 37 ], |
45 'conditions': [ | 38 'conditions': [ |
46 ['enable_packing == 1', { | 39 ['enable_packing == 1', { |
47 'message': 'Packing ARM relative relocations for <(_target_name)', | 40 'message': 'Packing relocations for <(_target_name)', |
48 'dependencies': [ | 41 'dependencies': [ |
49 '<(DEPTH)/tools/relocation_packer/relocation_packer.gyp:relocation_packe
r#host', | 42 '<(DEPTH)/third_party/android_platform/relocation_packer.gyp:android_rel
ocation_packer#host', |
50 ], | 43 ], |
51 'inputs': [ | 44 'inputs': [ |
52 '<(PRODUCT_DIR)/relocation_packer', | 45 '<(PRODUCT_DIR)/android_relocation_packer', |
53 ], | 46 ], |
54 'action': [ | 47 'action': [ |
55 'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py', | 48 'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py', |
56 '--configuration-name=<(CONFIGURATION_NAME)', | 49 '--configuration-name=<(CONFIGURATION_NAME)', |
57 '--enable-packing=1', | 50 '--enable-packing=1', |
58 '--has-relocations-with-addends=<(has_relocations_with_addends)', | |
59 '--exclude-packing-list=<@(exclude_packing_list)', | 51 '--exclude-packing-list=<@(exclude_packing_list)', |
60 '--android-pack-relocations=<(PRODUCT_DIR)/relocation_packer', | 52 '--android-pack-relocations=<(PRODUCT_DIR)/android_relocation_packer', |
61 '--android-objcopy=<(android_objcopy)', | |
62 '--stripped-libraries-dir=<(stripped_libraries_dir)', | 53 '--stripped-libraries-dir=<(stripped_libraries_dir)', |
63 '--packed-libraries-dir=<(packed_libraries_dir)', | 54 '--packed-libraries-dir=<(packed_libraries_dir)', |
64 '--libraries=@FileArg(<(ordered_libraries_file):libraries)', | 55 '--libraries=@FileArg(<(ordered_libraries_file):libraries)', |
65 '--stamp=<(stamp)', | 56 '--stamp=<(stamp)', |
66 ], | 57 ], |
67 }, { | 58 }, { |
68 'message': 'Copying libraries (no relocation packing) for <(_target_name)'
, | 59 'message': 'Copying libraries (no relocation packing) for <(_target_name)'
, |
69 'action': [ | 60 'action': [ |
70 'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py', | 61 'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py', |
71 '--configuration-name=<(CONFIGURATION_NAME)', | 62 '--configuration-name=<(CONFIGURATION_NAME)', |
72 '--enable-packing=0', | 63 '--enable-packing=0', |
73 '--stripped-libraries-dir=<(stripped_libraries_dir)', | 64 '--stripped-libraries-dir=<(stripped_libraries_dir)', |
74 '--packed-libraries-dir=<(packed_libraries_dir)', | 65 '--packed-libraries-dir=<(packed_libraries_dir)', |
75 '--libraries=@FileArg(<(ordered_libraries_file):libraries)', | 66 '--libraries=@FileArg(<(ordered_libraries_file):libraries)', |
76 '--stamp=<(stamp)', | 67 '--stamp=<(stamp)', |
77 ], | 68 ], |
78 }], | 69 }], |
79 ['component == "shared_library"', { | 70 ['component == "shared_library"', { |
80 # Add a fake output to force the build to always re-run this step. This | 71 # Add a fake output to force the build to always re-run this step. This |
81 # is required because the real inputs are not known at gyp-time and | 72 # is required because the real inputs are not known at gyp-time and |
82 # changing base.so may not trigger changes to dependent libraries. | 73 # changing base.so may not trigger changes to dependent libraries. |
83 'outputs': [ '<(stamp).fake' ] | 74 'outputs': [ '<(stamp).fake' ] |
84 }], | 75 }], |
85 ], | 76 ], |
86 } | 77 } |
OLD | NEW |