# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # Variables to specify in an ebuild which uses this eclass: # GAME - (doom3, quake4 or ut2004), unless ${PN} starts with e.g. "doom3-" # MOD_DIR - Subdirectory name for the mod, if applicable # MOD_NAME - Creates a command-line wrapper and desktop icon for the mod # MOD_ICON - Custom icon for the mod, instead of the default inherit games EXPORT_FUNCTIONS src_install SLOT="0" # "-*" because the games don't run on other arches KEYWORDS="-* amd64 x86" IUSE="" LICENSE="freedist" RESTRICT="nomirror nostrip" # Map packs and mods should never overwrite existing files FEATURES="${FEATURES} collision-protect" if [[ -z ${GAME} ]] ; then # Guess ${GAME} from ${PN}, e.g. "doom3" from "doom3-inhell" GAME=${PN%%-*} fi # Most of the SRC_URIs are going to be zipped DEPEND="app-arch/unzip" # Add ut2007 support, when the game is released case "${GAME}" in "doom3") RDEPEND=">=games-fps/doom3-1.3.1302-r1" GAME_TITLE="Doom III" DEFAULT_MOD_ICON="doom3.png" SELECT_MOD="+set fs_game " ;; "quake4") RDEPEND=">=games-fps/quake4-bin-1.0.6" GAME_TITLE="Quake IV" DEFAULT_MOD_ICON="/usr/share/pixmaps/quake4.bmp" SELECT_MOD="+set fs_game " ;; "ut2004") RDEPEND=">=games-fps/ut2004-3369-r1" GAME_TITLE="UT2004" DEFAULT_MOD_ICON="ut2004.xpm" SELECT_MOD="-mod=" ;; esac S=${WORKDIR} dir=${GAMES_PREFIX_OPT}/${GAME} GAME_EXE=${GAME} games-mappack_src_install() { # Sanity check if [[ "${GAME}" != "doom3" ]] && [[ "${GAME}" != "quake4" ]] \ && [[ "${GAME}" != "ut2004" ]] ; then die "GAME must be one of: doom3, quake4, ut2004" fi INS_DIR="${dir}" if [[ -n "${MOD_DIR}" ]] ; then # Am installing into a new subdirectory of the game if [[ ! -d "${MOD_DIR}" ]] ; then INS_DIR="${dir}/${MOD_DIR}" fi if [[ -n "${MOD_NAME}" ]] ; then if [[ -n "${MOD_ICON}" ]] ; then # Install custom icon # This Bash voodoo determines the file extension, e.g. "xpm" MOD_ICON_EXT=${MOD_ICON##*.} newicon "${MOD_ICON}" "${PN}.${MOD_ICON_EXT}" \ || die "newicon ${MOD_ICON} failed" else # Use the game's standard icon MOD_ICON=${DEFAULT_MOD_ICON} fi # Set up command-line and desktop menu entry games_make_wrapper ${PN} "${GAME_EXE} ${SELECT_MOD}${MOD_DIR}" make_desktop_entry ${PN} "${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" fi fi # We expect anything not wanted to have been deleted by the ebuild insinto "${INS_DIR}" doins -r * || die "doins -r failed" prepgamesdirs }