1 | #!/bin/bash |
1 | #!/opt/local/bin/bash |
2 | |
2 | |
3 | # Convert a gtk2-perl program to a standalone OS X binary |
3 | # Convert a gtk2-perl program to a standalone OS X binary |
4 | |
4 | |
|
|
5 | # port install libsdl +no_x11 libsdl_mixer libsdl_image libvorbis libpng jpeg pango db46 libogg p5-libwww-perl p5-yaml db52 |
|
|
6 | # port install bash wget |
5 | # need to patch libSDL_image from /opt/local/lib/libjpeg.dylib to ./libjpeg.62.dylib |
7 | # need to patch libSDL_image from /opt/local/lib/libjpeg.dylib to ./libjpeg.8.dylib |
|
|
8 | # ln -s db46/db.h /opt/local/include |
|
|
9 | # ln -s db46/libdb.dylib /opt/local/lib |
|
|
10 | # /opt/local/bin/cpan Pod::POM PAR::Packer |
6 | |
11 | |
7 | #export MACOSX_DEPLOYMENT_TARGET=10.3 # maybe it helps |
12 | #export MACOSX_DEPLOYMENT_TARGET=10.3 # maybe it helps |
8 | export MACOSX_DEPLOYMENT_TARGET=10.5 # nope |
13 | #export MACOSX_DEPLOYMENT_TARGET=10.5 # nope |
9 | |
14 | |
10 | cvs update |
15 | cvs update |
11 | |
16 | |
12 | PERL=/opt/local |
17 | PREFIX=/opt/local |
13 | PERLLIB=/usr/lib/perl5 |
18 | PERL=$PREFIX |
|
|
19 | DB1=4 |
|
|
20 | DB2=6 |
14 | |
21 | |
15 | umask 022 |
22 | umask 022 |
16 | |
23 | |
|
|
24 | ln -sf $PREFIX/include/db$DB1$DB2/db.h $PREFIX/include/db.h |
|
|
25 | rm -f $PREFIX/lib/libdb-$DB1.$DB2.dylib |
|
|
26 | cp -p $PREFIX/lib/db$DB1$DB2/libdb-$DB1.$DB2.dylib $PREFIX/lib/libdb-$DB1.$DB2.dylib |
|
|
27 | |
|
|
28 | OPTLIBS=( |
|
|
29 | db-4.6 |
|
|
30 | gthread-2.0.0 glib-2.0.0 gobject-2.0.0 gmodule-2.0.0 |
|
|
31 | pango-1.0.0 pangoft2-1.0.0 ffi.5 |
|
|
32 | SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0 |
|
|
33 | png14.14 jpeg.8 tiff.3 z.1 bz2.1.0 |
|
|
34 | smpeg-0.4.0 |
|
|
35 | vorbisfile.3 vorbis.0 ogg.0 mikmod.3 FLAC.8 |
|
|
36 | fontconfig.1 expat.1 freetype.6 intl.8 iconv.2 |
|
|
37 | ) |
|
|
38 | |
|
|
39 | declare -A deliantrified |
|
|
40 | |
|
|
41 | patchlibs() { |
|
|
42 | <"$1" \ |
|
|
43 | perl -0777 -pe ' |
|
|
44 | s%('"$PREFIX/lib[^\x00]*/lib"'([^\x00/]+)\.dylib\x00)% |
|
|
45 | my $s = $1; |
|
|
46 | my $r = "libdeliantra-$2.dylib\x00"; |
|
|
47 | (length $r) <= (length $s) |
|
|
48 | or die "lib replacement <$r> larger than <$s>\n"; |
|
|
49 | substr $s, 0, length $r, $r; |
|
|
50 | $s |
|
|
51 | %ge |
|
|
52 | ' \ |
|
|
53 | >"$1~" && mv "$1~" "$1" || exit 67 |
|
|
54 | } |
|
|
55 | |
|
|
56 | patchbundle() { |
|
|
57 | [ -e "$1.unpatched" ] && [ "$1.unpatched" -ot "$1" ] && ln -f "$1.unpatched" "$1" |
|
|
58 | ln -f "$1" "$1.unpatched" |
|
|
59 | patchlibs "$1" || exit |
|
|
60 | } |
|
|
61 | |
|
|
62 | deliantrify_lib() { |
|
|
63 | local lib="$1" |
|
|
64 | |
|
|
65 | [ "${deliantrified["$lib"]}" ] && return |
|
|
66 | deliantrified["$lib"]=+ |
|
|
67 | |
|
|
68 | echo "deliantrifying $lib" |
|
|
69 | cp -p $PREFIX/lib/lib$lib.dylib $PREFIX/lib/libdeliantra-$lib.dylib || exit 68 |
|
|
70 | install_name_tool -id libdeliantra-$lib.dylib $PREFIX/lib/libdeliantra-$lib.dylib |
|
|
71 | for lib2 in $(otool -L $PREFIX/lib/lib$lib.dylib | perl -ne 'print "$1\n" if m%'"$PREFIX/lib/lib"'(\S+).dylib%'); do |
|
|
72 | deliantrify_lib "$lib2" || exit |
|
|
73 | #install_name_tool -change $PREFIX/lib/lib$lib2.dylib libdeliantra-$lib2.dylib $PREFIX/lib/libdeliantra-$lib.dylib |
|
|
74 | done |
|
|
75 | patchlibs $PREFIX/lib/libdeliantra-$lib.dylib || exit |
|
|
76 | ln -s $PREFIX/lib/libdeliantra-$lib.dylib /opt/libdeliantra |
|
|
77 | } |
|
|
78 | |
17 | if true; then |
79 | if true; then |
18 | for mod in AnyEvent EV JSON-XS deliantra/Deliantra Compress-LZF BDB Guard; do |
80 | for mod in common-sense AnyEvent EV JSON-XS Compress-LZF BDB Guard deliantra/Deliantra; do |
19 | ( |
81 | ( |
20 | mkdir -p /root/src/$mod || exit 77 |
82 | mkdir -p /root/src/$mod || exit 77 |
21 | cd /root/src/$mod |
83 | cd /root/src/$mod |
22 | set -x |
84 | set -x |
23 | pwd |
85 | pwd |
24 | rsync -avPessh 10.0.0.1:src/$mod/. . --del |
86 | rsync -avPessh 10.0.0.1:src/$mod/. . --del --exclude "*.tar.gz" --delete-excluded |
25 | $PERL/bin/perl Makefile.PL </dev/null |
87 | $PERL/bin/perl Makefile.PL </dev/null |
26 | make clean |
88 | make clean |
27 | $PERL/bin/perl Makefile.PL </dev/null |
89 | $PERL/bin/perl Makefile.PL </dev/null |
28 | make install || exit |
90 | make install || exit |
29 | make clean |
91 | make clean |
30 | ) || exit |
92 | ) || exit |
31 | done |
93 | done |
32 | fi |
94 | fi |
33 | |
95 | |
34 | if true; then |
96 | if true; then |
|
|
97 | # don't ask... |
|
|
98 | rm -rf /opt/libdeliantra |
|
|
99 | mkdir /opt/libdeliantra |
|
|
100 | for lib in "${OPTLIBS[@]}"; do |
|
|
101 | deliantrify_lib "$lib" || exit |
|
|
102 | done |
|
|
103 | fi |
|
|
104 | |
|
|
105 | DYLD_LIBRARY_PATH=/opt/libdeliantra:$DYLD_LIBRARY_PATH |
|
|
106 | |
|
|
107 | if true; then |
35 | |
108 | |
36 | ( |
109 | ( |
37 | perl -ne '/^(resources\/.*)/ and print "$1;root/Deliantra/Client/private/$1\n"' <MANIFEST |
110 | perl -ne '/^(resources\/.*)/ and print "$1;root/Deliantra/Client/private/$1\n"' <MANIFEST |
38 | |
111 | |
39 | echo "docwiki.pst;root/Deliantra/Client/private/resources/docwiki.pst" |
112 | echo "docwiki.pst;root/Deliantra/Client/private/resources/docwiki.pst" |
40 | |
113 | |
41 | #pangoversion;root/pangoversion |
114 | #pangoversion;root/pangoversion |
42 | #/opt/local/lib/libglib-2.0.so.0;shlib/darwin-2level/libglib-2.0.dylib |
115 | #/opt/local/lib/libglib-2.0.so.0;shlib/darwin-multi-2level/libglib-2.0.dylib |
43 | #/lib/libgcc_s.so.1;shlib/darwin-2level/libgcc_s.so.1 |
116 | #/lib/libgcc_s.so.1;shlib/darwin-multi-2level/libgcc_s.so.1 |
44 | #/opt/local/lib/libstdc++.so.6;shlib/darwin-2level/libstdc++.so.6 |
117 | #/opt/local/lib/libstdc++.so.6;shlib/darwin-multi-2level/libstdc++.so.6 |
45 | #/opt/local/lib/libaudio.so.2;shlib/darwin-2level/libaudio.so.2 |
118 | #/opt/local/lib/libaudio.so.2;shlib/darwin-multi-2level/libaudio.so.2 |
46 | |
119 | |
47 | ( echo "[Pango]"; echo "ModuleFiles = pango.modules" ) > pango.rc |
120 | ( echo "[Pango]"; echo "ModuleFiles = pango.modules" ) > pango.rc |
48 | echo "pango.rc;root/pango.rc" |
121 | echo "pango.rc;root/pango.rc" |
49 | |
122 | |
50 | ( |
123 | ( |
51 | grep ^/opt /opt/local/etc/pango/pango.modules | while read so rest; do |
124 | grep ^/opt /opt/local/etc/pango/pango.modules | while read so rest; do |
52 | base=$(basename "$so") |
125 | base=$(basename "$so") |
|
|
126 | ln -f "$so" "$so.deliantra" |
|
|
127 | patchlibs "$so.deliantra" |
53 | echo "$so;root/$base" |
128 | echo "$so.deliantra;root/$base" |
54 | echo "$base $rest" >&5 |
129 | echo "$base $rest" >&5 |
55 | done |
130 | done |
56 | ) 5>pango.modules |
131 | ) 5>pango.modules |
57 | echo "pango.modules;root/pango.modules" |
132 | echo "pango.modules;root/pango.modules" |
58 | |
133 | |
59 | for lib in \ |
134 | for lib in "${OPTLIBS[@]}"; do |
60 | db-4.6 \ |
|
|
61 | glib-2.0.0 gobject-2.0.0 gmodule-2.0.0 \ |
|
|
62 | pango-1.0.0 pangoft2-1.0.0 \ |
|
|
63 | SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0 \ |
|
|
64 | vorbisfile vorbis.0 ogg.0 \ |
|
|
65 | png12 jpeg.62 z.1 \ |
|
|
66 | fontconfig.1 expat.1 freetype.6 intl.8 iconv.2; |
|
|
67 | do |
|
|
68 | echo "/opt/local/lib/lib$lib.dylib;shlib/darwin-2level/lib$lib.dylib" |
135 | echo "/opt/local/lib/libdeliantra-$lib.dylib;shlib/darwin-multi-2level/libdeliantra-$lib.dylib" |
69 | done |
136 | done |
70 | |
137 | |
71 | ) >addlist |
138 | ) >addlist |
72 | |
139 | |
73 | #cat pango.modules;exit |
140 | #cat pango.modules;exit |
74 | |
141 | |
75 | trap "rm -f addlist pango.rc pango.modules fonts.conf" 0 |
142 | trap "rm -f addlist pango.rc pango.modules fonts.conf" 0 |
76 | |
|
|
77 | cd /root/src/deliantra/Deliantra-Client |
|
|
78 | |
143 | |
79 | $PERL/bin/perl Makefile.PL |
144 | $PERL/bin/perl Makefile.PL |
80 | make clean |
145 | make clean |
81 | $PERL/bin/perl Makefile.PL |
146 | $PERL/bin/perl Makefile.PL |
82 | make install || exit |
147 | make install || exit |
83 | |
148 | |
84 | DYLD_LIBRARY_PATH=/opt/local/lib \ |
149 | eval $(perl -V:installsitearch) |
|
|
150 | patchbundle "$installsitearch/auto/BDB/BDB.bundle" |
|
|
151 | patchbundle "$installsitearch/auto/Deliantra/Client/Client.bundle" |
|
|
152 | |
85 | $PERL/bin/pp -C \ |
153 | $PERL/bin/pp -C \ |
86 | -z 9 \ |
154 | -z 9 \ |
87 | -M AnyEvent::Impl::EV \ |
155 | -M AnyEvent::Impl::EV \ |
88 | -M attributes \ |
156 | -M attributes \ |
89 | -a "blib/arch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \ |
157 | -a "$installsitearch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \ |
90 | -o deliantra -A addlist bin/deliantra || exit |
158 | -o deliantra -A addlist bin/deliantra || exit |
91 | |
159 | |
92 | fi |
160 | fi |
93 | |
161 | |
94 | # for other OS'es, we would be finished now, but for OS X, this is just one third of the process :/ |
162 | # for other OS'es, we would be finished now, but for OS X, this is just one third of the process :/ |
… | |
… | |
138 | <key>LSMinimumSystemVersion</key> |
206 | <key>LSMinimumSystemVersion</key> |
139 | <string>10.5</string> |
207 | <string>10.5</string> |
140 | <key>NSAppleScriptEnabled</key> |
208 | <key>NSAppleScriptEnabled</key> |
141 | <false/> |
209 | <false/> |
142 | <key>NSHumanReadableCopyright</key> |
210 | <key>NSHumanReadableCopyright</key> |
143 | <string>Deliantra MORPG Client - Copyright 2008 The Deliantra Team</string> |
211 | <string>Deliantra MORPG Client - Copyright 2008,2009,2010,2011 The Deliantra Team</string> |
144 | </dict> |
212 | </dict> |
145 | </plist> |
213 | </plist> |
146 | EOF |
214 | EOF |
147 | |
215 | |
148 | rm -rf dmg |
216 | rm -rf dmg |
… | |
… | |
203 | |
271 | |
204 | DMG="Deliantra_MORPG_Client-$VER".dmg |
272 | DMG="Deliantra_MORPG_Client-$VER".dmg |
205 | |
273 | |
206 | hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG" |
274 | hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG" |
207 | ls -l ~user/"$DMG" |
275 | ls -l ~user/"$DMG" |
208 | rm -rf dmg |
276 | #rm -rf dmg |
209 | |
277 | |
210 | chmod 644 ~user/$DMG |
278 | chmod 644 ~user/$DMG |
211 | echo http://data.plan9.de/"$DMG" |
279 | echo http://data.plan9.de/"$DMG" |
212 | rsync -avPessh ~user/"$DMG" ruth:/var/www/data.plan9.de/. |
280 | rsync -avPessh ~user/"$DMG" rijk.plan9.de:/var/www/data.plan9.de/. |
213 | |
281 | |
214 | |
282 | |
215 | |
283 | |