Use system copy of media-libs/jpeg wrt #252719.
authorSamuli Suominen <ssuominen@gentoo.org>
Wed, 3 Mar 2010 18:39:24 +0000 (18:39 +0000)
committerSamuli Suominen <ssuominen@gentoo.org>
Wed, 3 Mar 2010 18:39:24 +0000 (18:39 +0000)
Package-Manager: portage-2.2_rc63/cvs/Linux x86_64

games-fps/tremulous/ChangeLog
games-fps/tremulous/Manifest
games-fps/tremulous/files/tremulous-1.1.0-system_jpeg-2.patch [new file with mode: 0644]
games-fps/tremulous/files/tremulous-1.1.0-system_jpeg.patch [new file with mode: 0644]
games-fps/tremulous/tremulous-1.1.0-r4.ebuild [new file with mode: 0644]

index 402194e35f40b6aef67167aa6c33b11161ca8037..0ecd589792b4678fe3aa1c65be3b55f59cb87aa7 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for games-fps/tremulous
 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/games-fps/tremulous/ChangeLog,v 1.14 2010/01/22 20:07:25 ranger Exp $
+# $Header: /var/cvsroot/gentoo-x86/games-fps/tremulous/ChangeLog,v 1.15 2010/03/03 18:39:23 ssuominen Exp $
+
+*tremulous-1.1.0-r4 (03 Mar 2010)
+
+  03 Mar 2010; Samuli Suominen <ssuominen@gentoo.org>
+  +tremulous-1.1.0-r4.ebuild, +files/tremulous-1.1.0-system_jpeg.patch,
+  +files/tremulous-1.1.0-system_jpeg-2.patch:
+  Use system copy of media-libs/jpeg wrt #252719.
 
   22 Jan 2010; Brent Baude <ranger@gentoo.org> tremulous-1.1.0-r3.ebuild:
   stable ppc, bug 289368
index fc31d95f1ae269ae63f6ac4d1941b3d0e2ef09c4..20ce74379541bafd22b34e1f4dfa37dfdbf99bee 100644 (file)
@@ -1,7 +1,10 @@
+AUX tremulous-1.1.0-system_jpeg-2.patch 5161 RMD160 98948577b9fa5b44cdfe187bd00aca3a3ca344cc SHA1 fe22bb6ce24da27a71b343bb6ac37d3d806f7a12 SHA256 077f70aaf03c581991ff682be7dab9ab80cabc925df75582273e34f15fcbc6b1
+AUX tremulous-1.1.0-system_jpeg.patch 5913 RMD160 66e452a6a9f4c4b59d897739d21d6d76e15bfcdf SHA1 a9df8970098fe80d1400d6d8843a57c47069496a SHA256 57ffe4237e18aa97c16eb603f11b5907533a584985fb84a24116a5cbe2522515
 DIST tremulous-1.1.0.zip 105821907 RMD160 36d25fee8ee6b348b1045ab027ab6733aef77a1d SHA1 39d820cc50eda1eff58917158bb0ec68b62f633c SHA256 c7bb66f55abc88932edee16c253e5d37f90dded2ce29cf6cb15ad4f78e378987
 DIST tremulous-gentoopatches-1.1.0-r5.zip 372877 RMD160 08d07feaa9b8df910a880beb8574ff1aed5a97cc SHA1 ce2bfa1535f1774c92aa3fdf738d3054f7bb5b65 SHA256 c03f22b49b65d8f7acae18981f3c87eac0f17a44c3916282eaa10afe232ca12b
 DIST vms-1.1.t971.pk3 495308 RMD160 fc970c73cb4401ab1f9524cfc090af1ac0976560 SHA1 ea11d498a92abeaa5fc5bd5567771dca3a7ea55e SHA256 bb2f57e5c2dd725e095f0e92a9dfe5fb99f8ba84344618087828d0f5dced797e
 EBUILD tremulous-1.1.0-r2.ebuild 2706 RMD160 e7362d913bf311417f10171e2a0ef39d38556a67 SHA1 539e49ad91c9493bacec29d910663695bfab2b6b SHA256 930da649ddb3ea929caf8387efdc584c0a199b4f651c26b651b3af3637fae16a
 EBUILD tremulous-1.1.0-r3.ebuild 2881 RMD160 f104e538b65569099da9d9f8553bf438650e4f20 SHA1 853068f0e0faabd484df0aa57a5cbe2e91b0f1fc SHA256 55899fac30e8806c2c8e0ac487ce905f9a38d1a4edef375583d7034b066f1962
-MISC ChangeLog 2242 RMD160 538f84c9249eff7a0a12a87280174341d24ecf6d SHA1 9b11d146460b5e9429b607286ec34e708852ac81 SHA256 8441b31ec8a3e0f1fa545e3d572169cefa8a28f02a6841249ece7a560df78e7d
+EBUILD tremulous-1.1.0-r4.ebuild 2994 RMD160 99c7416313fa5a74ded7b1bca92ae6c1f59b2289 SHA1 cf42478cc5f2707e24752dd845957ed49d518dc8 SHA256 dd342cb4e41264724fb8c63654b19e06267ba750ad5cacc086087bebf69a0429
+MISC ChangeLog 2503 RMD160 9dda597a96ef2ef7a138d1d731f8ff4401c198df SHA1 d169fd069cf846ac24491ed1e3bf349cc84aa63f SHA256 2451ede7e2905c503a15a39e35793160ca0c36ef314c1abf618b96241f4919e7
 MISC metadata.xml 158 RMD160 cbd9984bb6b426c8c9cee5022fe0a26261612fea SHA1 be5251fa1dacef5c41b74761bb1c8c54fb633b9e SHA256 1423a4fdd4a79b1728a2056d9e300f7e1074253095d82726218d9e9b953888a3
diff --git a/games-fps/tremulous/files/tremulous-1.1.0-system_jpeg-2.patch b/games-fps/tremulous/files/tremulous-1.1.0-system_jpeg-2.patch
new file mode 100644 (file)
index 0000000..d2ade8e
--- /dev/null
@@ -0,0 +1,174 @@
+--- /dev/null
++++ src/renderer/jpeg_memsrc.h
+@@ -0,0 +1,5 @@
++#include <stdio.h>
++#include <jpeglib.h>
++
++void jpeg_memory_src (j_decompress_ptr cinfo, const JOCTET * buffer,
++  size_t bufsize);
+--- /dev/null
++++ src/renderer/jpeg_memsrc.c
+@@ -0,0 +1,163 @@
++/*
++* memsrc.c
++*
++* Copyright (C) 1994-1996, Thomas G. Lane.
++* This file is part of the Independent JPEG Group's software.
++* For conditions of distribution and use, see the accompanying README file.
++*
++* This file contains decompression data source routines for the case of
++* reading JPEG data from a memory buffer that is preloaded with the entire
++* JPEG file. This would not seem especially useful at first sight, but
++* a number of people have asked for it.
++* This is really just a stripped-down version of jdatasrc.c. Comparison
++* of this code with jdatasrc.c may be helpful in seeing how to make
++* custom source managers for other purposes.
++*/
++
++/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
++#include <stdio.h>
++#include <jpeglib.h>
++#include <jerror.h>
++
++
++/* Expanded data source object for memory input */
++
++typedef struct {
++struct jpeg_source_mgr pub; /* public fields */
++
++JOCTET eoi_buffer[2]; /* a place to put a dummy EOI */
++} my_source_mgr;
++
++typedef my_source_mgr * my_src_ptr;
++
++
++/*
++* Initialize source --- called by jpeg_read_header
++* before any data is actually read.
++*/
++
++METHODDEF(void)
++init_source (j_decompress_ptr cinfo)
++{
++/* No work, since jpeg_memory_src set up the buffer pointer and count.
++* Indeed, if we want to read multiple JPEG images from one buffer,
++* this *must* not do anything to the pointer.
++*/
++}
++
++
++/*
++* Fill the input buffer --- called whenever buffer is emptied.
++*
++* In this application, this routine should never be called; if it is called,
++* the decompressor has overrun the end of the input buffer, implying we
++* supplied an incomplete or corrupt JPEG datastream. A simple error exit
++* might be the most appropriate response.
++*
++* But what we choose to do in this code is to supply dummy EOI markers
++* in order to force the decompressor to finish processing and supply
++* some sort of output image, no matter how corrupted.
++*/
++
++METHODDEF(boolean)
++fill_input_buffer (j_decompress_ptr cinfo)
++{
++my_src_ptr src = (my_src_ptr) cinfo->src;
++
++WARNMS(cinfo, JWRN_JPEG_EOF);
++
++/* Create a fake EOI marker */
++src->eoi_buffer[0] = (JOCTET) 0xFF;
++src->eoi_buffer[1] = (JOCTET) JPEG_EOI;
++src->pub.next_input_byte = src->eoi_buffer;
++src->pub.bytes_in_buffer = 2;
++
++return TRUE;
++}
++
++
++/*
++* Skip data --- used to skip over a potentially large amount of
++* uninteresting data (such as an APPn marker).
++*
++* If we overrun the end of the buffer, we let fill_input_buffer deal with
++* it. An extremely large skip could cause some time-wasting here, but
++* it really isn't supposed to happen ... and the decompressor will never
++* skip more than 64K anyway.
++*/
++
++METHODDEF(void)
++skip_input_data (j_decompress_ptr cinfo, long num_bytes)
++{
++my_src_ptr src = (my_src_ptr) cinfo->src;
++
++if (num_bytes > 0) {
++while (num_bytes > (long) src->pub.bytes_in_buffer) {
++num_bytes -= (long) src->pub.bytes_in_buffer;
++(void) fill_input_buffer(cinfo);
++/* note we assume that fill_input_buffer will never return FALSE,
++* so suspension need not be handled.
++*/
++}
++src->pub.next_input_byte += (size_t) num_bytes;
++src->pub.bytes_in_buffer -= (size_t) num_bytes;
++}
++}
++
++
++/*
++* An additional method that can be provided by data source modules is the
++* resync_to_restart method for error recovery in the presence of RST markers.
++* For the moment, this source module just uses the default resync method
++* provided by the JPEG library. That method assumes that no backtracking
++* is possible.
++*/
++
++
++/*
++* Terminate source --- called by jpeg_finish_decompress
++* after all data has been read. Often a no-op.
++*
++* NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
++* application must deal with any cleanup that should happen even
++* for error exit.
++*/
++
++METHODDEF(void)
++term_source (j_decompress_ptr cinfo)
++{
++/* no work necessary here */
++}
++
++
++/*
++* Prepare for input from a memory buffer.
++*/
++
++GLOBAL(void)
++jpeg_memory_src (j_decompress_ptr cinfo, const JOCTET * buffer, size_t bufsize)
++{
++my_src_ptr src;
++
++/* The source object is made permanent so that a series of JPEG images
++* can be read from a single buffer by calling jpeg_memory_src
++* only before the first one.
++* This makes it unsafe to use this manager and a different source
++* manager serially with the same JPEG object. Caveat programmer.
++*/
++if (cinfo->src == NULL) { /* first time for this JPEG object? */
++cinfo->src = (struct jpeg_source_mgr *)
++(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
++sizeof(my_source_mgr));
++}
++
++src = (my_src_ptr) cinfo->src;
++src->pub.init_source = init_source;
++src->pub.fill_input_buffer = fill_input_buffer;
++src->pub.skip_input_data = skip_input_data;
++src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
++src->pub.term_source = term_source;
++
++src->pub.next_input_byte = buffer;
++src->pub.bytes_in_buffer = bufsize;
++}
diff --git a/games-fps/tremulous/files/tremulous-1.1.0-system_jpeg.patch b/games-fps/tremulous/files/tremulous-1.1.0-system_jpeg.patch
new file mode 100644 (file)
index 0000000..d8f0f98
--- /dev/null
@@ -0,0 +1,259 @@
+--- Makefile
++++ Makefile
+@@ -91,6 +91,10 @@
+ USE_OPENAL=1
+ endif
+ 
++ifndef USE_SYSTEM_JPEG
++USE_SYSTEM_JPEG=1
++endif
++
+ ifndef USE_OPENAL_DLOPEN
+ USE_OPENAL_DLOPEN=0
+ endif
+@@ -193,6 +197,10 @@
+     endif
+   endif
+ 
++  ifeq ($(USE_SYSTEM_JPEG),1)
++      BASE_CFLAGS += -DUSE_SYSTEM_JPEG=1
++  endif
++
+   ifeq ($(USE_CURL),1)
+     BASE_CFLAGS += -DUSE_CURL=1
+     ifeq ($(USE_CURL_DLOPEN),1)
+@@ -269,6 +277,10 @@
+     CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
+   endif
+ 
++  ifeq ($(USE_SYSTEM_JPEG),1)
++    CLIENT_LDFLAGS += -ljpeg
++  endif
++
+   ifeq ($(ARCH),x86)
+     # linux32 make ...
+     BASE_CFLAGS += -m32
+@@ -928,6 +940,33 @@
+   $(B)/client/vm.o \
+   $(B)/client/vm_interpreted.o \
+   \
++  $(B)/client/tr_animation.o \
++  $(B)/client/tr_backend.o \
++  $(B)/client/tr_bloom.o \
++  $(B)/client/tr_bsp.o \
++  $(B)/client/tr_cmds.o \
++  $(B)/client/tr_curve.o \
++  $(B)/client/tr_flares.o \
++  $(B)/client/tr_font.o \
++  $(B)/client/tr_image.o \
++  $(B)/client/tr_init.o \
++  $(B)/client/tr_light.o \
++  $(B)/client/tr_main.o \
++  $(B)/client/tr_marks.o \
++  $(B)/client/tr_mesh.o \
++  $(B)/client/tr_model.o \
++  $(B)/client/tr_noise.o \
++  $(B)/client/tr_scene.o \
++  $(B)/client/tr_shade.o \
++  $(B)/client/tr_shade_calc.o \
++  $(B)/client/tr_shader.o \
++  $(B)/client/tr_shadows.o \
++  $(B)/client/tr_sky.o \
++  $(B)/client/tr_surface.o \
++  $(B)/client/tr_world.o \
++
++ifneq ($(USE_SYSTEM_JPEG),1)
++  Q3OBJ += \
+   $(B)/client/jcapimin.o \
+   $(B)/client/jchuff.o   \
+   $(B)/client/jcinit.o \
+@@ -961,32 +1000,10 @@
+   $(B)/client/jidctflt.o \
+   $(B)/client/jmemmgr.o \
+   $(B)/client/jmemnobs.o \
+-  $(B)/client/jutils.o \
+-  \
+-  $(B)/client/tr_animation.o \
+-  $(B)/client/tr_backend.o \
+-  $(B)/client/tr_bloom.o \
+-  $(B)/client/tr_bsp.o \
+-  $(B)/client/tr_cmds.o \
+-  $(B)/client/tr_curve.o \
+-  $(B)/client/tr_flares.o \
+-  $(B)/client/tr_font.o \
+-  $(B)/client/tr_image.o \
+-  $(B)/client/tr_init.o \
+-  $(B)/client/tr_light.o \
+-  $(B)/client/tr_main.o \
+-  $(B)/client/tr_marks.o \
+-  $(B)/client/tr_mesh.o \
+-  $(B)/client/tr_model.o \
+-  $(B)/client/tr_noise.o \
+-  $(B)/client/tr_scene.o \
+-  $(B)/client/tr_shade.o \
+-  $(B)/client/tr_shade_calc.o \
+-  $(B)/client/tr_shader.o \
+-  $(B)/client/tr_shadows.o \
+-  $(B)/client/tr_sky.o \
+-  $(B)/client/tr_surface.o \
+-  $(B)/client/tr_world.o \
++  $(B)/client/jutils.o
++else
++  Q3OBJ += $(B)/client/jpeg_memsrc.o
++endif
+ 
+ ifeq ($(ARCH),x86)
+   Q3OBJ += \
+@@ -1284,8 +1301,12 @@
+ $(B)/client/%.o: $(BLIBDIR)/%.c
+       $(DO_BOT_CC)
+ 
++ifneq ($(USE_SYSTEM_JPEG),1)
+ $(B)/client/%.o: $(JPDIR)/%.c
+       $(DO_CC)
++else
++$(B)/client/jmemnobs.o : $(JPDIR)/jmemnobs.c; $(DO_CC)  $(GL_CFLAGS) $(MINGW_CFLAGS)
++endif
+ 
+ $(B)/client/%.o: $(RDIR)/%.c
+       $(DO_CC)
+--- src/jpeg-6/jmemnobs.c
++++ src/jpeg-6/jmemnobs.c
+@@ -16,11 +16,23 @@
+  */
+ 
+ #include "../renderer/tr_local.h"
++#ifdef USE_SYSTEM_JPEG
++#include <stdio.h>
++#include <stdlib.h>
++#include <jpeglib.h>
++
++#undef GLOBAL
++#define GLOBAL
++#define FAR
+ 
++typedef void * backing_store_ptr;
++
++#else
+ #define JPEG_INTERNALS
+ #include "jinclude.h"
+ #include "jpeglib.h"
+ #include "jmemsys.h"          /* import the system-dependent declarations */
++#endif
+ 
+ /*
+  * Memory allocation and ri.Freeing are controlled by the regular library
+@@ -83,7 +95,13 @@
+ jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
+                        long total_bytes_needed)
+ {
+-  ERREXIT(cinfo, JERR_NO_BACKING_STORE);
++#ifdef USE_SYSTEM_JPEG
++  fprintf(stderr,
++    "jmemnobs.c: jpeg_open_backing_store() call, this should never happen!\n");
++  exit(1);
++#else
++ERREXIT(cinfo, JERR_NO_BACKING_STORE);
++#endif
+ }
+ 
+ 
+--- src/renderer/tr_image.c
++++ src/renderer/tr_image.c
+@@ -31,8 +31,13 @@
+  * You may also wish to include "jerror.h".
+  */
+ 
++#ifdef USE_SYSTEM_JPEG
++#include <jpeglib.h>
++#include "jpeg_memsrc.h"
++#else
+ #define JPEG_INTERNALS
+ #include "../jpeg-6/jpeglib.h"
++#endif
+ 
+ #include "../qcommon/puff.h"
+ 
+@@ -1409,6 +1414,12 @@
+   unsigned char *out;
+   byte        *fbuffer;
+   byte  *buf;
++  size_t bufsize;
++#ifdef USE_SYSTEM_JPEG
++  int i,j;
++  byte *inptr, *outptr;
++#endif
++
+ 
+   /* In this example we want to open the input file before doing anything else,
+    * so that the setjmp() error recovery below can assume the file is open.
+@@ -1416,7 +1427,7 @@
+    * requires it in order to read binary files.
+    */
+ 
+-  ri.FS_ReadFile ( ( char * ) filename, (void **)&fbuffer);
++  bufsize = ri.FS_ReadFile ( ( char * ) filename, (void **)&fbuffer);
+   if (!fbuffer) {
+       return;
+   }
+@@ -1434,8 +1445,11 @@
+   jpeg_create_decompress(&cinfo);
+ 
+   /* Step 2: specify data source (eg, a file) */
+-
++#ifdef USE_SYSTEM_JPEG
++  jpeg_memory_src(&cinfo, fbuffer, bufsize);
++#else
+   jpeg_stdio_src(&cinfo, fbuffer);
++#endif
+ 
+   /* Step 3: read file parameters with jpeg_read_header() */
+ 
+@@ -1478,7 +1492,7 @@
+   }
+ 
+   memcount = pixelcount * 4;
+-  row_stride = cinfo.output_width * cinfo.output_components;
++  row_stride = cinfo.output_width * 4;
+ 
+   out = ri.Malloc(memcount);
+ 
+@@ -1499,6 +1513,21 @@
+       buf = ((out+(row_stride*cinfo.output_scanline)));
+       buffer = &buf;
+     (void) jpeg_read_scanlines(&cinfo, buffer, 1);
++#ifdef USE_SYSTEM_JPEG
++    /* we have RGB data, we need to expand this out to ARGB */
++    inptr = buf + cinfo.output_width * 3 - 1;
++    outptr = buf + row_stride - 1;
++
++    for (i = 0; i < cinfo.output_width; i++) {
++      /* endian dependent? maybe for big endian this must be done after the
++         color/pixel copy? */
++      *outptr-- = 255;
++      for (j = 0; j < 3; j++) {
++        JOCTET color = *inptr--;
++        *outptr-- = color;
++      }
++    }
++#endif
+   }
+   
+   buf = out;
+@@ -1617,6 +1646,7 @@
+   return TRUE;
+ }
+ 
++#ifndef USE_SYSTEM_JPEG
+ 
+ /*
+  * Compression initialization.
+@@ -1709,6 +1739,8 @@
+   return row_ctr;
+ }
+ 
++#endif
++
+ /*
+  * Terminate destination --- called by jpeg_finish_compress
+  * after all data has been written.  Usually needs to flush buffer.
diff --git a/games-fps/tremulous/tremulous-1.1.0-r4.ebuild b/games-fps/tremulous/tremulous-1.1.0-r4.ebuild
new file mode 100644 (file)
index 0000000..234db7f
--- /dev/null
@@ -0,0 +1,108 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-fps/tremulous/tremulous-1.1.0-r4.ebuild,v 1.1 2010/03/03 18:39:23 ssuominen Exp $
+
+EAPI=2
+
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="Team-based aliens vs humans FPS with buildable structures"
+HOMEPAGE="http://tremulous.net/ http://trem-servers.com"
+SRC_URI="http://dl.trem-servers.com/${PN}-gentoopatches-${PV}-r5.zip
+       http://dl.trem-servers.com/vms-1.1.t971.pk3
+       http://0day.icculus.org/mirrors/${PN}/${P}.zip
+       ftp://ftp.wireplay.co.uk/pub/quake3arena/mods/${PN}/${P}.zip
+       mirror://sourceforge/${PN}/${P}.zip"
+
+LICENSE="GPL-2 CCPL-Attribution-ShareAlike-2.5"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="dedicated openal +opengl +vorbis"
+
+UIDEPEND="
+       media-libs/jpeg:0
+       media-libs/libsdl[opengl?]
+       vorbis? ( media-libs/libogg media-libs/libvorbis )
+       openal? ( media-libs/openal )
+       x11-libs/libXau
+       x11-libs/libXdmcp"
+RDEPEND="opengl? ( ${UIDEPEND} )
+       !opengl? ( !dedicated? ( ${UIDEPEND} ) )"
+DEPEND="${RDEPEND}
+       app-arch/unzip"
+
+S=${WORKDIR}/${PN}/${P}-src
+
+src_unpack() {
+       unpack ${PN}-gentoopatches-${PV}-r5.zip
+       unpack ${P}.zip
+
+       cd ${PN}
+       unpack ./${P}-src.tar.gz
+       cp -f "${DISTDIR}"/vms-1.1.t971.pk3 "${WORKDIR}"/${PN}/base/ || die
+}
+
+src_prepare() {
+       # security patches
+       epatch "${WORKDIR}"/${PN}-svn755-upto-971.patch
+       epatch "${WORKDIR}"/${PN}-t971-client.patch
+       epatch "${FILESDIR}"/${P}-system_jpeg.patch \
+               "${FILESDIR}"/${P}-system_jpeg-2.patch
+       # fix the gcc-4.3.3 Werror issue
+       # This is probably issue for all icculus q3 based games
+       sed -i -e '16s/-Werror //' src/tools/asm/Makefile || die
+}
+
+src_compile() {
+       buildit() { use $1 && echo 1 || echo 0 ; }
+
+       local client=1
+       if ! use opengl; then
+               client=0
+               if ! use dedicated; then
+                       # user is not sure what he wants
+                       client=1
+               fi
+       fi
+
+       emake \
+               $(use amd64 && echo ARCH=x86_64) \
+               BUILD_CLIENT=${client} \
+               BUILD_CLIENT_SMP=${client} \
+               BUILD_SERVER=$(buildit dedicated) \
+               BUILD_GAME_SO=0 \
+               BUILD_GAME_QVM=0 \
+               CC="$(tc-getCC)" \
+               DEFAULT_BASEDIR="${GAMES_DATADIR}/${PN}" \
+               USE_CODEC_VORBIS=$(buildit vorbis) \
+               USE_OPENAL=$(buildit openal) \
+               USE_LOCAL_HEADERS=0 \
+               OPTIMIZE= \
+               || die "emake failed"
+}
+
+src_install() {
+       insinto "${GAMES_DATADIR}"/${PN}
+       doins -r ../base || die "doins -r failed"
+       dodoc ChangeLog ../manual.pdf
+       if use opengl || ! use dedicated ; then
+               newgamesbin build/release-linux-*/${PN}-smp.* ${PN} \
+                       || die "newgamesbin ${PN}"
+               newicon "${WORKDIR}"/tyrant.xpm ${PN}.xpm
+               make_desktop_entry ${PN} Tremulous
+       fi
+       if use dedicated ; then
+               newgamesbin build/release-linux-*/tremded.* ${PN}-ded \
+                       || die "newgamesbin ${PN}-ded failed"
+       fi
+       prepgamesdirs
+}
+
+pkg_postinst() {
+       games_pkg_postinst
+
+       elog "If you want to add extra maps, download"
+       elog "http://tremulous.bricosoft.com/base/all-maps.tgz"
+       elog "and unpack it into ~/.tremulous/base for your user"
+       elog "or into ${GAMES_DATADIR}/${PN}/base for all users."
+}