Index: chrome/tools/build/mac/copy_keystone_framework.py |
diff --git a/chrome/tools/build/mac/copy_keystone_framework.py b/chrome/tools/build/mac/copy_keystone_framework.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b43893bf8aa7847375a04c421d849f2dde69a4d3 |
--- /dev/null |
+++ b/chrome/tools/build/mac/copy_keystone_framework.py |
@@ -0,0 +1,43 @@ |
+# Copyright 2016 The Chromium 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 os.path |
+import shutil |
+import subprocess |
+import sys |
+ |
+# Usage: python copy_keystone_framework.py /path/to/input /path/to/output |
+# |
+# This script copies the KeystoneRegistration.framework, removing its |
+# versioned directory structure, thinning it to just x86_64, and deleting |
+# the Headers directory. |
+ |
+def Main(args): |
+ if len(args) != 3: |
+ print >> sys.stderr, '%s: /path/to/input /path/to/output' % (args[0],) |
+ return 1 |
+ |
+ # Delete any old copies of the framework. |
+ output_path = os.path.join(args[2], 'KeystoneRegistration.framework') |
+ if os.path.exists(output_path): |
+ shutil.rmtree(output_path) |
+ |
+ # Copy the framework out of its versioned directory. Use rsync to exclude |
+ # dotfiles and the Headers directories. |
+ subprocess.check_call( |
+ ['rsync', '-acC', '--delete', |
+ '--exclude', 'Headers', '--exclude', 'PrivateHeaders', |
+ '--include', '*.so', |
+ os.path.join(args[1], 'Versions/Current/'), |
+ output_path]) |
+ |
+ # Thin the library to just the required arch. |
+ library_path = os.path.join(output_path, 'KeystoneRegistration') |
+ subprocess.check_call( |
+ ['lipo', '-thin', 'x86_64', library_path, '-o', library_path]) |
+ return 0 |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(Main(sys.argv)) |