# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Header: $ inherit eutils games MY_PN="${PN}-source" DESCRIPTION="Adventures on Planet Zephulor : little 2D game, written in python" HOMEPAGE="http://www.hollowworks.com/apz/" SRC_URI="http://www.hollowworks.com/downloads/adventuresonplanetzephulor/files/${MY_PN}.tar.gz" LICENSE="GPL-2" SLOT="0" KEYWORDS="~x86" IUSE="tools" DEPEND="" RDEPEND="dev-python/pygame" S="${WORKDIR}/${MY_PN}" # Create new wrapper for zephulor # # Usage: new_zephulor_wrapper [] # ex: new_zephulor_wrapper main maptool # ex: new_zephulor_wrapper zephulor # # Notes: - BINARY_DIRECTORY is optional, but if given, # it must be relative to ${GAMES_DATADIR}/${PN}, and # must be a subdir of ${GAMES_DATADIR}/${PN} # - you must NOT specify .py for BINARY # - wrapper's name is defined with the 3 first lines # of the function : warning : only one wrapper by subdir is allowed ! new_zephulor_wrapper() { local WRAPPER_NAME=${PN} [[ "${1}" != "${PN}" ]] && WRAPPER_NAME=${PN}-${1} [[ ! -z ${2} ]] && WRAPPER_NAME=${PN}-${2} local ZEPHULOR_DATADIR=${GAMES_DATADIR}/${PN} [[ ! -z ${2} ]] && ZEPHULOR_DATADIR=${ZEPHULOR_DATADIR}/${2} local THIS_WRAPPER_PATH=${GAMES_BINDIR}/${WRAPPER_NAME} einfo "creating ${WRAPPER_NAME} wrapper ..." newgamesbin "${FILESDIR}"/wrapper ${WRAPPER_NAME} sed -i \ -e "s:BINARY_PATH:${ZEPHULOR_DATADIR}:" ${D}/${THIS_WRAPPER_PATH} \ || die "sed ${THIS_WRAPPER_PATH} failed" sed -i \ -e "s:BINARY:${1}:" ${D}/${THIS_WRAPPER_PATH} \ || die "sed ${THIS_WRAPPER_PATH} failed" } pkg_setup() { if use tools && ! built_with_use virtual/python tcltk; then eerror "Zephulor's tools need python's tcltk support." die "Please rebuild python with tcltk support." fi if ! use tools; then einfo "Editor tools are available, but are not installed by default." einfo "To have them, please rebuild ${PN} with the \"tools\" useflag." fi games_pkg_setup } src_install() { insinto "${GAMES_DATADIR}/${PN}" doins -r "${S}/data" # if tools useflag not set, we remove tools binaries at the end for GameFile in *.py; do doins "${S}/${GameFile}" done dodoc COPYING.txt LGPL.txt README.txt manual.txt # game wrapper new_zephulor_wrapper ${PN} doicon ${FILESDIR}/${PN}.png make_desktop_entry ${PN} 'Adventures on Planet Zephulor' ${PN}.png if use tools; then # tools wrappers for BINARY in chared scnloadtool maploadtool; do new_zephulor_wrapper ${BINARY} done # map editor wrapper new_zephulor_wrapper main maptool insinto "${GAMES_DATADIR}/${PN}" doins -r "${S}/maptool" rm ${D}/${GAMES_DATADIR}/${PN}/maptool/COPYING.txt \ ${D}/${GAMES_DATADIR}/${PN}/maptool/manual.txt dodoc readme-chared.txt readme-maploadtool.txt readme-scnloadtool.txt newdoc maptool/manual.txt maptool-manual.txt ewarn ewarn "Please read ${PN}'s documentation before using tools wrappers." ewarn else # tools useflag not set, removing binaries cd ${D}/${GAMES_DATADIR}/${PN} rm chared.py scnloadtool.py maploadtool.py fi prepgamesdirs }