# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils flag-o-matic subversion toolchain-funcs games MY_PN="quake2" DESCRIPTION="Enhanced Quake 2 engine" HOMEPAGE="http://qudos.quakedev.com/" SRC_URI="" # View at http://svn.quakedev.com/viewvc.cgi/qudos/trunk/ ESVN_REPO_URI="svn://svn.quakedev.com/${PN}/trunk" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="alsa audacious cdinstall debug dedicated demo dga ipv6 joystick mods opengl optimize-cflags qmax oss sdl textures" UIDEPEND="alsa? ( media-libs/alsa-lib ) audacious? ( media-sound/audacious ) dga? ( x11-libs/libXxf86dga ) sdl? ( media-libs/libsdl ) media-libs/jpeg media-libs/libogg media-libs/libpng media-libs/libvorbis virtual/opengl virtual/glu x11-libs/libX11 x11-libs/libXext x11-libs/libXxf86vm" COMMON="opengl? ( ${UIDEPEND} ) !opengl? ( sdl? ( ${UIDEPEND} ) ) !opengl? ( !sdl? ( !dedicated? ( ${UIDEPEND} ) ) )" DEPEND="${COMMON} x11-proto/xf86vidmodeproto" RDEPEND="${COMMON} cdinstall? ( games-fps/quake2-data ) demo? ( games-fps/quake2-demodata ) textures? ( games-fps/quake2-textures )" S=${WORKDIR} dir=${GAMES_DATADIR}/${MY_PN} build_client() { if use opengl || use sdl || ! use dedicated ; then # Build default client return 0 fi return 1 } pkg_setup() { games_pkg_setup local alert_user if ! use qmax && build_client ; then elog "The 'qmax' graphical improvements are recommended." echo alert_user=y fi # Determine the default sound driver. "oss" is the default and favourite. # snd_drv is not a local variable. snd_drv="oss" use alsa && snd_drv="alsa" use sdl && snd_drv="sdl" use oss && snd_drv="oss" if build_client ; then elog "Selected the ${snd_drv} sound driver as the default." echo if [[ "${snd_drv}" = "alsa" ]] ; then # OSS is the default sound driver in the Makefile ewarn "The ALSA sound driver for this game is incomplete." ewarn "The 'oss' USE flag is recommended instead." echo alert_user=y fi fi if [[ -n "${alert_user}" ]] ; then ebeep epause fi } src_unpack() { subversion_src_unpack local libdir=$(games_get_libdir)/${PN} rm docs/gnu.txt # Change default sound driver and its location sed -i \ -e "s:\"oss\":\"${snd_drv}\":" \ -e "s:\"\./snd:\"${libdir}/snd:" \ src/client/snd_dma.c || die "sed snd_dma.c failed" # Fix Makefile for "debug" and "optimize-cflags" USE flags local march=$(get-flag -march) sed -i \ -e "s:-fno-strict-aliasing::" \ -e "s:-Werror ::" \ -e "s:-march=\$(MACHINE):${march}:" \ Makefile || die "sed Makefile failed" } src_compile() { yesno() { useq $1 && echo YES || echo NO ; } local libdir=$(games_get_libdir)/${PN} local client="NO" build_client && client="YES" local type="release" use debug && type="debug" # Favour OpenGL over SDL - it does not lose focus when audacious starts. # OpenGL will be the default, if it is built. local build_sdl="NO" build_opengl=$(yesno opengl) use sdl && build_sdl="YES" && build_opengl="YES" # Prevent "signal 11" abort filter-flags -fomit-frame-pointer emake -j1 \ BUILD_QUAKE2="${client}" \ BUILD_DEDICATED=$(yesno dedicated) \ BUILD_GLX=${build_opengl} \ BUILD_SDLGL=${build_sdl} \ BUILD_SDL_SND=${build_sdl} \ BUILD_ALSA_SND=$(yesno alsa) \ BUILD_OSS_SND=$(yesno oss) \ WITH_AUDACIOUS=$(yesno audacious) \ WITH_XMMS=NO \ WITH_DGA_MOUSE=$(yesno dga) \ WITH_JOYSTICK=$(yesno joystick) \ DATADIR="${dir}" \ LOCALBASE=/usr \ LIBDIR="${libdir}" \ WITH_QMAX=$(yesno qmax) \ BUILD_3ZB2=$(yesno mods) \ BUILD_CTF=$(yesno mods) \ BUILD_JABOT=$(yesno mods) \ BUILD_ROGUE=$(yesno mods) \ BUILD_XATRIX=$(yesno mods) \ BUILD_ZAERO=$(yesno mods) \ WITH_BOTS=$(yesno mods) \ HAVE_IPV6=$(yesno ipv6) \ OPTIMIZE=$(yesno optimize-cflags) \ CC="$(tc-getCC)" \ WITH_DATADIR=YES \ WITH_LIBDIR=YES \ BUILD_DEBUG_DIR=release \ BUILD_RELEASE_DIR=release \ BUILD_GAME=YES \ STRIP=NO \ TYPE="${type}" \ || die "emake failed" } src_install() { local icon=${PN}.png local libdir=$(games_get_libdir)/${PN} if build_client ; then newgamesbin ${MY_PN}/QuDos ${PN} \ || die "newgamesbin QuDos failed" # This icon is not available in the 0.40.1 tarball newicon src/unix/Q2.png "${icon}" \ || die "newicon failed" if use demo ; then games_make_wrapper ${PN}-demo "${PN} +set game demo" make_desktop_entry ${PN}-demo "QuDos (Demo)" "${icon}" else make_desktop_entry ${PN} "QuDos" "${icon}" fi fi if use dedicated ; then newgamesbin ${MY_PN}/QuDos-ded ${PN}-ded \ || die "newgamesbin QuDos-ded failed" fi insinto "${libdir}" doins -r ${MY_PN}/* || die "doins libs failed" rm "${D}/${libdir}"/QuDos insinto "${libdir}"/baseq2 doins data/qudos.pk3 || die "doins qudos.pk3 failed" dodoc $(find docs -name \*.txt) docs/q2_orig/README* prepgamesdirs }