# Exit on error:
set -e

wget http://www.delorie.com/store/ace/ace-1.4.tar.gz
tar xf ace-1.4.tar.gz
cd ace-1.4

patch -Np1 < ace-1.4-1.patch

./configure \
    --prefix=/usr

make
make install

cd ..

# Freedesktop stuff:

for GAME in \
    freecell \
    mastermind \
    minesweeper \
    solitaire \
    spider \
    taipei
do {
    echo '[Desktop Entry]'    > /usr/share/applications/$GAME.desktop
    echo 'Type=Application'  >> /usr/share/applications/$GAME.desktop
    echo "Name=$GAME"        >> /usr/share/applications/$GAME.desktop
    echo "GenericName=$GAME" >> /usr/share/applications/$GAME.desktop
    echo "TryExec=$GAME"     >> /usr/share/applications/$GAME.desktop
    echo "Exec=$GAME"        >> /usr/share/applications/$GAME.desktop
    echo 'Categories=Game'   >> /usr/share/applications/$GAME.desktop
};
done;

exit 0
