File: bundleify.sh

package info (click to toggle)
patchage 0.5.0%2Bdfsg0-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,512 kB
  • sloc: python: 11,225; cpp: 5,306; sh: 35; makefile: 12
file content (33 lines) | stat: -rwxr-xr-x 1,070 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

bundle=$1
exe=$2

libs="`otool -L $exe | grep '\.dylib\|\.so' | grep '/User\|/opt/local' | sed 's/(.*//'`"

mkdir "$bundle/Contents/lib"
for l in $libs; do
	cp $l $bundle/Contents/lib
done

mkdir "$bundle/Contents/lib/engines"
cp /opt/local/lib/gtk-2.0/2.10.0/engines/libclearlooks.so $bundle/Contents/lib/engines

mkdir "$bundle/Contents/lib/modules"
cp /opt/local/lib/pango/1.6.0/modules/*basic*.so $bundle/Contents/lib/modules

reclibs="`otool -L $bundle/Contents/lib/engines/* $bundle/Contents/lib/modules/* | grep '\.dylib\|\.so' | grep '/User\|/opt/local' | sed 's/(.*//'`"

for l in $libs $reclibs; do
	lname=`echo $l | sed 's/.*\///'`
	lid="@executable_path/lib/$lname"
	lpath="$bundle/Contents/lib/$lname"
	install_name_tool -id $lid $lpath
	install_name_tool -change $l $lid $exe
	for j in `find $bundle -name '*.so' -or -name '*.dylib'`; do
		install_name_tool -change $l $lid $j
	done;
done

echo "External library references:"
otool -L $exe `find $bundle -name '*.so' -or -name '*.dylib'` | grep -v ':' | grep -v '@executable_path' | sort | uniq