1 |
root |
1.20 |
#!/opt/local/bin/bash |
2 |
root |
1.1 |
|
3 |
|
|
# Convert a gtk2-perl program to a standalone OS X binary |
4 |
|
|
|
5 |
root |
1.20 |
# 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 |
7 |
root |
1.18 |
# need to patch libSDL_image from /opt/local/lib/libjpeg.dylib to ./libjpeg.8.dylib |
8 |
root |
1.14 |
# ln -s db46/db.h /opt/local/include |
9 |
|
|
# ln -s db46/libdb.dylib /opt/local/lib |
10 |
root |
1.21 |
# /opt/local/bin/cpan Pod::POM PAR::Packer |
11 |
root |
1.6 |
|
12 |
root |
1.10 |
#export MACOSX_DEPLOYMENT_TARGET=10.3 # maybe it helps |
13 |
root |
1.14 |
#export MACOSX_DEPLOYMENT_TARGET=10.5 # nope |
14 |
root |
1.9 |
|
15 |
root |
1.11 |
cvs update |
16 |
|
|
|
17 |
root |
1.20 |
PREFIX=/opt/local |
18 |
|
|
PERL=$PREFIX |
19 |
|
|
DB1=4 |
20 |
|
|
DB2=6 |
21 |
|
|
|
22 |
root |
1.21 |
umask 022 |
23 |
|
|
|
24 |
root |
1.20 |
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 |
root |
1.21 |
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 |
root |
1.20 |
SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0 |
33 |
root |
1.21 |
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 |
root |
1.20 |
fontconfig.1 expat.1 freetype.6 intl.8 iconv.2 |
37 |
|
|
) |
38 |
|
|
|
39 |
|
|
declare -A deliantrified |
40 |
|
|
|
41 |
root |
1.21 |
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 |
root |
1.20 |
deliantrify_lib() { |
63 |
|
|
local lib="$1" |
64 |
|
|
|
65 |
root |
1.21 |
[ "${deliantrified["$lib"]}" ] && return |
66 |
root |
1.20 |
deliantrified["$lib"]=+ |
67 |
|
|
|
68 |
root |
1.21 |
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 |
root |
1.20 |
} |
78 |
|
|
|
79 |
root |
1.7 |
if true; then |
80 |
root |
1.18 |
for mod in common-sense AnyEvent EV JSON-XS Compress-LZF BDB Guard deliantra/Deliantra; do |
81 |
root |
1.1 |
( |
82 |
root |
1.11 |
mkdir -p /root/src/$mod || exit 77 |
83 |
root |
1.1 |
cd /root/src/$mod |
84 |
root |
1.9 |
set -x |
85 |
|
|
pwd |
86 |
root |
1.16 |
rsync -avPessh 10.0.0.1:src/$mod/. . --del --exclude "*.tar.gz" --delete-excluded |
87 |
root |
1.1 |
$PERL/bin/perl Makefile.PL </dev/null |
88 |
|
|
make clean |
89 |
|
|
$PERL/bin/perl Makefile.PL </dev/null |
90 |
|
|
make install || exit |
91 |
|
|
make clean |
92 |
root |
1.9 |
) || exit |
93 |
root |
1.1 |
done |
94 |
|
|
fi |
95 |
|
|
|
96 |
root |
1.21 |
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 |
root |
1.20 |
|
107 |
root |
1.2 |
if true; then |
108 |
|
|
|
109 |
root |
1.1 |
( |
110 |
|
|
perl -ne '/^(resources\/.*)/ and print "$1;root/Deliantra/Client/private/$1\n"' <MANIFEST |
111 |
|
|
|
112 |
|
|
echo "docwiki.pst;root/Deliantra/Client/private/resources/docwiki.pst" |
113 |
|
|
|
114 |
|
|
#pangoversion;root/pangoversion |
115 |
root |
1.19 |
#/opt/local/lib/libglib-2.0.so.0;shlib/darwin-multi-2level/libglib-2.0.dylib |
116 |
|
|
#/lib/libgcc_s.so.1;shlib/darwin-multi-2level/libgcc_s.so.1 |
117 |
|
|
#/opt/local/lib/libstdc++.so.6;shlib/darwin-multi-2level/libstdc++.so.6 |
118 |
|
|
#/opt/local/lib/libaudio.so.2;shlib/darwin-multi-2level/libaudio.so.2 |
119 |
root |
1.1 |
|
120 |
|
|
( echo "[Pango]"; echo "ModuleFiles = pango.modules" ) > pango.rc |
121 |
|
|
echo "pango.rc;root/pango.rc" |
122 |
|
|
|
123 |
|
|
( |
124 |
|
|
grep ^/opt /opt/local/etc/pango/pango.modules | while read so rest; do |
125 |
|
|
base=$(basename "$so") |
126 |
root |
1.21 |
ln -f "$so" "$so.deliantra" |
127 |
|
|
patchlibs "$so.deliantra" |
128 |
|
|
echo "$so.deliantra;root/$base" |
129 |
root |
1.1 |
echo "$base $rest" >&5 |
130 |
|
|
done |
131 |
|
|
) 5>pango.modules |
132 |
|
|
echo "pango.modules;root/pango.modules" |
133 |
|
|
|
134 |
root |
1.20 |
for lib in "${OPTLIBS[@]}"; do |
135 |
root |
1.21 |
echo "/opt/local/lib/libdeliantra-$lib.dylib;shlib/darwin-multi-2level/libdeliantra-$lib.dylib" |
136 |
root |
1.1 |
done |
137 |
|
|
|
138 |
|
|
) >addlist |
139 |
|
|
|
140 |
|
|
#cat pango.modules;exit |
141 |
|
|
|
142 |
|
|
trap "rm -f addlist pango.rc pango.modules fonts.conf" 0 |
143 |
|
|
|
144 |
root |
1.9 |
$PERL/bin/perl Makefile.PL |
145 |
|
|
make clean |
146 |
|
|
$PERL/bin/perl Makefile.PL |
147 |
root |
1.1 |
make install || exit |
148 |
|
|
|
149 |
root |
1.21 |
eval $(perl -V:installsitearch) |
150 |
|
|
patchbundle "$installsitearch/auto/BDB/BDB.bundle" |
151 |
|
|
patchbundle "$installsitearch/auto/Deliantra/Client/Client.bundle" |
152 |
|
|
|
153 |
root |
1.1 |
$PERL/bin/pp -C \ |
154 |
root |
1.2 |
-z 9 \ |
155 |
root |
1.1 |
-M AnyEvent::Impl::EV \ |
156 |
|
|
-M attributes \ |
157 |
root |
1.21 |
-a "$installsitearch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \ |
158 |
root |
1.2 |
-o deliantra -A addlist bin/deliantra || exit |
159 |
|
|
|
160 |
|
|
fi |
161 |
|
|
|
162 |
|
|
# for other OS'es, we would be finished now, but for OS X, this is just one third of the process :/ |
163 |
|
|
# create the app |
164 |
|
|
|
165 |
|
|
VER=$(perl -e 'require "DC.pm"; print $DC::VERSION') |
166 |
|
|
APP="Deliantra MORPG Client $VER" |
167 |
|
|
|
168 |
|
|
rm -rf "Deliantra MORPG Client "*.app |
169 |
|
|
|
170 |
|
|
mkdir "$APP".app "$APP".app/Contents "$APP".app/Contents/MacOS "$APP".app/Contents/Resources |
171 |
|
|
|
172 |
|
|
ln deliantra "$APP".app/Contents/MacOS/run |
173 |
|
|
ln osx/deliantra.icns "$APP".app/Contents/Resources/ |
174 |
|
|
|
175 |
|
|
cat >"$APP.app/Contents/Info.plist" <<EOF |
176 |
|
|
<?xml version="1.0" encoding="UTF-8"?> |
177 |
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
178 |
|
|
<plist version="1.0"> |
179 |
|
|
<dict> |
180 |
|
|
<key>CFBundleDevelopmentRegion</key> |
181 |
|
|
<string>English</string> |
182 |
|
|
<key>CFBundleDisplayName</key> |
183 |
|
|
<string>Deliantra MORPG Client</string> |
184 |
|
|
<key>CFBundleExecutable</key> |
185 |
|
|
<string>run</string> |
186 |
|
|
<key>CFBundleGetInfoString</key> |
187 |
|
|
<string>Deliantra MORPG Client $VER (www.deliantra.net)</string> |
188 |
|
|
<key>CFBundleIconFile</key> |
189 |
|
|
<string>deliantra.icns</string> |
190 |
|
|
<key>CFBundleIdentifier</key> |
191 |
|
|
<string>net.deliantra.client</string> |
192 |
|
|
<key>CFBundleInfoDictionaryVersion</key> |
193 |
|
|
<string>6.0</string> |
194 |
|
|
<key>CFBundleName</key> |
195 |
|
|
<string>Deliantra MORPG Client</string> |
196 |
|
|
<key>CFBundlePackageType</key> |
197 |
|
|
<string>APPL</string> |
198 |
|
|
<key>CFBundleShortVersionString</key> |
199 |
|
|
<string>$VER</string> |
200 |
|
|
<key>CFBundleVersionString</key> |
201 |
|
|
<string>$VER.$(date "+%Y.%m.%d.%H.%M.%S")</string> |
202 |
|
|
<key>CFBundleSignature</key> |
203 |
|
|
<string>????</string> |
204 |
|
|
<key>LSHasLocalizedDisplayName</key> |
205 |
|
|
<false/> |
206 |
|
|
<key>LSMinimumSystemVersion</key> |
207 |
root |
1.10 |
<string>10.5</string> |
208 |
root |
1.2 |
<key>NSAppleScriptEnabled</key> |
209 |
|
|
<false/> |
210 |
|
|
<key>NSHumanReadableCopyright</key> |
211 |
root |
1.21 |
<string>Deliantra MORPG Client - Copyright 2008,2009,2010,2011 The Deliantra Team</string> |
212 |
root |
1.2 |
</dict> |
213 |
|
|
</plist> |
214 |
|
|
EOF |
215 |
|
|
|
216 |
|
|
rm -rf dmg |
217 |
|
|
mkdir dmg |
218 |
|
|
|
219 |
|
|
mv "$APP.app" dmg/ |
220 |
|
|
|
221 |
root |
1.3 |
cat >dmg/README.txt <<EOF |
222 |
|
|
Hello! |
223 |
|
|
|
224 |
|
|
This disk image contains the Deliantra MORPG game client. |
225 |
|
|
|
226 |
root |
1.5 |
The client has been compiled for Intel systems only. |
227 |
|
|
|
228 |
|
|
The client uses a lot of right mouse button click pop-up menus, to emulate |
229 |
|
|
a right-click with a mouse that has only one button, use ctrl-click. |
230 |
|
|
|
231 |
root |
1.3 |
To play it, simply double-click it, then select a good graphics resolution |
232 |
|
|
in the Setup => Graphics tab and then go to Setup => Login, enter a nickname |
233 |
|
|
(no spaces, only ASCII letters supported) and a password, then hit Login. |
234 |
|
|
|
235 |
|
|
You can also install the client application by dragging it onto your |
236 |
|
|
harddisk or anywhere else, but it should play perfectly fine from the disk |
237 |
|
|
image. |
238 |
|
|
|
239 |
|
|
The game stores configuration settings, map data, music and other resources |
240 |
|
|
in a hidden directory called .deliantra in your home directory. |
241 |
|
|
|
242 |
|
|
The script "Reset Configuration" will reset the configuration and delete |
243 |
|
|
any downloaded resources. You can use this when you no longer want to play |
244 |
|
|
Deliantra, or when you have problems with the settings (window too large |
245 |
|
|
etc.). |
246 |
|
|
|
247 |
|
|
Unfortunately, Mac OS X has quite buggy OpenGL support: make sure your |
248 |
|
|
monitor cable is plugged in correctly when you can't go into fullscreen or |
249 |
|
|
when the graphics look broken. |
250 |
|
|
|
251 |
|
|
See http://www.deliantra.net/ for more info. |
252 |
|
|
|
253 |
|
|
EOF |
254 |
|
|
|
255 |
|
|
cat >dmg/"Reset Configuration" <<EOF |
256 |
|
|
#!/bin/sh |
257 |
|
|
|
258 |
|
|
rm -rf ~/.deliantra |
259 |
|
|
|
260 |
|
|
echo |
261 |
|
|
echo |
262 |
|
|
echo |
263 |
|
|
echo |
264 |
|
|
echo |
265 |
|
|
echo Configuration/Cache Cleared |
266 |
|
|
|
267 |
|
|
EOF |
268 |
|
|
chmod 755 dmg/"Reset Configuration" |
269 |
|
|
|
270 |
root |
1.2 |
# now, the last third, putting all this into a dmg |
271 |
|
|
|
272 |
root |
1.4 |
DMG="Deliantra_MORPG_Client-$VER".dmg |
273 |
|
|
|
274 |
|
|
hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG" |
275 |
|
|
ls -l ~user/"$DMG" |
276 |
root |
1.21 |
#rm -rf dmg |
277 |
root |
1.2 |
|
278 |
root |
1.4 |
chmod 644 ~user/$DMG |
279 |
|
|
echo http://data.plan9.de/"$DMG" |
280 |
root |
1.21 |
rsync -avPessh ~user/"$DMG" rijk.plan9.de:/var/www/data.plan9.de/. |
281 |
root |
1.4 |
|
282 |
root |
1.1 |
|
283 |
|
|
|