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

Side by Side Diff: tools/create_sdk.py

Issue 2720613004: [Fuchsia] Adds an option to create_sdk.py to skip binary stripping (Closed)
Patch Set: Rename flag no_strip -> disable_stripping Created 3 years, 9 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
« no previous file with comments | « BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 # A script which will be invoked from gyp to create an SDK. 7 # A script which will be invoked from gyp to create an SDK.
8 # 8 #
9 # Usage: create_sdk.py sdk_directory 9 # Usage: create_sdk.py sdk_directory
10 # 10 #
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 def GetOptions(): 90 def GetOptions():
91 options = optparse.OptionParser(usage='usage: %prog [options]') 91 options = optparse.OptionParser(usage='usage: %prog [options]')
92 options.add_option("--sdk_output_dir", 92 options.add_option("--sdk_output_dir",
93 help='Where to output the sdk') 93 help='Where to output the sdk')
94 options.add_option("--snapshot_location", 94 options.add_option("--snapshot_location",
95 help='Location of the snapshots.') 95 help='Location of the snapshots.')
96 options.add_option("--copy_libs", 96 options.add_option("--copy_libs",
97 action="store_true", default=False, 97 action="store_true", default=False,
98 help='Copy dynamically linked libraries to the SDK bin directory.') 98 help='Copy dynamically linked libraries to the SDK bin directory.')
99 options.add_option("--disable_stripping",
100 action="store_true", default=False,
101 help='Do not try to strip binaries. Use when they are already stripped')
99 return options.parse_args() 102 return options.parse_args()
100 103
101 104
102 def ReplaceInFiles(paths, subs): 105 def ReplaceInFiles(paths, subs):
103 """Reads a series of files, applies a series of substitutions to each, and 106 """Reads a series of files, applies a series of substitutions to each, and
104 saves them back out. subs should by a list of (pattern, replace) tuples.""" 107 saves them back out. subs should by a list of (pattern, replace) tuples."""
105 for path in paths: 108 for path in paths:
106 contents = open(path).read() 109 contents = open(path).read()
107 for pattern, replace in subs: 110 for pattern, replace in subs:
108 contents = re.sub(pattern, replace, contents) 111 contents = re.sub(pattern, replace, contents)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if HOST_OS == 'win32': 233 if HOST_OS == 'win32':
231 dart_file_extension = '.exe' 234 dart_file_extension = '.exe'
232 dart_import_lib_src = join(HOME, build_dir, 'dart.lib') 235 dart_import_lib_src = join(HOME, build_dir, 'dart.lib')
233 dart_import_lib_dest = join(BIN, 'dart.lib') 236 dart_import_lib_dest = join(BIN, 'dart.lib')
234 copyfile(dart_import_lib_src, dart_import_lib_dest) 237 copyfile(dart_import_lib_src, dart_import_lib_dest)
235 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) 238 dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension)
236 dart_dest_binary = join(BIN, 'dart' + dart_file_extension) 239 dart_dest_binary = join(BIN, 'dart' + dart_file_extension)
237 copyfile(dart_src_binary, dart_dest_binary) 240 copyfile(dart_src_binary, dart_dest_binary)
238 copymode(dart_src_binary, dart_dest_binary) 241 copymode(dart_src_binary, dart_dest_binary)
239 # Strip the binaries on platforms where that is supported. 242 # Strip the binaries on platforms where that is supported.
240 if HOST_OS == 'linux': 243 if HOST_OS == 'linux' and not options.disable_stripping:
241 subprocess.call(['strip', dart_dest_binary]) 244 subprocess.call(['strip', dart_dest_binary])
242 elif HOST_OS == 'macos': 245 elif HOST_OS == 'macos' and not options.disable_stripping:
243 subprocess.call(['strip', '-x', dart_dest_binary]) 246 subprocess.call(['strip', '-x', dart_dest_binary])
244 247
245 # 248 #
246 # Create and populate sdk/include. 249 # Create and populate sdk/include.
247 # 250 #
248 INCLUDE = join(SDK_tmp, 'include') 251 INCLUDE = join(SDK_tmp, 'include')
249 os.makedirs(INCLUDE) 252 os.makedirs(INCLUDE)
250 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'), 253 copyfile(join(HOME, 'runtime', 'include', 'dart_api.h'),
251 join(INCLUDE, 'dart_api.h')) 254 join(INCLUDE, 'dart_api.h'))
252 copyfile(join(HOME, 'runtime', 'include', 'dart_mirrors_api.h'), 255 copyfile(join(HOME, 'runtime', 'include', 'dart_mirrors_api.h'),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 f.close() 351 f.close()
349 352
350 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 353 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
351 Copy(join(HOME, 'LICENSE'), join(SDK_tmp, 'LICENSE')) 354 Copy(join(HOME, 'LICENSE'), join(SDK_tmp, 'LICENSE'))
352 Copy(join(HOME, 'sdk', 'api_readme.md'), join(SDK_tmp, 'lib', 'api_readme.md') ) 355 Copy(join(HOME, 'sdk', 'api_readme.md'), join(SDK_tmp, 'lib', 'api_readme.md') )
353 356
354 move(SDK_tmp, SDK) 357 move(SDK_tmp, SDK)
355 358
356 if __name__ == '__main__': 359 if __name__ == '__main__':
357 sys.exit(Main()) 360 sys.exit(Main())
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698