ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/makebin.osx
Revision: 1.20
Committed: Mon Dec 26 03:58:12 2011 UTC (12 years, 4 months ago) by root
Branch: MAIN
Changes since 1.19: +52 -13 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
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     # /opt/local/bin/cpan Pod::POM
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     ln -sf $PREFIX/include/db$DB1$DB2/db.h $PREFIX/include/db.h
23     rm -f $PREFIX/lib/libdb-$DB1.$DB2.dylib
24     cp -p $PREFIX/lib/db$DB1$DB2/libdb-$DB1.$DB2.dylib $PREFIX/lib/libdb-$DB1.$DB2.dylib
25    
26     eval $(perl -V:sitelib)
27     PERLLIB=$sitelib
28    
29     OPTLIBS=(
30     db-4.6
31     glib-2.0.0 gobject-2.0.0 gmodule-2.0.0
32     pango-1.0.0 pangoft2-1.0.0
33     SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0
34     vorbisfile vorbis.0 ogg.0
35     png14.14 jpeg.8 tiff.3 z.1
36     fontconfig.1 expat.1 freetype.6 intl.8 iconv.2
37     )
38    
39     declare -A deliantrified
40    
41     deliantrify_lib() {
42     local lib="$1"
43    
44     [ "${deliantrified["$lib"]}" ] && exit 0
45     deliantrified["$lib"]=+
46    
47     (
48     cd $PREFIX/lib || exit 69
49     echo "deliantrifying $lib"
50     cp -p lib$lib.dylib libdeliantra-$lib.dylib || exit 68
51     install_name_tool -id libdeliantra-$lib.dylib libdeliantra-$lib.dylib
52     for lib2 in $(otool -L libdeliantra-$lib.dylib | perl -ne 'print "$1\n" if m%'"$PREFIX/lib/lib"'(\S+).dylib%'); do
53     deliantrify_lib "$lib2"
54     install_name_tool -change lib$lib2.dylib libdeliantra-$lib2.dylib libdeliantra-$lib.dylib
55     done
56     ) || exit
57     }
58    
59     # don't ask...
60     #for lib in "${OPTLIBS[@]}"; do
61     # deliantrify_lib "$lib"
62     #done
63 root 1.1
64 root 1.2 umask 022
65    
66 root 1.7 if true; then
67 root 1.18 for mod in common-sense AnyEvent EV JSON-XS Compress-LZF BDB Guard deliantra/Deliantra; do
68 root 1.1 (
69 root 1.11 mkdir -p /root/src/$mod || exit 77
70 root 1.1 cd /root/src/$mod
71 root 1.9 set -x
72     pwd
73 root 1.16 rsync -avPessh 10.0.0.1:src/$mod/. . --del --exclude "*.tar.gz" --delete-excluded
74 root 1.1 $PERL/bin/perl Makefile.PL </dev/null
75     make clean
76     $PERL/bin/perl Makefile.PL </dev/null
77     make install || exit
78     make clean
79 root 1.9 ) || exit
80 root 1.1 done
81     fi
82    
83 root 1.20 exit 0
84    
85 root 1.2 if true; then
86    
87 root 1.1 (
88     perl -ne '/^(resources\/.*)/ and print "$1;root/Deliantra/Client/private/$1\n"' <MANIFEST
89    
90     echo "docwiki.pst;root/Deliantra/Client/private/resources/docwiki.pst"
91    
92     #pangoversion;root/pangoversion
93 root 1.19 #/opt/local/lib/libglib-2.0.so.0;shlib/darwin-multi-2level/libglib-2.0.dylib
94     #/lib/libgcc_s.so.1;shlib/darwin-multi-2level/libgcc_s.so.1
95     #/opt/local/lib/libstdc++.so.6;shlib/darwin-multi-2level/libstdc++.so.6
96     #/opt/local/lib/libaudio.so.2;shlib/darwin-multi-2level/libaudio.so.2
97 root 1.1
98     ( echo "[Pango]"; echo "ModuleFiles = pango.modules" ) > pango.rc
99     echo "pango.rc;root/pango.rc"
100    
101     (
102     grep ^/opt /opt/local/etc/pango/pango.modules | while read so rest; do
103     base=$(basename "$so")
104     echo "$so;root/$base"
105     echo "$base $rest" >&5
106     done
107     ) 5>pango.modules
108     echo "pango.modules;root/pango.modules"
109    
110 root 1.20 for lib in "${OPTLIBS[@]}"; do
111 root 1.19 echo "/opt/local/lib/lib$lib.dylib;shlib/darwin-multi-2level/lib$lib.dylib"
112 root 1.1 done
113    
114     ) >addlist
115    
116     #cat pango.modules;exit
117    
118     trap "rm -f addlist pango.rc pango.modules fonts.conf" 0
119    
120 root 1.9 $PERL/bin/perl Makefile.PL
121     make clean
122     $PERL/bin/perl Makefile.PL
123 root 1.1 make install || exit
124    
125     DYLD_LIBRARY_PATH=/opt/local/lib \
126     $PERL/bin/pp -C \
127 root 1.2 -z 9 \
128 root 1.1 -M AnyEvent::Impl::EV \
129     -M attributes \
130     -a "blib/arch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \
131 root 1.2 -o deliantra -A addlist bin/deliantra || exit
132    
133     fi
134    
135     # for other OS'es, we would be finished now, but for OS X, this is just one third of the process :/
136     # create the app
137    
138     VER=$(perl -e 'require "DC.pm"; print $DC::VERSION')
139     APP="Deliantra MORPG Client $VER"
140    
141     rm -rf "Deliantra MORPG Client "*.app
142    
143     mkdir "$APP".app "$APP".app/Contents "$APP".app/Contents/MacOS "$APP".app/Contents/Resources
144    
145     ln deliantra "$APP".app/Contents/MacOS/run
146     ln osx/deliantra.icns "$APP".app/Contents/Resources/
147    
148     cat >"$APP.app/Contents/Info.plist" <<EOF
149     <?xml version="1.0" encoding="UTF-8"?>
150     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
151     <plist version="1.0">
152     <dict>
153     <key>CFBundleDevelopmentRegion</key>
154     <string>English</string>
155     <key>CFBundleDisplayName</key>
156     <string>Deliantra MORPG Client</string>
157     <key>CFBundleExecutable</key>
158     <string>run</string>
159     <key>CFBundleGetInfoString</key>
160     <string>Deliantra MORPG Client $VER (www.deliantra.net)</string>
161     <key>CFBundleIconFile</key>
162     <string>deliantra.icns</string>
163     <key>CFBundleIdentifier</key>
164     <string>net.deliantra.client</string>
165     <key>CFBundleInfoDictionaryVersion</key>
166     <string>6.0</string>
167     <key>CFBundleName</key>
168     <string>Deliantra MORPG Client</string>
169     <key>CFBundlePackageType</key>
170     <string>APPL</string>
171     <key>CFBundleShortVersionString</key>
172     <string>$VER</string>
173     <key>CFBundleVersionString</key>
174     <string>$VER.$(date "+%Y.%m.%d.%H.%M.%S")</string>
175     <key>CFBundleSignature</key>
176     <string>????</string>
177     <key>LSHasLocalizedDisplayName</key>
178     <false/>
179     <key>LSMinimumSystemVersion</key>
180 root 1.10 <string>10.5</string>
181 root 1.2 <key>NSAppleScriptEnabled</key>
182     <false/>
183     <key>NSHumanReadableCopyright</key>
184 root 1.15 <string>Deliantra MORPG Client - Copyright 2008,2009 The Deliantra Team</string>
185 root 1.2 </dict>
186     </plist>
187     EOF
188    
189     rm -rf dmg
190     mkdir dmg
191    
192     mv "$APP.app" dmg/
193    
194 root 1.3 cat >dmg/README.txt <<EOF
195     Hello!
196    
197     This disk image contains the Deliantra MORPG game client.
198    
199 root 1.5 The client has been compiled for Intel systems only.
200    
201     The client uses a lot of right mouse button click pop-up menus, to emulate
202     a right-click with a mouse that has only one button, use ctrl-click.
203    
204 root 1.3 To play it, simply double-click it, then select a good graphics resolution
205     in the Setup => Graphics tab and then go to Setup => Login, enter a nickname
206     (no spaces, only ASCII letters supported) and a password, then hit Login.
207    
208     You can also install the client application by dragging it onto your
209     harddisk or anywhere else, but it should play perfectly fine from the disk
210     image.
211    
212     The game stores configuration settings, map data, music and other resources
213     in a hidden directory called .deliantra in your home directory.
214    
215     The script "Reset Configuration" will reset the configuration and delete
216     any downloaded resources. You can use this when you no longer want to play
217     Deliantra, or when you have problems with the settings (window too large
218     etc.).
219    
220     Unfortunately, Mac OS X has quite buggy OpenGL support: make sure your
221     monitor cable is plugged in correctly when you can't go into fullscreen or
222     when the graphics look broken.
223    
224     See http://www.deliantra.net/ for more info.
225    
226     EOF
227    
228     cat >dmg/"Reset Configuration" <<EOF
229     #!/bin/sh
230    
231     rm -rf ~/.deliantra
232    
233     echo
234     echo
235     echo
236     echo
237     echo
238     echo Configuration/Cache Cleared
239    
240     EOF
241     chmod 755 dmg/"Reset Configuration"
242    
243 root 1.2 # now, the last third, putting all this into a dmg
244    
245 root 1.4 DMG="Deliantra_MORPG_Client-$VER".dmg
246    
247     hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG"
248     ls -l ~user/"$DMG"
249 root 1.2 rm -rf dmg
250    
251 root 1.4 chmod 644 ~user/$DMG
252     echo http://data.plan9.de/"$DMG"
253     rsync -avPessh ~user/"$DMG" ruth:/var/www/data.plan9.de/.
254    
255 root 1.1
256