From cf06a05c0315f27d559a5b5b74fb109d982e7b33 Mon Sep 17 00:00:00 2001 From: Sam James Date: Wed, 7 Apr 2021 12:10:15 +0000 Subject: games-fps/quake2-icculus: port to EAPI 7, games.eclass-- Signed-off-by: Sam James --- .../quake2-icculus/files/0.16-rogue-armor.patch | 4 +- .../quake2-icculus/files/0.16-rogue-nan.patch | 4 +- .../files/quake2-icculus-0.16.1-alsa.patch | 4 +- .../files/quake2-icculus-0.16.1-amd64.patch | 4 +- .../files/quake2-icculus-0.16.1-gcc41.patch | 4 +- .../files/quake2-icculus-0.16.1-gentoo-paths.patch | 20 +- .../files/quake2-icculus-0.16.1-gnusource.patch | 4 +- .../files/quake2-icculus-0.16.1-ia64.patch | 8 +- .../files/quake2-icculus-0.16.1-ldflags.patch | 4 +- .../files/quake2-icculus-0.16.1-no-asm-io.patch | 8 +- .../files/quake2-icculus-0.16.1-x11_mouse.patch | 4 +- .../files/quake2-icculus-0.16.1-x11_soft.patch | 12 +- .../quake2-icculus/quake2-icculus-0.16.1-r1.ebuild | 196 ------------------- .../quake2-icculus/quake2-icculus-0.16.1-r2.ebuild | 207 +++++++++++++++++++++ 14 files changed, 247 insertions(+), 236 deletions(-) delete mode 100644 games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild create mode 100644 games-fps/quake2-icculus/quake2-icculus-0.16.1-r2.ebuild (limited to 'games-fps') diff --git a/games-fps/quake2-icculus/files/0.16-rogue-armor.patch b/games-fps/quake2-icculus/files/0.16-rogue-armor.patch index 194f965a0501..bed337e4ce31 100644 --- a/games-fps/quake2-icculus/files/0.16-rogue-armor.patch +++ b/games-fps/quake2-icculus/files/0.16-rogue-armor.patch @@ -1,5 +1,5 @@ ---- src/rogue/g_local.h.orig -+++ src/rogue/g_local.h +--- a/rogue/g_local.h ++++ b/rogue/g_local.h @@ -545,9 +545,6 @@ extern int sm_meat_index; extern int snd_fry; diff --git a/games-fps/quake2-icculus/files/0.16-rogue-nan.patch b/games-fps/quake2-icculus/files/0.16-rogue-nan.patch index 0961fa68a985..09da62bee201 100644 --- a/games-fps/quake2-icculus/files/0.16-rogue-nan.patch +++ b/games-fps/quake2-icculus/files/0.16-rogue-nan.patch @@ -1,5 +1,5 @@ ---- src/rogue/g_local.h.orig -+++ src/rogue/g_local.h +--- a/rogue/g_local.h ++++ b/rogue/g_local.h @@ -24,3 +24,3 @@ #ifndef _WIN32 -#include diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch index 185359373c4b..a27fc035cd4c 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch @@ -1,5 +1,5 @@ ---- src/linux/snd_alsa.c.old -+++ src/linux/snd_alsa.c +--- a/src/linux/snd_alsa.c ++++ b/src/linux/snd_alsa.c @@ -22,13 +22,22 @@ $Id: quake2-icculus-0.16.1-alsa.patch,v 1.2 2015/03/27 06:40:34 mr_bones_ Exp $ */ diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch index b3291827996c..30966c813d7c 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch @@ -4,8 +4,8 @@ glx renderer by default. http://bugs.gentoo.org/show_bug.cgi?id=86552 ---- src/linux/vid_so.c -+++ src/linux/vid_so.c +--- a/src/linux/vid_so.c ++++ b/src/linux/vid_so.c @@ -435,6 +440,9 @@ VID_Init */ void VID_Init (void) diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch index 626cf5a1b64d..1ea4d41df80a 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch @@ -1,5 +1,5 @@ ---- src/xatrix/g_local.h.old -+++ src/xatrix/g_local.h +--- a/src/xatrix/g_local.h ++++ b/src/xatrix/g_local.h @@ -446,11 +446,6 @@ extern int sm_meat_index; extern int snd_fry; diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch index 61f0bb2286e5..4631d3ca92f4 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch @@ -1,5 +1,5 @@ ---- Makefile -+++ Makefile +--- a/Makefile ++++ b/Makefile @@ -74,35 +74,46 @@ endif CC=gcc @@ -85,8 +85,8 @@ targets: $(TARGETS) ---- src/linux/qgl_linux.c -+++ src/linux/qgl_linux.c +--- a/src/linux/qgl_linux.c ++++ b/src/linux/qgl_linux.c @@ -3006,13 +3006,17 @@ qboolean QGL_Init( const char *dllname ) // dllname, dlerror()); @@ -108,8 +108,8 @@ } Com_Printf ("Using %s for OpenGL...", fn); } else { ---- src/linux/vid_so.c -+++ src/linux/vid_so.c +--- a/src/linux/vid_so.c ++++ b/src/linux/vid_so.c @@ -237,13 +237,17 @@ qboolean VID_LoadRefresh( char *name ) //regain root seteuid(saved_euid); @@ -154,8 +154,8 @@ } /*****************************************************************************/ ---- src/qcommon/files.c -+++ src/qcommon/files.c +--- a/src/qcommon/files.c ++++ b/src/qcommon/files.c @@ -60,6 +60,7 @@ typedef struct pack_s char fs_gamedir[MAX_OSPATH]; @@ -195,8 +195,8 @@ // // then add a '.quake2/baseq2' directory in home directory by default ---- src/qcommon/qcommon.h -+++ src/qcommon/qcommon.h +--- a/src/qcommon/qcommon.h ++++ b/src/qcommon/qcommon.h @@ -74,6 +74,13 @@ Foundation, Inc., 59 Temple Place - Suit #endif diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch index ad1f37309c30..42041978509f 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch @@ -1,5 +1,5 @@ ---- quake2-r0.16.1/src/linux/q_shlinux.c -+++ quake2-r0.16.1-modified/src/linux/q_shlinux.c +--- a/src/linux/q_shlinux.c ++++ b/src/linux/q_shlinux.c @@ -17,6 +17,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch index ae1aa2e4068c..fe61bf501658 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch @@ -1,5 +1,5 @@ ---- quake2-r0.16.1.orig/Makefile -+++ quake2-r0.16.1/Makefile +--- a/Makefile ++++ b/Makefile @@ -54,24 +54,26 @@ endif @@ -74,8 +74,8 @@ ifeq ($(strip $(BUILD_SVGA)),YES) $(warning Warning: SVGAlib support not supported for $(ARCH)) endif ---- quake2-r0.16.1.orig/src/linux/sys_linux.c -+++ quake2-r0.16.1/src/linux/sys_linux.c +--- a/src/linux/sys_linux.c ++++ b/src/linux/sys_linux.c @@ -216,16 +216,18 @@ void *Sys_GetGameAPI (void *parms) char *path; char *str_p; diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch index 978c9c9820ea..765c146dd4ec 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch @@ -1,5 +1,5 @@ ---- Makefile.old -+++ Makefile +--- a/Makefile ++++ b/Makefile @@ -169,18 +169,18 @@ DEBUG_CFLAGS=$(BASE_CFLAGS) -g diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch index d94925b83e4b..0a1eecef2afa 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch @@ -3,8 +3,8 @@ http://bugs.gentoo.org/193107 asm/io.h does not exist with sanitized kernel headers, nor do these source files actually need the header, so punt it ---- src/linux/rw_in_aa.c -+++ src/linux/rw_in_aa.c +--- a/src/linux/rw_in_aa.c ++++ b/src/linux/rw_in_aa.c @@ -46,7 +46,6 @@ #include @@ -13,8 +13,8 @@ files actually need the header, so punt it #include #endif ---- src/linux/rw_aa.c -+++ src/linux/rw_aa.c +--- a/src/linux/rw_aa.c ++++ b/src/linux/rw_aa.c @@ -63,7 +63,6 @@ #include #if defined (__linux__) diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch index 6dc6f0f1ddfb..5d2a85a68e9b 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch @@ -1,5 +1,5 @@ ---- src/linux/rw_x11.c.old -+++ src/linux/rw_x11.c +--- a/src/linux/rw_x11.c ++++ b/src/linux/rw_x11.c @@ -989,8 +989,8 @@ } else diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch index e23caf9db09f..cd0f2c807ae0 100644 --- a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch +++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch @@ -1,8 +1,8 @@ the x11 software renderer just needs some tweaks to get working ---- Makefile.old -+++ Makefile +--- a/Makefile ++++ b/Makefile @@ -358,7 +358,7 @@ endif @@ -12,8 +12,8 @@ the x11 software renderer just needs some tweaks to get working endif ifeq ($(strip $(BUILD_GLX)),YES) ---- src/linux/rw_x11.c.old -+++ src/linux/rw_x11.c +--- a/src/linux/rw_x11.c ++++ b/src/linux/rw_x11.c @@ -53,7 +53,7 @@ #include #include @@ -32,8 +32,8 @@ the x11 software renderer just needs some tweaks to get working #ifdef REDBLUE static PIXEL16 st2d_8to16table_s[2][256]; static PIXEL24 st2d_8to24table_s[2][256]; ---- src/ref_soft/r_poly.c.old -+++ src/ref_soft/r_poly.c +--- a/src/ref_soft/r_poly.c ++++ b/src/ref_soft/r_poly.c @@ -994,7 +994,7 @@ scale = yscale * pout->zi; pout->v = (ycenter - scale * transformed[1]); diff --git a/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild b/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild deleted file mode 100644 index 5a5e6b994311..000000000000 --- a/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=5 -inherit eutils toolchain-funcs games - -MY_P="quake2-r${PV}" -DESCRIPTION="The icculus.org Linux port of iD's Quake 2 engine" -HOMEPAGE="http://icculus.org/quake2/" -SRC_URI="http://icculus.org/quake2/files/${MY_P}.tar.gz - qmax? ( http://icculus.org/quake2/files/maxpak.pak ) - rogue? ( mirror://idsoftware/quake2/source/roguesrc320.shar.Z ) - xatrix? ( mirror://idsoftware/quake2/source/xatrixsrc320.shar.Z )" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="aalib alsa cdinstall dedicated demo ipv6 joystick opengl qmax rogue sdl X xatrix" - -UIDEPEND="aalib? ( media-libs/aalib ) - alsa? ( media-libs/alsa-lib ) - opengl? ( virtual/opengl ) - sdl? ( media-libs/libsdl[sound,joystick?,video] ) - X? ( - x11-libs/libXxf86dga - x11-libs/libXxf86vm - )" -RDEPEND="${UIDEPEND} - cdinstall? ( games-fps/quake2-data ) - demo? ( games-fps/quake2-demodata )" -DEPEND="${UIDEPEND} - X? ( x11-base/xorg-proto ) - rogue? ( app-arch/sharutils ) - xatrix? ( app-arch/sharutils )" - -S=${WORKDIR}/${MY_P} - -pkg_setup() { - games_pkg_setup - - if ! use qmax && $( use opengl || use sdl ) ; then - elog "The 'qmax' graphical improvements are recommended." - echo - fi -} - -src_prepare() { - # Now we deal with the silly rogue / xatrix addons ... this is ugly :/ - ln -s $(type -P echo) "${T}"/more - for g in rogue xatrix ; do - use ${g} || continue - mkdir -p src/${g} - pushd src/${g} - local shar=../../../${g}src320.shar - sed -i -e 's:^read ans:ans=yes :' ${shar} || die - echo ">>> Unpacking ${shar} to ${PWD}" - env PATH="${T}:${PATH}" unshar ${shar} || die - popd - done - sed -i -e 's:jpeg_mem_src:_&:' src/ref_candygl/gl_image.c || die - - sed -i -e 's:BUILD_SOFTX:BUILD_X11:' Makefile || die - # -amd64.patch # make sure this is still needed in future versions - epatch \ - "${FILESDIR}"/${P}-amd64.patch \ - "${FILESDIR}"/${P}-gentoo-paths.patch \ - "${FILESDIR}"/${P}-ldflags.patch \ - "${FILESDIR}"/${P}-no-asm-io.patch \ - "${FILESDIR}"/${P}-gnusource.patch \ - "${FILESDIR}"/${P}-x11_soft.patch \ - "${FILESDIR}"/${P}-x11_mouse.patch \ - "${FILESDIR}"/${P}-alsa.patch \ - "${FILESDIR}"/${P}-ia64.patch \ - "${FILESDIR}"/${P}-fno-common.patch - - if use xatrix ; then - epatch "${FILESDIR}/${P}"-gcc41.patch - fi - if use rogue ; then - cd src - epatch \ - "${FILESDIR}"/0.16-rogue-nan.patch \ - "${FILESDIR}"/0.16-rogue-armor.patch - fi -} - -yesno() { - for f in "$@" ; do - if ! use $f ; then - echo NO - return 1 - fi - done - echo YES - return 0 -} - -src_compile() { - # xatrix fails to build - # rogue fails to build - local libsuffix - for BUILD_QMAX in YES NO ; do - ! use qmax && [[ ${BUILD_QMAX} == "YES" ]] && continue - [[ ${BUILD_QMAX} == "YES" ]] \ - && libsuffix=-qmax \ - || libsuffix= - emake -j1 clean - emake -j1 build_release \ - BUILD_SDLQUAKE2=$(yesno sdl) \ - BUILD_SVGA=NO \ - BUILD_X11=$(yesno X) \ - BUILD_GLX=$(yesno opengl) \ - BUILD_SDL=$(yesno sdl) \ - BUILD_SDLGL=$(yesno sdl opengl) \ - BUILD_CTFDLL=YES \ - BUILD_XATRIX=$(yesno xatrix) \ - BUILD_ROGUE=$(yesno rogue) \ - BUILD_JOYSTICK=$(yesno joystick) \ - BUILD_DEDICATED=$(yesno dedicated) \ - BUILD_AA=$(yesno aalib) \ - BUILD_QMAX=${BUILD_QMAX} \ - HAVE_IPV6=$(yesno ipv6) \ - BUILD_ARTS=NO \ - BUILD_ALSA=$(yesno alsa) \ - SDLDIR=/usr/lib \ - DEFAULT_BASEDIR="${GAMES_DATADIR}/quake2" \ - DEFAULT_LIBDIR="$(games_get_libdir)/${PN}${libsuffix}" \ - OPT_CFLAGS="${CFLAGS}" \ - CC="$(tc-getCC)" - # now we save the build dir ... except for the object files ... - rm release*/*/*.o - mv release* my-rel-${BUILD_QMAX} - cd my-rel-${BUILD_QMAX} - rm -rf ref_{gl,soft} ded game client ctf/*.o - mkdir baseq2 - mv game*.so baseq2/ - cd .. - done -} - -src_install() { - local q2dir=$(games_get_libdir)/${PN} - local q2maxdir=$(games_get_libdir)/${PN}-qmax - - dodoc readme.txt README TODO "${FILESDIR}"/README-postinstall - - # regular q2 files - dodir "${q2dir}" - cp -rf my-rel-NO/* "${D}/${q2dir}"/ - dogamesbin "${D}/${q2dir}"/quake2 - rm "${D}/${q2dir}"/quake2 - use dedicated \ - && dogamesbin "${D}/${q2dir}"/q2ded \ - && rm "${D}/${q2dir}"/q2ded - use sdl \ - && dogamesbin "${D}/${q2dir}"/sdlquake2 \ - && rm "${D}/${q2dir}"/sdlquake2 - - doicon "${FILESDIR}"/quake2.xpm - make_desktop_entry quake2 "Quake 2" quake2 - - # q2max files - if use qmax ; then - dodir "${q2maxdir}" - cp -rf my-rel-YES/* "${D}/${q2maxdir}"/ || die - newgamesbin "${D}/${q2maxdir}"/quake2 quake2-qmax - rm "${D}/${q2maxdir}"/quake2 - use dedicated \ - && newgamesbin "${D}/${q2maxdir}"/q2ded q2ded-qmax \ - && rm "${D}/${q2maxdir}"/q2ded - use sdl \ - && newgamesbin "${D}/${q2maxdir}"/sdlquake2 sdlquake2-qmax \ - && rm "${D}/${q2maxdir}"/sdlquake2 - - insinto "${q2maxdir}"/baseq2 - doins "${DISTDIR}"/maxpak.pak - - make_desktop_entry quake2-qmax Quake2-qmax quake2 - fi - - prepgamesdirs -} - -pkg_postinst() { - games_pkg_postinst - - elog "Go read README-postinstall in /usr/share/doc/${PF}" - elog "right now! It's important - This install is just the engine, you still need" - elog "the data paks. Go read." - - if use demo && ! has_version "games-fps/quake2-demodata[symlink]" ; then - ewarn "To play the Quake 2 demo," - ewarn "emerge games-fps/quake2-demodata with the 'symlink' USE flag." - echo - fi -} diff --git a/games-fps/quake2-icculus/quake2-icculus-0.16.1-r2.ebuild b/games-fps/quake2-icculus/quake2-icculus-0.16.1-r2.ebuild new file mode 100644 index 000000000000..ef6f7b8b34a4 --- /dev/null +++ b/games-fps/quake2-icculus/quake2-icculus-0.16.1-r2.ebuild @@ -0,0 +1,207 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit desktop toolchain-funcs + +MY_P="quake2-r${PV}" +DESCRIPTION="The icculus.org Linux port of iD's Quake 2 engine" +HOMEPAGE="http://icculus.org/quake2/" +SRC_URI="http://icculus.org/quake2/files/${MY_P}.tar.gz + qmax? ( http://icculus.org/quake2/files/maxpak.pak ) + rogue? ( mirror://idsoftware/quake2/source/roguesrc320.shar.Z ) + xatrix? ( mirror://idsoftware/quake2/source/xatrixsrc320.shar.Z )" +S="${WORKDIR}"/${MY_P} + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="aalib alsa cdinstall dedicated demo ipv6 joystick opengl qmax rogue sdl X xatrix" + +UIDEPEND="aalib? ( media-libs/aalib ) + alsa? ( media-libs/alsa-lib ) + opengl? ( virtual/opengl ) + sdl? ( media-libs/libsdl[sound,joystick?,video] ) + X? ( + x11-libs/libXxf86dga + x11-libs/libXxf86vm + )" +RDEPEND="${UIDEPEND} + cdinstall? ( games-fps/quake2-data ) + demo? ( games-fps/quake2-demodata )" +DEPEND="${UIDEPEND} + X? ( x11-base/xorg-proto ) + rogue? ( app-arch/sharutils ) + xatrix? ( app-arch/sharutils )" + +PATCHES=( + # -amd64.patch # make sure this is still needed in future versions + "${FILESDIR}"/${P}-amd64.patch + "${FILESDIR}"/${P}-gentoo-paths.patch + "${FILESDIR}"/${P}-ldflags.patch + "${FILESDIR}"/${P}-no-asm-io.patch + "${FILESDIR}"/${P}-gnusource.patch + "${FILESDIR}"/${P}-x11_soft.patch + "${FILESDIR}"/${P}-x11_mouse.patch + "${FILESDIR}"/${P}-alsa.patch + "${FILESDIR}"/${P}-ia64.patch + "${FILESDIR}"/${P}-fno-common.patch +) + +pkg_setup() { + if ! use qmax && $( use opengl || use sdl ) ; then + elog "The 'qmax' graphical improvements are recommended." + echo + fi +} + +src_prepare() { + # Now we deal with the silly rogue / xatrix addons ... this is ugly :/ + ln -s $(type -P echo) "${T}"/more || die + + for g in rogue xatrix ; do + use ${g} || continue + mkdir -p src/${g} || die + + pushd src/${g} || die + + local shar=../../../${g}src320.shar + sed -i -e 's:^read ans:ans=yes :' ${shar} || die + elog "Unpacking ${shar} to ${PWD}" + env PATH="${T}:${PATH}" unshar ${shar} || die + + popd || die + done + + sed -i -e 's:jpeg_mem_src:_&:' src/ref_candygl/gl_image.c || die + sed -i -e 's:BUILD_SOFTX:BUILD_X11:' Makefile || die + + default + + if use xatrix ; then + eapply "${FILESDIR}/${P}"-gcc41.patch + fi + if use rogue ; then + cd src || die + eapply \ + "${FILESDIR}"/0.16-rogue-nan.patch \ + "${FILESDIR}"/0.16-rogue-armor.patch + fi +} + +yesno() { + for f in "$@" ; do + if ! use $f ; then + echo NO + return 1 + fi + done + echo YES + return 0 +} + +src_compile() { + # xatrix fails to build + # rogue fails to build + local libsuffix + for BUILD_QMAX in YES NO ; do + ! use qmax && [[ ${BUILD_QMAX} == "YES" ]] && continue + [[ ${BUILD_QMAX} == "YES" ]] \ + && libsuffix=-qmax \ + || libsuffix= + emake -j1 clean + emake -j1 build_release \ + BUILD_SDLQUAKE2=$(yesno sdl) \ + BUILD_SVGA=NO \ + BUILD_X11=$(yesno X) \ + BUILD_GLX=$(yesno opengl) \ + BUILD_SDL=$(yesno sdl) \ + BUILD_SDLGL=$(yesno sdl opengl) \ + BUILD_CTFDLL=YES \ + BUILD_XATRIX=$(yesno xatrix) \ + BUILD_ROGUE=$(yesno rogue) \ + BUILD_JOYSTICK=$(yesno joystick) \ + BUILD_DEDICATED=$(yesno dedicated) \ + BUILD_AA=$(yesno aalib) \ + BUILD_QMAX=${BUILD_QMAX} \ + HAVE_IPV6=$(yesno ipv6) \ + BUILD_ARTS=NO \ + BUILD_ALSA=$(yesno alsa) \ + SDLDIR=/usr/lib \ + DEFAULT_BASEDIR="/usr/share/quake2" \ + DEFAULT_LIBDIR="/usr/$(get_libdir)/${PN}${libsuffix}" \ + OPT_CFLAGS="${CFLAGS}" \ + CC="$(tc-getCC)" + + # now we save the build dir ... except for the object files ... + rm release*/*/*.o || die + mv release* my-rel-${BUILD_QMAX} || die + cd my-rel-${BUILD_QMAX} || die + rm -rf ref_{gl,soft} ded game client ctf/*.o || die + mkdir baseq2 || die + mv game*.so baseq2/ || die + cd .. || die + done +} + +src_install() { + local q2dir=/usr/$(get_libdir)/${PN} + local q2maxdir=/usr/$(get_libdir)/${PN}-qmax + + dodoc readme.txt README TODO "${FILESDIR}"/README-postinstall + + # regular q2 files + dodir "${q2dir}" + cp -rf my-rel-NO/* "${ED}/${q2dir}"/ || die + + dobin "${ED}/${q2dir}"/quake2 + rm "${ED}/${q2dir}"/quake2 || die + + use dedicated \ + && dobin "${ED}/${q2dir}"/q2ded \ + && rm "${ED}/${q2dir}"/q2ded + use sdl \ + && dobin "${ED}/${q2dir}"/sdlquake2 \ + && rm "${ED}/${q2dir}"/sdlquake2 + + doicon "${FILESDIR}"/quake2.xpm + make_desktop_entry quake2 "Quake 2" quake2 + + # q2max files + if use qmax ; then + dodir "${q2maxdir}" + + cp -rf my-rel-YES/* "${ED}/${q2maxdir}"/ || die + + newbin "${ED}/${q2maxdir}"/quake2 quake2-qmax + rm "${ED}/${q2maxdir}"/quake2 || die + + if use dedicated ; then + newbin "${ED}/${q2maxdir}"/q2ded q2ded-qmax + rm "${ED}/${q2maxdir}"/q2ded || die + fi + + if use sdl ; then + newbin "${ED}/${q2maxdir}"/sdlquake2 sdlquake2-qmax + rm "${ED}/${q2maxdir}"/sdlquake2 || die + fi + + insinto "${q2maxdir}"/baseq2 + doins "${DISTDIR}"/maxpak.pak + + make_desktop_entry quake2-qmax Quake2-qmax quake2 + fi +} + +pkg_postinst() { + elog "Go read README-postinstall in /usr/share/doc/${PF}" + elog "right now! It's important - this install is just the engine, you still need" + elog "the data paks. Go read." + + if use demo && ! has_version "games-fps/quake2-demodata[symlink]" ; then + ewarn "To play the Quake 2 demo," + ewarn "emerge games-fps/quake2-demodata with the 'symlink' USE flag." + echo + fi +} -- cgit v1.2.3-65-gdbad