Restrict relocation packing to Release build.
Pass CONFIGURATION_NAME as an argument to pack_arm_relocations.py, and turn on packing only if its value is 'Release'. (CONFIGURATION_NAME cannot be used in conditionals because it is not resolved until after the conditional has been processed.) Prior art: https://code.google.com/p/chromium/codesearch#chromium/src/build/android/gyp/apk_obfuscate.py&l=103 https://code.google.com/p/chromium/codesearch#chromium/src/build/java_apk.gypi&l=742 BUG=385553 Review URL: https://codereview.chromium.org/396283002 git-svn-id: http://src.chromium.org/svn/trunk/src/build@283721 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
b98bd1596b
Коммит
c4afee99f3
|
@ -6,10 +6,11 @@
|
|||
|
||||
"""Pack ARM relative relocations in a library (or copy unchanged).
|
||||
|
||||
If --enable-packing, invoke the relocation_packer tool to pack the .rel.dyn
|
||||
section in the given library files. This step is inserted after the libraries
|
||||
are stripped. Packing adds a new .android.rel.dyn section to the file and
|
||||
reduces the size of .rel.dyn accordingly.
|
||||
If --enable-packing and --configuration-name=='Release', invoke the
|
||||
relocation_packer tool to pack the .rel.dyn section in the given library
|
||||
files. This step is inserted after the libraries are stripped. Packing
|
||||
adds a new .android.rel.dyn section to the file and reduces the size of
|
||||
.rel.dyn accordingly.
|
||||
|
||||
Currently packing only understands ARM32 shared libraries. For all other
|
||||
architectures --enable-packing should be set to zero. In this case the
|
||||
|
@ -61,9 +62,13 @@ def CopyArmLibraryUnchanged(library_path, output_path):
|
|||
def main():
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
parser.add_option('--configuration-name',
|
||||
default='Release',
|
||||
help='Gyp configuration name (i.e. Debug, Release)')
|
||||
parser.add_option('--enable-packing',
|
||||
choices=['0', '1'],
|
||||
help='Pack relocations if 1, otherwise plain file copy')
|
||||
help=('Pack relocations if 1 and configuration name is \'Release\','
|
||||
' otherwise plain file copy'))
|
||||
parser.add_option('--exclude-packing-list',
|
||||
default='',
|
||||
help='Names of any libraries explicitly not packed')
|
||||
|
@ -80,7 +85,8 @@ def main():
|
|||
parser.add_option('--stamp', help='Path to touch on success')
|
||||
|
||||
options, _ = parser.parse_args()
|
||||
enable_packing = options.enable_packing == '1'
|
||||
enable_packing = (options.enable_packing == '1' and
|
||||
options.configuration_name == 'Release')
|
||||
exclude_packing_set = set(shlex.split(options.exclude_packing_list))
|
||||
|
||||
with open(options.libraries_file, 'r') as libfile:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# found in the LICENSE file.
|
||||
|
||||
# This file is meant to be included into an action to provide a rule that
|
||||
# packs ARM relative relocations in native libraries.
|
||||
# packs ARM relative relocations in Release builds of native libraries.
|
||||
#
|
||||
# To use this, create a gyp target with the following form:
|
||||
# {
|
||||
|
@ -46,6 +46,7 @@
|
|||
],
|
||||
'action': [
|
||||
'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py',
|
||||
'--configuration-name=<(CONFIGURATION_NAME)',
|
||||
'--enable-packing=1',
|
||||
'--exclude-packing-list=<@(exclude_packing_list)',
|
||||
'--android-pack-relocations=<(PRODUCT_DIR)/relocation_packer',
|
||||
|
@ -59,6 +60,7 @@
|
|||
'message': 'Copying libraries (no relocation packing) for <(_target_name)',
|
||||
'action': [
|
||||
'python', '<(DEPTH)/build/android/gyp/pack_arm_relocations.py',
|
||||
'--configuration-name=<(CONFIGURATION_NAME)',
|
||||
'--enable-packing=0',
|
||||
'--stripped-libraries-dir=<(stripped_libraries_dir)',
|
||||
'--packed-libraries-dir=<(packed_libraries_dir)',
|
||||
|
|
Загрузка…
Ссылка в новой задаче