git: 37eb44cc9bb2 - main - games/yquake2: new port had been added (Yamagi Quake II)

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Fri, 25 Mar 2022 12:46:04 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=37eb44cc9bb29b78ce13879e4f8d673f02524879

commit 37eb44cc9bb29b78ce13879e4f8d673f02524879
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-03-25 12:44:18 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-03-25 12:44:18 +0000

    games/yquake2: new port had been added (Yamagi Quake II)
    
    Yamagi Quake II is advanced port of Icculus Quake II.  It uses SDL2
    and therefore can be run in Wayland without any additional tweaks.
    
    PR:     245770 (modified)
---
 games/Makefile                                    |  1 +
 games/yquake2/Makefile                            | 45 +++++++++++++++++++++++
 games/yquake2/distinfo                            |  3 ++
 games/yquake2/files/patch-Makefile                | 28 ++++++++++++++
 games/yquake2/files/patch-src_client_vid_vid.c    | 17 +++++++++
 games/yquake2/files/patch-src_common_filesystem.c | 12 ++++++
 games/yquake2/pkg-descr                           |  9 +++++
 games/yquake2/pkg-plist                           | 16 ++++++++
 8 files changed, 131 insertions(+)

diff --git a/games/Makefile b/games/Makefile
index cfa10b590d9d..283d72afdfde 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -1157,6 +1157,7 @@
     SUBDIR += xzip
     SUBDIR += yadex
     SUBDIR += yahtzee
+    SUBDIR += yquake2
     SUBDIR += zangband
     SUBDIR += zatacka
     SUBDIR += zaz
diff --git a/games/yquake2/Makefile b/games/yquake2/Makefile
new file mode 100644
index 000000000000..47a627afb692
--- /dev/null
+++ b/games/yquake2/Makefile
@@ -0,0 +1,45 @@
+# Created by: Vasily Postnicov <shamaz.mazum@gmail.com>
+
+PORTNAME=	yquake2
+PORTVERSION=	8.01
+CATEGORIES=	games
+MASTER_SITES=	https://deponie.yamagi.org/quake2/
+DISTNAME=	quake2-${PORTVERSION}
+
+MAINTAINER=	shamaz.mazum@gmail.com
+COMMENT=	Improved version of Icculus Quake II
+
+LICENSE=	GPLv2
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+# Quake II loads optional libraries via dlopen(3)
+BUILD_DEPENDS=	${LOCALBASE}/include/curl/curl.h:ftp/curl
+RUN_DEPENDS=	${LOCALBASE}/lib/libcurl.so:ftp/curl
+
+USES=		gmake openal gl sdl tar:xz
+USE_GL=		gl
+USE_SDL=	sdl2
+MAKE_ARGS=	VERBOSE=1 WITH_SYSTEMWIDE=yes \
+		WITH_SYSTEMDATADIR="${Q2DIR}" \
+		WITH_SYSTEMLIBDIR="${PREFIX}/lib/${PORTNAME}"
+
+OPTIONS_DEFINE=	DOCS
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/release/q2ded \
+		${STAGEDIR}${PREFIX}/bin/yq2ded
+	${INSTALL_PROGRAM} ${WRKSRC}/release/quake2 \
+		${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}/baseq2
+	${INSTALL_LIB} ${WRKSRC}/release/baseq2/game.so \
+		${STAGEDIR}${PREFIX}/lib/${PORTNAME}/baseq2
+	${INSTALL_LIB} ${WRKSRC}/release/ref_*.so \
+		${STAGEDIR}${PREFIX}/lib/${PORTNAME}
+
+post-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/CHANGELOG ${WRKSRC}/doc/*.md \
+		${STAGEDIR}${DOCSDIR}
+
+.include "${.CURDIR}/../quake2-data/Makefile.include"
+.include <bsd.port.mk>
diff --git a/games/yquake2/distinfo b/games/yquake2/distinfo
new file mode 100644
index 000000000000..ee74449e7613
--- /dev/null
+++ b/games/yquake2/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1642841575
+SHA256 (quake2-8.01.tar.xz) = 132889a6976dd7c75bf94a4ca49c76ff09cf843d66541872320d7a02a25a622c
+SIZE (quake2-8.01.tar.xz) = 2109408
diff --git a/games/yquake2/files/patch-Makefile b/games/yquake2/files/patch-Makefile
new file mode 100644
index 000000000000..0d09f6f0be64
--- /dev/null
+++ b/games/yquake2/files/patch-Makefile
@@ -0,0 +1,28 @@
+--- Makefile.orig	2022-01-22 08:51:28 UTC
++++ Makefile
+@@ -251,10 +251,13 @@ endif
+ # Systemwide installation.
+ ifeq ($(WITH_SYSTEMWIDE),yes)
+ override CFLAGS += -DSYSTEMWIDE
+-ifneq ($(WITH_SYSTEMDIR),"")
+-override CFLAGS += -DSYSTEMDIR=\"$(WITH_SYSTEMDIR)\"
++ifneq ($(WITH_SYSTEMDATADIR),"")
++override CFLAGS += -DSYSTEMDATADIR=\"$(WITH_SYSTEMDATADIR)\"
+ endif
++ifneq ($(WITH_SYSTEMLIBDIR),"")
++override CFLAGS += -DSYSTEMLIBDIR=\"$(WITH_SYSTEMLIBDIR)\"
+ endif
++endif
+ 
+ # ----------
+ 
+@@ -405,7 +408,8 @@ config:
+ 	@echo "WITH_OPENAL = $(WITH_OPENAL)"
+ 	@echo "WITH_RPATH = $(WITH_RPATH)"
+ 	@echo "WITH_SYSTEMWIDE = $(WITH_SYSTEMWIDE)"
+-	@echo "WITH_SYSTEMDIR = $(WITH_SYSTEMDIR)"
++	@echo "WITH_SYSTEMDATADIR = $(WITH_SYSTEMDATADIR)"
++	@echo "WITH_SYSTEMLIBDIR = $(WITH_SYSTEMLIBDIR)"
+ 	@echo "============================"
+ 	@echo ""
+ 
diff --git a/games/yquake2/files/patch-src_client_vid_vid.c b/games/yquake2/files/patch-src_client_vid_vid.c
new file mode 100644
index 000000000000..3238c79518d5
--- /dev/null
+++ b/games/yquake2/files/patch-src_client_vid_vid.c
@@ -0,0 +1,17 @@
+--- src/client/vid/vid.c.orig	2022-01-22 08:51:28 UTC
++++ src/client/vid/vid.c
+@@ -318,7 +318,13 @@ const char* lib_ext = "so";
+ static void
+ VID_GetRendererLibPath(const char *renderer, char *path, size_t len)
+ {
+-	snprintf(path, len, "%sref_%s.%s", Sys_GetBinaryDir(), renderer, lib_ext);
++	char *next_path = NULL;
++
++	while ((next_path = FS_GetNextRawPath (next_path)) != NULL) {
++		snprintf(path, len, "%s/ref_%s.%s", next_path, renderer, lib_ext);
++		if (Sys_IsFile(path))
++			break;
++	}
+ }
+ 
+ /*
diff --git a/games/yquake2/files/patch-src_common_filesystem.c b/games/yquake2/files/patch-src_common_filesystem.c
new file mode 100644
index 000000000000..827038394300
--- /dev/null
+++ b/games/yquake2/files/patch-src_common_filesystem.c
@@ -0,0 +1,12 @@
+--- src/common/filesystem.c.orig	2022-01-22 08:51:28 UTC
++++ src/common/filesystem.c
+@@ -2029,7 +2029,8 @@ void FS_BuildRawPath(void) {
+ 	// binary compiled with SYSTEMWIDE (installed from
+ 	// packages), but no systemwide game data.
+ #ifdef SYSTEMWIDE
+-	FS_AddDirToRawPath(SYSTEMDIR, false, false);
++	FS_AddDirToRawPath(SYSTEMDATADIR, false, false);
++	FS_AddDirToRawPath(SYSTEMLIBDIR, false, false);
+ #endif
+ 
+ 	// The CD must be the last directory of the path,
diff --git a/games/yquake2/pkg-descr b/games/yquake2/pkg-descr
new file mode 100644
index 000000000000..5929463f39fe
--- /dev/null
+++ b/games/yquake2/pkg-descr
@@ -0,0 +1,9 @@
+Yamagi Quake II is an enhanced client for id Software's Quake II with
+focus on offline and cooperative gameplay.  Both the gameplay and the
+graphics are unchanged, but many bugs in the last official release were
+fixed and some nice to have features like widescreen support and a modern
+OpenGL 3.2 renderer were added.  Unlike most other Quake II source ports
+Yamagi Quake II is fully 64-bit clean.  It works perfectly on modern
+processors and operating systems.
+
+WWW: https://www.yamagi.org/quake2/
diff --git a/games/yquake2/pkg-plist b/games/yquake2/pkg-plist
new file mode 100644
index 000000000000..fce8f627ae2e
--- /dev/null
+++ b/games/yquake2/pkg-plist
@@ -0,0 +1,16 @@
+bin/yq2ded
+bin/yquake2
+lib/yquake2/baseq2/game.so
+lib/yquake2/ref_gl1.so
+lib/yquake2/ref_gl3.so
+lib/yquake2/ref_soft.so
+%%PORTDOCS%%%%DOCSDIR%%/010_index.md
+%%PORTDOCS%%%%DOCSDIR%%/020_installation.md
+%%PORTDOCS%%%%DOCSDIR%%/030_configuration.md
+%%PORTDOCS%%%%DOCSDIR%%/040_cvarlist.md
+%%PORTDOCS%%%%DOCSDIR%%/050_commands.md
+%%PORTDOCS%%%%DOCSDIR%%/060_multiplayer.md
+%%PORTDOCS%%%%DOCSDIR%%/070_packaging.md
+%%PORTDOCS%%%%DOCSDIR%%/080_contributing.md
+%%PORTDOCS%%%%DOCSDIR%%/090_filelists.md
+%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG