git: 443dd2c414f2 - main - games/SRB2: version 2.2.13 update request

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Sun, 18 Aug 2024 17:38:29 UTC
The branch main has been updated by fernape:

URL: https://cgit.FreeBSD.org/ports/commit/?id=443dd2c414f2d78c621ad6ded53f608cf87b9419

commit 443dd2c414f2d78c621ad6ded53f608cf87b9419
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2024-06-09 16:22:04 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2024-08-18 17:38:02 +0000

    games/SRB2: version 2.2.13 update request
    
    ChangeLog: https://github.com/STJr/SRB2/releases/tag/SRB2_release_2.2.13
    
    PR:             264260
    Reported by:    slava@planetslav.ca
    
    Several improvements
    
     * Fix assets version
     * Configure with system libraries (avoid CPM)
---
 games/SRB2/Makefile                              | 27 +++++++++-----
 games/SRB2/distinfo                              | 10 +++---
 games/SRB2/files/patch-CMakeLists.txt            | 45 ++++++++++++++++++++++++
 games/SRB2/files/patch-assets_CMakeLists.txt     | 14 ++++++++
 games/SRB2/files/patch-thirdparty_CMakeLists.txt | 10 ++++++
 games/SRB2/pkg-plist                             |  3 +-
 6 files changed, 94 insertions(+), 15 deletions(-)

diff --git a/games/SRB2/Makefile b/games/SRB2/Makefile
index 553ed6daf616..8bff37a52198 100644
--- a/games/SRB2/Makefile
+++ b/games/SRB2/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	SRB2
-PORTVERSION=	2.2.9
+PORTVERSION=	2.2.13
 DISTVERSIONPREFIX=	SRB2_release_
-PORTREVISION=	1
 CATEGORIES=	games
 MASTER_SITES=	https://github.com/STJr/SRB2/releases/download/SRB2_release_${PORTVERSION}/:assets
 DISTFILES+=	SRB2-v${PORTVERSION:C/\.//g}-Full.zip:assets
@@ -19,7 +18,12 @@ LIB_DEPENDS=	libcurl.so:ftp/curl \
 		libopenmpt.so:audio/libopenmpt \
 		libpng.so:graphics/png
 
-USES=		cmake sdl
+USES=		cmake localbase:ldflags sdl
+CMAKE_ARGS+=	-DSRB2_CONFIG_ASSET_DIRECTORY=${WRKSRC}/assets/installer/ \
+		-DSRB2_SDL2_EXE_NAME=${EXE_NAME}
+
+CMAKE_ON=	SRB2_CONFIG_SYSTEM_LIBRARIES
+CMAKE_OFF=	SRB2_CONFIG_ENABLE_TESTS
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	STJr
@@ -29,20 +33,25 @@ USE_SDL=	mixer2 sdl2
 CXXFLAGS+=	-DDEFAULTWADLOCATION5=${DATADIR}
 LDFLAGS+=	-lexecinfo -lm
 
+EXE_NAME=	srb2
+
 post-extract:
 	@${MKDIR} ${WRKSRC}/assets/installer
-	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v229-Full.zip srb2.pk3
-	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v229-Full.zip player.dta
-	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v229-Full.zip zones.pk3
-	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v229-Full.zip patch.pk3
+	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v${PORTVERSION:S/.//g}-Full.zip srb2.pk3
+	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v${PORTVERSION:S/.//g}-Full.zip models.dat
+	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v${PORTVERSION:S/.//g}-Full.zip music.dta
+	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v${PORTVERSION:S/.//g}-Full.zip player.dta
+	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v${PORTVERSION:S/.//g}-Full.zip zones.pk3
+	@cd ${WRKSRC}/assets/installer && ${UNZIP_NATIVE_CMD} ${DISTDIR}/SRB2-v${PORTVERSION:S/.//g}-Full.zip patch.pk3
 
 post-install:
 	@${MKDIR} ${STAGEDIR}/${DATADIR}
 	@${MV} ${STAGEDIR}/${PREFIX}/srb2.pk3 ${STAGEDIR}/${DATADIR}
+	@${MV} ${STAGEDIR}/${PREFIX}/models.dat ${STAGEDIR}/${DATADIR}
+	@${MV} ${STAGEDIR}/${PREFIX}/music.dta ${STAGEDIR}/${DATADIR}
 	@${MV} ${STAGEDIR}/${PREFIX}/player.dta ${STAGEDIR}/${DATADIR}
 	@${MV} ${STAGEDIR}/${PREFIX}/zones.pk3 ${STAGEDIR}/${DATADIR}
 	@${MV} ${STAGEDIR}/${PREFIX}/patch.pk3 ${STAGEDIR}/${DATADIR}
-	@${MV} ${STAGEDIR}/${PREFIX}/srb2 ${STAGEDIR}/${PREFIX}/bin
-	@${MV} ${STAGEDIR}/${PREFIX}/srb2-${PORTVERSION} ${STAGEDIR}/${PREFIX}/bin
+	@${MV} ${STAGEDIR}/${PREFIX}/${EXE_NAME} ${STAGEDIR}/${PREFIX}/bin
 
 .include <bsd.port.mk>
diff --git a/games/SRB2/distinfo b/games/SRB2/distinfo
index 788670fa6553..b41c0c889ded 100644
--- a/games/SRB2/distinfo
+++ b/games/SRB2/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1631304306
-SHA256 (SRB2-v229-Full.zip) = 48e644604bed81b5ce6b12ef23a2f4042d0118d0ba70f18c534dfe86ebe6f37d
-SIZE (SRB2-v229-Full.zip) = 195309133
-SHA256 (STJr-SRB2-SRB2_release_2.2.9_GH0.tar.gz) = 5f7eeb08e90323e28cdcb02ad25c904eef25ce75316720609b995a1e4ffd154a
-SIZE (STJr-SRB2-SRB2_release_2.2.9_GH0.tar.gz) = 59265756
+TIMESTAMP = 1717950063
+SHA256 (SRB2-v2213-Full.zip) = 83b91a351135b63705e49daffa44e7ac3cf3e33b397f56ff347ebb71eda27d4a
+SIZE (SRB2-v2213-Full.zip) = 156054029
+SHA256 (STJr-SRB2-SRB2_release_2.2.13_GH0.tar.gz) = 0fc460dc93c056c21bfcc389ac0515588673ee692968d9a6711b19e63d283b3f
+SIZE (STJr-SRB2-SRB2_release_2.2.13_GH0.tar.gz) = 58207762
diff --git a/games/SRB2/files/patch-CMakeLists.txt b/games/SRB2/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..4ed20a9a8c29
--- /dev/null
+++ b/games/SRB2/files/patch-CMakeLists.txt
@@ -0,0 +1,45 @@
+--- CMakeLists.txt.orig	2023-09-08 23:16:28 UTC
++++ CMakeLists.txt
+@@ -8,7 +8,9 @@ include(CMakeDependentOption)
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+ 
+ include(CMakeDependentOption)
+-include(cmake/CPM.cmake)
++if (SRB2_CONFIG_SYSTEM_LIBRARIES)
++	include(cmake/CPM.cmake)
++endif()
+ 
+ file(STRINGS src/version.h SRB2_VERSION)
+ string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION})
+@@ -79,7 +81,8 @@ set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to
+ # SRB2_CONFIG_PROFILEMODE is probably superceded by some CMake setting.
+ option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF)
+ set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.")
+-
++ 
++if (NOT SRB2_CONFIG_SYSTEM_LIBRARIES)
+ if(SRB2_CONFIG_ENABLE_TESTS)
+ 	# https://github.com/catchorg/Catch2
+ 	CPMAddPackage(
+@@ -98,6 +101,7 @@ endif()
+ 	target_compile_features(srb2tests PRIVATE c_std_11 cxx_std_17)
+ 	catch_discover_tests(srb2tests)
+ endif()
++endif()
+ 
+ # Enable CCache
+ # (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options)
+@@ -114,11 +118,13 @@ else()
+ 		endif()
+ 	endif()
+ else()
++	if (NOT SRB2_CONFIG_SYSTEM_LIBRARIES)
+ 	CPMAddPackage(
+ 		NAME Ccache.cmake
+ 		GITHUB_REPOSITORY TheLartians/Ccache.cmake
+ 		VERSION 1.2
+ 	)
++endif()
+ endif()
+ 
+ # Dependencies
diff --git a/games/SRB2/files/patch-assets_CMakeLists.txt b/games/SRB2/files/patch-assets_CMakeLists.txt
new file mode 100644
index 000000000000..8e17ae4a87e1
--- /dev/null
+++ b/games/SRB2/files/patch-assets_CMakeLists.txt
@@ -0,0 +1,14 @@
+--- assets/CMakeLists.txt.orig	2024-06-23 17:50:54 UTC
++++ assets/CMakeLists.txt
+@@ -43,9 +43,9 @@ if(${CMAKE_SYSTEM} MATCHES Darwin)
+ if(${CMAKE_SYSTEM} MATCHES Darwin)
+ 	get_target_property(outname SRB2SDL2 OUTPUT_NAME)
+ 	install(FILES ${SRB2_ASSETS} DESTINATION "${outname}.app/Contents/Resources")
+-	install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION "${outname}.app/Contents/Resources")
++	install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/" DESTINATION "${outname}.app/Contents/Resources")
+ 	install(FILES ${SRB2_ASSETS_DOCS} DESTINATION .)
+ else()
+ 	install(FILES ${SRB2_ASSETS} DESTINATION .)
+-	install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION .)
++	install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/" DESTINATION .)
+ endif()
diff --git a/games/SRB2/files/patch-thirdparty_CMakeLists.txt b/games/SRB2/files/patch-thirdparty_CMakeLists.txt
new file mode 100644
index 000000000000..2c0d39f3569c
--- /dev/null
+++ b/games/SRB2/files/patch-thirdparty_CMakeLists.txt
@@ -0,0 +1,10 @@
+--- thirdparty/CMakeLists.txt.orig	2024-06-10 07:06:58 UTC
++++ thirdparty/CMakeLists.txt
+@@ -16,6 +16,5 @@ if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
+ 	include("cpm-png.cmake")
+ 	include("cpm-curl.cmake")
+ 	include("cpm-openmpt.cmake")
++	include("cpm-libgme.cmake")
+ endif()
+-
+-include("cpm-libgme.cmake")
diff --git a/games/SRB2/pkg-plist b/games/SRB2/pkg-plist
index 384bfd0c0cf8..92e43045f277 100644
--- a/games/SRB2/pkg-plist
+++ b/games/SRB2/pkg-plist
@@ -1,5 +1,6 @@
 bin/srb2
-bin/srb2-2.2.9
+%%DATADIR%%/models.dat
+%%DATADIR%%/music.dta
 %%DATADIR%%/patch.pk3
 %%DATADIR%%/player.dta
 %%DATADIR%%/srb2.pk3