ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/makebin.osx
(Generate patch)

Comparing deliantra/Deliantra-Client/makebin.osx (file contents):
Revision 1.5 by root, Mon Sep 1 09:17:46 2008 UTC vs.
Revision 1.21 by root, Mon Dec 26 07:22:49 2011 UTC

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
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
11
12#export MACOSX_DEPLOYMENT_TARGET=10.3 # maybe it helps
13#export MACOSX_DEPLOYMENT_TARGET=10.5 # nope
14
15cvs update
16
5PERL=/opt/local 17PREFIX=/opt/local
6PERLLIB=/usr/lib/perl5 18PERL=$PREFIX
7PANGO=1.6.0 19DB1=4
20DB2=6
8 21
9umask 022 22umask 022
10 23
11if false; then 24ln -sf $PREFIX/include/db$DB1$DB2/db.h $PREFIX/include/db.h
12 for mod in AnyEvent EV JSON-XS Deliantra Compress-LZF BDB; do 25rm -f $PREFIX/lib/libdb-$DB1.$DB2.dylib
26cp -p $PREFIX/lib/db$DB1$DB2/libdb-$DB1.$DB2.dylib $PREFIX/lib/libdb-$DB1.$DB2.dylib
27
28OPTLIBS=(
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
39declare -A deliantrified
40
41patchlibs() {
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
56patchbundle() {
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
62deliantrify_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
79if true; then
80 for mod in common-sense AnyEvent EV JSON-XS Compress-LZF BDB Guard deliantra/Deliantra; do
13 ( 81 (
82 mkdir -p /root/src/$mod || exit 77
14 cd /root/src/$mod 83 cd /root/src/$mod
84 set -x
85 pwd
86 rsync -avPessh 10.0.0.1:src/$mod/. . --del --exclude "*.tar.gz" --delete-excluded
15 $PERL/bin/perl Makefile.PL </dev/null 87 $PERL/bin/perl Makefile.PL </dev/null
16 make clean 88 make clean
17 $PERL/bin/perl Makefile.PL </dev/null 89 $PERL/bin/perl Makefile.PL </dev/null
18 make install || exit 90 make install || exit
19 make clean 91 make clean
20 ) 92 ) || exit
21 done 93 done
22fi 94fi
95
96if 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
103fi
104
105DYLD_LIBRARY_PATH=/opt/libdeliantra:$DYLD_LIBRARY_PATH
23 106
24if true; then 107if true; then
25 108
26( 109(
27 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
28 111
29 echo "docwiki.pst;root/Deliantra/Client/private/resources/docwiki.pst" 112 echo "docwiki.pst;root/Deliantra/Client/private/resources/docwiki.pst"
30 113
31#pangoversion;root/pangoversion 114#pangoversion;root/pangoversion
32#/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
33#/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
34#/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
35#/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
36 119
37 ( echo "[Pango]"; echo "ModuleFiles = pango.modules" ) > pango.rc 120 ( echo "[Pango]"; echo "ModuleFiles = pango.modules" ) > pango.rc
38 echo "pango.rc;root/pango.rc" 121 echo "pango.rc;root/pango.rc"
39 122
40 ( 123 (
41 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
42 base=$(basename "$so") 125 base=$(basename "$so")
126 ln -f "$so" "$so.deliantra"
127 patchlibs "$so.deliantra"
43 echo "$so;root/$base" 128 echo "$so.deliantra;root/$base"
44 echo "$base $rest" >&5 129 echo "$base $rest" >&5
45 done 130 done
46 ) 5>pango.modules 131 ) 5>pango.modules
47 echo "pango.modules;root/pango.modules" 132 echo "pango.modules;root/pango.modules"
48 133
49 for lib in \ 134 for lib in "${OPTLIBS[@]}"; do
50 db-4.6 \
51 glib-2.0.0 gobject-2.0.0 gmodule-2.0.0 \
52 pango-1.0.0 pangoft2-1.0.0 \
53 SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0 \
54 vorbisfile vorbis.0 ogg.0 \
55 png12 jpeg.62 z.1 \
56 fontconfig.1 expat.1 freetype.6 intl.8 iconv.2;
57 do
58 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"
59 done 136 done
60
61 cat >>fonts.conf <<EOF
62<?xml version="1.0"?>
63<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
64<fontconfig>
65
66 <match target="pattern"> <test qual="any" name="family"> <string>mono</string> </test> <edit name="family" mode="assign"> <string>monospace</string> </edit> </match>
67
68 <match target="pattern"> <test qual="any" name="family"> <string>sans serif</string> </test> <edit name="family" mode="assign"> <string>sans-serif</string> </edit> </match>
69
70 <match target="pattern"> <test qual="any" name="family"> <string>sans</string> </test> <edit name="family" mode="assign"> <string>sans-serif</string> </edit> </match>
71
72 <cachedir>fontconfig-cache</cachedir>
73
74 <config>
75 <blank>
76 <int>0x0020</int><int>0x00A0</int><int>0x00AD</int><int>0x034F</int><int>0x0600</int><int>0x0601</int><int>0x0602</int><int>0x0603</int><int>0x06DD</int><int>0x070F</int><int>0x115F</int><int>0x1160</int><int>0x1680</int><int>0x17B4</int><int>0x17B5</int><int>0x180E</int><int>0x2000</int><int>0x2001</int><int>0x2002</int><int>0x2003</int><int>0x2004</int><int>0x2005</int><int>0x2006</int><int>0x2007</int><int>0x2008</int><int>0x2009</int><int>0x200A</int><int>0x200B</int><int>0x200C</int><int>0x200D</int><int>0x200E</int><int>0x200F</int><int>0x2028</int><int>0x2029</int><int>0x202A</int><int>0x202B</int><int>0x202C</int><int>0x202D</int><int>0x202E</int><int>0x202F</int><int>0x205F</int><int>0x2060</int><int>0x2061</int><int>0x2062</int><int>0x2063</int><int>0x206A</int><int>0x206B</int><int>0x206C</int><int>0x206D</int><int>0x206E</int><int>0x206F</int><int>0x2800</int><int>0x3000</int><int>0x3164</int><int>0xFEFF</int><int>0xFFA0</int><int>0xFFF9</int><int>0xFFFA</int><int>0xFFFB</int>
77 </blank>
78 </config>
79
80</fontconfig>
81EOF
82 echo "fonts.conf;root/fonts.conf"
83 137
84) >addlist 138) >addlist
85 139
86#cat pango.modules;exit 140#cat pango.modules;exit
87 141
88trap "rm -f addlist pango.rc pango.modules fonts.conf" 0 142trap "rm -f addlist pango.rc pango.modules fonts.conf" 0
89 143
90cd /root/src/deliantra/Deliantra-Client
91
92#$PERL/bin/perl Makefile.PL 144$PERL/bin/perl Makefile.PL
93#make clean 145make clean
94#$PERL/bin/perl Makefile.PL 146$PERL/bin/perl Makefile.PL
95make install || exit 147make install || exit
96 148
97DYLD_LIBRARY_PATH=/opt/local/lib \ 149eval $(perl -V:installsitearch)
150patchbundle "$installsitearch/auto/BDB/BDB.bundle"
151patchbundle "$installsitearch/auto/Deliantra/Client/Client.bundle"
152
98$PERL/bin/pp -C \ 153$PERL/bin/pp -C \
99 -z 9 \ 154 -z 9 \
100 -M AnyEvent::Impl::EV \ 155 -M AnyEvent::Impl::EV \
101 -M attributes \ 156 -M attributes \
102 -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" \
103 -o deliantra -A addlist bin/deliantra || exit 158 -o deliantra -A addlist bin/deliantra || exit
104 159
105fi 160fi
106 161
107# 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 :/
151 <key>LSMinimumSystemVersion</key> 206 <key>LSMinimumSystemVersion</key>
152 <string>10.5</string> 207 <string>10.5</string>
153 <key>NSAppleScriptEnabled</key> 208 <key>NSAppleScriptEnabled</key>
154 <false/> 209 <false/>
155 <key>NSHumanReadableCopyright</key> 210 <key>NSHumanReadableCopyright</key>
156 <string>Deliantra MORPG Client - Copyright 2008 The Deliantra Team</string> 211 <string>Deliantra MORPG Client - Copyright 2008,2009,2010,2011 The Deliantra Team</string>
157</dict> 212</dict>
158</plist> 213</plist>
159EOF 214EOF
160 215
161rm -rf dmg 216rm -rf dmg
216 271
217DMG="Deliantra_MORPG_Client-$VER".dmg 272DMG="Deliantra_MORPG_Client-$VER".dmg
218 273
219hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG" 274hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG"
220ls -l ~user/"$DMG" 275ls -l ~user/"$DMG"
221rm -rf dmg 276#rm -rf dmg
222 277
223chmod 644 ~user/$DMG 278chmod 644 ~user/$DMG
224echo http://data.plan9.de/"$DMG" 279echo http://data.plan9.de/"$DMG"
225rsync -avPessh ~user/"$DMG" ruth:/var/www/data.plan9.de/. 280rsync -avPessh ~user/"$DMG" rijk.plan9.de:/var/www/data.plan9.de/.
226 281
227 282
228 283

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines