Ucpt:Games-engines/ags-bin/ags-bin-2.70.864.ebuild
From Gentoo Linux Wiki
#Download - Bugs - Discussion - History
inherit eutils games
DESCRIPTION="The Adventure Game Studio engine binaries for Linux/x86"
SRC_URI="http://drevil.warpcore.org/ags/files/linux/ags-v2_70_864.tar.bz2 http://drevil.warpcore.org/ags/files/midiptch.tar.bz2"
HOMEPAGE="http://www.adventuregamestudio.co.uk/"
SLOT="0"
LICENSE="ags"
KEYWORDS="x86"
IUSE=""
DEPEND=""
src_install() {
cd ${WORKDIR}
cd ags
dodoc docs/* README
cd ${WORKDIR}
rm -rf ags/docs ags/README
mkdir -p ${D}/usr/share/games
mv -f ags ${D}/usr/share/games/ags-engine
cd ${D}/usr/share/games/ags-engine
tar xjf ${DISTDIR}/midiptch.tar.bz2
cat > acsetup.cfg << EOF
[misc]
cachemax=20480
screenres=1
windowed=0
forceletterbox=0
antialias=0
[sound]
digiid=-1
midiid=-1
usevox=1
usespeech=0
[language]
EOF
mkdir -p ${D}/usr/games/bin
cd ${D}/usr/games/bin
cat > ags-start << MYEOF
#!/bin/sh
if [ "\$1" == "--help" ]; then
cat << EOF
Options: --help this help page
--win run in window
--fs run fullscreen
--config configure game settings
EOF
exit
fi
APP=\`basename \$0\`
APPHOME=~/.ags/"\$APP"
APPDIR="/usr/share/games/\$APP"
AGSDIR="/usr/share/games/ags-engine"
if [ ! -d \$APPDIR ]; then exit; fi
if [ ! -d "\$APPHOME" ]; then
mkdir -p "\$APPHOME" || exit
cd "\$APPHOME" || exit
# do we have to run a windows installer? (due to licensing problems...)
if [ -e "\$APPDIR/wine_user_setup_exe" ]; then
while read EXEFILE; do
wine "\$APPDIR/\$EXEFILE"
done < "\$APPDIR/wine_user_setup_exe"
# find installation dir...
echo "Trying to locate installed files..."
# first we try ~/.wine, then ~
AC2GAMEDAT=`< "\$APPDIR/ac2game_dat_exe"`
find ~/.wine -name "\$AC2GAMEDAT" | while read TMP; do
echo "\${TMP%/*}" > temp
done
NEWAPPDIR="`< temp`"
if [ -z "\$NEWAPPDIR" ]; then
find ~ -name "\$AC2GAMEDAT" | while read TMP; do
echo "\${TMP%/*}" > temp
done
NEWAPPDIR="`< temp`"
fi
rm -f temp > /dev/null 2>&1
if [ -z "\$NEWAPPDIR" ]; then
echo "Cannot find installation directory! (\$AC2GAMEDAT)"
cd
rm -rf "\$APPHOME"
exit 1
fi
ln -s "\$NEWAPPDIR/\$AC2GAMEDAT" ac2game.dat
APPDIR=\$NEWAPPDIR
fi
cp -Rs "\$AGSDIR/"* . >/dev/null 2>&1
cp -Rs "\$APPDIR/"* . >/dev/null 2>&1
rm -f acsetup.cfg
cp "\$AGSDIR/acsetup.cfg" .
fi
cd "\$APPHOME" || exit
if [ "\$1" == "--config" ]; then
./ags-setup 2>&1 >/dev/null
exit
fi
if [ "\$1" == "--win" ]; then
sed 's/windowed=0/windowed=1/' acsetup.cfg > acsetup.cfg.tmp
mv -f acsetup.cfg.tmp acsetup.cfg
fi
if [ "\$1" == "--fs" ]; then
sed 's/windowed=1/windowed=0/' acsetup.cfg > acsetup.cfg.tmp
mv -f acsetup.cfg.tmp acsetup.cfg
fi
if [ -x startup.sh ]; then
./startup.sh
fi
./ags
MYEOF
chmod 755 ags-start
prepgamesdirs
}
#
