[teeworlds] Update to 0.6.2; Drop needed patches and fix patches for new version; Add systemd daemon with exampl

Igor Gnatenko ignatenkobrain at fedoraproject.org
Tue Jul 2 15:52:21 UTC 2013


commit 1549029a3f7ca4ca3098343cc32aff08cd0f5a15
Author: Igor Gnatenko <i.gnatenko.brain at gmail.com>
Date:   Tue Jul 2 19:47:57 2013 +0400

    Update to 0.6.2; Drop needed patches and fix patches for new version; Add systemd daemon with example server cfg; Some fixes in spec

 .gitignore                             |    1 +
 server.cfg                             |   16 +++
 sources                                |    2 +-
 teeworlds-0.6.2-extlibs-optflags.patch |  176 ++++++++++++++++++++++++++++++++
 teeworlds-server.service               |   11 ++
 teeworlds.spec                         |  136 ++++++++++++++----------
 6 files changed, 284 insertions(+), 58 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 887197b..3638f4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 teeworlds-0.5.2-src.tar.gz
 /teeworlds-0.6.0-src.tar.gz
 /teeworlds-0.6.1-source.tar.gz
+/teeworlds-0.6.2-source.tar.gz
diff --git a/server.cfg b/server.cfg
new file mode 100644
index 0000000..1f166e3
--- /dev/null
+++ b/server.cfg
@@ -0,0 +1,16 @@
+# More info: https://www.teeworlds.com/?page=docs&wiki=ServerSettings
+sv_name                unnamed server # Name of the server
+sv_bindaddr            * # Address to bind
+sv_port                8303 # Port the server will listen on
+sv_external_port       0 # Port to report to the master servers (e.g. in case of a firewall rename)
+sv_max_clients         12 # Number of clients that can be connected to the server at the same time
+sv_max_clients_per_ip  2 # Number of clients with the same ip that can be connected to the server at the same time
+sv_high_bandwidth      0 # Use high bandwidth mode, for LAN servers only
+sv_register            1 # Register on the master servers
+sv_map                 dm1 # Map to use
+#sv_rcon_password        # Password to access the remote console (if not set, rcon is disabled)
+#password                # Password to connect to the server
+#logfile                 # Path to a logfile
+#console_output_level    # Adjust the amount of messages in the console
+sv_rcon_max_tries      3 # Maximum number of tries for remote console authetication
+sv_rcon_bantime        5 # Time (in minutes) a client gets banned if remote console authentication fails (0 makes it just use kick)
diff --git a/sources b/sources
index b25d513..c8bab30 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-00de7195ecd1f23596dc3237341af512  teeworlds-0.6.1-source.tar.gz
+649f6c05a7b117096b238c07062edc39  teeworlds-0.6.2-source.tar.gz
diff --git a/teeworlds-0.6.2-extlibs-optflags.patch b/teeworlds-0.6.2-extlibs-optflags.patch
new file mode 100644
index 0000000..f940169
--- /dev/null
+++ b/teeworlds-0.6.2-extlibs-optflags.patch
@@ -0,0 +1,176 @@
+diff -uNr teeworlds-0.6.2-source.orig/bam.lua teeworlds-0.6.2-source/bam.lua
+--- teeworlds-0.6.2-source.orig/bam.lua	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/bam.lua	2013-07-02 18:08:17.477703604 +0400
+@@ -11,6 +11,8 @@
+ config:Add(OptTestCompileC("minmacosxsdk", "int main(){return 0;}", "-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk"))
+ config:Add(OptTestCompileC("macosxppc", "int main(){return 0;}", "-arch ppc"))
+ config:Add(OptLibrary("zlib", "zlib.h", false))
++config:Add(OptLibrary("wavpack", "wavpack/wavpack.h", false))
++config:Add(OptLibrary("pnglite", "sys/types.h", false))
+ config:Add(SDL.OptFind("sdl", true))
+ config:Add(FreeType.OptFind("freetype", true))
+ config:Finalize("config.lua")
+@@ -142,6 +144,13 @@
+ 	
+ 	--settings.objdir = Path("objs")
+ 	settings.cc.Output = Intermediate_Output
++	settings.cc.flags:Add(os.getenv ('CFLAGS'))
++	settings.cc.flags:Add(os.getenv ('CPPFLAGS'))
++	settings.cc.flags:Add(os.getenv ('LDFLAGS'))
++	settings.link.libs:Add("wavpack")
++	settings.link.libs:Add("z")
++	settings.link.libs:Add("pnglite")
++	--settings.link.flags:Add('-lpng12')
+ 
+ 	if config.compiler.driver == "cl" then
+ 		settings.cc.flags:Add("/wd4244")
+@@ -186,22 +195,6 @@
+ 		settings.link.libs:Add("shell32")
+ 	end
+ 
+-	-- compile zlib if needed
+-	if config.zlib.value == 1 then
+-		settings.link.libs:Add("z")
+-		if config.zlib.include_path then
+-			settings.cc.includes:Add(config.zlib.include_path)
+-		end
+-		zlib = {}
+-	else
+-		zlib = Compile(settings, Collect("src/engine/external/zlib/*.c"))
+-		settings.cc.includes:Add("src/engine/external/zlib")
+-	end
+-
+-	-- build the small libraries
+-	wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
+-	pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
+-
+ 	-- build game components
+ 	engine_settings = settings:Copy()
+ 	server_settings = engine_settings:Copy()
+diff -uNr teeworlds-0.6.2-source.orig/src/engine/client/graphics.cpp teeworlds-0.6.2-source/src/engine/client/graphics.cpp
+--- teeworlds-0.6.2-source.orig/src/engine/client/graphics.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/engine/client/graphics.cpp	2013-07-02 18:59:48.228212271 +0400
+@@ -9,7 +9,7 @@
+ #include "SDL_opengl.h"
+ 
+ #include <base/system.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <pnglite.h>
+ 
+ #include <engine/shared/config.h>
+ #include <engine/graphics.h>
+diff -uNr teeworlds-0.6.2-source.orig/src/engine/client/graphics_threaded.cpp teeworlds-0.6.2-source/src/engine/client/graphics_threaded.cpp
+--- teeworlds-0.6.2-source.orig/src/engine/client/graphics_threaded.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/engine/client/graphics_threaded.cpp	2013-07-02 18:10:13.657098950 +0400
+@@ -6,7 +6,10 @@
+ #include <base/tl/threading.h>
+ 
+ #include <base/system.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <sys/types.h>
++#include <string.h>
++#include <stdio.h>
++#include <pnglite.h>
+ 
+ #include <engine/shared/config.h>
+ #include <engine/graphics.h>
+diff -uNr teeworlds-0.6.2-source.orig/src/engine/client/sound.cpp teeworlds-0.6.2-source/src/engine/client/sound.cpp
+--- teeworlds-0.6.2-source.orig/src/engine/client/sound.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/engine/client/sound.cpp	2013-07-02 18:11:42.810402161 +0400
+@@ -13,7 +13,7 @@
+ #include "sound.h"
+ 
+ extern "C" { // wavpack
+-	#include <engine/external/wavpack/wavpack.h>
++	#include <wavpack/wavpack.h>
+ }
+ #include <math.h>
+ 
+@@ -338,6 +338,7 @@
+ 	CSample *pSample;
+ 	int SampleID = -1;
+ 	char aError[100];
++	char completefilename[102400] = "";
+ 	WavpackContext *pContext;
+ 
+ 	// don't waste memory on sound when we are stress testing
+@@ -351,7 +352,9 @@
+ 	if(!m_pStorage)
+ 		return -1;
+ 
+-	ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
++        strncat(completefilename, "/usr/share/teeworlds/data/", 50);
++        strncat(completefilename, pFilename, strlen(pFilename));
++        ms_File = m_pStorage->OpenFile(completefilename, IOFLAG_READ, IStorage::TYPE_ALL);
+ 	if(!ms_File)
+ 	{
+ 		dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
+@@ -363,7 +366,7 @@
+ 		return -1;
+ 	pSample = &m_aSamples[SampleID];
+ 
+-	pContext = WavpackOpenFileInput(ReadData, aError);
++	pContext = WavpackOpenFileInput(completefilename, aError, 0, 0);
+ 	if (pContext)
+ 	{
+ 		int m_aSamples = WavpackGetNumSamples(pContext);
+diff -uNr teeworlds-0.6.2-source.orig/src/tools/dilate.cpp teeworlds-0.6.2-source/src/tools/dilate.cpp
+--- teeworlds-0.6.2-source.orig/src/tools/dilate.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/tools/dilate.cpp	2013-07-02 19:22:12.749938964 +0400
+@@ -2,7 +2,7 @@
+ /* If you are missing that file, acquire a complete release at teeworlds.com.                */
+ #include <base/system.h>
+ #include <base/math.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <pnglite.h>
+ 
+ typedef struct
+ {
+diff -uNr teeworlds-0.6.2-source.orig/src/tools/tileset_borderadd.cpp teeworlds-0.6.2-source/src/tools/tileset_borderadd.cpp
+--- teeworlds-0.6.2-source.orig/src/tools/tileset_borderadd.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/tools/tileset_borderadd.cpp	2013-07-02 19:07:14.750771008 +0400
+@@ -2,7 +2,7 @@
+ /* If you are missing that file, acquire a complete release at teeworlds.com.                */
+ #include <base/math.h>
+ #include <base/system.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <pnglite.h>
+ 
+ typedef struct
+ {
+diff -uNr teeworlds-0.6.2-source.orig/src/tools/tileset_borderfix.cpp teeworlds-0.6.2-source/src/tools/tileset_borderfix.cpp
+--- teeworlds-0.6.2-source.orig/src/tools/tileset_borderfix.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/tools/tileset_borderfix.cpp	2013-07-02 19:17:57.887034675 +0400
+@@ -1,7 +1,7 @@
+ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
+ /* If you are missing that file, acquire a complete release at teeworlds.com.                */
+ #include <base/system.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <pnglite.h>
+ 
+ typedef struct
+ {
+diff -uNr teeworlds-0.6.2-source.orig/src/tools/tileset_borderrem.cpp teeworlds-0.6.2-source/src/tools/tileset_borderrem.cpp
+--- teeworlds-0.6.2-source.orig/src/tools/tileset_borderrem.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/tools/tileset_borderrem.cpp	2013-07-02 18:59:50.619220642 +0400
+@@ -2,7 +2,7 @@
+ /* If you are missing that file, acquire a complete release at teeworlds.com.                */
+ #include <base/math.h>
+ #include <base/system.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <pnglite.h>
+ 
+ typedef struct
+ {
+diff -uNr teeworlds-0.6.2-source.orig/src/tools/tileset_borderset.cpp teeworlds-0.6.2-source/src/tools/tileset_borderset.cpp
+--- teeworlds-0.6.2-source.orig/src/tools/tileset_borderset.cpp	2013-05-01 15:47:39.000000000 +0400
++++ teeworlds-0.6.2-source/src/tools/tileset_borderset.cpp	2013-07-02 19:03:44.194037097 +0400
+@@ -2,7 +2,7 @@
+ /* If you are missing that file, acquire a complete release at teeworlds.com.                */
+ #include <base/math.h>
+ #include <base/system.h>
+-#include <engine/external/pnglite/pnglite.h>
++#include <pnglite.h>
+ 
+ typedef struct
+ {
diff --git a/teeworlds-server.service b/teeworlds-server.service
new file mode 100644
index 0000000..8e5cb48
--- /dev/null
+++ b/teeworlds-server.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Teeworlds Server
+After=syslog.target network.target
+
+[Service]
+User=teeworlds
+WorkingDirectory=/etc/teeworlds/
+ExecStart=/usr/bin/teeworlds-srv -f server.cfg
+
+[Install]
+WantedBy=multi-user.target
diff --git a/teeworlds.spec b/teeworlds.spec
index 4657162..7ac682e 100644
--- a/teeworlds.spec
+++ b/teeworlds.spec
@@ -1,66 +1,73 @@
-%define _hardened_build 1
-Name:           teeworlds
-Version:        0.6.1
-Release:        6%{?dist}
-Summary:        Online multi-player platform 2D shooter
-
-Group:          Amusements/Games
-License:        Teeworlds
-URL:            http://www.teeworlds.com/
-Source0:        http://www.teeworlds.com/files/%{name}-%{version}-source.tar.gz
-Source1:        %{name}.png
-Source2:        %{name}.desktop
-Patch1:         %{name}-0.6.1-extlibs.patch
-#Patch2:         %{name}-0.6.0-optflags.patch
-Patch3:	        %{name}-0.6.0-cstddef.patch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
-BuildRequires:  mesa-libGLU-devel
-BuildRequires:  bam >= 0.4.0
-BuildRequires:  python-devel
-BuildRequires:  alsa-lib-devel
-BuildRequires:  desktop-file-utils
-BuildRequires:  zlib-devel
-BuildRequires:  wavpack-devel
-BuildRequires:  pnglite-devel
-BuildRequires:  SDL-devel
-BuildRequires:	libpng-devel
-BuildRequires:	freetype-devel
-Requires:       %{name}-data
-
+%global _hardened_build 1
+Name:             teeworlds
+Version:          0.6.2
+Release:          1%{?dist}
+Summary:          Online multi-player platform 2D shooter
+
+Group:            Amusements/Games
+License:          Teeworlds
+URL:              http://www.teeworlds.com/
+Source0:          http://www.teeworlds.com/files/%{name}-%{version}-source.tar.gz
+Source1:          %{name}.png
+Source2:          %{name}.desktop
+# systemd unit definition
+Source3:          %{name}-server.service
+# example config file for server
+Source4:          server.cfg
+Patch0:           %{name}-0.6.2-extlibs-optflags.patch
+BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires:    mesa-libGLU-devel
+BuildRequires:    bam >= 0.4.0
+BuildRequires:    python-devel
+BuildRequires:    alsa-lib-devel
+BuildRequires:    desktop-file-utils
+BuildRequires:    zlib-devel
+BuildRequires:    wavpack-devel
+BuildRequires:    pnglite-devel
+BuildRequires:    SDL-devel
+BuildRequires:    libpng-devel
+BuildRequires:    freetype-devel
+Requires:         %{name}-data
 
 %description
 The game features cartoon-themed graphics and physics, 
 and relies heavily on classic shooter weaponry and gameplay. 
 The controls are heavily inspired by the FPS genre of computer games. 
 
+%package          server
+Summary:          Server for %{name}
+Group:            Amusements/Games
+Requires:         %{name}-data
+Requires(pre):    shadow-utils
+Requires(post):   systemd-units
+Requires(preun):  systemd-units
+Requires(postun): systemd-units
+BuildRequires:    systemd-units
 
-%package        server
-Summary:        Server for %{name}
-Group:          Amusements/Games
-Requires:       %{name}-data
-
-
-%description    server
-Data for %{name}, an online multi-player platform 2D shooter. 
-
+%description      server
+Server for %{name}, an online multi-player platform 2D shooter. 
 
-%package        data
-Summary:        Data-files for %{name}
-Group:          Amusements/Games
+%package          data
+Summary:          Data-files for %{name}
+Group:            Amusements/Games
 
-
-%description    data
+%description      data
 Data-files for %{name}, an online multi-player platform 2D shooter.
 
+%pre server
+getent group teeworlds >/dev/null || groupadd -f -r teeworlds
+if ! getent passwd teeworlds >/dev/null ; then
+      useradd -r -g teeworlds -d %{_sysconfdir}/%{name} -s /sbin/nologin \
+              -c "%{name} server daemon account" teeworlds
+fi
+exit 0
 
 %prep
-%setup -q -n %{name}-b177-r50edfd37-source
+%setup -q -n %{name}-%{version}-source
 rm -rf src/engine/external
 
-%patch1 -p1
-#%patch2 -p1
-%patch3 -p1
+%patch0 -p1
 
 #for f in ./readme.txt ./src/game/editor/array.hpp
 #do
@@ -69,15 +76,13 @@ rm -rf src/engine/external
 #  mv $f.utf8 $f
 #done
 
-
 %build
 CFLAGS="%{optflags}" bam -v release
 
-
 %install
-rm -rf %{buildroot}
-mkdir -p %{buildroot}%{_datadir}/%{name}/data
-mkdir -p %{buildroot}%{_datadir}/pixmaps
+rm -rf %{buildroot}/
+mkdir -p %{buildroot}%{_datadir}/%{name}/data/
+mkdir -p %{buildroot}%{_datadir}/pixmaps/
 
 install -D -m 0755 %{name} \
         %{buildroot}%{_bindir}/%{name}
@@ -91,7 +96,6 @@ cp -pr data/* \
 install -p -m 0644 %{SOURCE1} \
         %{buildroot}%{_datadir}/pixmaps/%{name}.png
 
-
 desktop-file-install \
                      %if 0%{?rhel}
                      --vendor="" \
@@ -99,11 +103,23 @@ desktop-file-install \
                      --dir=$RPM_BUILD_ROOT%{_datadir}/applications \
                      %{SOURCE2}
 
+mkdir -p %{buildroot}%{_unitdir}/
+install -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}-server.service
+mkdir -p %{buildroot}%{_sysconfdir}/%{name}/
+install -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/%{name}/example.cfg
+
+%post server
+%systemd_post %{name}-server.service
+
+%preun server
+%systemd_preun %{name}-server.service
+
+%postun server
+%systemd_postun_with_restart %{name}-server.service 
 
 %clean
 rm -rf %{buildroot}
 
-
 %files
 %defattr(-,root,root,-)
 %doc readme.txt license.txt
@@ -111,19 +127,25 @@ rm -rf %{buildroot}
 %{_datadir}/pixmaps/%{name}.png
 %{_datadir}/applications/%{name}.desktop
 
-
 %files data
 %defattr(-,root,root,-)
 %{_datadir}/%{name}/
 
-
 %files server
 %defattr(-,root,root,-)
 %doc readme.txt license.txt
 %{_bindir}/%{name}-srv
+%{_unitdir}/%{name}-server.service
+%attr(-,teeworlds, teeworlds)%{_sysconfdir}/%{name}/
 
 
 %changelog
+* Tue Jul  2 2013 Igor Gnatenko <i.gnatenko.brain at gmail.com> - 0.6.2-1
+- Update to 0.6.2
+- Drop needed patches and fix patches for new version
+- Add systemd daemon with example server cfg
+- Some fixes in spec
+
 * Fri Feb 15 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.1-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
 


More information about the scm-commits mailing list