--- deliantra/Deliantra-Client/makebin.osx 2008/12/05 14:49:09 1.10 +++ deliantra/Deliantra-Client/makebin.osx 2011/12/26 07:22:49 1.21 @@ -1,24 +1,89 @@ -#!/bin/bash +#!/opt/local/bin/bash # Convert a gtk2-perl program to a standalone OS X binary -# need to patch libSDL_image from /opt/local/lib/libjpeg.dylib to ./libjpeg.62.dylib +# port install libsdl +no_x11 libsdl_mixer libsdl_image libvorbis libpng jpeg pango db46 libogg p5-libwww-perl p5-yaml db52 +# port install bash wget +# need to patch libSDL_image from /opt/local/lib/libjpeg.dylib to ./libjpeg.8.dylib +# ln -s db46/db.h /opt/local/include +# ln -s db46/libdb.dylib /opt/local/lib +# /opt/local/bin/cpan Pod::POM PAR::Packer #export MACOSX_DEPLOYMENT_TARGET=10.3 # maybe it helps -export MACOSX_DEPLOYMENT_TARGET=10.5 # nope +#export MACOSX_DEPLOYMENT_TARGET=10.5 # nope -PERL=/opt/local -PERLLIB=/usr/lib/perl5 +cvs update + +PREFIX=/opt/local +PERL=$PREFIX +DB1=4 +DB2=6 umask 022 +ln -sf $PREFIX/include/db$DB1$DB2/db.h $PREFIX/include/db.h +rm -f $PREFIX/lib/libdb-$DB1.$DB2.dylib +cp -p $PREFIX/lib/db$DB1$DB2/libdb-$DB1.$DB2.dylib $PREFIX/lib/libdb-$DB1.$DB2.dylib + +OPTLIBS=( + db-4.6 + gthread-2.0.0 glib-2.0.0 gobject-2.0.0 gmodule-2.0.0 + pango-1.0.0 pangoft2-1.0.0 ffi.5 + SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0 + png14.14 jpeg.8 tiff.3 z.1 bz2.1.0 + smpeg-0.4.0 + vorbisfile.3 vorbis.0 ogg.0 mikmod.3 FLAC.8 + fontconfig.1 expat.1 freetype.6 intl.8 iconv.2 +) + +declare -A deliantrified + +patchlibs() { + <"$1" \ + perl -0777 -pe ' + s%('"$PREFIX/lib[^\x00]*/lib"'([^\x00/]+)\.dylib\x00)% + my $s = $1; + my $r = "libdeliantra-$2.dylib\x00"; + (length $r) <= (length $s) + or die "lib replacement <$r> larger than <$s>\n"; + substr $s, 0, length $r, $r; + $s + %ge + ' \ + >"$1~" && mv "$1~" "$1" || exit 67 +} + +patchbundle() { + [ -e "$1.unpatched" ] && [ "$1.unpatched" -ot "$1" ] && ln -f "$1.unpatched" "$1" + ln -f "$1" "$1.unpatched" + patchlibs "$1" || exit +} + +deliantrify_lib() { + local lib="$1" + + [ "${deliantrified["$lib"]}" ] && return + deliantrified["$lib"]=+ + + echo "deliantrifying $lib" + cp -p $PREFIX/lib/lib$lib.dylib $PREFIX/lib/libdeliantra-$lib.dylib || exit 68 + install_name_tool -id libdeliantra-$lib.dylib $PREFIX/lib/libdeliantra-$lib.dylib + for lib2 in $(otool -L $PREFIX/lib/lib$lib.dylib | perl -ne 'print "$1\n" if m%'"$PREFIX/lib/lib"'(\S+).dylib%'); do + deliantrify_lib "$lib2" || exit + #install_name_tool -change $PREFIX/lib/lib$lib2.dylib libdeliantra-$lib2.dylib $PREFIX/lib/libdeliantra-$lib.dylib + done + patchlibs $PREFIX/lib/libdeliantra-$lib.dylib || exit + ln -s $PREFIX/lib/libdeliantra-$lib.dylib /opt/libdeliantra +} + if true; then - for mod in AnyEvent EV JSON-XS deliantra/Deliantra Compress-LZF BDB; do + for mod in common-sense AnyEvent EV JSON-XS Compress-LZF BDB Guard deliantra/Deliantra; do ( + mkdir -p /root/src/$mod || exit 77 cd /root/src/$mod set -x pwd - rsync -avPessh 10.0.0.1:src/$mod/. . --del + rsync -avPessh 10.0.0.1:src/$mod/. . --del --exclude "*.tar.gz" --delete-excluded $PERL/bin/perl Makefile.PL pango.rc echo "pango.rc;root/pango.rc" @@ -47,66 +123,38 @@ ( grep ^/opt /opt/local/etc/pango/pango.modules | while read so rest; do base=$(basename "$so") - echo "$so;root/$base" + ln -f "$so" "$so.deliantra" + patchlibs "$so.deliantra" + echo "$so.deliantra;root/$base" echo "$base $rest" >&5 done ) 5>pango.modules echo "pango.modules;root/pango.modules" - for lib in \ - db-4.6 \ - glib-2.0.0 gobject-2.0.0 gmodule-2.0.0 \ - pango-1.0.0 pangoft2-1.0.0 \ - SDL-1.2.0 SDL_mixer-1.2.0 SDL_image-1.2.0 \ - vorbisfile vorbis.0 ogg.0 \ - png12 jpeg.62 z.1 \ - fontconfig.1 expat.1 freetype.6 intl.8 iconv.2; - do - echo "/opt/local/lib/lib$lib.dylib;shlib/darwin-2level/lib$lib.dylib" + for lib in "${OPTLIBS[@]}"; do + echo "/opt/local/lib/libdeliantra-$lib.dylib;shlib/darwin-multi-2level/libdeliantra-$lib.dylib" done - cat >>fonts.conf < - - - - mono monospace - - sans serif sans-serif - - sans sans-serif - - fontconfig-cache - - - - 0x00200x00A00x00AD0x034F0x06000x06010x06020x06030x06DD0x070F0x115F0x11600x16800x17B40x17B50x180E0x20000x20010x20020x20030x20040x20050x20060x20070x20080x20090x200A0x200B0x200C0x200D0x200E0x200F0x20280x20290x202A0x202B0x202C0x202D0x202E0x202F0x205F0x20600x20610x20620x20630x206A0x206B0x206C0x206D0x206E0x206F0x28000x30000x31640xFEFF0xFFA00xFFF90xFFFA0xFFFB - - - - -EOF - echo "fonts.conf;root/fonts.conf" - ) >addlist #cat pango.modules;exit trap "rm -f addlist pango.rc pango.modules fonts.conf" 0 -cd /root/src/deliantra/Deliantra-Client - $PERL/bin/perl Makefile.PL make clean $PERL/bin/perl Makefile.PL make install || exit -DYLD_LIBRARY_PATH=/opt/local/lib \ +eval $(perl -V:installsitearch) +patchbundle "$installsitearch/auto/BDB/BDB.bundle" +patchbundle "$installsitearch/auto/Deliantra/Client/Client.bundle" + $PERL/bin/pp -C \ -z 9 \ -M AnyEvent::Impl::EV \ -M attributes \ - -a "blib/arch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \ + -a "$installsitearch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \ -o deliantra -A addlist bin/deliantra || exit fi @@ -160,7 +208,7 @@ NSAppleScriptEnabled NSHumanReadableCopyright - Deliantra MORPG Client - Copyright 2008 The Deliantra Team + Deliantra MORPG Client - Copyright 2008,2009,2010,2011 The Deliantra Team EOF @@ -225,11 +273,11 @@ hdiutil create -srcfolder dmg -volname "Deliantra MORPG Client" -ov -format UDZO ~user/"$DMG" ls -l ~user/"$DMG" -rm -rf dmg +#rm -rf dmg chmod 644 ~user/$DMG echo http://data.plan9.de/"$DMG" -rsync -avPessh ~user/"$DMG" ruth:/var/www/data.plan9.de/. +rsync -avPessh ~user/"$DMG" rijk.plan9.de:/var/www/data.plan9.de/.