#!/bin/bash
#Script para atualizar o SDLMAME
#data: 2009.04.07 22:25 25'
SDLMAMEDIR=~/emu/sdlmame #where it will copy the binary files
SDLMAMEFILE=`echo $1 | cut -d "/" -f8` #get only filename, fix w/ your dir
SDLMAMEVER=`echo $SDLMAMEFILE | cut -d "." -f1` #return version
if [ ! -e "$1" ]; then
echo OOPs! arquivo \"$1\" inexistente. && exit 1
#fi
elif [ -e $SDLMAMEVER ]; then
echo Removendo $SDLMAMEVER atual...
sleep 2
rm -rfv $SDLMAMEVER || exit 1
echo && sleep 2
fi
echo Descompactando $SDLMAMEVER ...
unzip $1 && cd $SDLMAMEVER || exit 1
echo
if [ -e makefile ]; then
echo Aplicando patch para compilar sem Gnome ...
patch -p1 -i ../sdlfix-2.diff || exit 1
echo
time make -s PTR64=1 -j5 || exit 1
echo
for file in `find . -type f -maxdepth 1`; do
if [ -x $file ]; then
echo Copiando $file ...
cp -rfv $file $SDLMAMEDIR || exit 1
md5sum -b $file && md5sum -b $SDLMAMEDIR/$file || exit
fi
done
fi