Ticket #3378: patch-complete-bundle.sh

File patch-complete-bundle.sh, 1.5 KB (added by jyrki.wahlstedt@…, 19 years ago)

patch to create pgAdmin3 bundle completing shell script (missing from the archive)

Line 
1--- pkg/mac/complete-bundle.sh  1970-01-01 02:00:00.000000000 +0200
2+++ pkg/mac/complete-bundle.sh  2005-05-20 10:27:31.000000000 +0300
3@@ -0,0 +1,51 @@
4+#!/bin/sh
5+bundle="$1"
6+
7+if ! test -d "$bundle" ; then
8+       echo "$bundle is no bundle!" >&2
9+       exit 1
10+fi
11+
12+test -d "$bundle/Contents/Frameworks" || mkdir -p "$bundle/Contents/Frameworks" || exit 1
13+
14+echo "Completing bundle: $bundle"
15+cd "$bundle"
16+fw_basepath=$(dirname $(pwd))
17+todo=$(find ./ | \
18+       xargs file | \
19+       sed -n 's/^\([^:][^:]*\):[[:space:]]*Mach-O executable ppc$/\1/p' \
20+)
21+echo "Found executables: $todo"
22+while test "$todo" != ""; do
23+       todo_old=$todo ;
24+       todo="" ;
25+       for todo_obj in $todo_old; do
26+               for lib in $(
27+                       otool -L $todo_obj | \
28+                       sed -n 's|^.*[[:space:]]\([^[:space:]]*\.dylib\).*$|\1|p' | \
29+                       egrep -v '^(/usr/lib)|(/System)|@executable_path@' \
30+               ); do
31+                       lib_bn="$(basename "$lib")" ;
32+                       if ! test -f "Contents/Frameworks/$lib_bn"; then
33+                               echo "Adding library: $lib_bn (because of: $todo_obj)"
34+                               case "$lib" in
35+                                       /*)
36+                                               cp "$lib" "Contents/Frameworks/$lib_bn"
37+                                       ;;
38+                                       *)
39+                                               cp "$fw_basepath/$lib" "Contents/Frameworks/$lib_bn"
40+                                       ;;
41+                               esac
42+                               install_name_tool \
43+                                       -id "@executable_path/../Frameworks/$lib_bn" \
44+                                       "Contents/Frameworks/$lib_bn" || exit 1
45+                               todo="$todo Contents/Frameworks/$lib_bn"
46+                       fi
47+                       install_name_tool -change \
48+                               "$lib" \
49+                               "@executable_path/../Frameworks/$lib_bn" \
50+                               "$todo_obj" || exit 1
51+               done
52+       done
53+done
54+echo "Bundle completed"