# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils toolchain-funcs games DESCRIPTION="Team-based aliens vs humans FPS with buildable structures" HOMEPAGE="http://tremulous.net/" SRC_URI="mirror://sourceforge/${PN}/${P}.zip http://0day.icculus.org/mirrors/${PN}/${P}.zip ftp://ftp.wireplay.co.uk/pub/quake3arena/mods/${PN}/${P}.zip" LICENSE="GPL-2 CCPL-Attribution-ShareAlike-2.5" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="debug dedicated custom-cflags masterded openal opengl sdl vorbis" UIDEPEND="media-libs/alsa-lib openal? ( media-libs/openal ) sdl? ( media-libs/libsdl ) vorbis? ( media-libs/libogg media-libs/libvorbis ) virtual/opengl || ( ( x11-libs/libX11 x11-libs/libXau x11-libs/libXdmcp x11-libs/libXext !sdl? ( x11-libs/libXxf86dga x11-libs/libXxf86vm ) ) virtual/x11 )" RDEPEND="opengl? ( ${UIDEPEND} ) !opengl? ( sdl? ( ${UIDEPEND} ) ) !opengl? ( !sdl? ( !dedicated? ( ${UIDEPEND} ) ) )" DEPEND="${RDEPEND} !games-fps/tremulous-bin app-arch/unzip" home=${WORKDIR}/${PN} S=${home}/${P}-src dir=${GAMES_DATADIR}/${PN} bindir=${S}/build/release-linux-${ARCH} pkg_setup() { games_pkg_setup if use amd64 ; then ewarn "emerge games-fps/tremulous-bin instead for better performance." echo fi if ! use sdl ; then ewarn "Turn on the 'sdl' USE flag to fix 'joystick' compilation errors." echo fi if use openal && has_version =media-libs/openal-20050504* ; then eerror "Upgrade media-libs/openal to a later version, e.g. openal-0.0.8" die "Need a more recent version of media-libs/openal" fi } src_unpack() { unpack ${P}.zip cd "${home}" unpack ./${P}-src.tar.gz # Prevent debug/release directory change sed -i "${S}/Makefile" \ -e "s:B=\$(BD):B=\$(BR):" \ || die "sed Makefile failed" } src_compile() { buildit() { use $1 && echo 1 || echo 0 ; } local build_client=1 if use dedicated && ! use opengl && ! use sdl ; then build_client=0 fi local build_master=0 use dedicated && use masterded && build_master=1 local opts="BUILD_SERVER=$(buildit dedicated) BUILD_MASTER_SERVER=${build_master} BUILD_CLIENT=${build_client} CC=\"$(tc-getCC)\" DEFAULT_BASEDIR=\"${GAMES_DATADIR}/${PN}\" DEFAULT_LIBDIR=\"${GAMES_LIBDIR}/${PN}\" USE_OPENAL=$(buildit openal) USE_OPENAL_DLOPEN=$(buildit openal) USE_SDL=$(buildit sdl) USE_CODEC_VORBIS=$(buildit vorbis) USE_LOCAL_HEADERS=0" if use custom-cflags ; then # Override default CFLAGS in OPTIMIZE opts="${opts} OPTIMIZE=" fi emake ${opts} \ || die "emake failed" } src_install() { insinto "${dir}" doins -r "${home}"/{base,*.pdf} || die "doins -r failed" if use opengl || use sdl || ! use dedicated ; then # Install client newgamesbin "${bindir}/${PN}.${ARCH}" ${PN} \ || die "newgamesbin client failed" doicon "${home}"/${PN}.xpm || die "doicon failed" make_desktop_entry ${PN} "Tremulous" ${PN}.xpm fi if use dedicated ; then # Install server newgamesbin "${bindir}/tremded.${ARCH}" ${PN}-ded \ || die "newgamesbin ded failed" fi dodoc "${home}"/ChangeLog prepgamesdirs } pkg_postinst() { games_pkg_postinst elog "Read instructions: http://tremulous.net/manual/" elog "or: ${dir}/manual.pdf" echo }