Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: build/android/gyp/write_ordered_libraries.py

Issue 334783006: Allow the mojo shell to run on android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Writes dependency ordered list of native libraries. 7 """Writes dependency ordered list of native libraries.
8 8
9 The list excludes any Android system libraries, as those are not bundled with 9 The list excludes any Android system libraries, as those are not bundled with
10 the APK. 10 the APK.
(...skipping 15 matching lines...) Expand all
26 import sys 26 import sys
27 27
28 from util import build_utils 28 from util import build_utils
29 29
30 _options = None 30 _options = None
31 _library_re = re.compile( 31 _library_re = re.compile(
32 '.*NEEDED.*Shared library: \[(?P<library_name>[\w/.]+)\]') 32 '.*NEEDED.*Shared library: \[(?P<library_name>[\w/.]+)\]')
33 33
34 34
35 def FullLibraryPath(library_name): 35 def FullLibraryPath(library_name):
36 return '%s/%s' % (_options.libraries_dir, library_name) 36 for directory in _options.libraries_dir.split(','):
37 path = '%s/%s' % (directory, library_name)
38 if os.path.exists(path):
39 return path
40 return library_name
37 41
38 42
39 def IsSystemLibrary(library_name): 43 def IsSystemLibrary(library_name):
40 # If the library doesn't exist in the libraries directory, assume that it is 44 # If the library doesn't exist in the libraries directory, assume that it is
41 # an Android system library. 45 # an Android system library.
42 return not os.path.exists(FullLibraryPath(library_name)) 46 return not os.path.exists(FullLibraryPath(library_name))
43 47
44 48
45 def CallReadElf(library_or_executable): 49 def CallReadElf(library_or_executable):
46 readelf_cmd = [_options.readelf, 50 readelf_cmd = [_options.readelf,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 parser.add_option('--libraries-dir', 103 parser.add_option('--libraries-dir',
100 help='The directory which contains shared libraries.') 104 help='The directory which contains shared libraries.')
101 parser.add_option('--readelf', help='Path to the readelf binary.') 105 parser.add_option('--readelf', help='Path to the readelf binary.')
102 parser.add_option('--output', help='Path to the generated .json file.') 106 parser.add_option('--output', help='Path to the generated .json file.')
103 parser.add_option('--stamp', help='Path to touch on success.') 107 parser.add_option('--stamp', help='Path to touch on success.')
104 108
105 global _options 109 global _options
106 _options, _ = parser.parse_args() 110 _options, _ = parser.parse_args()
107 111
108 libraries = build_utils.ParseGypList(_options.input_libraries) 112 libraries = build_utils.ParseGypList(_options.input_libraries)
109 if libraries[0].endswith('.so'): 113 if len(libraries):
110 libraries = [os.path.basename(lib) for lib in libraries] 114 if libraries[0].endswith('.so'):
111 libraries = GetSortedTransitiveDependencies(libraries) 115 libraries = [os.path.basename(lib) for lib in libraries]
112 else: 116 libraries = GetSortedTransitiveDependencies(libraries)
113 libraries = GetSortedTransitiveDependenciesForExecutable(libraries[0]) 117 else:
118 libraries = GetSortedTransitiveDependenciesForExecutable(libraries[0])
114 119
115 build_utils.WriteJson(libraries, _options.output, only_if_changed=True) 120 build_utils.WriteJson(libraries, _options.output, only_if_changed=True)
116 121
117 if _options.stamp: 122 if _options.stamp:
118 build_utils.Touch(_options.stamp) 123 build_utils.Touch(_options.stamp)
119 124
120 125
121 if __name__ == '__main__': 126 if __name__ == '__main__':
122 sys.exit(main()) 127 sys.exit(main())
123 128
124 129
OLDNEW
« no previous file with comments | « build/android/gyp/strip_library_for_device.py ('k') | build/android/strip_native_libraries.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698