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
3 # found in the LICENSE file.
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.
8 # To use this, create a gyp target with the following form:
10 # 'action_name': 'pack_arm_relocations',
13 # 'enable_packing': 'pack relocations if 1, plain file copy if 0'
14 # 'exclude_packing_list': 'names of libraries explicitly not packed',
15 # 'ordered_libraries_file': 'file generated by write_ordered_libraries'
16 # 'input_paths': 'files to be added to the list of inputs'
17 # 'stamp': 'file to touch when the action is complete'
18 # 'stripped_libraries_dir': 'directory holding stripped libraries',
19 # 'packed_libraries_dir': 'directory holding packed libraries',
20 # 'includes': [ '../../build/android/pack_arm_relocations.gypi' ],
29 ['target_arch == "arm64"', {
30 'has_relocations_with_addends': 1,
32 'has_relocations_with_addends': 0,
37 '<(DEPTH)/build/android/gyp/util/build_utils.py',
38 '<(DEPTH)/build/android/gyp/pack_arm_relocations.py',
39 '<(ordered_libraries_file)',
46 ['enable_packing == 1', {
47 'message': 'Packing ARM relative relocations for <(_target_name)',
49 '<(DEPTH)/tools/relocation_packer/relocation_packer.gyp:relocation_packer#host',
52 '<(PRODUCT_DIR)/relocation_packer',
55 'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py',
56 '--configuration-name=<(CONFIGURATION_NAME)',
58 '--has-relocations-with-addends=<(has_relocations_with_addends)',
59 '--exclude-packing-list=<@(exclude_packing_list)',
60 '--android-pack-relocations=<(PRODUCT_DIR)/relocation_packer',
61 '--android-objcopy=<(android_objcopy)',
62 '--stripped-libraries-dir=<(stripped_libraries_dir)',
63 '--packed-libraries-dir=<(packed_libraries_dir)',
64 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
68 'message': 'Copying libraries (no relocation packing) for <(_target_name)',
70 'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py',
71 '--configuration-name=<(CONFIGURATION_NAME)',
73 '--stripped-libraries-dir=<(stripped_libraries_dir)',
74 '--packed-libraries-dir=<(packed_libraries_dir)',
75 '--libraries=@FileArg(<(ordered_libraries_file):libraries)',
79 ['component == "shared_library"', {
80 # 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
82 # changing base.so may not trigger changes to dependent libraries.
83 'outputs': [ '<(stamp).fake' ]