Completed script to make OS X app bundles, seems to pack up correctly my PPC build without ffmpeg, assuming it'll do anything else correctly too
Originally committed to SVN as r2487.
This commit is contained in:
parent
802fd34d54
commit
f77a4ccd22
1 changed files with 56 additions and 3 deletions
|
@ -5,15 +5,68 @@ test -e $1 && ( echo "$1 already exists, will not overwrite."; exit 1 )
|
||||||
|
|
||||||
echo "Making directory structure..."
|
echo "Making directory structure..."
|
||||||
mkdir $1 || ( echo "Failed creating directory $1"; exit 1 )
|
mkdir $1 || ( echo "Failed creating directory $1"; exit 1 )
|
||||||
mkdir $1/Contents mkdir $1/Contents/MacOS
|
mkdir $1/Contents $1/Contents/MacOS $1/Contents/Resources
|
||||||
mkdir $1/Contents/Resources
|
|
||||||
|
|
||||||
echo "Copying files into package..."
|
echo "Copying files into package..."
|
||||||
cp aegisub/macosx/Info.plist $1/Contents
|
cp aegisub/macosx/Info.plist $1/Contents
|
||||||
cp aegisub/aegisub $1/Contents/MacOS
|
cp aegisub/aegisub $1/Contents/MacOS
|
||||||
cp aegisub/macosx/*.icns $1/Contents/Resources
|
cp aegisub/macosx/*.icns $1/Contents/Resources
|
||||||
|
|
||||||
echo "Here we should be finding and fixing up libraries"
|
echo "Now about to collect and fix up shared libraries..."
|
||||||
|
|
||||||
|
python - $1/Contents/MacOS/aegisub <<FIXLIBS_END
|
||||||
|
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
|
||||||
|
|
||||||
|
def otool(cmdline):
|
||||||
|
pipe = os.popen("otool " + cmdline, 'r')
|
||||||
|
output = pipe.readlines()
|
||||||
|
pipe.close()
|
||||||
|
return output
|
||||||
|
|
||||||
|
def collectlibs(lib, masterlist, targetdir):
|
||||||
|
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"
|
||||||
|
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 " ...done. Will now fix up 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 libbase,
|
||||||
|
sys.stdout.flush()
|
||||||
|
print
|
||||||
|
print "All done!"
|
||||||
|
FIXLIBS_END
|
||||||
|
|
||||||
echo "Done creating $1!"
|
echo "Done creating $1!"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue