# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # Aric LeDell 2003-01-11 16:20 inherit games S=${WORKDIR}/${P} DESCRIPTION="This is a collection of games from NetBSD" HOMEPAGE="http://www.advogato.org/proj/bsd-games/" SRC_URI="ftp://metalab.unc.edu/pub/Linux/games/${P}.tar.gz" SLOT="0" LICENSE="BSD" KEYWORDS="~x86 ~ppc" DEPEND="sys-libs/ncurses sys-apps/miscfiles sys-apps/less sys-devel/bison sys-devel/flex" echo ${GAMES_TO_BUILD:="adventure arithmetic atc backgammon battlestar bcd boggle caesar canfield cribbage fish gomoku hangman hunt mille monop morse number phantasia pig pom ppt primes quiz rain random robots sail snake tetris trek wargames worm worms wtf wump"} > /dev/null export GAMES_TO_BUILD export DOCSDIR=${D}usr/share/doc/${PF} src_unpack() { unpack ${P}.tar.gz einfo Applying debian patches and one gentoo patch cd ${S} cat ${FILESDIR}/bsdgames_2.13-11.diff | patch -p1 cat ${FILESDIR}/bsdgames-2.13-gentoo.diff | patch -p1 } src_compile() { cd ${S} einfo "Getting bsd-games's custom configure ready for gentoo" cp -a ${FILESDIR}/config.params-gentoo ./config.params # Set GAMES_TO_BUILD variable to whatever you want echo bsd_games_cfg_build_dirs=\"${GAMES_TO_BUILD}\" >> ./config.params ./configure || die make || die } src_install() { cd ${S} dodir ${GAMES_BINDIR} dodir /usr/share/man/man1 dodir /usr/share/man/man6 make DESTDIR=${D} install-strip || die dodoc AUTHORS BUGS COPYING ChangeLog ChangeLog.0 INSTALL README \ PACKAGING SECURITY THANKS TODO YEAR2000 gzip -c ${S}/debian/changelog > ${DOCSDIR}/changelog.debian.gz gzip -c ${S}/debian/copyright > ${DOCSDIR}/copyright.debian.gz # The following games have extra documentation # atc, hunt, phantasia, boggle, trek # The following games have score files and need to be sgid ${GAMES_GROUP} # atc, battlestar, canfield, cribbage, robots, snake, tetris-bsd, phantasia, sail # The following games have data subdirs that need to be setgid too # phantasia, sail # Now we do the special stuff for each game if build_game adventure ; then einfo "Doing special installation tasks for adventure" do_binary adventure fi if build_game arithmetic ; then einfo "Doing special installation tasks for arithmetic" do_binary arithmetic fi if build_game atc ; then einfo "Doing special installation tasks for atc" do_binary_setgid atc do_statefile atc_score do_constdir atc do_extra_doc BUGS fi if build_game backgammon ; then einfo "Doing special installation tasks for backgammon" do_binary backgammon teachgammon fi if build_game banner ; then ewarn You should really use another banner fi if build_game battlestar ; then einfo "Doing special installation tasks for battlestar" do_binary_setgid battlestar do_statefile battlestar.log fi if build_game bcd ; then einfo "Doing special installation tasks for bcd" do_binary bcd fi if build_game boggle ; then einfo "Doing special installation tasks for boggle" do_binary boggle do_constdir boggle do_extra_doc boggle README README.linux fi if build_game caesar ; then einfo "Doing special installation tasks for caesar" do_binary caesar rot13 fi if build_game canfield ; then einfo "Doing special installation tasks for canfield" do_binary_setgid canfield do_binary cfscores do_statefile cfscores fi if build_game countmail ; then ewarn countmail doesnt seem to have any binaries fi if build_game cribbage; then einfo "Doing special installation tasks for cribbage" do_binary_setgid cribbage do_statefile criblog do_constfile cribbage.instr fi if build_game factor; then ewarn factor is part of sys-apps/misc fi if build_game fish ; then einfo "Doing special installation tasks for fish" do_binary fish do_constfile fish.instr fi if build_game fortune ; then ewarn "You should really use app-games/fortune-mod instead" fi if build_game gomoku ; then einfo "Doing special installation tasks for gomoku" do_binary gomoku fi if build_game hangman ; then einfo "Doing special installation tasks for hangman" do_binary hangman fi if build_game hunt ; then einfo "Doing special installation tasks for hunt" einfo " 'huntd' will still be owned by root" do_binary hunt do_extra_doc hunt README README.linux fi if build_game mille ; then einfo "Doing special installation tasks for mille" do_binary mille fi if build_game monop ; then einfo "Doing special installation tasks for monop" do_binary monop do_constfile monop-cards.pck fi if build_game morse ; then einfo "Doing special installation tasks for morse" do_binary morse fi if build_game number ; then einfo "Doing special installation tasks for number" do_binary number fi if build_game phantasia ; then einfo "Doing special installation tasks for phantasia" do_binary_setgid phantasia do_statedir phantasia # This file should not be world-readable because it has passwords in it chmod 660 ${D}/${GAMES_STATEDIR}/phantasia/characs do_extra_doc phantasia COPYRIGHT OWNER README fi if build_game pig ; then einfo "Doing special installation tasks for pig" do_binary pig fi if build_game pom ; then einfo "Doing special installation tasks for pom" do_binary pom fi if build_game ppt ; then einfo "Doing special installation tasks for ppt" do_binary ppt fi if build_game primes ; then einfo "Doing special installation tasks for primes" do_binary primes # Since factor is usually not installed, and primes.6 is a symlink to # factor.6, I need to change that to the actual man page. if [ ! `build_game factor` ] ; then rm -f ${D}usr/share/man/man6/factor.6 ${D}usr/share/man/man6/primes.6 cp -a factor/factor.6 ${D}usr/share/man/man6/primes.6 fi fi if build_game quiz ; then einfo "Doing special installation tasks for quiz" do_binary quiz do_constdir quiz fi if build_game rain ; then einfo "Doing special installation tasks for rain" do_binary rain fi if build_game random ; then einfo "Doing special installation tasks for random" do_binary random fi if build_game robots ; then einfo "Doing special installation tasks for robots" do_binary_setgid robots do_statefile robots_roll fi if build_game sail ; then einfo "Doing special installation tasks for sail" do_binary_setgid sail do_statedir sail do_statefile saillog fi if build_game snake ; then einfo "Doing special installation tasks for snake" do_binary_setgid snake do_binary snscore do_statefile snake.log snakerawscores fi if build_game tetris ; then einfo "Doing special installation tasks for tetris" do_binary_setgid tetris-bsd do_statefile tetris-bsd.scores fi if build_game trek ; then einfo "Doing special installation tasks for trek" do_binary trek cp -a trek/USD.doc/trek.me ${DOCSDIR} fi if build_game wargames ; then einfo "Doing special installation tasks for wargames" do_binary wargames fi if build_game worm ; then einfo "Doing special installation tasks for worm" do_binary worm fi if build_game worms ; then einfo "Doing special installation tasks for worms" do_binary worms fi if build_game wtf ; then einfo "Doing special installation tasks for wtf" do_binary wtf do_constfile acronyms fi if build_game wump ; then einfo "Doing special installation tasks for wump" do_binary wump do_constfile wump.info fi } # Modeled after /usr/lib/portage/bin/ebuild.sh 's use() function build_game() { local x for x in ${GAMES_TO_BUILD} do if [ "${x}" = "${1}" ] then return 0 fi done return 1 } # Do binary owner and permission do_binary() { local x for x in $@ do gamesowners ${D}/${GAMES_BINDIR}/${x} gamesperms ${D}/${GAMES_BINDIR}/${x} done return 0 } # Do setgid binary owner and permission do_binary_setgid() { local x for x in $@ do do_binary ${x} chmod g+s ${D}/${GAMES_BINDIR}/${x} done return 0 } # Do statefile owner and permission (for scorefiles) do_statefile() { local x for x in $@ do touch ${D}/${GAMES_STATEDIR}/${x} chown ${GAMES_USER}.${GAMES_GROUP} ${D}/${GAMES_STATEDIR}/${x} chmod 664 ${D}/${GAMES_STATEDIR}/${x} done return 0 } # Do statedir (when games have a whole directory...) do_statedir() { local x for x in $@ do mkdir -p ${D}/${GAMES_STATEDIR}/${x} chown -R ${GAMES_USER}.${GAMES_GROUP} ${D}/${GAMES_STATEDIR}/${x} chmod g+rws ${D}/${GAMES_STATEDIR}/${x} local y for y in $(ls ${D}/${GAMES_STATEDIR}/${x}) do chmod 664 ${D}/${GAMES_STATEDIR}/${x}/${y} done done return 0 } do_constfile() { local x for x in $@ do chown ${GAMES_USER}.${GAMES_GROUP} ${D}/${GAMES_DATADIR}/${x} done return 0 } do_constdir() { local x for x in $@ do mkdir -p ${D}/${GAMES_DATADIR}/${x} chown -R ${GAMES_USER}.${GAMES_GROUP} ${D}/${GAMES_DATADIR}/${x} done return 0 } # For extra documentation in the game's build subdirectory do_extra_doc() { local dir="$1"; shift local x for x in $@ do gzip -c ${S}/${dir}/${x} > ${DOCSDIR}/${x}.${dir}.gz done return 0 }