91d73ec8ea
1. cd aegisub/ 2. svn mv *cpp *h src/ 3. svn mv Makefile.am MatroskaParser.c auto4_perldata.inc bitmaps boost \ changelog.txt config gl include libosxutil libresrc md5.c msvc mythes.cxx \ mythes.hxx res.rc src/ 4. cd .. 5. svn mv FFmpegSource2/ INSTALL Makefile.am README acinclude.m4 \ autogen.sh automation/ bin build configure.in desktop dummy.txt lib \ libass/ m4macros/ packages/ po/ scripts/ universalchardet/ aegisub/ 6. mkdir -p docs/wiki_convert 7. svn add docs/wiki_convert 8. cd docs 9. svn mv aegisub_convert_docs.pl convert.bat output wiki_convert/ * See r2749 for full description. Originally committed to SVN as r2752.
66 lines
1.6 KiB
Python
Executable file
66 lines
1.6 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import re
|
|
import sys
|
|
import os
|
|
import shutil
|
|
|
|
is_bad_lib = re.compile(r'(/usr/local|/opt)').match
|
|
is_sys_lib = re.compile(r'(/usr|/System)').match
|
|
otool_libname_extract = re.compile(r'\s+(/.*?)[\(\s:]').search
|
|
goodlist = []
|
|
|
|
def otool(cmdline):
|
|
pipe = os.popen("otool " + cmdline, 'r')
|
|
output = pipe.readlines()
|
|
pipe.close()
|
|
return output
|
|
|
|
def collectlibs(lib, masterlist, targetdir):
|
|
global goodlist
|
|
liblist = otool("-L " + lib)
|
|
locallist = []
|
|
for l in liblist:
|
|
lr = otool_libname_extract(l)
|
|
if not lr: continue
|
|
l = lr.group(1)
|
|
if is_bad_lib(l):
|
|
sys.exit("Linking with library in blacklisted location: " + l)
|
|
if not is_sys_lib(l) and not l in masterlist:
|
|
locallist.append(l)
|
|
print "found ", l,
|
|
shutil.copy(l, targetdir)
|
|
print " ...copied to target"
|
|
elif not l in goodlist and not l in masterlist:
|
|
goodlist.append(l)
|
|
masterlist.extend(locallist)
|
|
for l in locallist:
|
|
collectlibs(l, masterlist, targetdir)
|
|
|
|
binname = sys.argv[1]
|
|
targetdir = os.path.dirname(binname)
|
|
print "Searching for libraries in ", binname, "..."
|
|
libs = [binname]
|
|
collectlibs(sys.argv[1], libs, targetdir)
|
|
|
|
print
|
|
print "System libraries used..."
|
|
goodlist.sort()
|
|
for l in goodlist:
|
|
print l
|
|
|
|
|
|
print
|
|
print "Fixing library install names..."
|
|
in_tool_cmdline = "install_name_tool "
|
|
for lib in libs:
|
|
libbase = os.path.basename(lib)
|
|
in_tool_cmdline = in_tool_cmdline + ("-change %s @executable_path/%s " % (lib, libbase))
|
|
for lib in libs:
|
|
libbase = os.path.basename(lib)
|
|
os.system("%s -id @executable_path/%s '%s/%s'" % (in_tool_cmdline, libbase, targetdir, libbase))
|
|
print lib, "-> @executable_path/" + libbase
|
|
sys.stdout.flush()
|
|
|
|
print
|
|
print "All done!"
|