* 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:
Amar Takhar 2008-12-29 04:41:00 +00:00
parent 954d7282aa
commit a41e1279b4
2 changed files with 44 additions and 15 deletions

View file

@ -1,19 +1,35 @@
#!/bin/bash
test -f aegisub/.libs/aegisub && test -x aegisub/.libs/aegisub || ( exit "Make sure you're in the right dir"; exit 1 )
test -e $1 && ( echo "$1 already exists, will not overwrite."; exit 1 )
PKG_DIR=${1}.app
SKEL_DIR="packages/osx_bundle"
echo "Making directory structure..."
mkdir $1 || ( echo "Failed creating directory $1"; exit 1 )
mkdir $1/Contents $1/Contents/MacOS $1/Contents/Resources
if ! test -d packages/osx_bundle; then
echo "Make sure you're in the toplevel source directory"
exit 1;
fi
echo "Copying files into package..."
cp aegisub/macosx/Info.plist $1/Contents
cp aegisub/.libs/aegisub $1/Contents/MacOS
cp aegisub/macosx/*.icns $1/Contents/Resources
echo "Removing ${PKG_DIR}"
rm -rf ${PKG_DIR}
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}"

View file

@ -8,6 +8,7 @@ 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')
@ -16,6 +17,7 @@ def otool(cmdline):
return output
def collectlibs(lib, masterlist, targetdir):
global goodlist
liblist = otool("-L " + lib)
locallist = []
for l in liblist:
@ -26,9 +28,11 @@ def collectlibs(lib, masterlist, targetdir):
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,
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)
@ -39,7 +43,15 @@ print "Searching for libraries in ", binname, "..."
libs = [binname]
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 "
for lib in libs:
libbase = os.path.basename(lib)
@ -47,7 +59,8 @@ for lib in libs:
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,
print lib, "-> @executable_path/" + libbase
sys.stdout.flush()
print
print "All done!"