# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils flag-o-matic games versionator DESCRIPTION="Enhanced engine for iD Software's Quake 1" HOMEPAGE="http://icculus.org/twilight/darkplaces/" MY_PV=$(replace_version_separator 1 '' ) SRC_URI="http://icculus.org/twilight/darkplaces/files/darkplacesenginelinux${MY_PV}.zip" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="alsa cdinstall cdsound dedicated opengl oss sdl" RESTRICT="nomirror" RDEPEND="sys-libs/glibc alsa? ( media-libs/alsa-lib ) cdinstall? ( games-fps/quake1-data ) opengl? ( virtual/opengl || ( ( x11-libs/libX11 x11-libs/libXau x11-libs/libXdmcp x11-libs/libXext x11-libs/libXxf86dga x11-libs/libXxf86vm ) virtual/x11 ) ) sdl? ( media-libs/libsdl media-libs/sdl-mixer || ( ( x11-libs/libX11 x11-libs/libXau x11-libs/libXdmcp x11-libs/libXext ) virtual/x11 ) )" DEPEND="${RDEPEND} app-arch/unzip" S=${WORKDIR}/${PN} dir=${GAMES_DATADIR}/quake1 pkg_setup() { (use opengl || use sdl || use dedicated) || \ die "At least one of the USE flags 'opengl', 'sdl' and 'dedicated' are required." games_pkg_setup } src_unpack() { unpack ${A} cd "${WORKDIR}" unzip ${PN}enginesource${MY_PV}.zip || die "unzip failed" cd "${S}" # Only CFLAGS optimization is the -march flag local MARCH=$(get-flag -march) sed -i "s/CPUOPTIMIZATIONS=/CPUOPTIMIZATIONS=${MARCH}/" makefile.inc use cdsound || sed -i "s/cd_linux/cd_null/" makefile.inc # Default sound is alsa. if ! use alsa ; then if use oss ; then sed -i "s/DEFAULT_SNDAPI=ALSA/DEFAULT_SNDAPI=OSS/" \ makefile else sed -i "s/DEFAULT_SNDAPI=ALSA/DEFAULT_SNDAPI=NULL/" \ makefile fi fi } src_compile() { if use opengl ; then emake cl-release || die "emake cl-release failed" fi if use sdl ; then emake sdl-release || die "emake sdl-release failed" fi if use dedicated ; then emake sv-release || die "emake sv-release failed" fi } src_install() { if use opengl ; then newgamesbin ${PN}-glx ${PN}-glx.bin games_make_wrapper ${PN}-glx ${PN}-glx.bin "${dir}" fi if use sdl ; then newgamesbin ${PN}-sdl ${PN}-sdl.bin games_make_wrapper ${PN}-sdl ${PN}-sdl.bin "${dir}" fi if use dedicated ; then newgamesbin ${PN}-dedicated ${PN}-dedicated.bin games_make_wrapper ${PN}-dedicated ${PN}-dedicated.bin "${dir}" fi dodoc ${PN}.txt ChangeLog todo prepgamesdirs } pkg_postinst() { einfo "Put the data files into ${GAMES_DATADIR}/quake1/id1" games_pkg_postinst }