# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=4 inherit eutils flag-o-matic games DESCRIPTION="Quake 2 engine focused on multi player, stability, security and speed" HOMEPAGE="http://www.r1ch.net/stuff/r1q2/" SRC_URI="http://www.r1ch.net/stuff/r1q2/src/r1q2-b${PV}-src.zip" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="+client dedicated" REQUIRED_USE="|| ( client dedicated )" RDEPEND="client? ( >=media-libs/libpng-1.4 media-libs/libsdl virtual/jpeg virtual/opengl )" DEPEND="${RDEPEND}" S="${WORKDIR}" R1Q2LIB="$(games_get_libdir)/${PN}" src_prepare() { # Negate the need for a wrapper script. epatch "${FILESDIR}/paths.patch" # jpeg_mem_src is already present in libjpeg 8+. # Fix for newer libpng versions. sed -i -r \ -e '/^void jpeg_mem_src\b/,/^}/d' \ -e 's/png_set_gray_1_2_4_to_8/png_set_expand_gray_1_2_4_to_8/g' \ -e 's/info_ptr->([^ _]+_[^ ;]+)/png_get_\1(png_ptr, info_ptr)/g' \ -e 's/info_ptr->([^ ;]+)/png_get_image_\1(png_ptr, info_ptr)/g' \ ref_gl/gl_image.c || die # Link against latest libpng, not 1.2. sed -i 's/png12/png/g' binaries/ref_gl/Makefile || die # Fix for newer zlib versions. sed -i 's/\bOF\b/_Z_OF/g' qcommon/{ioapi,unzip}.{c,h} || die # Override the base flags. sed -i '/^CFLAGS+=/d' binaries/make.inc || die } src_compile() { # Refer to the Makefile about these flags. append-cflags -DLINUX -fno-strict-aliasing -Wall -ffloat-store -MMD \ -DR1Q2LIB="\\\"${R1Q2LIB}\\\"" -DSYSTEMDIR="\\\"${GAMES_DATADIR}/quake2\\\"" use debug && append-cflags -D_DEBUG local TARGETS="game" use client && TARGETS="client ref_gl ${TARGETS}" use dedicated && TARGETS="r1q2ded ${TARGETS}" cd binaries || die emake ${TARGETS} } src_install() { if use dedicated; then dogamesbin binaries/r1q2ded/r1q2ded fi if use client; then newgamesbin binaries/client/quake2 "${PN}" newicon linux/q2icon.xbm "${PN}.xbm" make_desktop_entry "${PN}" "R1Q2 Quake II" exeinto "${R1Q2LIB}" doexe binaries/ref_gl/ref_gl.so fi exeinto "${R1Q2LIB}/baseq2" newexe binaries/game/game*.so game.so dodoc r1q2.txt readme.txt TODO.txt prepgamesdirs }