# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils games toolchain-funcs [[ "${PV}" == 9999* ]] && inherit subversion MY_PN="ioquake3" MY_PV="${PV}" MY_P="${MY_PN}-${MY_PV}" DESCRIPTION="Quake III Arena - 3rd installment of the classic id 3D first-person shooter" HOMEPAGE="http://ioquake3.org/" [[ "${PV}" != 9999* ]] && SRC_URI="http://ioquake3.org/files/${MY_PV}/${MY_P}.tar.bz2" ESVN_REPO_URI="svn://svn.icculus.org/quake3/trunk" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd" IUSE="curl dedicated mumble openal opengl smp teamarena voice vorbis" UIDEPEND=" virtual/opengl media-libs/libsdl openal? ( media-libs/openal ) vorbis? ( media-libs/libogg media-libs/libvorbis ) curl? ( net-misc/curl ) voice? ( media-libs/speex ) " DEPEND=" opengl? ( ${UIDEPEND} ) !dedicated? ( ${UIDEPEND} ) " RDEPEND=" ${DEPEND} opengl? ( voice? ( mumble? ( media-sound/mumble ) ) ) !dedicated? ( voice? ( mumble? ( media-sound/mumble ) ) ) games-fps/quake3-data teamarena? ( games-fps/quake3-teamarena ) " if [[ "${PV}" == 9999* ]]; then S="${WORKDIR}/trunk" else S="${WORKDIR}/${MY_P}" fi src_unpack() { if [[ "${PV}" == 9999* ]]; then subversion_src_unpack else default fi } src_prepare() { sed -i \ -e '/ALDRIVER_DEFAULT/s/libopenal.so.0/libopenal.so/' \ code/client/snd_openal.c \ || die "sed failed" } src_compile() { my_arch() { if use x86 ; then echo "i386" elif use amd64 ; then echo "x86_64" else tc-arch-kernel fi } buildit() { use $1 && echo "1" || echo "0" } # TODO Someone with better cross-compilation knowledge # should look into this # PLATFORM="?" emake \ ARCH="$(my_arch)" \ BUILD_CLIENT=$(( $(buildit opengl) | $(buildit !dedicated) )) \ BUILD_CLIENT_SMP=$(buildit smp) \ BUILD_SERVER=$(buildit dedicated) \ DEFAULT_BASEDIR="${GAMES_DATADIR}/${PN}" \ DEFAULT_LIBDIR="$(games_get_libdir)/${PN}" \ OPTIMIZE="${CFLAGS}" \ TEMPDIR="${T}" \ USE_CODEC_VORBIS=$(buildit vorbis) \ USE_CURL=$(buildit curl) \ USE_CURL_DLOPEN="0" \ USE_INTERNAL_SPEEX="1" \ USE_LOCAL_HEADERS="0" \ USE_MUMBLE=$(buildit mumble) \ USE_OPENAL=$(buildit openal) \ USE_OPENAL_DLOPEN="0" \ USE_VOIP=$(buildit voice) \ || die "emake failed" } src_install() { dodoc id-readme.txt TODO README BUGS ChangeLog md4-readme.txt || die "dodoc" if use voice ; then dodoc voip-readme.txt || die "dodoc" fi if use opengl || ! use dedicated ; then doicon misc/quake3.png misc/quake3-tango.png if use smp; then make_desktop_entry quake3-smp "Quake III Arena (SMP)" else make_desktop_entry quake3 "Quake III Arena" fi fi cd build/release-* || die local exe target for exe in ioq* ; do target=${exe%.*} newgamesbin ${exe} ${target} || die "newgamesbin ${target}" dosym ${target} "${GAMES_BINDIR}/${target/io}" || die "dosym ${target}" done exeinto "$(games_get_libdir)/${PN}/baseq3" doexe baseq3/*.so || die "baseq3 .so" exeinto "$(games_get_libdir)/${PN}/missionpack" doexe missionpack/*.so || die "missionpack .so" prepgamesdirs } pkg_postinst() { games_pkg_postinst ewarn "The source version of Quake III Arena will not work with PunkBuster." ewarn "If you need PB support, then use the games-fps/quake3-bin package." ewarn }