mirror of https://github.com/odrling/Aegisub
* Fix sh script to use new paths.
* Change osx-fix-libs.py to print system libraries used Originally committed to SVN as r2546.
This commit is contained in:
parent
954d7282aa
commit
a41e1279b4
|
@ -1,19 +1,35 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -f aegisub/.libs/aegisub && test -x aegisub/.libs/aegisub || ( exit "Make sure you're in the right dir"; exit 1 )
|
PKG_DIR=${1}.app
|
||||||
test -e $1 && ( echo "$1 already exists, will not overwrite."; exit 1 )
|
SKEL_DIR="packages/osx_bundle"
|
||||||
|
|
||||||
echo "Making directory structure..."
|
if ! test -d packages/osx_bundle; then
|
||||||
mkdir $1 || ( echo "Failed creating directory $1"; exit 1 )
|
echo "Make sure you're in the toplevel source directory"
|
||||||
mkdir $1/Contents $1/Contents/MacOS $1/Contents/Resources
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Copying files into package..."
|
echo "Removing ${PKG_DIR}"
|
||||||
cp aegisub/macosx/Info.plist $1/Contents
|
rm -rf ${PKG_DIR}
|
||||||
cp aegisub/.libs/aegisub $1/Contents/MacOS
|
|
||||||
cp aegisub/macosx/*.icns $1/Contents/Resources
|
|
||||||
|
|
||||||
echo "Now about to collect and fix up shared libraries..."
|
echo
|
||||||
|
echo "---- Directory Structure ----"
|
||||||
|
mkdir -v ${PKG_DIR}
|
||||||
|
mkdir -v ${PKG_DIR}/Contents
|
||||||
|
mkdir -v ${PKG_DIR}/Contents/MacOS
|
||||||
|
mkdir -v ${PKG_DIR}/Contents/Resources
|
||||||
|
|
||||||
python scripts/osx-fix-libs.py "$1/Contents/MacOS/aegisub"
|
echo
|
||||||
|
echo "---- Copying Skel Files ----"
|
||||||
|
cp -v ${SKEL_DIR}/Contents/Resources/* ${PKG_DIR}/Contents/Resources
|
||||||
|
cp -v ${SKEL_DIR}/Contents/Info.plist ${PKG_DIR}/Contents
|
||||||
|
|
||||||
echo "Done creating $1!"
|
echo
|
||||||
|
echo "---- Binaries ----"
|
||||||
|
cp -v aegisub/.libs/aegisub ${PKG_DIR}/Contents/MacOS
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "---- Libraries ----"
|
||||||
|
python scripts/osx-fix-libs.py "${PKG_DIR}/Contents/MacOS/aegisub"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Done Creating ${PKG_DIR}"
|
||||||
|
|
|
@ -8,6 +8,7 @@ import shutil
|
||||||
is_bad_lib = re.compile(r'(/usr/local|/opt)').match
|
is_bad_lib = re.compile(r'(/usr/local|/opt)').match
|
||||||
is_sys_lib = re.compile(r'(/usr|/System)').match
|
is_sys_lib = re.compile(r'(/usr|/System)').match
|
||||||
otool_libname_extract = re.compile(r'\s+(/.*?)[\(\s:]').search
|
otool_libname_extract = re.compile(r'\s+(/.*?)[\(\s:]').search
|
||||||
|
goodlist = []
|
||||||
|
|
||||||
def otool(cmdline):
|
def otool(cmdline):
|
||||||
pipe = os.popen("otool " + cmdline, 'r')
|
pipe = os.popen("otool " + cmdline, 'r')
|
||||||
|
@ -16,6 +17,7 @@ def otool(cmdline):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def collectlibs(lib, masterlist, targetdir):
|
def collectlibs(lib, masterlist, targetdir):
|
||||||
|
global goodlist
|
||||||
liblist = otool("-L " + lib)
|
liblist = otool("-L " + lib)
|
||||||
locallist = []
|
locallist = []
|
||||||
for l in liblist:
|
for l in liblist:
|
||||||
|
@ -26,9 +28,11 @@ def collectlibs(lib, masterlist, targetdir):
|
||||||
sys.exit("Linking with library in blacklisted location: " + l)
|
sys.exit("Linking with library in blacklisted location: " + l)
|
||||||
if not is_sys_lib(l) and not l in masterlist:
|
if not is_sys_lib(l) and not l in masterlist:
|
||||||
locallist.append(l)
|
locallist.append(l)
|
||||||
print " ...found ", l,
|
print "found ", l,
|
||||||
shutil.copy(l, targetdir)
|
shutil.copy(l, targetdir)
|
||||||
print " ...copied to target"
|
print " ...copied to target"
|
||||||
|
elif not l in goodlist and not l in masterlist:
|
||||||
|
goodlist.append(l)
|
||||||
masterlist.extend(locallist)
|
masterlist.extend(locallist)
|
||||||
for l in locallist:
|
for l in locallist:
|
||||||
collectlibs(l, masterlist, targetdir)
|
collectlibs(l, masterlist, targetdir)
|
||||||
|
@ -39,7 +43,15 @@ print "Searching for libraries in ", binname, "..."
|
||||||
libs = [binname]
|
libs = [binname]
|
||||||
collectlibs(sys.argv[1], libs, targetdir)
|
collectlibs(sys.argv[1], libs, targetdir)
|
||||||
|
|
||||||
print " ...done. Will now fix up library install names..."
|
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 "
|
in_tool_cmdline = "install_name_tool "
|
||||||
for lib in libs:
|
for lib in libs:
|
||||||
libbase = os.path.basename(lib)
|
libbase = os.path.basename(lib)
|
||||||
|
@ -47,7 +59,8 @@ for lib in libs:
|
||||||
for lib in libs:
|
for lib in libs:
|
||||||
libbase = os.path.basename(lib)
|
libbase = os.path.basename(lib)
|
||||||
os.system("%s -id @executable_path/%s '%s/%s'" % (in_tool_cmdline, libbase, targetdir, libbase))
|
os.system("%s -id @executable_path/%s '%s/%s'" % (in_tool_cmdline, libbase, targetdir, libbase))
|
||||||
print libbase,
|
print lib, "-> @executable_path/" + libbase
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
print
|
print
|
||||||
print "All done!"
|
print "All done!"
|
||||||
|
|
Loading…
Reference in New Issue