#!/opt/local/bin/bash # Convert a gtk2-perl program to a standalone OS X binary # 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 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 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 --exclude "*.tar.gz" --delete-excluded $PERL/bin/perl Makefile.PL pango.rc echo "pango.rc;root/pango.rc" ( grep ^/opt /opt/local/etc/pango/pango.modules | while read so rest; do base=$(basename "$so") 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 "${OPTLIBS[@]}"; do echo "/opt/local/lib/libdeliantra-$lib.dylib;shlib/darwin-multi-2level/libdeliantra-$lib.dylib" done ) >addlist #cat pango.modules;exit trap "rm -f addlist pango.rc pango.modules fonts.conf" 0 $PERL/bin/perl Makefile.PL make clean $PERL/bin/perl Makefile.PL make install || exit 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 "$installsitearch/auto/Deliantra/Client/Client.bundle;lib/auto/Deliantra/Client/Client.bundle" \ -o deliantra -A addlist bin/deliantra || exit fi # for other OS'es, we would be finished now, but for OS X, this is just one third of the process :/ # create the app VER=$(perl -e 'require "DC.pm"; print $DC::VERSION') APP="Deliantra MORPG Client $VER" rm -rf "Deliantra MORPG Client "*.app mkdir "$APP".app "$APP".app/Contents "$APP".app/Contents/MacOS "$APP".app/Contents/Resources ln deliantra "$APP".app/Contents/MacOS/run ln osx/deliantra.icns "$APP".app/Contents/Resources/ cat >"$APP.app/Contents/Info.plist" < CFBundleDevelopmentRegion English CFBundleDisplayName Deliantra MORPG Client CFBundleExecutable run CFBundleGetInfoString Deliantra MORPG Client $VER (www.deliantra.net) CFBundleIconFile deliantra.icns CFBundleIdentifier net.deliantra.client CFBundleInfoDictionaryVersion 6.0 CFBundleName Deliantra MORPG Client CFBundlePackageType APPL CFBundleShortVersionString $VER CFBundleVersionString $VER.$(date "+%Y.%m.%d.%H.%M.%S") CFBundleSignature ???? LSHasLocalizedDisplayName LSMinimumSystemVersion 10.5 NSAppleScriptEnabled NSHumanReadableCopyright Deliantra MORPG Client - Copyright 2008,2009,2010,2011 The Deliantra Team EOF rm -rf dmg mkdir dmg mv "$APP.app" dmg/ cat >dmg/README.txt < Graphics tab and then go to Setup => Login, enter a nickname (no spaces, only ASCII letters supported) and a password, then hit Login. You can also install the client application by dragging it onto your harddisk or anywhere else, but it should play perfectly fine from the disk image. The game stores configuration settings, map data, music and other resources in a hidden directory called .deliantra in your home directory. The script "Reset Configuration" will reset the configuration and delete any downloaded resources. You can use this when you no longer want to play Deliantra, or when you have problems with the settings (window too large etc.). Unfortunately, Mac OS X has quite buggy OpenGL support: make sure your monitor cable is plugged in correctly when you can't go into fullscreen or when the graphics look broken. See http://www.deliantra.net/ for more info. EOF cat >dmg/"Reset Configuration" <