Ucpt:Games-rpg/acorn-client-bin/acorn-client-bin-0.4.ebuild
From Gentoo Linux Wiki
#Download - Bugs - Discussion - History
inherit eutils games
DESCRIPTION="Acorn client binaries and data. Look at the WorldForge website for active RPG servers!"
SRC_URI="ftp://ftp.ecs.soton.ac.uk/pub/worldforge/acorn/0.4/iso/acorn-0.4-min.iso http://purple.worldforge.org/downloads/games/acorn/0.4/iso/acorn-0.4-min.iso ftp://victor.worldforge.org/pub/worldforge/games/acorn/0.4/iso/acorn-0.4-min.iso ftp://ftp.fr.gnome.org/pub/worldforge/games/acorn/0.4/iso/acorn-0.4-min.iso"
HOMEPAGE="http://www.worldforge.org/"
SLOT="0"
LICENSE="GPL-2, LGPL, GFDL"
KEYWORDS="x86"
IUSE=""
DEPEND="virtual/libc
>=dev-libs/libcdio-0.73
dev-lang/perl
sys-apps/sed"
src_unpack() {
cd ${WORKDIR}
einfo "Extracting files from ISO image..."
iso-info -i ${DISTDIR}/${A} -f | perl -ne 's/^\s*[0-9]+\s*//;print $_' | grep --regexp '\(\.gz$\|\.sh$\|^/bin/\|README\|licence\.txt\|icon\.xpm\)' | while read FILE; do
einfo " ${FILE}"
DIRN="./`dirname \"${FILE}\"`"
rm -f "${DIRN}" >/dev/null 2>&1
mkdir -p "${DIRN}"
iso-read -i ${DISTDIR}/${A} -e "${FILE}" -o "./${FILE}"
done
}
src_install() {
BINDIR=/usr/games/lib/acorn/bin
SHAREDIR=/usr/share/games/acorn
cd ${WORKDIR}
mkdir -p ${D}${BINDIR}
mkdir -p ${D}${SHAREDIR}
mkdir -p ${D}/usr/games/bin
# install binaries
mv ${WORKDIR}/bin/x86/bin/u* ${D}${BINDIR}
chmod 750 ${D}${BINDIR}/*
# adjust user config initialization script used by uclient start script
grep -v FOO ${WORKDIR}/setup.data/postinstall.sh | sed "s/'\$SETUP_INSTALLPATH'/\/usr\/share\/games\/acorn/" > ${D}${BINDIR}/user-setup.sh
chmod 755 ${D}${BINDIR}/user-setup.sh
# create uclient start script. Makes sure that the user does not have to configure
# the client himself.
ACS=${D}/usr/games/bin/acorn-client
echo '#!/bin/sh' > ${ACS}
echo 'if [ ! -f "$HOME/.uclient/acorn-0.4-tag" ]; then' >> ${ACS}
echo ${BINDIR}'/user-setup.sh' >> ${ACS}
echo 'touch "$HOME/.uclient/acorn-0.4-tag"' >> ${ACS}
echo 'fi' >> ${ACS}
echo ${BINDIR}'/uclient' >> ${ACS}
chmod 750 ${ACS}
chown root:games ${ACS}
# unpack data files for uclient (extraction paths derived from setup.data/setup.xml)
tar -C ${D}${SHAREDIR} -xzf ${WORKDIR}/acorn_client_share*
tar -C ${D}${SHAREDIR} -xzf ${WORKDIR}/uclient-graphics*
mv ${WORKDIR}/icon.xpm ${D}${SHAREDIR}
mkdir -p ${D}${SHAREDIR}/share/forge
tar -C ${D}${SHAREDIR}/share/forge -xzf ${WORKDIR}/acorn_media2d*
tar -C ${D}${SHAREDIR}/share/forge -xzf ${WORKDIR}/acorn_sprites*
# setup.xml tells me that the music files should go under ${SHAREDIR},
# but the resource description lists look like they should go under
# ${SHAREDIR}/share/forge which seems to be the more obvious choice because
# uclient's installation path is ${SHAREDIR}/share. To be sure, we
# just add two links...
tar -C ${D}${SHAREDIR}/share/forge -xzf ${WORKDIR}/acorn_music*
cd ${D}${SHAREDIR}
ln -s share/forge/music .
cd share
ln -s forge/music .
# minimal doc files
cd ${WORKDIR}
mv licence.txt LICENSE
dodoc README LICENSE
# set root:games permissions
chown -R root:games ${D}${SHAREDIR} ${D}${BINDIR}
chmod -R u+rw,g+r,g-w,o-rwx ${D}${SHAREDIR}
chmod -R u+x,g+x ${D}${BINDIR}
prepgamesdirs
make_desktop_entry acorn-client "WorldForge Acorn Client" ${SHAREDIR}/icon.xpm
}
#
