summaryrefslogtreecommitdiff
path: root/games-fps/quake2-icculus
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /games-fps/quake2-icculus
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'games-fps/quake2-icculus')
-rw-r--r--games-fps/quake2-icculus/Manifest20
-rw-r--r--games-fps/quake2-icculus/files/0.16-rogue-armor.patch12
-rw-r--r--games-fps/quake2-icculus/files/0.16-rogue-nan.patch7
-rw-r--r--games-fps/quake2-icculus/files/README-postinstall79
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch172
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch18
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch14
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch213
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch12
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch97
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch56
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch25
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch13
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch45
-rw-r--r--games-fps/quake2-icculus/files/quake2.xpm37
-rw-r--r--games-fps/quake2-icculus/metadata.xml14
-rw-r--r--games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild195
17 files changed, 1029 insertions, 0 deletions
diff --git a/games-fps/quake2-icculus/Manifest b/games-fps/quake2-icculus/Manifest
new file mode 100644
index 000000000000..dda2f9248fa8
--- /dev/null
+++ b/games-fps/quake2-icculus/Manifest
@@ -0,0 +1,20 @@
+AUX 0.16-rogue-armor.patch 240 BLAKE2B 5643b1af747e3b6d34d21f8ee830d6d5bec91e356e724dfb66e6840df3a594af7ebfe9a442979801fc3096b35b6485f9cd41db3295b154cdf096526779e34fca SHA512 591fccd0cbc1225982b6d95d4818a4d0ff409717de8799b1d49f424633169d8a8187206220c24b60a341337aec2e297dfd8517dd478223e7d557ee85f6ecc453
+AUX 0.16-rogue-nan.patch 170 BLAKE2B 76beecbd38d07bad65595a049aea6802f7575d65e1640cef2a05ce5ecef8031d333af2df56995bcf2b420034e663896d89dadc362959786a92eea0078d609c3c SHA512 3d9b3a95a85a6fa39f2c6f7ad5e49b313b723bfb0fa88392f8690df27c16a7d6ad7617043b6fd66dc87cbbac9b01b941b8cbc8ecf4e045b908e844832c80d26a
+AUX README-postinstall 3083 BLAKE2B 364510b4eb37b6623e8346c74743b27156f99938fc9726929500c4488fd9d8a54b45d762586bfb43996d27f8aab09b2cd2feda08cad2aba0be534f4b8ca303e0 SHA512 cc7441ce14117ea765a7df98b3de0370b251f444289fd8aaa03c97ea5b383d626088977bc30dfc7a30124dedce4796b5d6392dad7e3d203ee2257d71a9b49bfe
+AUX quake2-icculus-0.16.1-alsa.patch 4386 BLAKE2B f85c0332ee7ff5fec98dcc5762cf63733f8442e76864cbd844dc19426f14eb22b4d3fec7fea8592fc9fe95cb55193324cefb87076fefb254cb7773cd2423f567 SHA512 8bb9e4d6f551ebe3e6715e044453affd7edd749650791fca32b5286038e75a59685c7d47efce8ac7b9dff488e6c2952dfdc68807f3365d276afb4b7387ad5dbc
+AUX quake2-icculus-0.16.1-amd64.patch 534 BLAKE2B 8f3afa80b23784a6683762a94b651b5999a7570ae954c87e5bf963ea52bf1fbdb3150c22715b4d4711b31892e3d67ef01bdfbb3285338add10bcbba0aaa335c2 SHA512 03faf4b85aa176a267847196fb56204b6d02bde0ebef858a34edb3c87cb41e57636d9b6e5b3be44163e918cb4b3ff38299b2db9de90690179108ee77146b942d
+AUX quake2-icculus-0.16.1-gcc41.patch 292 BLAKE2B 393df8fbd236fb3eb509fa640c650144e734f15baf3b1f985ca0a0d81810e227e87b4a19ceb5db95067b40370ce7dab1e641f48a9ecd00d7f0bcaa3726f9bc56 SHA512 87193f69670e7cd6573bd4ff550202fda2702a5d7dfadb3af31f673b8910958ec3718e0d7ae558666c6a6921c43d543626dc8eaa0e3822345f33aecdbdf7ee50
+AUX quake2-icculus-0.16.1-gentoo-paths.patch 6419 BLAKE2B ed3fe4cd3f812b6dda63bd017eca74a57dafe0ae56a877a30e814c486b4378a04a7c0525f71a13804f653febec5b6ff855be5cea3b8c4a4ca9bccf0e2d441e4f SHA512 91a83f82b013245256db386a212c044bfbd637e1685e532d2ca75959e6870e65f3763f6d83c85db184d46a0ed77b5d4a53c4f7421b55b82a4709bdfc70d0f307
+AUX quake2-icculus-0.16.1-gnusource.patch 316 BLAKE2B 344afcbda64c0a52e06a91cbcfd4a53f9badf8c0d25ac384525e84eff164a1f103df9289d5a691b413e5e1a1a2749872841ad18ff4e3517465fb1c1cd729edce SHA512 0e1bed0bfd7ab31ad574a17534a49e89b44ef99308b90d9a30726f7d39ec4606514643e064968a5d9e53dd7a20394d5a27162fba06f37713ee3bc1e65f31b76b
+AUX quake2-icculus-0.16.1-ia64.patch 2399 BLAKE2B e4dcbc6528f0859ac791627f4a043c479e8a6024c1947196d540e11e53f9909f1151f26b8eaa272e371190f7287f323304ab7f5518704702aad64569278d4ee3 SHA512 fce5f699ecabe8ca9f215507172be537c8850fc91ed44224a588780bf76901d60486c220d5bf821b70fe9d2687f6ec9d966b78008de1f6cf4f1ac3644bb66844
+AUX quake2-icculus-0.16.1-ldflags.patch 1537 BLAKE2B d91b2a7f43f50ef615628e62951701ae4d920f2d8e9cc6f4d5e55368c00c80f2fbc9940df1bcc786b51e85e28fbb43e0c70d04225002a22f302d01a4775185dd SHA512 c4a1dc06b02c227e0cbb8e289b2eab864f5f599f0f92cb376d2a6be7d746774b89fddba21c003c91908a9a140fe639e1588dcff28cccc1a531a6eff8e8f4ccf0
+AUX quake2-icculus-0.16.1-no-asm-io.patch 513 BLAKE2B dbfb2134697e0fdedb47019595a740dfc9c56fa0cb7e21f40cf3a785b20a859d63eb81917cf95157866fd467cd8b0e4f4a8ffa1a871b35679d68c4d77d64bca5 SHA512 ad2d62ce9c69f10683bd5a0970339c82acdf9543b802a0ed070fb025efab6b3aad6e352cc29de5e3120449a3b679823feb920dc175f33b00d230cb9082be3f16
+AUX quake2-icculus-0.16.1-x11_mouse.patch 330 BLAKE2B 0b3da68e551dd76104c29acb9956393d29cd74462c38e9546575ce8951bbf05a14d2f01bd1246aaee842b59e46b25e90fd64e889a5e113dc325aaf7aa948b4e1 SHA512 4387615cab034dd37fb502e7f7411a9cf5ac9370ef474e123c1ea550d79fb06c838ac1de6e443d3e9aeea73ec905bd7464f57f9a561d4eca90852abace20eea0
+AUX quake2-icculus-0.16.1-x11_soft.patch 1128 BLAKE2B 0a0ffe6ced6a6b18f2a1f888d4f329f49b0ddd1ab8c31b20e37cbb6de9dbc703e681ca117aac0eb9e5c98b9b5e5e35b9c3fa6edc6f1925bbbfc7f8d2e21b8e8f SHA512 c8d479919fd4440041d1f2e3a020c45cfb6522d6ff675845bd646c0b736d6ce4b400bcdf99b7f4d456938e8e946e02e40ebab4d574779fb86cff49e4213abc1f
+AUX quake2.xpm 1234 BLAKE2B 7525cb6b2be194822bd57554c7de5e4fcc9f7db9363e3216acac8dd13d8bd17810ff19f18000027f4de112b464a13aaf37c6be5370261283abac7d0a9f6ab8c4 SHA512 e7ed561123c2919a514ba7e4bcd32214bb368764cb53ad314b2816abefa0368247c0a9d463d9e96217c3583aa30f0f79b80bb5f798f6af857f4a0b069ab57e80
+DIST maxpak.pak 3282742 BLAKE2B 3ad4dd5aade5747b100a24499bae0f0d7fd5cc610e4671c1eafb3fc9fe50cbb955bb1d0d0cbaa19b08be7c07499c6a488200f1d811fb2fbe98e190dd58b324b8 SHA512 49eef504190323add8bbe6fd007ee51a17dc843898a2199a44a0b214a14da90202070f9eb025503c58b64d6306832bdb6c0d04efe927ea651eb83b0517a59782
+DIST quake2-r0.16.1.tar.gz 1525384 BLAKE2B b95db08ed3799d2788a20d24f63ea3a84d7ff4b581ee5f01dc5d588a1d5af50d52586a04ca28d9942e953d028e140112737432e499edcebf999085a29c63fcfb SHA512 63e8fa10446698b1f1cbd20b4bbfeec75d7620cb6454bb90b853cd2a3d6cd9040041a164666a5e015c3a8289423127f9164b500f57793505f6e4671dec932cf2
+DIST roguesrc320.shar.Z 626769 BLAKE2B f6d79630ee41e834ad07907f886766fdc9fd99152c2a1964629d2c74de259b9a232f691e5e3c4ad26ff3239d127f06d20878422dd7c1b896591db7c732a41ef7 SHA512 330db4966b758b8e363eb8d699b30ce5ec7d9fa581936288e7267000d0815996388adebc0206a8903734cdc1c5658616b15518a2bf888ad9e6059f8155960141
+DIST xatrixsrc320.shar.Z 455917 BLAKE2B 646801fad3c7eaac4957a971f507b13fff0ea6ae0423cb7fe8e8276666c4f89165384e2e2148e828b692533f9f582b64db849efe8d858e51026b9fb847282101 SHA512 6723440d3cfdaf7f9b260d5777d9823937a4c3ee800c8c204e8a5c3d29f2b37f6bdc7c0786025a19d040b5692aa54b99b9db2dc121bc0ca2b53c8763b4ab4dfa
+EBUILD quake2-icculus-0.16.1-r1.ebuild 5274 BLAKE2B a5b340d6375dfa039ab42159c94867b7e2123d2381cad6fbc1ac9c53cb97bfcd45adbaa698fe162d2de1813f2a6f5c3856b57e1f65278a86693c00a752ebcba9 SHA512 d3e70d7c722c9ea0dcb288e0c32ab3976a79dedb987844c0f2fff951874dd9ae9c1c1e83d3b6f0a31c882c8d73c6f553da94e90416a2e83d2d320d7ca16c4184
+MISC metadata.xml 612 BLAKE2B 0e452fab96a1eaa0cdbb5113cd957576e968eef662103403cef968ae05b909a3d3bc25939dfbb4d36a191d18853e1af0d342ce37cbd6a30defc4fb5ac9e4285c SHA512 0c143ca3470f6b33b35d660e3ad55678356e7139cab94589d18947617988f63f8c69485167d9d8c3e21ef231b0521f993a5063df26ae3e5e5cf4c64bee30d45b
diff --git a/games-fps/quake2-icculus/files/0.16-rogue-armor.patch b/games-fps/quake2-icculus/files/0.16-rogue-armor.patch
new file mode 100644
index 000000000000..194f965a0501
--- /dev/null
+++ b/games-fps/quake2-icculus/files/0.16-rogue-armor.patch
@@ -0,0 +1,12 @@
+--- src/rogue/g_local.h.orig
++++ src/rogue/g_local.h
+@@ -545,9 +545,6 @@
+ extern int sm_meat_index;
+ extern int snd_fry;
+
+-extern int jacket_armor_index;
+-extern int combat_armor_index;
+-extern int body_armor_index;
+
+
+ // means of death
diff --git a/games-fps/quake2-icculus/files/0.16-rogue-nan.patch b/games-fps/quake2-icculus/files/0.16-rogue-nan.patch
new file mode 100644
index 000000000000..0961fa68a985
--- /dev/null
+++ b/games-fps/quake2-icculus/files/0.16-rogue-nan.patch
@@ -0,0 +1,7 @@
+--- src/rogue/g_local.h.orig
++++ src/rogue/g_local.h
+@@ -24,3 +24,3 @@
+ #ifndef _WIN32
+-#include <nan.h>
++#include <bits/nan.h>
+ #define min(a,b) ((a) < (b) ? (a) : (b))
diff --git a/games-fps/quake2-icculus/files/README-postinstall b/games-fps/quake2-icculus/files/README-postinstall
new file mode 100644
index 000000000000..3e2245f3bb0a
--- /dev/null
+++ b/games-fps/quake2-icculus/files/README-postinstall
@@ -0,0 +1,79 @@
+This was taken from the README file in the source distribution
+and cleaned up a bit. Read all of this, or at least skim it. Please?
+
+Note:
+1. If you install a new compile of quake2, you'll lose your savegames. I'm
+sorry. Don't upgrade in the middle of a single-player game.
+
+===============================================================================
+
+To emerge the Quake2 data:
+--------------------------
+1. emerge quake2-data
+
+That was easy huh ? :) Note: this requires the Quake2 CD and/or the data files
+from an installed copy of the game (like for windows).
+
+===============================================================================
+
+To install the Quake2 demo data:
+--------------------------------
+1. download ftp://ftp.idsoftware.com/idstuff/quake2/q2-314-demo-x86.exe
+2. unzip -L q2-314-demo-x86.exe into a temp directory
+3. cp baseq2/pak0.pak to /usr/share/games/quake2-data/baseq2/pak0.pak
+
+===============================================================================
+
+To install the Quake2 gamedata from game CD:
+--------------------------------------------
+(assuming the cdrom is mounted at /cdrom)
+
+1. cp /cdrom/Install/Data/baseq2/pak0.pak /usr/share/games/quake2-data/baseq2/
+
+2. cp /cdrom/Install/Data/baseq2/video/ /usr/share/games/quake2-data/baseq2/
+ (optional)
+
+3. Download ftp://ftp.idsoftware.com/idstuff/quake2/q2-3.20-x86-full.exe
+ and extract the contents to a temporary directory (use unzip -L, as this
+ is a standard zip file).
+
+4. cp <temp directory>/baseq2/pak1.pak /usr/share/games/quake2-data/baseq2/
+5. cp <temp directory>/baseq2/pak2.pak /usr/share/games/quake2-data/baseq2/
+6. cp <temp directory>/baseq2/players/ /usr/share/games/quake2-data/baseq2/
+
+7. if you really want to use the crakhor model, you can find the
+ skins/sounds on websites like http://www.mike-d.com/games/modskins.html
+ (optional)
+
+===============================================================================
+
+Capture The Flag:
+-----------
+To run Capture The Flag, you need to do the following:
+
+1. Download ftp://ftp.idsoftware.com/idstuff/quake2/q2-3.20-x86-full-ctf.exe
+2. unzip that file (using unzip -L) into a temp directory
+3. cp <temp directory>/ctf /usr/share/games/quake2-data/
+
+Execute quake2 with:
+
+quake2 +set game ctf +set dedicated 1
+ -- or --
+q2ded +set game ctf
+===============================================================================
+
+Joystick Support:
+-----------------
+Joystick should function on all compatible SDL platforms using the sdlquake2
+binary as well as on linux using the linux kernel joystick API.
+
+Joystick obeys the same free-look/strafe rules as mouse. You can set these in
+the options menu.
+
+There are four command line settings for joystick:
+1. j_invert_y [1],0 if set to zero pulling back on the joystick points down
+2. j_lr_axis [0] set the axis which controls left right movement
+3. j_ud_axis [1] set the axis which controls up down (in free-look) or
+ forward back (freelock off)
+4. j_throttle [3] set the axis which controls the players forward backward
+ throttle (if free-look is true)
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
new file mode 100644
index 000000000000..185359373c4b
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch
@@ -0,0 +1,172 @@
+--- src/linux/snd_alsa.c.old
++++ 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 $
+ */
+
+-#define BUFFER_SIZE 4096
++// quake2-r0.16.1/src/linux/snd_alsa.c 2010-08-29 09:58:50
++// Alsa Redux Patch
++#define BUFFER_SIZE 16384
+
+ #include <alsa/asoundlib.h>
+
+ #include "../client/client.h"
+ #include "../client/snd_loc.h"
+
++#define AFSize 4
++static int snd_inited=0;
++static snd_pcm_t *playback_handle;
++static int AlsaFrames;
++static int AlsaPos;
++
++/*
+ #define snd_buf BUFFER_SIZE
+
+ static int snd_inited;
+@@ -43,17 +52,58 @@
+ cvar_t *snddevice;
+
+ static int tryrates[] = { 44100, 22051, 11025, 8000 };
+-
++*/
+ qboolean SNDDMA_Init (void)
+ {
+- int i;
+- int err;
+- int buffersize;
+- int framesize;
+- int format;
++ int confirm;
++ int latency;
++ Com_Printf("Setting up ALSA driver .....\n");
+
+ if (snd_inited) { return 1; }
+-
++ int s_khz=(Cvar_Get("s_khz", "22", CVAR_ARCHIVE))->value;
++ if (s_khz <22 ){
++ Com_Printf("Low Performance 11KHz.\n");
++ Cvar_Set("s_mixahead","0.2");
++ dma.speed=11025;
++ AlsaFrames=2048;
++ latency=200000;
++ }else{
++ Com_Printf("High Quality 48KHz.\n");
++ Cvar_Set("s_mixahead","0.1");
++ dma.speed=48000;
++ AlsaFrames=4800;
++ latency=110000;}
++
++ dma.channels = 2;
++ dma.samplebits = 16;
++ AlsaPos = 0;
++ playback_handle = NULL;
++ confirm =
++snd_pcm_open(&playback_handle,"default",SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK);
++ if (confirm < 0) {
++ Com_Printf("ALSA sound error: cannot open device \n");
++ return 0;}
++ confirm = snd_pcm_set_params(playback_handle,
++ SND_PCM_FORMAT_S16_LE,
++ SND_PCM_ACCESS_RW_INTERLEAVED,
++ dma.channels,
++ dma.speed,
++ 1,//soft resample
++ latency);
++ if (confirm < 0){
++ Com_Printf("Alsa error: %s\n", snd_strerror(confirm));
++ return 0;}
++ confirm = snd_pcm_prepare(playback_handle);
++ if (confirm < 0) {
++ Com_Printf("...failed.\n");
++ return 0;}
++
++ int rambuffer = (BUFFER_SIZE+AlsaFrames)*AFSize;
++ dma.buffer=malloc(rambuffer);
++ dma.samplepos = 0;
++ dma.samples = BUFFER_SIZE*dma.channels;
++ dma.submission_chunk = 16;
++ /*
+ sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE);
+ sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE);
+ sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE);
+@@ -159,7 +209,6 @@
+ return 0;
+ }
+
+- /*
+ buffer_size = snd_pcm_hw_params_get_buffer_size(hw_params);
+ frame_size = (snd_pcm_format_physical_width(format)*dma.channels)/8;
+
+@@ -172,7 +221,6 @@
+ }
+
+ snd_buf = buffer_size*frame_size;
+- */
+
+ //snd_buf = BUFFER_SIZE;
+
+@@ -183,7 +231,7 @@
+ dma.samples = snd_buf / (dma.samplebits/8);
+ dma.submission_chunk = 1;
+ dma.buffer = (char *)buffer;
+-
++ */
+ snd_inited = 1;
+ return 1;
+ }
+@@ -191,11 +239,25 @@
+ int
+ SNDDMA_GetDMAPos (void)
+ {
+- if(snd_inited)
+- return dma.samplepos;
+- else
+- Com_Printf ("Sound not inizialized\n");
+- return 0;
++ int timerpos;
++ int send;
++ int taken;
++ timerpos = snd_pcm_avail(playback_handle);
++ if (timerpos<0){// likely buffer underrun.
++ timerpos = snd_pcm_prepare(playback_handle);
++ timerpos=0;}
++
++ send=AlsaFrames-timerpos;
++ if ( (send+AlsaPos)>BUFFER_SIZE )
++ { memcpy (dma.buffer+BUFFER_SIZE*AFSize,
++ dma.buffer,AlsaFrames*AFSize);}
++ taken = snd_pcm_writei(playback_handle, dma.buffer+AlsaPos*AFSize, send);
++ if (taken<0) {taken=0;}
++
++ AlsaPos+=taken;
++ if (BUFFER_SIZE<=AlsaPos){AlsaPos -= BUFFER_SIZE;}
++ return AlsaPos*dma.channels;
++
+ }
+
+ void
+@@ -205,8 +267,8 @@
+ snd_pcm_drop(playback_handle);
+ snd_pcm_close(playback_handle);
+ snd_inited = 0;
++ free(dma.buffer);
+ }
+- free(dma.buffer);
+ dma.buffer = NULL;
+ }
+
+@@ -217,13 +279,6 @@
+ void
+ SNDDMA_Submit (void)
+ {
+- int written;
+-
+- if ((written = snd_pcm_writei(playback_handle, dma.buffer, snd_buf)) < 0) {
+- snd_pcm_prepare(playback_handle);
+- Com_Printf("alsa: buffer underrun\n");
+- }
+- dma.samplepos += written/(dma.samplebits/8);
+ }
+
+
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
new file mode 100644
index 000000000000..b3291827996c
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch
@@ -0,0 +1,18 @@
+The default video renderers (softx / soft) currently do not work
+on amd64. So for now we add a little hack which will select the
+glx renderer by default.
+
+http://bugs.gentoo.org/show_bug.cgi?id=86552
+
+--- src/linux/vid_so.c
++++ src/linux/vid_so.c
+@@ -435,6 +440,9 @@ VID_Init
+ */
+ void VID_Init (void)
+ {
++#if defined __x86_64__
++ vid_ref = Cvar_Get ("vid_ref", "glx", CVAR_ARCHIVE);
++#endif
+ /* Create the video variables so we know how to start the graphics drivers */
+ // if DISPLAY is defined, try X
+ if (getenv("DISPLAY"))
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
new file mode 100644
index 000000000000..626cf5a1b64d
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch
@@ -0,0 +1,14 @@
+--- src/xatrix/g_local.h.old
++++ src/xatrix/g_local.h
+@@ -446,11 +446,6 @@
+ extern int sm_meat_index;
+ extern int snd_fry;
+
+-extern int jacket_armor_index;
+-extern int combat_armor_index;
+-extern int body_armor_index;
+-
+-
+ // means of death
+ #define MOD_UNKNOWN 0
+ #define MOD_BLASTER 1
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
new file mode 100644
index 000000000000..61f0bb2286e5
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch
@@ -0,0 +1,213 @@
+--- Makefile
++++ Makefile
+@@ -74,35 +74,46 @@ endif
+
+ CC=gcc
+
++ifndef OPT_CFLAGS
+ ifeq ($(ARCH),axp)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
++OPT_CFLAGS=-ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+
+ ifeq ($(ARCH),ppc)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
++OPT_CFLAGS=-O2 -ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+
+ ifeq ($(ARCH),sparc)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
++OPT_CFLAGS=-ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+
+ ifeq ($(ARCH),i386)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \
++OPT_CFLAGS=-O2 -ffast-math -funroll-loops -falign-loops=2 \
+ -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing
+ # compiler bugs with gcc 2.96 and 3.0.1 can cause bad builds with heavy opts.
+-#RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -m486 -ffast-math -funroll-loops \
++#OPT_CFLAGS=-O6 -m486 -ffast-math -funroll-loops \
+ # -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
+ # -malign-jumps=2 -malign-functions=2
+ endif
+
+ ifeq ($(ARCH),x86_64)
+ _LIB := 64
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
++OPT_CFLAGS=-O2 -ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing
+ endif
++endif
++RELEASE_CFLAGS=$(BASE_CFLAGS) $(OPT_CFLAGS)
++
++ifeq ($(ADDCFLAGS),debug)
++CFLAGS=$(DEBUG_CFLAGS) -DLINUX_VERSION=\"$(VERSION) Debug\"
++endif
++
++ifeq ($(ADDCFLAGS),release)
++CFLAGS=$(RELEASE_CFLAGS) -DLINUX_VERSION=\"$(VERSION)\"
++endif
+
+ VERSION=3.21+r0.16
+
+@@ -133,6 +136,13 @@ else
+ NET_UDP=net_udp
+ endif
+
++ifdef DEFAULT_BASEDIR
++BASE_CFLAGS += -DDEFAULT_BASEDIR=\"$(DEFAULT_BASEDIR)\"
++endif
++ifdef DEFAULT_LIBDIR
++BASE_CFLAGS += -DDEFAULT_LIBDIR=\"$(DEFAULT_LIBDIR)\"
++endif
++
+ ifeq ($(strip $(BUILD_QMAX)),YES)
+ BASE_CFLAGS+=-DQMAX
+ endif
+@@ -406,7 +424,7 @@
+ $(BUILD_DEBUG_DIR)/ctf \
+ $(BUILD_DEBUG_DIR)/xatrix \
+ $(BUILD_DEBUG_DIR)/rogue
+- $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS) -DLINUX_VERSION='\"$(VERSION) Debug\"'"
++ $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) ADDCFLAGS=debug
+
+ build_release:
+ @-mkdir -p $(BUILD_RELEASE_DIR) \
+@@ -418,7 +436,7 @@
+ $(BUILD_RELEASE_DIR)/ctf \
+ $(BUILD_RELEASE_DIR)/xatrix \
+ $(BUILD_RELEASE_DIR)/rogue
+- $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS) -DLINUX_VERSION='\"$(VERSION)\"'"
++ $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) ADDCFLAGS=release
+
+ targets: $(TARGETS)
+
+--- src/linux/qgl_linux.c
++++ src/linux/qgl_linux.c
+@@ -3006,13 +3006,17 @@ qboolean QGL_Init( const char *dllname )
+ // dllname, dlerror());
+
+ // try basedir next
+- path = ri.Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
++ path = ri.Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string;
+
+ snprintf (fn, MAX_OSPATH, "%s/%s", path, dllname );
+
+ if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) {
+- ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() );
+- return false;
++ path = ri.Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string;
++ snprintf (fn, MAX_OSPATH, "%s/%s", path, dllname );
++ if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) {
++ ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() );
++ return false;
++ }
+ }
+ Com_Printf ("Using %s for OpenGL...", fn);
+ } else {
+--- src/linux/vid_so.c
++++ src/linux/vid_so.c
+@@ -237,13 +237,17 @@ qboolean VID_LoadRefresh( char *name )
+ //regain root
+ seteuid(saved_euid);
+
+- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
++ path = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string;
+
+ snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
+
+ if (stat(fn, &st) == -1) {
+- Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno));
+- return false;
++ path = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string;
++ snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
++ if (stat(fn, &st) == -1) {
++ Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno));
++ return false;
++ }
+ }
+
+ // permission checking
+@@ -493,13 +497,19 @@ qboolean VID_CheckRefExists (const char
+ char *path;
+ struct stat st;
+
+- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
++ path = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string;
+ snprintf (fn, MAX_OSPATH, "%s/ref_%s.so", path, ref );
+
+ if (stat(fn, &st) == 0)
+ return true;
+- else
+- return false;
++ else {
++ path = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string;
++ snprintf (fn, MAX_OSPATH, "%s/ref_%s.so", path, ref );
++ if (stat(fn, &st) == 0)
++ return true;
++ else
++ return false;
++ }
+ }
+
+ /*****************************************************************************/
+--- src/qcommon/files.c
++++ src/qcommon/files.c
+@@ -60,6 +60,7 @@ typedef struct pack_s
+
+ char fs_gamedir[MAX_OSPATH];
+ cvar_t *fs_basedir;
++cvar_t *fs_libdir;
+ cvar_t *fs_cddir;
+ cvar_t *fs_gamedirvar;
+
+@@ -681,6 +682,7 @@ void FS_SetGamedir (char *dir)
+ if (fs_cddir->string[0])
+ FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) );
+ FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
++ FS_AddGameDirectory (va("%s/%s", fs_libdir->string, dir) );
+ FS_AddHomeAsGameDirectory(dir);
+ }
+ }
+@@ -898,7 +900,13 @@ void FS_InitFilesystem (void)
+ // basedir <path>
+ // allows the game to run from outside the data tree
+ //
+- fs_basedir = Cvar_Get ("basedir", ".", CVAR_NOSET);
++ fs_basedir = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET);
++
++ //
++ // libdir <path>
++ // allows the game to store binary files (not data) in a sep tree
++ //
++ fs_libdir = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET);
+
+ //
+ // cddir <path>
+@@ -913,6 +921,7 @@ void FS_InitFilesystem (void)
+ // add baseq2 to search path
+ //
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
++ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_libdir->string) );
+
+ //
+ // then add a '.quake2/baseq2' directory in home directory by default
+--- src/qcommon/qcommon.h
++++ src/qcommon/qcommon.h
+@@ -74,6 +74,13 @@ Foundation, Inc., 59 Temple Place - Suit
+
+ #endif
+
++#ifndef DEFAULT_BASEDIR
++# define DEFAULT_BASEDIR "."
++#endif
++#ifndef DEFAULT_LIBDIR
++# define DEFAULT_LIBDIR DEFAULT_BASEDIR
++#endif
++
+ //============================================================================
+
+ typedef struct sizebuf_s
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
new file mode 100644
index 000000000000..ad1f37309c30
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch
@@ -0,0 +1,12 @@
+--- quake2-r0.16.1/src/linux/q_shlinux.c
++++ quake2-r0.16.1-modified/src/linux/q_shlinux.c
+@@ -17,6 +17,9 @@
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ */
++#if !defined(_GNU_SOURCE)
++ #define _GNU_SOURCE
++#endif
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <errno.h>
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
new file mode 100644
index 000000000000..ae1aa2e4068c
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch
@@ -0,0 +1,97 @@
+--- quake2-r0.16.1.orig/Makefile
++++ quake2-r0.16.1/Makefile
+@@ -54,24 +54,26 @@ endif
+
+
+ # this nice line comes from the linux kernel makefile
+ ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/)
+
+ ifneq ($(ARCH),x86_64)
+ ifneq ($(ARCH),i386)
+ ifneq ($(ARCH),axp)
++ifneq ($(ARCH),ia64)
+ ifneq ($(ARCH),ppc)
+ ifneq ($(ARCH),sparc)
+ $(error arch $(ARCH) is currently not supported)
+ endif
+ endif
+ endif
+ endif
+ endif
++endif
+
+ CC=gcc
+
+ ifndef OPT_CFLAGS
+ ifeq ($(ARCH),axp)
+ OPT_CFLAGS=-ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+@@ -283,16 +285,46 @@ ifeq ($(ARCH),axp)
+ $(warning Warning: SDL support not supported for $(ARCH))
+ endif
+
+ ifeq ($(strip $(BUILD_SDLGL)),YES)
+ $(warning Warning: SDLGL support not supported for $(ARCH))
+ endif
+ endif # ARCH axp
+
++ifeq ($(ARCH),ia64)
++ ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
++ TARGETS += $(BUILDDIR)/sdlquake2
++ endif
++
++ ifeq ($(strip $(BUILD_SVGA)),YES)
++ TARGETS += $(BUILDDIR)/ref_soft.$(SHLIBEXT)
++ endif
++
++ ifeq ($(strip $(BUILD_X11)),YES)
++ TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
++ endif
++
++ ifeq ($(strip $(BUILD_GLX)),YES)
++ TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT)
++ endif
++
++ ifeq ($(strip $(BUILD_FXGL)),YES)
++ TARGETS += $(BUILDDIR)/ref_gl.$(SHLIBEXT)
++ endif
++
++ ifeq ($(strip $(BUILD_SDL)),YES)
++ TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT)
++ endif
++
++ ifeq ($(strip $(BUILD_SDLGL)),YES)
++ TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT)
++ endif
++endif # ARCH ia64
++
+ ifeq ($(ARCH),ppc)
+ ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
+ TARGETS += $(BUILDDIR)/sdlquake2
+ endif
+
+ 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
+@@ -216,16 +216,18 @@ void *Sys_GetGameAPI (void *parms)
+ char *path;
+ char *str_p;
+ #if defined __i386__
+ const char *gamename = "gamei386.so";
+ #elif defined __x86_64__
+ const char *gamename = "gamex86_64.so";
+ #elif defined __alpha__
+ const char *gamename = "gameaxp.so";
++#elif defined __ia64__
++ const char *gamename = "gameia64.so";
+ #elif defined __powerpc__
+ const char *gamename = "gameppc.so";
+ #elif defined __sparc__
+ const char *gamename = "gamesparc.so";
+ #else
+ #error Unknown arch
+ #endif
+
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
new file mode 100644
index 000000000000..978c9c9820ea
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch
@@ -0,0 +1,56 @@
+--- Makefile.old
++++ Makefile
+@@ -169,18 +169,18 @@
+ DEBUG_CFLAGS=$(BASE_CFLAGS) -g
+
+ ifeq ($(OSTYPE),FreeBSD)
+-LDFLAGS=-lm
++LDLIBS=-lm
+ endif
+ ifeq ($(OSTYPE),Linux)
+-LDFLAGS=-lm -ldl
++LDLIBS=-lm -ldl
+ endif
+
+ ifeq ($(strip $(BUILD_ARTS)),YES)
+-LDFLAGS+=$(shell artsc-config --libs)
++LDLIBS+=$(shell artsc-config --libs)
+ endif
+
+ ifeq ($(strip $(BUILD_ALSA)),YES)
+-LDFLAGS+=-lasound
++LDLIBS+=-lasound
+ endif
+
+
+@@ -226,7 +226,7 @@
+ SHLIBEXT=so
+
+ SHLIBCFLAGS=-fPIC
+-SHLIBLDFLAGS=-shared
++SHLIBLDFLAGS=$(LDFLAGS) -shared
+
+ DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
+ DO_DED_CC=$(CC) $(CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
+@@ -518,10 +518,10 @@
+ endif
+
+ $(BUILDDIR)/quake2 : $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS) $(LDLIBS)
+
+ $(BUILDDIR)/sdlquake2 : $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) $(LDFLAGS) $(SDLLDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) $(LDLIBS) $(SDLLDFLAGS)
+
+ $(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
+ $(DO_CC)
+@@ -710,7 +710,7 @@
+ $(BUILDDIR)/ded/cd_null.o
+
+ $(BUILDDIR)/q2ded : $(Q2DED_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(Q2DED_OBJS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q2DED_OBJS) $(LDLIBS)
+
+ $(BUILDDIR)/ded/cmd.o : $(COMMON_DIR)/cmd.c
+ $(DO_DED_CC)
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
new file mode 100644
index 000000000000..d94925b83e4b
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch
@@ -0,0 +1,25 @@
+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
+@@ -46,7 +46,6 @@
+ #include <sys/mman.h>
+
+ #if defined (__linux__)
+-#include <asm/io.h>
+ #include <sys/vt.h>
+ #endif
+
+--- src/linux/rw_aa.c
++++ src/linux/rw_aa.c
+@@ -63,7 +63,6 @@
+ #include <dlfcn.h>
+ #if defined (__linux__)
+ #include <sys/vt.h>
+-#include <asm/io.h>
+ #endif
+ #include <aalib.h>
+
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
new file mode 100644
index 000000000000..6dc6f0f1ddfb
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch
@@ -0,0 +1,13 @@
+--- src/linux/rw_x11.c.old
++++ src/linux/rw_x11.c
+@@ -989,8 +989,8 @@
+ }
+ else
+ {
+- mx -= ((int)event.xmotion.x + mwx)*2;
+- my -= ((int)event.xmotion.y + mwy)*2;
++ mx += ((int)event.xmotion.x - mwx)*2;
++ my += ((int)event.xmotion.y - mwy)*2;
+ mwx = event.xmotion.x;
+ mwy = event.xmotion.y;
+
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
new file mode 100644
index 000000000000..e23caf9db09f
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch
@@ -0,0 +1,45 @@
+
+the x11 software renderer just needs some tweaks to get working
+
+--- Makefile.old
++++ Makefile
+@@ -358,7 +358,7 @@
+ endif
+
+ ifeq ($(strip $(BUILD_X11)),YES)
+- $(warning Warning: Software X Renderer not supported for $(ARCH))
++ TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_GLX)),YES)
+--- src/linux/rw_x11.c.old
++++ src/linux/rw_x11.c
+@@ -53,7 +53,7 @@
+ #include <X11/Xatom.h>
+ #include <X11/keysym.h>
+ #include <X11/extensions/XShm.h>
+-#include <X11/extensions/xf86dga.h>
++#include <X11/extensions/Xxf86dga.h>
+ #ifdef OPENGL
+ #include <X11/extensions/xf86vmode.h>
+ #endif
+@@ -151,7 +151,7 @@
+ int config_notify_height;
+
+ typedef unsigned short PIXEL16;
+-typedef unsigned long PIXEL24;
++typedef unsigned int PIXEL24;
+ #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
+@@ -994,7 +994,7 @@
+ scale = yscale * pout->zi;
+ pout->v = (ycenter - scale * transformed[1]);
+
+- pv += sizeof (vec5_t) / sizeof (pv);
++ pv += sizeof (vec5_t) / sizeof (float);
+ }
+
+ // draw it
diff --git a/games-fps/quake2-icculus/files/quake2.xpm b/games-fps/quake2-icculus/files/quake2.xpm
new file mode 100644
index 000000000000..bbbcbb8f064f
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2.xpm
@@ -0,0 +1,37 @@
+/* XPM */
+static char * quake2_xpm[] = {
+"32 32 2 1",
+" c None",
+". c #000000",
+" ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" ... ... ",
+" ... ........ ... ",
+" ... ...... ... ",
+" .... .. .. .... ",
+" .... .. .. .... ",
+" ........ ........ ",
+" ................ ",
+" .............. ",
+" .......... ",
+" ...... ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. "};
diff --git a/games-fps/quake2-icculus/metadata.xml b/games-fps/quake2-icculus/metadata.xml
new file mode 100644
index 000000000000..62d0273c2558
--- /dev/null
+++ b/games-fps/quake2-icculus/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+ <use>
+ <flag name="demo">Install the demo files (quake2-demodata) and configure for use</flag>
+ <flag name="qmax">Build the pretty version (quake max)</flag>
+ <flag name="rogue">Build support for the 'Ground Zero' Mission Pack (rogue)</flag>
+ <flag name="xatrix">Build support for the 'The Reckoning' Mission Pack (xatrix)</flag>
+ </use>
+</pkgmetadata>
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
new file mode 100644
index 000000000000..38e4fb6d071a
--- /dev/null
+++ b/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild
@@ -0,0 +1,195 @@
+# Copyright 1999-2015 Gentoo Foundation
+# 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 ~x86-fbsd"
+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? ( || ( sys-freebsd/freebsd-ubin app-arch/sharutils ) )
+ xatrix? ( || ( sys-freebsd/freebsd-ubin 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
+
+ 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
+}