summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Ospald <hasufell@gentoo.org>2013-01-05 18:23:50 +0000
committerJulian Ospald <hasufell@gentoo.org>2013-01-05 18:23:50 +0000
commit63a741f2615b817ec520f3d83088dc6d4193a4e9 (patch)
tree6ea798fef64f7c238199fcc91a2e0822060d98c5 /games-fps/sauerbraten
parentVersion bump. (diff)
downloadhistorical-63a741f2615b817ec520f3d83088dc6d4193a4e9.tar.gz
historical-63a741f2615b817ec520f3d83088dc6d4193a4e9.tar.bz2
historical-63a741f2615b817ec520f3d83088dc6d4193a4e9.zip
version bump wrt #450360
Package-Manager: portage-2.2.0_alpha149/cvs/Linux x86_64 Manifest-Sign-Key: 0xE73C35B3
Diffstat (limited to 'games-fps/sauerbraten')
-rw-r--r--games-fps/sauerbraten/ChangeLog12
-rw-r--r--games-fps/sauerbraten/Manifest23
-rw-r--r--games-fps/sauerbraten/files/sauerbraten-2013.01.04-QA.patch50
-rw-r--r--games-fps/sauerbraten/files/sauerbraten-2013.01.04-master.patch323
-rw-r--r--games-fps/sauerbraten/files/sauerbraten-2013.01.04-system-enet.patch64
-rw-r--r--games-fps/sauerbraten/metadata.xml5
-rw-r--r--games-fps/sauerbraten/sauerbraten-2013.01.04.ebuild127
7 files changed, 599 insertions, 5 deletions
diff --git a/games-fps/sauerbraten/ChangeLog b/games-fps/sauerbraten/ChangeLog
index a9169e7689b2..69252583ebc1 100644
--- a/games-fps/sauerbraten/ChangeLog
+++ b/games-fps/sauerbraten/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for games-fps/sauerbraten
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/games-fps/sauerbraten/ChangeLog,v 1.18 2012/12/04 15:37:45 ago Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/games-fps/sauerbraten/ChangeLog,v 1.19 2013/01/05 18:23:48 hasufell Exp $
+
+*sauerbraten-2013.01.04 (05 Jan 2013)
+
+ 05 Jan 2013; Julian Ospald <hasufell@gentoo.org>
+ +sauerbraten-2013.01.04.ebuild, +files/sauerbraten-2013.01.04-QA.patch,
+ +files/sauerbraten-2013.01.04-master.patch,
+ +files/sauerbraten-2013.01.04-system-enet.patch:
+ version bump wrt #450360
04 Dec 2012; <ago@gentoo.org> sauerbraten-2010.07.28.ebuild:
Stable for x86, wrt bug #443560
diff --git a/games-fps/sauerbraten/Manifest b/games-fps/sauerbraten/Manifest
index 4d945685397c..0b98cc4b4d9d 100644
--- a/games-fps/sauerbraten/Manifest
+++ b/games-fps/sauerbraten/Manifest
@@ -1,8 +1,27 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
AUX sauerbraten-2010.07.28-system-enet.patch 1947 SHA256 862ffc81548e6c4a9c0daf273e133ba8143f20fcda3359237e95f79b8c4ccab5 SHA512 da39646d329f989811b0e63d112d6c93df0882837b6314a024c7f439e2a3d85d8e508d484336a5c410680b695c7ae974214a9e94106c03f14623a5869afdd3a1 WHIRLPOOL 8d9223f195c74b4b74dbc49739a59742d7ba08216b2c8114759d8be2c891260cee1eecfbc867cc1f16897c69c5441e90a79788b2fcfa55310aeb525aa97e12b2
+AUX sauerbraten-2013.01.04-QA.patch 2037 SHA256 baddf2bb64ad33df6ad11bbdfaf7d7c918a4f6c26f62bd641d43633051be83c4 SHA512 1725945f0373f03e5ae81b8e9eee4e2a9260d9362ad424e4198bb71af2e69055439268197f784d2acbd9e17ff977e8b1a7f5193d378a036488ff758d0ead4b5a WHIRLPOOL 312c17a2fa83a8fa73cdba080c8d74291f5572098ab05ee29e5238b672ad2e7540949e4f0a78e557ae96c9062e584e313dfb82d8e1b9d5aa72d6a207db0b316f
+AUX sauerbraten-2013.01.04-master.patch 9577 SHA256 ccbb0e3cb50a60f94f5f5ed76dc6904634b232aa3077fc55bf71b3ec2a5e2afe SHA512 93932305b543bf4095170fdb4e3b0bd334437b5a2d373257f7f2cc642e493dad76f7a32f414ed1cb33e0f048fb51d0207f92363a0c56ba8537872751570b640e WHIRLPOOL 7131d4f0039a037ab469d558d9ba962cbde52c822616389803d4e50ca9203c59919e741e3d0a0959a92ee3b6b28d2657f5078e8918eae2fde225975dff9e28a8
+AUX sauerbraten-2013.01.04-system-enet.patch 1880 SHA256 3dddd4fca0c0176121b72d180f9046a28a026a68666a228503b1a4cebb44f597 SHA512 b53e7db4e6b7ce012ee292a24cbf6e84e1c6bce01cde1a41985d0b471a68c1d2978f8272bc359a81beb317b5ab2ff88a13a1e73aaeb7f5c643e778ffe9861c7a WHIRLPOOL 38d88521ab507735d744b4f186a495fd25b73cbbd24d8b0b0adaca4219cabf56342e25bc12e55c782e6a86c418bcf54cf3802752a41009ff2dd641dc8b123067
AUX sauerbraten.conf 605 SHA256 6e0694718370b126034bc569229d91b63cbfbd87f86af0a03d20e08833069811 SHA512 685b7358ad7267b1b19ac00f879a82205f346b32fda8cb460c4f8c50e9f20263c102b0fca62ab437dabe67ebbdd281f130f28f3b8ef2bcf064ae45fbd23cce67 WHIRLPOOL c1f4de209300898333856a027e5587a2b1d5f978b653f8085b47b40f72ef533462e5810d79757675742998206c9db445ca94d904aea3563807d3300b872a47b1
AUX sauerbraten.init 1950 SHA256 6d7b46186b368ea5edee77f72d9772d5ca42fb8ad14c3e90c0caa7e663666159 SHA512 a4e159aeee9536aac0d47f4a8bf33db1b4dde69f999b1c21d8a0f373969fb38d2130129fb080b97cd98048f3a10f98d30e6d4ea53efb29c3c38ba74b66f47f14 WHIRLPOOL c48c3fcad3b19d1b2791dede723a60a5930e1c4f607d5030dfefe1766a5b951a262ba75d4023ed8c75df968c6bc440cc9bf280bb3271e776c148d69bc7ab47f7
AUX sauerbraten_unix.patch 644 SHA256 0198017bd3c88d06ad0b0f369b7f0c71ff2451bf82345eb8869fdd34a5b81c79 SHA512 ce4086f89a2192580a7a6be37f2d6f5cb0f4257c9b59b1b241b13693ffe7b1304ca7ce5e323ee9a8be44addaea330d576467967aca056d9b5cc7242e30ad2b01 WHIRLPOOL 7747daa49192c0d35b7bfec79b0f59231e16e072778b369be3bc326b28af9a8d762acb4310eb529d0f88c53243e4cd4b495ba7a2eee5173f723bc84c03b3283e
DIST sauerbraten_2010_07_28_justice_edition_linux.tar.bz2 464652953 SHA256 185e5dbf41a4426af5f692e49afa69237e23976ef3b368f43ec6aa19fb3cc86c SHA512 0d768c68264cd3083945945ce7a7b331b8b53adeb333803da7617643a5d521884be30c05d4635eed34489cc9280ce06b9af1e471557ba908977c39041c457282 WHIRLPOOL 7ff612e79813dae9f3ab9f8a85ce5c2e421468566b038112c0375b50c05e7f0dec7fdd84970374609687f899e4ca807d4d50382cfaa19e1a2f5e72ead3f79596
+DIST sauerbraten_2013_01_04_collect_edition_linux.tar.bz2 589939261 SHA256 3ecc27c318125883763130e45805eb7ba3a426234e5766ab0d00522f4a437bd1 SHA512 f89c9e69bb69596829661f551e4b63b2f2af96a01f075cb94a80e2bfae4f8664b7dab8f4850b91499817240e0311b64b049ea985c761ff7bb6d39ed75e6198cd WHIRLPOOL d10e354942180064ab44a2f8c8b13819240fde3537825908768d1ddda24f600971641b8a9cee4abee9539ec912bf265cb1771c001ad81a33e287c99e0f6906b8
EBUILD sauerbraten-2010.07.28.ebuild 3216 SHA256 87a7147c2f9e6e5d6217175d7aaaacc7d9596c4cae7a69d28c533cbcc83f952e SHA512 a23e049f7b8dfc444bbd65950463638922e86cb72586664342817c4605e275a20c6d2a3b3f23e51c594ab0147b799c9c951d3222f28684173c53d949bd219f1e WHIRLPOOL 08316673935154155f6ae35537be534fd98be9102b98b8756d0d9b45a5efad391534ad8562002bdb28c782ee67dca7d8e83b6d37cd6fcac50f81fe50c75124dc
-MISC ChangeLog 3027 SHA256 849f5923c57521b0e8987b66d8481b15f1513e3b9a537bd1f7fafea02e042e96 SHA512 2bbe5911e57241b7f775d33b22ec398445d28055336f285909cb11f5c1c6017c882abc99a1b8743f619958ffc8294e28db9f399773add1d3e3f787f702b0f54c WHIRLPOOL 8d3e8b135e835fe7fb115df9f14911fd0c840ca5e2aef8badb8c66082d6dc796ea7b5a99e02e311de087c417ab7c2c0b4a55004ace2df3b2539f68c395ceb73f
-MISC metadata.xml 158 SHA256 1423a4fdd4a79b1728a2056d9e300f7e1074253095d82726218d9e9b953888a3 SHA512 d954564236b67b6ab97846b73f74e715e8f1bec2dba6595e9a5046c2e8c3b93f4879c293f9d1d02d99a533bee56156dae3f31a485697128c51af14cdbfdada8a WHIRLPOOL d03e7293d09d794d61c095a423f945b3644355a247f270a73ca8d30b4dfe9c98244297536bfd1a4bd6c14794aa1152eca20fd83bfdf3e1e74d4f676152d35ada
+EBUILD sauerbraten-2013.01.04.ebuild 3383 SHA256 a7bbe159758e00cf4fcbb9bee74defd880206939c7ed5e1d9d7559a1a590308c SHA512 5514385469e5cad568fd553062e03f91a77b7be5fdc3d4703c10961aa43c6b1bda6f592be23562a8986b496357229b90d0b7b2c829b5bc719b997539821632d1 WHIRLPOOL c2e59c6ade5426a72d421065270ac6fdc80a265cd985c0036a20379bccaabd7fe5d64f0414e10c7ccb6de10c9bac0cba540b2a22485256c42b969b1f7db14246
+MISC ChangeLog 3321 SHA256 8c30fe0693780a6a4696d9e908cf2602a66e2fd74836818c6252cf768595369f SHA512 2480f131fd535ffa4ccdbfc3ce30b3a9237fc03e589259e0829e8d68a910cc0ace025d5023b20335dbfaaea869ab05f9c8936e992d2422fcebaace0ef430e00a WHIRLPOOL 745c3f6263e789652e19ff953805b68e2d262a6c7d35bbc2f451061b342d48067812273858e23936bc44b5a7f26614423285538e335f6b43887e66d9e3398063
+MISC metadata.xml 226 SHA256 5895cc4875434ce5d4986e44142ba75592ff8db946f467fb1c853759707c00dd SHA512 a42c73f8da988c9d7b165b4151819181b070f7b1c073f68c885e0212a97b7f791b95c759f1b44bda88496087ffebb4c1cbba7ef39501cc4afb00b9ab396e7f9c WHIRLPOOL 4468be6499e7e4e02a85d768bee66eabf75d0fa2319af60f3f7d4c462ecfaa99054d65998320d1cb8d498e1bafdbd089b3a9f10eba03314d03095e2dfbc32e34
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQEcBAEBCAAGBQJQ6G+1AAoJEFpvPKfnPDWzJP0H/0r4kgKZa70L3gtCjgek+vZq
++cyLrAu6Kix3/1FHTBgI3X6VPmdPuWHHGVE2Xjf3v7akTiHEvJ/9+xNDOhe2T4K4
+Z/wKXLBY37B4TtcnjlUrPAL7zryKDQlYCbMMA/e36Je9qgyrfkq4mc4uYWFwYqUZ
+VGHQgFtf+iEDqE1IskcR2jTbDfE9hXjPDOYWpchZSlpEwO8defP3Bmnd/YrAL8Rb
+S/wSe0WcS440HzVwF9KcmAO1G+59AN4OLZoi+hsEQt9LEabG3zf7R6SCGpQqDZW/
+wAksfuo+ls/5hQdr9ws2jCPRL3CXtQuSrWg54fHNxPow6sGgSaH5cc/KccrTSu8=
+=Z2bo
+-----END PGP SIGNATURE-----
diff --git a/games-fps/sauerbraten/files/sauerbraten-2013.01.04-QA.patch b/games-fps/sauerbraten/files/sauerbraten-2013.01.04-QA.patch
new file mode 100644
index 000000000000..21f1b13c7a2a
--- /dev/null
+++ b/games-fps/sauerbraten/files/sauerbraten-2013.01.04-QA.patch
@@ -0,0 +1,50 @@
+applied on top of sauerbraten-2013.01.04-system-enet.patch
+
+respect LDFLAGS, CXXFLAGS and CPPFLAGS
+--- sauerbraten/src/Makefile
++++ sauerbraten/src/Makefile
+@@ -1,4 +1,4 @@
+-CXXFLAGS= -O3 -fomit-frame-pointer
++CXXFLAGS ?= -O3 -fomit-frame-pointer
+ override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti
+
+ PLATFORM= $(shell uname -s)
+@@ -139,11 +139,11 @@
+ -$(RM) $(CLIENT_PCH) $(CLIENT_OBJS) $(SERVER_OBJS) $(MASTER_OBJS) sauer_client sauer_server sauer_master
+
+ %.h.gch: %.h
+- $(CXX) $(CXXFLAGS) -o $(subst .h.gch,.tmp.h.gch,$@) $(subst .h.gch,.h,$@)
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(subst .h.gch,.tmp.h.gch,$@) $(subst .h.gch,.h,$@)
+ $(MV) $(subst .h.gch,.tmp.h.gch,$@) $@
+
+ %-standalone.o: %.cpp
+- $(CXX) $(CXXFLAGS) -c -o $@ $(subst -standalone.o,.cpp,$@)
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(subst -standalone.o,.cpp,$@)
+
+ $(CLIENT_OBJS): CXXFLAGS += $(CLIENT_INCLUDES)
+ $(filter shared/%,$(CLIENT_OBJS)): $(filter shared/%,$(CLIENT_PCH))
+@@ -168,19 +168,19 @@
+ install: all
+ else
+ client: $(CLIENT_OBJS)
+- $(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS)
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS)
+
+ server: $(SERVER_OBJS)
+- $(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS)
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS)
+
+ master: $(MASTER_OBJS)
+- $(CXX) $(CXXFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS)
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS)
+
+ shared/cube2font.o: shared/cube2font.c
+- $(CXX) $(CXXFLAGS) -c -o $@ $< `freetype-config --cflags`
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< `freetype-config --cflags`
+
+ cube2font: shared/cube2font.o
+- $(CXX) $(CXXFLAGS) -o cube2font shared/cube2font.o `freetype-config --libs` -lz
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o cube2font shared/cube2font.o `freetype-config --libs` -lz
+
+ install: all
+ cp sauer_client ../bin_unix/$(PLATFORM_PREFIX)_client
diff --git a/games-fps/sauerbraten/files/sauerbraten-2013.01.04-master.patch b/games-fps/sauerbraten/files/sauerbraten-2013.01.04-master.patch
new file mode 100644
index 000000000000..730a69a2f4d0
--- /dev/null
+++ b/games-fps/sauerbraten/files/sauerbraten-2013.01.04-master.patch
@@ -0,0 +1,323 @@
+http://sourceforge.net/p/sauerbraten/code/4699/
+
+--- a/src/shared/iengine.h
++++ b/src/shared/iengine.h
+@@ -415,23 +415,6 @@
+ extern int getservermtu();
+ extern int getnumclients();
+ extern uint getclientip(int n);
+-extern void putint(ucharbuf &p, int n);
+-extern void putint(packetbuf &p, int n);
+-extern void putint(vector<uchar> &p, int n);
+-extern int getint(ucharbuf &p);
+-extern void putuint(ucharbuf &p, int n);
+-extern void putuint(packetbuf &p, int n);
+-extern void putuint(vector<uchar> &p, int n);
+-extern int getuint(ucharbuf &p);
+-extern void putfloat(ucharbuf &p, float f);
+-extern void putfloat(packetbuf &p, float f);
+-extern void putfloat(vector<uchar> &p, float f);
+-extern float getfloat(ucharbuf &p);
+-extern void sendstring(const char *t, ucharbuf &p);
+-extern void sendstring(const char *t, packetbuf &p);
+-extern void sendstring(const char *t, vector<uchar> &p);
+-extern void getstring(char *t, ucharbuf &p, int len = MAXTRANS);
+-extern void filtertext(char *dst, const char *src, bool whitespace = true, int len = sizeof(string)-1);
+ extern void localconnect();
+ extern const char *disconnectreason(int reason);
+ extern void disconnect_client(int n, int reason);
+--- a/src/engine/server.cpp
++++ b/src/engine/server.cpp
+@@ -99,125 +99,6 @@
+ va_end(args);
+ }
+ #endif
+-
+-// all network traffic is in 32bit ints, which are then compressed using the following simple scheme (assumes that most values are small).
+-
+-template<class T>
+-static inline void putint_(T &p, int n)
+-{
+- if(n<128 && n>-127) p.put(n);
+- else if(n<0x8000 && n>=-0x8000) { p.put(0x80); p.put(n); p.put(n>>8); }
+- else { p.put(0x81); p.put(n); p.put(n>>8); p.put(n>>16); p.put(n>>24); }
+-}
+-void putint(ucharbuf &p, int n) { putint_(p, n); }
+-void putint(packetbuf &p, int n) { putint_(p, n); }
+-void putint(vector<uchar> &p, int n) { putint_(p, n); }
+-
+-int getint(ucharbuf &p)
+-{
+- int c = (char)p.get();
+- if(c==-128) { int n = p.get(); n |= char(p.get())<<8; return n; }
+- else if(c==-127) { int n = p.get(); n |= p.get()<<8; n |= p.get()<<16; return n|(p.get()<<24); }
+- else return c;
+-}
+-
+-// much smaller encoding for unsigned integers up to 28 bits, but can handle signed
+-template<class T>
+-static inline void putuint_(T &p, int n)
+-{
+- if(n < 0 || n >= (1<<21))
+- {
+- p.put(0x80 | (n & 0x7F));
+- p.put(0x80 | ((n >> 7) & 0x7F));
+- p.put(0x80 | ((n >> 14) & 0x7F));
+- p.put(n >> 21);
+- }
+- else if(n < (1<<7)) p.put(n);
+- else if(n < (1<<14))
+- {
+- p.put(0x80 | (n & 0x7F));
+- p.put(n >> 7);
+- }
+- else
+- {
+- p.put(0x80 | (n & 0x7F));
+- p.put(0x80 | ((n >> 7) & 0x7F));
+- p.put(n >> 14);
+- }
+-}
+-void putuint(ucharbuf &p, int n) { putuint_(p, n); }
+-void putuint(packetbuf &p, int n) { putuint_(p, n); }
+-void putuint(vector<uchar> &p, int n) { putuint_(p, n); }
+-
+-int getuint(ucharbuf &p)
+-{
+- int n = p.get();
+- if(n & 0x80)
+- {
+- n += (p.get() << 7) - 0x80;
+- if(n & (1<<14)) n += (p.get() << 14) - (1<<14);
+- if(n & (1<<21)) n += (p.get() << 21) - (1<<21);
+- if(n & (1<<28)) n |= -1<<28;
+- }
+- return n;
+-}
+-
+-template<class T>
+-static inline void putfloat_(T &p, float f)
+-{
+- lilswap(&f, 1);
+- p.put((uchar *)&f, sizeof(float));
+-}
+-void putfloat(ucharbuf &p, float f) { putfloat_(p, f); }
+-void putfloat(packetbuf &p, float f) { putfloat_(p, f); }
+-void putfloat(vector<uchar> &p, float f) { putfloat_(p, f); }
+-
+-float getfloat(ucharbuf &p)
+-{
+- float f;
+- p.get((uchar *)&f, sizeof(float));
+- return lilswap(f);
+-}
+-
+-template<class T>
+-static inline void sendstring_(const char *t, T &p)
+-{
+- while(*t) putint(p, *t++);
+- putint(p, 0);
+-}
+-void sendstring(const char *t, ucharbuf &p) { sendstring_(t, p); }
+-void sendstring(const char *t, packetbuf &p) { sendstring_(t, p); }
+-void sendstring(const char *t, vector<uchar> &p) { sendstring_(t, p); }
+-
+-void getstring(char *text, ucharbuf &p, int len)
+-{
+- char *t = text;
+- do
+- {
+- if(t>=&text[len]) { text[len-1] = 0; return; }
+- if(!p.remaining()) { *t = 0; return; }
+- *t = getint(p);
+- }
+- while(*t++);
+-}
+-
+-void filtertext(char *dst, const char *src, bool whitespace, int len)
+-{
+- for(int c = uchar(*src); c; c = uchar(*++src))
+- {
+- if(c == '\f')
+- {
+- if(!*++src) break;
+- continue;
+- }
+- if(iscubeprint(c) || (iscubespace(c) && whitespace))
+- {
+- *dst++ = c;
+- if(!--len) break;
+- }
+- }
+- *dst = '\0';
+-}
+
+ enum { ST_EMPTY, ST_LOCAL, ST_TCPIP };
+
+--- a/src/shared/tools.h
++++ b/src/shared/tools.h
+@@ -1178,5 +1178,24 @@
+ extern uint randomMT();
+ extern int guessnumcpus();
+
+-#endif
+-
++extern void putint(ucharbuf &p, int n);
++extern void putint(packetbuf &p, int n);
++extern void putint(vector<uchar> &p, int n);
++extern int getint(ucharbuf &p);
++extern void putuint(ucharbuf &p, int n);
++extern void putuint(packetbuf &p, int n);
++extern void putuint(vector<uchar> &p, int n);
++extern int getuint(ucharbuf &p);
++extern void putfloat(ucharbuf &p, float f);
++extern void putfloat(packetbuf &p, float f);
++extern void putfloat(vector<uchar> &p, float f);
++extern float getfloat(ucharbuf &p);
++extern void sendstring(const char *t, ucharbuf &p);
++extern void sendstring(const char *t, packetbuf &p);
++extern void sendstring(const char *t, vector<uchar> &p);
++extern void getstring(char *t, ucharbuf &p, int len);
++template<class T, size_t N> static inline void getstring(T (&t)[N], ucharbuf &p) { getstring(t, p, N); }
++extern void filtertext(char *dst, const char *src, bool whitespace = true, int len = sizeof(string)-1);
++
++#endif
++
+--- a/src/engine/master.cpp
++++ b/src/engine/master.cpp
+@@ -514,7 +514,7 @@
+ authreq &a = c.authreqs.add();
+ a.reqtime = servtime;
+ a.id = id;
+- uint seed[3] = { starttime, servtime, randomMT() };
++ uint seed[3] = { uint(starttime), servtime, randomMT() };
+ static vector<char> buf;
+ buf.setsize(0);
+ a.answer = genchallenge(u->pubkey, seed, sizeof(seed), buf);
+--- a/src/shared/tools.cpp
++++ b/src/shared/tools.cpp
+@@ -53,3 +53,124 @@
+ return y;
+ }
+
++///////////////////////// network ///////////////////////
++
++// all network traffic is in 32bit ints, which are then compressed using the following simple scheme (assumes that most values are small).
++
++template<class T>
++static inline void putint_(T &p, int n)
++{
++ if(n<128 && n>-127) p.put(n);
++ else if(n<0x8000 && n>=-0x8000) { p.put(0x80); p.put(n); p.put(n>>8); }
++ else { p.put(0x81); p.put(n); p.put(n>>8); p.put(n>>16); p.put(n>>24); }
++}
++void putint(ucharbuf &p, int n) { putint_(p, n); }
++void putint(packetbuf &p, int n) { putint_(p, n); }
++void putint(vector<uchar> &p, int n) { putint_(p, n); }
++
++int getint(ucharbuf &p)
++{
++ int c = (char)p.get();
++ if(c==-128) { int n = p.get(); n |= char(p.get())<<8; return n; }
++ else if(c==-127) { int n = p.get(); n |= p.get()<<8; n |= p.get()<<16; return n|(p.get()<<24); }
++ else return c;
++}
++
++// much smaller encoding for unsigned integers up to 28 bits, but can handle signed
++template<class T>
++static inline void putuint_(T &p, int n)
++{
++ if(n < 0 || n >= (1<<21))
++ {
++ p.put(0x80 | (n & 0x7F));
++ p.put(0x80 | ((n >> 7) & 0x7F));
++ p.put(0x80 | ((n >> 14) & 0x7F));
++ p.put(n >> 21);
++ }
++ else if(n < (1<<7)) p.put(n);
++ else if(n < (1<<14))
++ {
++ p.put(0x80 | (n & 0x7F));
++ p.put(n >> 7);
++ }
++ else
++ {
++ p.put(0x80 | (n & 0x7F));
++ p.put(0x80 | ((n >> 7) & 0x7F));
++ p.put(n >> 14);
++ }
++}
++void putuint(ucharbuf &p, int n) { putuint_(p, n); }
++void putuint(packetbuf &p, int n) { putuint_(p, n); }
++void putuint(vector<uchar> &p, int n) { putuint_(p, n); }
++
++int getuint(ucharbuf &p)
++{
++ int n = p.get();
++ if(n & 0x80)
++ {
++ n += (p.get() << 7) - 0x80;
++ if(n & (1<<14)) n += (p.get() << 14) - (1<<14);
++ if(n & (1<<21)) n += (p.get() << 21) - (1<<21);
++ if(n & (1<<28)) n |= -1<<28;
++ }
++ return n;
++}
++
++template<class T>
++static inline void putfloat_(T &p, float f)
++{
++ lilswap(&f, 1);
++ p.put((uchar *)&f, sizeof(float));
++}
++void putfloat(ucharbuf &p, float f) { putfloat_(p, f); }
++void putfloat(packetbuf &p, float f) { putfloat_(p, f); }
++void putfloat(vector<uchar> &p, float f) { putfloat_(p, f); }
++
++float getfloat(ucharbuf &p)
++{
++ float f;
++ p.get((uchar *)&f, sizeof(float));
++ return lilswap(f);
++}
++
++template<class T>
++static inline void sendstring_(const char *t, T &p)
++{
++ while(*t) putint(p, *t++);
++ putint(p, 0);
++}
++void sendstring(const char *t, ucharbuf &p) { sendstring_(t, p); }
++void sendstring(const char *t, packetbuf &p) { sendstring_(t, p); }
++void sendstring(const char *t, vector<uchar> &p) { sendstring_(t, p); }
++
++void getstring(char *text, ucharbuf &p, int len)
++{
++ char *t = text;
++ do
++ {
++ if(t>=&text[len]) { text[len-1] = 0; return; }
++ if(!p.remaining()) { *t = 0; return; }
++ *t = getint(p);
++ }
++ while(*t++);
++}
++
++void filtertext(char *dst, const char *src, bool whitespace, int len)
++{
++ for(int c = uchar(*src); c; c = uchar(*++src))
++ {
++ if(c == '\f')
++ {
++ if(!*++src) break;
++ continue;
++ }
++ if(iscubeprint(c) || (iscubespace(c) && whitespace))
++ {
++ *dst++ = c;
++ if(!--len) break;
++ }
++ }
++ *dst = '\0';
++}
++
diff --git a/games-fps/sauerbraten/files/sauerbraten-2013.01.04-system-enet.patch b/games-fps/sauerbraten/files/sauerbraten-2013.01.04-system-enet.patch
new file mode 100644
index 000000000000..e87b280ba0c1
--- /dev/null
+++ b/games-fps/sauerbraten/files/sauerbraten-2013.01.04-system-enet.patch
@@ -0,0 +1,64 @@
+--- sauerbraten/src/Makefile
++++ sauerbraten/src/Makefile
+@@ -4,7 +4,7 @@
+ PLATFORM= $(shell uname -s)
+ PLATFORM_PREFIX= native
+
+-INCLUDES= -Ishared -Iengine -Ifpsgame -Ienet/include
++INCLUDES= -Ishared -Iengine -Ifpsgame
+
+ STRIP=
+ ifeq (,$(findstring -g,$(CXXFLAGS)))
+@@ -36,8 +36,8 @@
+ endif
+ CLIENT_LIBS= -mwindows $(STD_LIBS) -L$(WINBIN) -L$(WINLIB) -lSDL -lSDL_image -lSDL_mixer -lzlib1 -lopengl32 -lenet -lws2_32 -lwinmm
+ else
+-CLIENT_INCLUDES= $(INCLUDES) -I/usr/X11R6/include `sdl-config --cflags`
+-CLIENT_LIBS= -Lenet/.libs -lenet -L/usr/X11R6/lib -lX11 `sdl-config --libs` -lSDL_image -lSDL_mixer -lz -lGL
++CLIENT_INCLUDES= $(INCLUDES) `sdl-config --cflags`
++CLIENT_LIBS= -lenet -lX11 `sdl-config --libs` -lSDL_image -lSDL_mixer -lz -lGL
+ endif
+ ifeq ($(PLATFORM),Linux)
+ CLIENT_LIBS+= -lrt
+@@ -106,7 +106,7 @@
+ MASTER_LIBS= $(STD_LIBS) -L$(WINBIN) -L$(WINLIB) -lzlib1 -lenet -lws2_32 -lwinmm
+ else
+ SERVER_INCLUDES= -DSTANDALONE $(INCLUDES)
+-SERVER_LIBS= -Lenet/.libs -lenet -lz
++SERVER_LIBS= -lenet -lz
+ MASTER_LIBS= $(SERVER_LIBS)
+ endif
+ SERVER_OBJS= \
+@@ -135,15 +135,6 @@
+
+ all: client server
+
+-enet/Makefile:
+- cd enet; ./configure --enable-shared=no --enable-static=yes
+-
+-libenet: enet/Makefile
+- $(MAKE) -C enet/ all
+-
+-clean-enet: enet/Makefile
+- $(MAKE) -C enet/ clean
+-
+ clean:
+ -$(RM) $(CLIENT_PCH) $(CLIENT_OBJS) $(SERVER_OBJS) $(MASTER_OBJS) sauer_client sauer_server sauer_master
+
+@@ -176,13 +167,13 @@
+
+ install: all
+ else
+-client: libenet $(CLIENT_OBJS)
++client: $(CLIENT_OBJS)
+ $(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS)
+
+-server: libenet $(SERVER_OBJS)
++server: $(SERVER_OBJS)
+ $(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS)
+
+-master: libenet $(MASTER_OBJS)
++master: $(MASTER_OBJS)
+ $(CXX) $(CXXFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS)
+
+ shared/cube2font.o: shared/cube2font.c
diff --git a/games-fps/sauerbraten/metadata.xml b/games-fps/sauerbraten/metadata.xml
index d3c2cc926f0b..1071eebc7386 100644
--- a/games-fps/sauerbraten/metadata.xml
+++ b/games-fps/sauerbraten/metadata.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
-<herd>games</herd>
+ <herd>games</herd>
+ <use>
+ <flag name='server'>Compile server support</flag>
+ </use>
</pkgmetadata>
diff --git a/games-fps/sauerbraten/sauerbraten-2013.01.04.ebuild b/games-fps/sauerbraten/sauerbraten-2013.01.04.ebuild
new file mode 100644
index 000000000000..1d8d6e43f9fd
--- /dev/null
+++ b/games-fps/sauerbraten/sauerbraten-2013.01.04.ebuild
@@ -0,0 +1,127 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-fps/sauerbraten/sauerbraten-2013.01.04.ebuild,v 1.1 2013/01/05 18:23:48 hasufell Exp $
+
+EAPI=5
+inherit eutils flag-o-matic gnome2-utils games
+
+EDITION="collect_edition"
+DESCRIPTION="Cube 2: Sauerbraten is an open source game engine (Cube 2) with freeware game data (Sauerbraten)"
+HOMEPAGE="http://sauerbraten.org/"
+SRC_URI="mirror://sourceforge/sauerbraten/sauerbraten/2013_01_04/sauerbraten_${PV//./_}_${EDITION}_linux.tar.bz2"
+
+LICENSE="ZLIB freedist"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug dedicated server"
+
+RDEPEND="
+ sys-libs/zlib
+ >=net-libs/enet-1.3.6:1.3
+ !dedicated? (
+ media-libs/libsdl[X,opengl]
+ media-libs/sdl-mixer[vorbis]
+ media-libs/sdl-image[png,jpeg]
+ virtual/opengl
+ virtual/glu
+ x11-libs/libX11 )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ ecvs_clean
+ rm -rf sauerbraten_unix bin_unix src/{include,lib,vcpp}
+
+ # Patch makefile to use system enet instead of bundled
+ # respect CXXFLAGS, LDFLAGS
+ epatch "${FILESDIR}"/${P}-{system-enet,QA,master}.patch
+
+ # Fix links so they point to the correct directory
+ sed -i \
+ -e 's:docs/::' \
+ README.html \
+ || die
+}
+
+src_compile() {
+ use debug && append-cppflags -D_DEBUG
+ emake -C src master $(usex dedicated "server" "$(usex server "server client" "client")")
+}
+
+src_install() {
+ local LIBEXECDIR="${GAMES_PREFIX}/lib"
+ local DATADIR="${GAMES_DATADIR}/${PN}"
+ local STATEDIR="${GAMES_STATEDIR}/${PN}"
+
+ if ! use dedicated ; then
+ # Install the game data
+ insinto "${DATADIR}"
+ doins -r data packages
+
+ # Install the client executable
+ exeinto "${LIBEXECDIR}"
+ doexe src/sauer_client
+
+ # Install the client wrapper
+ games_make_wrapper "${PN}-client" "${LIBEXECDIR}/sauer_client -q\$HOME/.${PN} -r" "${DATADIR}"
+
+ # Create menu entry
+ newicon -s 256 data/cube.png ${PN}.png
+ make_desktop_entry "${PN}-client" "Cube 2: Sauerbraten"
+ fi
+
+ # Install the server config files
+ insinto "${STATEDIR}"
+ doins "server-init.cfg"
+
+ # Install the server executables
+ exeinto "${LIBEXECDIR}"
+ doexe src/sauer_master
+ use dedicated || use server && doexe src/sauer_server
+
+ games_make_wrapper "${PN}-server" \
+ "${LIBEXECDIR}/sauer_server -k${DATADIR} -q${STATEDIR}"
+ games_make_wrapper "${PN}-master" \
+ "${LIBEXECDIR}/sauer_master ${STATEDIR}"
+
+ # Install the server init script
+ keepdir "${GAMES_STATEDIR}/run/${PN}"
+ cp "${FILESDIR}"/${PN}.init "${T}" || die
+ sed -i \
+ -e "s:%SYSCONFDIR%:${STATEDIR}:g" \
+ -e "s:%LIBEXECDIR%:${LIBEXECDIR}:g" \
+ -e "s:%GAMES_STATEDIR%:${GAMES_STATEDIR}:g" \
+ "${T}"/${PN}.init || die
+ newinitd "${T}"/${PN}.init ${PN}
+ cp "${FILESDIR}"/${PN}.conf "${T}" || die
+ sed -i \
+ -e "s:%SYSCONFDIR%:${STATEDIR}:g" \
+ -e "s:%LIBEXECDIR%:${LIBEXECDIR}:g" \
+ -e "s:%GAMES_USER_DED%:${GAMES_USER_DED}:g" \
+ -e "s:%GAMES_GROUP%:${GAMES_GROUP}:g" \
+ "${T}"/${PN}.conf || die
+ newconfd "${T}"/${PN}.conf ${PN}
+
+ nonfatal dodoc src/*.txt docs/dev/*.txt
+ nonfatal dohtml -r README.html docs/*
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ gnome2_icon_cache_update
+
+ elog "If you plan to use map editor feature copy all map data from ${DATADIR}"
+ elog "to corresponding folder in your HOME/.${PN}"
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}