#set -x #a subdirectory called xplayback will be created in these dirs #in which mame/mess tarballs of executables after building MAME=/mnt/mame MESS=/mnt/mess #set this to make 64 bit exe is64= is64=64 # set to make gdb useable DEBUG=1 DEBUG= # to see if patch file exists if [ ! -f "$1" ] ; then echo source archive "$1" DOES NOT EXIST echo usage "buildit sdlmXXX0XXX-wolf.diff" exit fi if [ ! -d "$MAME"/xplayback -o ! -d "$MESS"/xplayback ] ; then echo directories "$MAME"/xplayback and -"$MESS"/xplayback must exist exit fi # convert the patch file name you want to build to the source zip ball dist=`echo $1|sed s@-wolf.diff@.zip@` a=`echo $dist|sed s/.zip//` mameormess=`echo $a|sed 's/^.*\(m[ae][ms][es]\).*/\1/'` if [ "$is64" = "" ] ; then postfix=.i386 else postfix= fi # see if the exectuable has already been built if [ "$mameormess" = "mess" ] ; then if [ -f $MESS/xplayback/wolf$a$postfix.tar.bz2 ] ; then echo Executable archive exists $MESS/xplayback/wolf$a$postfix.tar.bz2 echo are you sure you want to rebuild it? echo if so then rm -f $MESS/xplayback/wolf$a$postfix.tar.bz2 exit fi else if [ -f $MAME/xplayback/xwolf-`echo $a|sed s/^sdlmame0//`$postfix.tar.bz2 ] ; then echo Executable archive exists $MAME/xplayback/xwolf-`echo $a|sed s/^sdlmame0//`$postfix.tar.bz2 echo are you sure you want to rebuild it? echo if so then rm -f $MAME/xplayback/xwolf-`echo $a|sed s/^sdlmame0//`$postfix.tar.bz2 exit fi fi echo MAMEORMESS $mameormess if [ ! -f "$MESS/playback/$dist" ] ; then # get the source file from harp base=`echo $a|sed 's@[0-9.-]*$@@'` pushd . cd $MESS/playback wget http://emulators.homeactionreplay.org/"$base"-mirror/$dist popd fi #clean the source rm -rf /tmp/"$a" unzip -o $MESS/playback/"$dist" -d /tmp # get the version#, not needed yet version=`echo $a|sed 's/^.*0\([0-9]*\).*$/\1/'` #goto the extracted source PATDIR="`pwd`" cd /tmp/$a #and patch echo PATCHING $1 # first crstrip the files in the patch dir for b in `grep ^+++ "$PATDIR/$1" |sed 's/[\t]/ /g'|cut -d' ' -f2|cut -d/ -f2-` ; do sed 's/[\r]//' < "$b" > /tmp/crstrip.$$ mv /tmp/crstrip.$$ "$b" done /usr/bin/patch -l -p1 < "$PATDIR/$1" #and build if [ "$DEBUG" = "1" ] ; then MAKEOPTS="$MAKEOPTS SYMBOLS=1" fi #add make multiple jobs for multiple processors echo VERSION=$version if [ "$mameormess" = "mess" ] ; then if [ "$version" -lt "137" ] ; then MAKEOPTS="-f makefile.sdl" else MAKEOPTS="TARGET=mess" fi else if [ "$version" -lt "137" ] ; then MAKEOPTS="-f makefile.sdl" else MAKEOPTS="TARGET=mame" fi fi #add make multiple jobs for multiple processors if [ `cat /proc/cpuinfo |egrep processor.*:|wc -l` -gt "1" ] ; then #MAKEOPTS="$MAKEOPTS -j3" MAKEOPTS="$MAKEOPTS -j`cat /proc/cpuinfo |egrep processor.*:|wc -l`" echo -------------------- USING MAKEOPTS $MAKEOPTS fi #silent quiet just print compile command lines #MAKEOPTS="$MAKEOPTS -n" # there are many warnings now just ignore them MAKEOPTS="$MAKEOPTS NOWERROR=1" if [ "$is64" = "" ] ; then echo making 32bit $MAKEOPTS nice make $MAKEOPTS else echo making $MAKEOPTS PTR64=1 AMD64=1 PM= nice make $MAKEOPTS PTR64=1 AMD64=1 PM= fi #and archive the executable if [ -x "$mameormess""$is64" -o -x "$mameormess" -o -x xmame.x11 ] ; then if [ "$mameormess" = "mess" ] ; then #move twice to make sure i get it mv "$mameormess""$is64" mess mv "$mameormess" mess tar cfj $MESS/xplayback/wolf$a$postfix.tar.bz2 mess else if [ ! -x xmame.x11 ] ; then #move twice to make sure i get it mv "$mameormess""$is64" xmame.x11 mv "$mameormess" xmame.x11 fi tar cfj $MAME/xplayback/xwolf-`echo $a|sed -e s/^sdlmame0// -e s/^xmame-0.//`$postfix.tar.bz2 xmame.x11 fi # clean the source if a succesfful compile #rm -rf /tmp/"$a" #rm -rf $MESS/playback/"$dist" else echo DID NOT BUILD $mameormess fi