mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Prior to this the Android embedder code would extract the icudtl.dat asset out of the APK and write it to local disk during the first startup of the app. This change will make that work unnecessary and eliminate the risk of ICU failures due to errors in the extraction process.
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
#!/usr/bin/env python
|
|
# Copyright 2013 The Flutter Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import argparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
# BFD architecture names recognized by objcopy.
|
|
BFD_ARCH = {
|
|
'arm': 'arm',
|
|
'arm64': 'aarch64',
|
|
'x86': 'i386',
|
|
'x64': 'i386:x86-64',
|
|
}
|
|
|
|
# BFD target names recognized by objcopy.
|
|
BFD_TARGET = {
|
|
'arm': 'elf32-littlearm',
|
|
'arm64': 'elf64-littleaarch64',
|
|
'x86': 'elf32-i386',
|
|
'x64': 'elf64-x86-64',
|
|
}
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Convert a data file to an object file')
|
|
parser.add_argument('--objcopy', type=str, required=True)
|
|
parser.add_argument('--input', type=str, required=True)
|
|
parser.add_argument('--output', type=str, required=True)
|
|
parser.add_argument('--arch', type=str, required=True)
|
|
|
|
args = parser.parse_args()
|
|
|
|
input_dir, input_file = os.path.split(args.input)
|
|
output_path = os.path.abspath(args.output)
|
|
|
|
subprocess.check_call([
|
|
args.objcopy,
|
|
'-I', 'binary',
|
|
'-O', BFD_TARGET[args.arch],
|
|
'-B', BFD_ARCH[args.arch],
|
|
input_file,
|
|
output_path,
|
|
], cwd=input_dir)
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|