changeset 3220:de181f6edcbf

[Darwin] darwin_files/standalone.py: Add command to strip Mach-O files in the app bundle
author Anirudha Bose <ani07nov@gmail.com>
date Sun, 22 Sep 2013 00:37:55 +0530
parents cab5cbcb6e54
children df242658d93d
files darwin_files/standalone.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/darwin_files/standalone.py
+++ b/darwin_files/standalone.py
@@ -33,8 +33,8 @@
 import sys
 
 def dylibs_fix(path):
-    print(path)
     m = MachO(path)
+    os.system("sudo strip "+path+" 2>/dev/null")
     for header in m.headers:
         seen = set()
         for idx, name, other in header.walkRelocatables():
@@ -42,14 +42,13 @@
                 seen.add(other)
                 relative_name = other[other.find("lib"):]
                 if other.startswith("/Users"):
-                        command = 'install_name_tool -change "%s" "@executable_path/../%s" ./%s\n'%(other,relative_name,path)
-                        print(command)
+                        command = 'sudo install_name_tool -change "%s" "@executable_path/../%s" ./%s'%(other,relative_name,path)
                         os.system(command)
                 elif other.endswith(".so") and not other.startswith("@executable_path"):
-                        command = 'install_name_tool -change "%s" "@executable_path/../lib/%s" ./%s\n'%(other,other,path)
-                        print(command)
+                        command = 'sudo install_name_tool -change "%s" "@executable_path/../lib/%s" ./%s'%(other,other,path)
                         os.system(command)
 def main():
+        print("Stripping Mach-O files and rewriting Mach-O headers ...")
         for path in sys.stdin:
                 dylibs_fix(path.replace('\n',''))