commit:     ad47a7041dd5606568c1ce7cc7ae175209e37cff
Author:     Christian Schmitt <chris <AT> ilovelinux <DOT> de>
AuthorDate: Tue Aug 25 18:30:06 2015 +0000
Commit:     Christian Schmitt <chris <AT> ilovelinux <DOT> de>
CommitDate: Tue Aug 25 18:30:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gamerlay.git/commit/?id=ad47a704

[games-fps/rtcw-9999] Some nice improvements from Lars Wendler (polynomial-c), 
a Gentoo dev. Thanks a lot!

 games-fps/rtcw/files/Makefile.local |   3 +-
 games-fps/rtcw/rtcw-9999.ebuild     | 101 ++++++++++++++++++++++++++++++++----
 2 files changed, 91 insertions(+), 13 deletions(-)

diff --git a/games-fps/rtcw/files/Makefile.local 
b/games-fps/rtcw/files/Makefile.local
index 462f31d..451bde9 100644
--- a/games-fps/rtcw/files/Makefile.local
+++ b/games-fps/rtcw/files/Makefile.local
@@ -30,11 +30,10 @@
 #COPYDIR               # the target installation directory
 #TEMPDIR               # specify userdefined directory for temp files
 CFLAGS=-march=native -mtune=native -O3 -pipe
+V=1
 USE_INTERNAL_LIBS=0
 USE_LOCAL_HEADERS=0
 USE_MUMBLE=0
 USE_VOIP=0
 USE_CODEC_OPUS=0
 NO_STRIP=1
-
-#CLIENT_CFLAGS+=-I/usr/include/opus

diff --git a/games-fps/rtcw/rtcw-9999.ebuild b/games-fps/rtcw/rtcw-9999.ebuild
index 6fdbcec..e50f689 100644
--- a/games-fps/rtcw/rtcw-9999.ebuild
+++ b/games-fps/rtcw/rtcw-9999.ebuild
@@ -3,19 +3,31 @@
 # $Id$
 
 EAPI=5
-inherit eutils games git-2
+
+SCM=""
+[[ "${PV}" = 9999 ]] && SCM="git-r3"
+inherit eutils games ${SCM}
+unset SCM
 
 DESCRIPTION="Return to Castle Wolfenstein - IORTCW Project"
 HOMEPAGE="http://games.activision.com/games/wolfenstein/";
-EGIT_REPO_URI="https://github.com/iortcw/iortcw.git";
+if [[ "${PV}" = 9999 ]] ; then
+       EGIT_REPO_URI="https://github.com/iortcw/iortcw.git";
+       KEYWORDS=""
+else
+       SRC_URI="https://github.com/iortcw/iortcw/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+       S="${WORKDIR}/iortcw-${PV}"
+       KEYWORDS="~amd64 ~x86"
+fi
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS="~amd64 ~x86"
-IUSE="opengl"
+IUSE="+client curl mumble openal opus server truetype voip vorbis"
+
+REQUIRED_USE="|| ( client server )
+               voip? ( opus )"
 
-UIDEPEND="
-       (
+DEPEND="client?        (
                media-libs/libsdl2
                x11-libs/libX11
                x11-libs/libXau
@@ -23,15 +35,82 @@ UIDEPEND="
                x11-libs/libXext
                virtual/opengl
        )"
-RDEPEND="sys-libs/glibc
-       opengl? ( ${UIDEPEND} )"
+
+RDEPEND="client? ( media-libs/libsdl2
+               virtual/opengl
+               virtual/jpeg:0
+               curl? ( net-misc/curl )
+               mumble? ( media-sound/mumble )
+               openal? ( media-libs/openal )
+               opus? ( media-libs/libogg
+                       media-libs/opus
+                       media-libs/opusfile )
+               truetype? ( media-libs/freetype )
+               vorbis? ( media-libs/libogg
+                       media-libs/libvorbis ) )"
+       #voip? ( media-libs/speex )"
 
 dir=${GAMES_PREFIX_OPT}/${PN}
 ARCHITECTURE=$(uname -m)
 
+use_switch() {
+       local flag="${1}" cfg_option="${2}" cfg_val=0
+       local makefile="${S}/SP/Makefile.local"
+       [[ -z "${flag}" ]] && die
+       [[ -z "${cfg_option}" ]] && die
+
+       use ${flag} && cfg_val=1
+
+       if grep -q "^${cfg_option}=" ${makefile} ; then
+               sed "/${cfg_option}=/s@[[:digit:]]@${cfg_val}@" -i ${makefile} \
+                       || die
+       else
+               echo "${cfg_option}=${cfg_val}" >> ${makefile}
+       fi
+}
+
 src_prepare(){
        epatch "${FILESDIR}/${PN}-zlib.patch"
        cp "${FILESDIR}/Makefile.local" "${S}/SP/"
+
+       # remove bundled libs
+       local bundled_libs bundle bdir tdir
+
+       bundled_libs=(
+               AL # openal
+               SDL2
+               freetype-2.5.5
+               jpeg-8c
+               libcurl-7.35.0
+               libogg-1.3.2
+               libvorbis-1.3.4
+               opus-1.1
+               opusfile-0.6
+               zlib
+       )
+       for bundle in ${bundled_libs[@]} ; do
+               for tdir in MP SP ; do
+                       bdir="${tdir}/code/${bundle}"
+                       if [[ -d "${bdir}" ]] ; then
+                               rm -r ${bdir} || die
+                       fi
+               done
+       done
+
+       sed "/^CFLAGS=/s@=.*\$@=${CFLAGS}@" -i SP/Makefile.local || die
+
+       use_switch client BUILD_CLIENT
+       use_switch curl USE_CURL
+       use_switch mumble USE_MUMBLE
+       use_switch openal USE_OPENAL
+       use_switch opus USE_CODEC_OPUS
+       use_switch server BUILD_SERVER
+       use_switch truetype USE_FREETYPE
+       use_switch vorbis USE_CODEC_VORBIS
+       use_switch voip USE_VOIP
+
+       use curl && echo "USE_CURL_DLOPEN=0" >> SP/Makefile.local
+       use openal && echo "USE_OPENAL_DLOPEN=0" >> SP/Makefile.local
 }
 
 src_compile() {
@@ -48,7 +127,7 @@ src_install() {
        #games_make_wrapper rtcwmp ./wolf.x86 "${dir}" "${dir}"
        games_make_wrapper rtcwsp ./iowolfsp."${ARCHITECTURE}" "${dir}" "${dir}"
 
-       #if use dedicated; then
+       #if use server; then
        #       games_make_wrapper wolf-ded ./wolfded.x86 "${dir}" "${dir}"
        #       newinitd "${FILESDIR}"/wolf-ded.rc wolf-ded
        #       sed -i \
@@ -65,13 +144,13 @@ src_install() {
 pkg_postinst() {
        games_pkg_postinst
        elog "You need to copy pak0.pk3, mp_pak0.pk3, mp_pak1.pk3, mp_pak2.pk3,"
-       elog "sp_pak1.pk3 and sp_pak2.pk3 from a Window installation into 
${dir}/main/"
+       elog "sp_pak1.pk3 and sp_pak2.pk3 sp_pak3.pk3 sp_pak4.pk3 from a Window 
installation into ${dir}/main/"
        elog
        elog "To play the game run:"
        elog " rtcwsp (single-player)"
        #elog " rtcwmp (multi-player)"
        elog
-#      if use dedicated
+#      if use server
 #      then
 #              elog "To start a dedicated server run:"
 #              elog " /etc/init.d/wolf-ded start"

Reply via email to