diff options
author | Sam James <sam@gentoo.org> | 2021-04-22 14:52:47 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-04-22 14:53:04 +0000 |
commit | ab219ce2849803591f4ceb79c1e977071cef20f1 (patch) | |
tree | 95df96a861cbd9cf5eb04dee3517015bd896fb7b /games-fps/sauerbraten | |
parent | www-client/opera-beta: bump to 76.0.4017.59 (diff) | |
download | gentoo-ab219ce2849803591f4ceb79c1e977071cef20f1.tar.gz gentoo-ab219ce2849803591f4ceb79c1e977071cef20f1.tar.bz2 gentoo-ab219ce2849803591f4ceb79c1e977071cef20f1.zip |
games-fps/sauerbraten: add 2020.12.27
Closes: https://bugs.gentoo.org/738152
Closes: https://bugs.gentoo.org/706308
Closes: https://bugs.gentoo.org/781863
Closes: https://bugs.gentoo.org/759535
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'games-fps/sauerbraten')
7 files changed, 441 insertions, 8 deletions
diff --git a/games-fps/sauerbraten/Manifest b/games-fps/sauerbraten/Manifest index 85124398a06f..758332c2c9bb 100644 --- a/games-fps/sauerbraten/Manifest +++ b/games-fps/sauerbraten/Manifest @@ -1 +1,2 @@ DIST sauerbraten_2013_02_03_collect_edition_linux.tar.bz2 589941180 BLAKE2B b8a1c929dcf7a32bc289262fffcbcd4e7bbab3a9030c12bce7d086d63aaddee0c573c5d38f9ac845b3080aeac38d1b548aa9d243b462c3c682b158a379fe8cc2 SHA512 7864e346cc2bc86d78973db1b341fd8256cc2e1953be51263ef91a5374f9ec00276ba2940850e6d5bba7a57c71190b670dc7ba97021be2935c31f8694fed4897 +DIST sauerbraten_2020_12_27_linux.tar.bz2 985815649 BLAKE2B 4ec9caf705766aed76153a8631b1990c6432db8c816d579e891263b36adf0e7ed4831d2fee010b7692f6457989c0acea552f72c95e0924e97182d2a03dc947f2 SHA512 60487e0493478b9dd8940a9239834d8f3f6b6ca529f3c5b718f91caf5116073942ca6908d7fff26ab37b7ec590114ab07f24cdcea5c355288d3c2706d626ea28 diff --git a/games-fps/sauerbraten/files/sauerbraten-2020.12.27-respect-FLAGS-don-t-strip-symbols.patch b/games-fps/sauerbraten/files/sauerbraten-2020.12.27-respect-FLAGS-don-t-strip-symbols.patch new file mode 100644 index 000000000000..6d0dc3b1f082 --- /dev/null +++ b/games-fps/sauerbraten/files/sauerbraten-2020.12.27-respect-FLAGS-don-t-strip-symbols.patch @@ -0,0 +1,146 @@ +From: Sam James <sam@gentoo.org> +Date: Thu, 22 Apr 2021 13:47:33 +0000 +Subject: Respect *FLAGS, don't strip symbols + +--- a/src/enet/Makefile ++++ b/src/enet/Makefile +@@ -1,4 +1,3 @@ +-CFLAGS=-O3 -fomit-frame-pointer + override CFLAGS:= $(CFLAGS) -Iinclude $(shell ./check_cflags.sh $(CC) $(CFLAGS)) + + OBJS= \ +--- a/src/rpggame/Makefile ++++ b/src/rpggame/Makefile +@@ -1,4 +1,3 @@ +-CXXFLAGS= -Os + override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti + + PLATFORM= $(shell uname -s) +@@ -7,11 +6,6 @@ PLATFORM_PREFIX= native + INCLUDES= -I../shared -I../engine -I../rpggame -I../enet/include + + STRIP= +-ifeq (,$(findstring -g,$(CXXFLAGS))) +-ifeq (,$(findstring -pg,$(CXXFLAGS))) +- STRIP=strip +-endif +-endif + + MV=mv + +@@ -118,7 +112,7 @@ clean: + $(filter-out shared/%,$(CLIENT_PCH)): $(filter shared/%,$(CLIENT_PCH)) + + %.h.gch: %.h +- $(CXX) $(CXXFLAGS) -x c++-header -o $@.tmp $< ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@.tmp $< + $(MV) $@.tmp $@ + + $(CLIENT_OBJS): CXXFLAGS += $(CLIENT_INCLUDES) +@@ -129,13 +123,13 @@ $(filter ../rpggame/%,$(CLIENT_OBJS)): $(filter ../rpggame/%,$(CLIENT_PCH)) + ifneq (,$(findstring MINGW,$(PLATFORM))) + client: $(CLIENT_OBJS) + $(WINDRES) -I ../vcpp -i ../vcpp/mingw.rc -J rc -o ../vcpp/mingw.res -O coff +- $(CXX) $(CXXFLAGS) -o ../$(WINBIN)/rpg.exe ../vcpp/mingw.res $(CLIENT_OBJS) $(CLIENT_LIBS) ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o ../$(WINBIN)/rpg.exe ../vcpp/mingw.res $(CLIENT_OBJS) $(CLIENT_LIBS) + ifneq (,$(STRIP)) + $(STRIP) ../../bin/rpg.exe + endif + else + client: libenet $(CLIENT_OBJS) +- $(CXX) $(CXXFLAGS) -o rpg_client $(CLIENT_OBJS) $(CLIENT_LIBS) ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o rpg_client $(CLIENT_OBJS) $(CLIENT_LIBS) + endif + + depend: +--- a/src/Makefile ++++ b/src/Makefile +@@ -1,4 +1,3 @@ +-CXXFLAGS= -O3 -fomit-frame-pointer -ffast-math + override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti + + PLATFORM= $(shell uname -s | tr '[:lower:]' '[:upper:]') +@@ -7,12 +6,6 @@ PLATFORM_PREFIX= native + INCLUDES= -Ishared -Iengine -Ifpsgame -Ienet/include + + STRIP= +-ifeq (,$(findstring -g,$(CXXFLAGS))) +-ifeq (,$(findstring -pg,$(CXXFLAGS))) +- STRIP=strip +-endif +-endif +- + MV=mv + + ifneq (,$(findstring MINGW,$(PLATFORM))) +@@ -65,8 +58,8 @@ CLIENT_LIBS= -F../sauerbraten.app/Contents/Frameworks/ -framework SDL2 -framewor + CLIENT_LIBS+= -framework SDL2_mixer -framework CoreAudio -framework AudioToolbox + CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -Lenet -lenet + else +-CLIENT_INCLUDES= $(INCLUDES) -I/usr/X11R6/include `sdl2-config --cflags` +-CLIENT_LIBS= -Lenet -lenet -L/usr/X11R6/lib -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL ++CLIENT_INCLUDES= $(INCLUDES) `sdl2-config --cflags` ++CLIENT_LIBS= -Lenet -lenet -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL + endif + endif + ifeq ($(PLATFORM),LINUX) +@@ -173,11 +166,11 @@ clean: + $(filter-out shared/%,$(CLIENT_PCH)): $(filter shared/%,$(CLIENT_PCH)) + + %.h.gch: %.h +- $(CXX) $(CXXFLAGS) -x c++-header -o $@.tmp $< ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -x c++-header -o $@.tmp $< + $(MV) $@.tmp $@ + + %-standalone.o: %.cpp +- $(CXX) $(CXXFLAGS) -c -o $@ $< ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< + + $(CLIENT_OBJS): CXXFLAGS += $(CLIENT_INCLUDES) + $(filter shared/%,$(CLIENT_OBJS)): $(filter shared/%,$(CLIENT_PCH)) +@@ -188,35 +181,35 @@ $(SERVER_MASTER_OBJS): CXXFLAGS += $(SERVER_INCLUDES) + + ifneq (,$(findstring MINGW,$(PLATFORM))) + client: $(CLIENT_OBJS) +- $(WINDRES) -I vcpp -i vcpp/mingw.rc -J rc -o vcpp/mingw.res -O coff +- $(CXX) $(CXXFLAGS) -o $(WINBIN)/sauerbraten.exe vcpp/mingw.res $(CLIENT_OBJS) $(CLIENT_LIBS) ++ $(WINDRES) -I vcpp -i vcpp/mingw.rc -J rc $(LDFLAGS) -o vcpp/mingw.res $(LDFLAGS) -o coff ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(WINBIN)/sauerbraten.exe vcpp/mingw.res $(CLIENT_OBJS) $(CLIENT_LIBS) + + server: $(SERVER_OBJS) +- $(WINDRES) -I vcpp -i vcpp/mingw.rc -J rc -o vcpp/mingw.res -O coff +- $(CXX) $(CXXFLAGS) -o $(WINBIN)/sauer_server.exe vcpp/mingw.res $(SERVER_OBJS) $(SERVER_LIBS) ++ $(WINDRES) -I vcpp -i vcpp/mingw.rc -J rc $(LDFLAGS) -o vcpp/mingw.res $(LDFLAGS) -o coff ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(WINBIN)/sauer_server.exe vcpp/mingw.res $(SERVER_OBJS) $(SERVER_LIBS) + + master: $(MASTER_OBJS) +- $(CXX) $(CXXFLAGS) -o $(WINBIN)/sauer_master.exe $(MASTER_OBJS) $(MASTER_LIBS) ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(WINBIN)/sauer_master.exe $(MASTER_OBJS) $(MASTER_LIBS) + + install: all + else + client: libenet $(CLIENT_OBJS) +- $(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS) ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS) + ifneq (,$(findstring DARWIN,$(PLATFORM))) + install_name_tool -add_rpath @executable_path/../Frameworks sauer_client + endif + + server: libenet $(SERVER_OBJS) +- $(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS) ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS) + + master: libenet $(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) $(LDFLAGS) -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 + + ifneq (,$(findstring DARWIN,$(PLATFORM))) + install: client diff --git a/games-fps/sauerbraten/files/sauerbraten-2020.12.27-unbundle-enet.patch b/games-fps/sauerbraten/files/sauerbraten-2020.12.27-unbundle-enet.patch new file mode 100644 index 000000000000..ad7494b55385 --- /dev/null +++ b/games-fps/sauerbraten/files/sauerbraten-2020.12.27-unbundle-enet.patch @@ -0,0 +1,113 @@ +From f269af0dc953ee79d95beabd2679e4c91992ac8d Mon Sep 17 00:00:00 2001 +From: Sam James <sam@gentoo.org> +Date: Thu, 22 Apr 2021 14:06:00 +0000 +Subject: [PATCH] Unbundle enet + +--- a/src/Makefile ++++ b/src/Makefile +@@ -4,7 +4,7 @@ override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti + PLATFORM= $(shell uname -s | tr '[:lower:]' '[:upper:]') + PLATFORM_PREFIX= native + +-INCLUDES= -Ishared -Iengine -Ifpsgame -Ienet/include ++INCLUDES= -Ishared -Iengine -Ifpsgame + + STRIP= + MV=mv +@@ -57,10 +57,10 @@ override CXX+= -arch x86_64 -mmacosx-version-min=$(OSXMIN) + CLIENT_INCLUDES= $(INCLUDES) -Iinclude + CLIENT_LIBS= -F../sauerbraten.app/Contents/Frameworks/ -framework SDL2 -framework SDL2_image + CLIENT_LIBS+= -framework SDL2_mixer -framework CoreAudio -framework AudioToolbox +-CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -Lenet -lenet ++CLIENT_LIBS+= -framework AudioUnit -framework OpenGL -framework Cocoa -lz -lenet + else +-CLIENT_INCLUDES= $(INCLUDES) `sdl2-config --cflags` +-CLIENT_LIBS= -Lenet -lenet -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL ++CLIENT_INCLUDES= $(INCLUDES) `sdl2-config --cflags` ++CLIENT_LIBS= -lenet -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL + endif + endif + ifeq ($(PLATFORM),LINUX) +@@ -135,7 +135,7 @@ SERVER_LIBS= -mwindows $(STD_LIBS) -L$(WINBIN) -L$(WINLIB) -lzlib1 -lenet -lws2_ + MASTER_LIBS= $(STD_LIBS) -L$(WINBIN) -L$(WINLIB) -lzlib1 -lenet -lws2_32 -lwinmm + else + SERVER_INCLUDES= -DSTANDALONE $(INCLUDES) +-SERVER_LIBS= -Lenet -lenet -lz ++SERVER_LIBS= -lenet -lz + MASTER_LIBS= $(SERVER_LIBS) + endif + SERVER_OBJS= \ +@@ -226,10 +226,6 @@ endif + endif + endif + +-enet/libenet.a: +- $(MAKE) -C enet CC='$(CC)' AR='$(AR)' +-libenet: enet/libenet.a +- + depend: + makedepend -Y -Ishared -Iengine -Ifpsgame $(CLIENT_OBJS:.o=.cpp) + makedepend -a -o.h.gch -Y -Ishared -Iengine -Ifpsgame $(CLIENT_PCH:.h.gch=.h) + +--- a/src/Makefile ++++ b/src/Makefile +@@ -193,16 +193,16 @@ master: $(MASTER_OBJS) + + install: all + else +-client: libenet $(CLIENT_OBJS) ++client: $(CLIENT_OBJS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS) + ifneq (,$(findstring DARWIN,$(PLATFORM))) + install_name_tool -add_rpath @executable_path/../Frameworks sauer_client + endif + +-server: libenet $(SERVER_OBJS) ++server: $(SERVER_OBJS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS) + +-master: libenet $(MASTER_OBJS) ++master: $(MASTER_OBJS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS) + + shared/cube2font.o: shared/cube2font.c +--- a/src/rpggame/Makefile ++++ b/src/rpggame/Makefile +@@ -3,7 +3,7 @@ override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti + PLATFORM= $(shell uname -s) + PLATFORM_PREFIX= native + +-INCLUDES= -I../shared -I../engine -I../rpggame -I../enet/include ++INCLUDES= -I../shared -I../engine -I../rpggame + + STRIP= + +@@ -41,7 +41,7 @@ STD_LIBS= -static-libgcc -static-libstdc++ + CLIENT_LIBS= -mwindows $(STD_LIBS) -L../$(WINBIN) -L../$(WINLIB) -lSDL2 -lSDL2_image -lSDL2_mixer -lzlib1 -lopengl32 -lenet -lws2_32 -lwinmm + else + CLIENT_INCLUDES= $(INCLUDES) -I/usr/X11R6/include `sdl2-config --cflags` +-CLIENT_LIBS= -L../enet -lenet -L/usr/X11R6/lib -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL ++CLIENT_LIBS= -lenet -L/usr/X11R6/lib -lX11 `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lz -lGL + endif + ifeq ($(PLATFORM),Linux) + CLIENT_LIBS+= -lrt +@@ -102,10 +102,6 @@ default: all + + all: client + +-enet/libenet.a: +- $(MAKE) -C ../enet/ +-libenet: enet/libenet.a +- + clean: + -$(RM) $(CLIENT_PCH) $(CLIENT_OBJS) rpg_client + +@@ -128,7 +124,7 @@ ifneq (,$(STRIP)) + $(STRIP) ../../bin/rpg.exe + endif + else +-client: libenet $(CLIENT_OBJS) ++client: $(CLIENT_OBJS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o rpg_client $(CLIENT_OBJS) $(CLIENT_LIBS) + endif + diff --git a/games-fps/sauerbraten/files/sauerbraten-2020.12.27-use-pkg-config-for-freetype2.patch b/games-fps/sauerbraten/files/sauerbraten-2020.12.27-use-pkg-config-for-freetype2.patch new file mode 100644 index 000000000000..ae4a43b43f98 --- /dev/null +++ b/games-fps/sauerbraten/files/sauerbraten-2020.12.27-use-pkg-config-for-freetype2.patch @@ -0,0 +1,28 @@ +From: Sam James <sam@gentoo.org> +Date: Thu, 22 Apr 2021 14:33:15 +0000 +Subject: [PATCH] Use pkg-config for freetype2 + +--- a/src/Makefile ++++ b/src/Makefile +@@ -1,5 +1,7 @@ + override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti + ++PKG_CONFIG?=pkg-config ++ + PLATFORM= $(shell uname -s | tr '[:lower:]' '[:upper:]') + PLATFORM_PREFIX= native + +@@ -206,10 +208,10 @@ master: libenet $(MASTER_OBJS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS) + + shared/cube2font.o: shared/cube2font.c +- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c -o $@ $< `freetype-config --cflags` ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -c -o $@ $< `${PKG_CONFIG} --cflags freetype2` + + cube2font: shared/cube2font.o +- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o cube2font shared/cube2font.o `freetype-config --libs` -lz ++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o cube2font shared/cube2font.o `${PKG_CONFIG} --libs freetype2` -lz + + ifneq (,$(findstring DARWIN,$(PLATFORM))) + install: client +-- diff --git a/games-fps/sauerbraten/files/sauerbraten.conf b/games-fps/sauerbraten/files/sauerbraten.conf index 8d93bf62b788..f0c2896b2bea 100644 --- a/games-fps/sauerbraten/files/sauerbraten.conf +++ b/games-fps/sauerbraten/files/sauerbraten.conf @@ -1,15 +1,15 @@ # Config file for /etc/init.d/sauerbraten # Owner of Sauerbraten server processes (must be existing) -USER="%GAMES_USER_DED%" -GROUP="%GAMES_GROUP%" +USER="sauerbraten" +GROUP="sauerbraten" # Whether to run the dedicated server RUNSERVER="Yes" # Location of the dedicated server config directory -SERVERCONFIG="%SYSCONFDIR%" +SERVERCONFIG="/var/lib/sauerbraten" # Additional command line arguments to the dedicated server SERVERARGS="" @@ -19,7 +19,7 @@ SERVERARGS="" RUNMASTER="No" # Location of the master server config directory -MASTERCONFIG="%SYSCONFDIR%" +MASTERCONFIG="/var/lib/sauerbraten" # What port should the masterserver use MASTERPORT="28787" diff --git a/games-fps/sauerbraten/files/sauerbraten.init b/games-fps/sauerbraten/files/sauerbraten.init index a5a7bb32966d..14248bc88959 100644 --- a/games-fps/sauerbraten/files/sauerbraten.init +++ b/games-fps/sauerbraten/files/sauerbraten.init @@ -24,7 +24,7 @@ start_server() { start-stop-daemon \ --quiet --start --user ${USER}:${GROUP} --chdir ${SERVERCONFIG} \ - --make-pidfile --pidfile %GAMES_STATEDIR%/run/sauerbraten/server.pid \ + --make-pidfile --pidfile /var/run/sauerbraten/server.pid \ --background --exec %LIBEXECDIR%/sauer_server -- ${SERVERARGS} eend $? } @@ -45,7 +45,7 @@ start_master() { start-stop-daemon \ --quiet --start --user ${USER}:${GROUP} \ - --make-pidfile --pidfile %GAMES_STATEDIR%/run/sauerbraten/master.pid \ + --make-pidfile --pidfile /var/run/sauerbraten/master.pid \ --background --exec %LIBEXECDIR%/sauer_master -- ${MASTERARGS} eend $? } @@ -58,13 +58,13 @@ stop() { stop_server() { ebegin "Stopping Sauerbraten dedicated server" - start-stop-daemon --stop --retry 3 --pidfile %GAMES_STATEDIR%/run/sauerbraten/server.pid + start-stop-daemon --stop --retry 3 --pidfile /var/run/sauerbraten/server.pid eend $? } stop_master() { ebegin "Stopping Sauerbraten master server" - start-stop-daemon --stop --retry 3 --pidfile %GAMES_STATEDIR%/run/sauerbraten/master.pid + start-stop-daemon --stop --retry 3 --pidfile /var/run/sauerbraten/master.pid eend $? } diff --git a/games-fps/sauerbraten/sauerbraten-2020.12.27.ebuild b/games-fps/sauerbraten/sauerbraten-2020.12.27.ebuild new file mode 100644 index 000000000000..46c1e22b18ee --- /dev/null +++ b/games-fps/sauerbraten/sauerbraten-2020.12.27.ebuild @@ -0,0 +1,145 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit desktop flag-o-matic gnome2-utils toolchain-funcs wrapper + +DESCRIPTION="Sauerbraten is a FOSS game engine (Cube 2) with freeware game data (Sauerbraten)" +HOMEPAGE="http://sauerbraten.org/" +SRC_URI="mirror://sourceforge/sauerbraten/sauerbraten/2020_11_29/sauerbraten_${PV//./_}_linux.tar.bz2" +S="${WORKDIR}"/${PN} + +LICENSE="ZLIB freedist" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="debug dedicated server" + +DEPEND=" + >=net-libs/enet-1.3.6:1.3 + sys-libs/zlib + !dedicated? ( + media-libs/libsdl2[X,opengl] + media-libs/sdl2-image + media-libs/sdl2-mixer + virtual/opengl + virtual/glu + x11-libs/libX11 + ) +" +RDEPEND=" + ${DEPEND} + acct-group/sauerbraten + dedicated? ( acct-user/sauerbraten ) +" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + # Respect CXXFLAGS, LDFLAGS + "${FILESDIR}"/${PN}-2020.12.27-respect-FLAGS-don-t-strip-symbols.patch + + # Patch Makefile to use system enet instead of bundled + "${FILESDIR}"/${PN}-2020.12.27-unbundle-enet.patch + + # Don't use freetype-config, it's obsolete + "${FILESDIR}"/${PN}-2020.12.27-use-pkg-config-for-freetype2.patch +) + +src_prepare() { + rm -rf sauerbraten_unix bin_unix src/{include,lib,vcpp} || die + + default + + # Fix links so they point to the correct directory + sed -i -e 's:docs/::' README.html || die +} + +src_compile() { + tc-export CXX PKG_CONFIG + + if use debug ; then + append-cppflags -D_DEBUG + fi + + emake -C src \ + master \ + $(usex dedicated "server" "$(usex server "server client" "client")") +} + +src_install() { + local LIBEXECDIR="/usr/lib" + local DATADIR="/usr/share/${PN}" + local STATEDIR="/var/lib/${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 + 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 + + if use dedicated || use server ; then + doexe src/sauer_server + fi + + make_wrapper "${PN}-server" \ + "${LIBEXECDIR}/sauer_server -k${DATADIR} -q${STATEDIR}" + make_wrapper "${PN}-master" \ + "${LIBEXECDIR}/sauer_master ${STATEDIR}" + + # Install the server init script + cp "${FILESDIR}"/${PN}.init "${T}" || die + sed -i \ + -e "s:%SYSCONFDIR%:${STATEDIR}:g" \ + -e "s:%LIBEXECDIR%:${LIBEXECDIR}:g" \ + -e "s:%/var/lib/%:/var/run: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%:sauerbraten:g" \ + -e "s:%GAMES_GROUP%:sauerbraten:g" \ + "${T}"/${PN}.conf || die + newconfd "${T}"/${PN}.conf ${PN} + + dodoc src/*.txt docs/dev/*.txt + + docinto html + dodoc -r README.html docs/* +} + +pkg_preinst() { + gnome2_icon_savelist +} + +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 +} |