git: 484170b79708 - main - games/vvvvvv: update to 2.3.6

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 13 Jan 2022 15:32:10 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=484170b797087d53205f432c055fc1790ad53bf3

commit 484170b797087d53205f432c055fc1790ad53bf3
Author:     Robert Clausecker <fuz@fuz.su>
AuthorDate: 2021-12-28 10:15:39 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-01-13 15:31:41 +0000

    games/vvvvvv: update to 2.3.6
    
    The game now comes in two flavours:
    
    The commercial flavour is the regular game and requires the user to
    supply his or her own copy of the data.zip file.
    
    The makeandplay flavour is a free version of the game which doesn't
    have come with the original levels, but ships player levels and
    allows you to build your own.
    
    PR:     260749
---
 games/vvvvvv/Makefile                            | 52 ++++++++++++++++++------
 games/vvvvvv/distinfo                            |  8 ++--
 games/vvvvvv/files/patch-CMakeLists.txt          | 11 +++++
 games/vvvvvv/files/patch-src_FileSystemUtils.cpp | 40 ++++++++++++------
 games/vvvvvv/files/patch-src_main.cpp            | 11 +++++
 games/vvvvvv/files/pkg-message.in                | 12 ++++++
 games/vvvvvv/pkg-descr                           |  9 +++-
 games/vvvvvv/pkg-message                         |  9 ----
 8 files changed, 112 insertions(+), 40 deletions(-)

diff --git a/games/vvvvvv/Makefile b/games/vvvvvv/Makefile
index 3b6730410585..d9fb4e25c4b3 100644
--- a/games/vvvvvv/Makefile
+++ b/games/vvvvvv/Makefile
@@ -1,33 +1,59 @@
 # Created by: Emmanuel Vadot <manu@FreeBSD.org>
 
 PORTNAME=	VVVVVV
-PORTVERSION=	v2.2
+DISTVERSION=	2.3.6
 CATEGORIES=	games
+.if ${FLAVOR:U} == makeandplay
+# The data file may only be distributed if the MAKEANDPLAY define is set.
+# See https://github.com/TerryCavanagh/VVVVVV/blob/master/License%20exceptions.md
+MASTER_SITES=	https://thelettervsixtim.es/makeandplay/data.zip?dummy=/:datafile
+DISTFILES=	VVVVVV-data-${DISTVERSION}.zip:datafile
+EXTRACT_ONLY=	${GH_ACCOUNT}-${GH_PROJECT}-${DISTVERSION}_GH0.tar.gz
+.endif
 
 MAINTAINER=	manu@FreeBSD.org
 COMMENT=	2D Platformer game
 
-LICENSE=	UNKNOWN
-LICENSE_NAME=	unknown
-LICENSE_FILE=	${WRKSRC}/../LICENSE.md
-LICENSE_PERMS=	dist-mirror no-dist-sell pkg-mirror no-pkg-sell auto-accept
+LICENSE=	VVVVVV BSD3CLAUSE
+LICENSE_COMB=	multi
+LICENSE_NAME_VVVVVV=	VVVVVV Source Code License v1.0
+LICENSE_FILE_VVVVVV=	${WRKSRC}/../LICENSE.md
+LICENSE_FILE_BSD3CLAUSE=	${WRKSRC}/../third_party/lodepng/LICENSE.txt
+LICENSE_PERMS_VVVVVV=	dist-mirror no-dist-sell pkg-mirror no-pkg-sell auto-accept
 
-ONLY_FOR_ARCHS=	amd64 powerpc64 powerpc64le
+.if defined(NO_LICENSES_INSTALL)
+IGNORE=		license requires that the license be shipped
+.endif
+
+BUILD_DEPENDS=	utf8cpp>0:devel/utf8cpp
+LIB_DEPENDS=	libtinyxml2.so:textproc/tinyxml2 \
+		libphysfs.so:devel/physfs
+
+FLAVORS=	commercial makeandplay
+makeandplay_PKGNAMESUFFIX=	-makeandplay
 
 USES=		sdl cmake localbase:ldflags
 USE_GITHUB=	yes
 GH_ACCOUNT=	TerryCavanagh
 GH_PROJECT=	${PORTNAME}
-GH_TAGNAME=	cb3640e5
-
-WRKSRC_SUBDIR=	desktop_version
-
 USE_SDL=	sdl2 mixer2
 
-PLIST_FILES=	bin/vvvvvv
+CFLAGS+=	-DASSETSPATH='\"${DATADIR}/data.zip\"'
+CMAKE_OFF=	BUNDLE_DEPENDENCIES
+.if ${FLAVOR:U} == makeandplay
+CMAKE_ON=	MAKEANDPLAY
+.endif
+
+WRKSRC_SUBDIR=	desktop_version
+PLIST_FILES=	bin/VVVVVV${PKGNAMESUFFIX} \
+		${"${FLAVOR}"=="makeandplay:?${DATADIR_REL}/data.zip:}
+SUB_FILES=	pkg-message
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKDIR}/.build/vvvvvv.x86_64 ${STAGEDIR}${PREFIX}/bin/vvvvvv
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/vvvvvv
+	${INSTALL_PROGRAM} ${WRKDIR}/.build/VVVVVV ${STAGEDIR}${PREFIX}/bin/VVVVVV${PKGNAMESUFFIX}
+.if ${FLAVOR:U} == makeandplay
+	${MKDIR} ${STAGEDIR}${DATADIR}
+	${INSTALL_DATA} ${DISTDIR}/VVVVVV-data-${DISTVERSION}.zip ${STAGEDIR}${DATADIR}/data.zip
+.endif
 
 .include <bsd.port.mk>
diff --git a/games/vvvvvv/distinfo b/games/vvvvvv/distinfo
index 2d11675cb41a..cbd7b9ea84fb 100644
--- a/games/vvvvvv/distinfo
+++ b/games/vvvvvv/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1578694479
-SHA256 (TerryCavanagh-VVVVVV-v2.2-cb3640e5_GH0.tar.gz) = d936ad517ef9b8236148cd8161201d23f55b98dc6a03f3b2763612abb11a1615
-SIZE (TerryCavanagh-VVVVVV-v2.2-cb3640e5_GH0.tar.gz) = 827825
+TIMESTAMP = 1640682897
+SHA256 (VVVVVV-data-2.3.6.zip) = 6fae3cdec06062d05827d4181c438153f3ea3900437a44db73bcd29799fe57e0
+SIZE (VVVVVV-data-2.3.6.zip) = 61404595
+SHA256 (TerryCavanagh-VVVVVV-2.3.6_GH0.tar.gz) = a3366aab9e8462d330044ab1ec63927e9f5c3801c0ed96b24f08c553dcb911e9
+SIZE (TerryCavanagh-VVVVVV-2.3.6_GH0.tar.gz) = 1725842
diff --git a/games/vvvvvv/files/patch-CMakeLists.txt b/games/vvvvvv/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..0927b9a29e55
--- /dev/null
+++ b/games/vvvvvv/files/patch-CMakeLists.txt
@@ -0,0 +1,11 @@
+--- CMakeLists.txt.orig	2021-12-22 13:20:25 UTC
++++ CMakeLists.txt
+@@ -181,7 +181,7 @@ if(APPLE)
+ endif()
+ set(PNG_SRC ../third_party/lodepng/lodepng.c)
+ 
+-if(NOT OFFICIAL_BUILD)
++if(FALSE)
+ 	# Add interim commit hash and its date to the build
+ 
+ 	# find_package sets GIT_FOUND and GIT_EXECUTABLE
diff --git a/games/vvvvvv/files/patch-src_FileSystemUtils.cpp b/games/vvvvvv/files/patch-src_FileSystemUtils.cpp
index 5bb4437be5bc..a93f7e9e794d 100644
--- a/games/vvvvvv/files/patch-src_FileSystemUtils.cpp
+++ b/games/vvvvvv/files/patch-src_FileSystemUtils.cpp
@@ -1,15 +1,29 @@
---- src/FileSystemUtils.cpp.orig	2020-01-10 22:11:00 UTC
+--- src/FileSystemUtils.cpp.orig	2021-12-22 13:20:25 UTC
 +++ src/FileSystemUtils.cpp
-@@ -73,6 +73,12 @@ int FILESYSTEM_init(char *argvZero)
- #ifdef _WIN32
- 	strcpy(output, PHYSFS_getBaseDir());
- 	strcat(output, "data.zip");
-+#elif defined(__FreeBSD__)
-+	PLATFORM_getOSDirectory(output);
-+	if (strlcat(output, "data.zip", sizeof(output)) >= sizeof(output)) {
-+		puts("Cannot find location for data.zip\n");
-+		return 0;
+@@ -1,3 +1,4 @@
++#include <errno.h>
+ #include <iostream>
+ #include <iterator>
+ #include <physfs.h>
+@@ -154,6 +155,12 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, cha
+ 	}
+ 
+ 	/* Mount the stock content last */
++	if (assetsPath && access(assetsPath, R_OK) == -1) {
++		printf("%s: %s\n", assetsPath, strerror(errno));
++		printf("Trying %sdata.zip instead.\n", output);
++		assetsPath = NULL;
 +	}
- #else
- 	strcpy(output, "data.zip");
- #endif
++
+ 	if (assetsPath)
+ 	{
+ 		SDL_strlcpy(output, assetsPath, sizeof(output));
+@@ -161,7 +168,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, cha
+ 	else
+ 	{
+ 		SDL_snprintf(output, sizeof(output), "%s%s",
+-			basePath,
++			output,
+ 			"data.zip"
+ 		);
+ 	}
diff --git a/games/vvvvvv/files/patch-src_main.cpp b/games/vvvvvv/files/patch-src_main.cpp
new file mode 100644
index 000000000000..437afa0e181f
--- /dev/null
+++ b/games/vvvvvv/files/patch-src_main.cpp
@@ -0,0 +1,11 @@
+--- src/main.cpp.orig	2021-12-28 09:43:31 UTC
++++ src/main.cpp
+@@ -342,7 +342,7 @@ static void cleanup(void);
+ int main(int argc, char *argv[])
+ {
+     char* baseDir = NULL;
+-    char* assetsPath = NULL;
++    char* assetsPath = (char*)ASSETSPATH;
+ 
+     for (int i = 1; i < argc; ++i)
+     {
diff --git a/games/vvvvvv/files/pkg-message.in b/games/vvvvvv/files/pkg-message.in
new file mode 100644
index 000000000000..27aa099f8126
--- /dev/null
+++ b/games/vvvvvv/files/pkg-message.in
@@ -0,0 +1,12 @@
+[
+{ type: install
+  message: <<EOM
+VVVVVV is copyright of Terry Cavanagh (c) 2010--2020.
+This copy of VVVVVV may have been altered for compatibility with FreeBSD.
+
+VVVVVV may require the data file from an official copy.
+Take data.zip and put it in %%DATADIR%%/data.zip
+or ~/.local/share/VVVVVV/data.zip.
+EOM
+}
+]
diff --git a/games/vvvvvv/pkg-descr b/games/vvvvvv/pkg-descr
index 91d1c8d2d80d..d2b3ac580831 100644
--- a/games/vvvvvv/pkg-descr
+++ b/games/vvvvvv/pkg-descr
@@ -1,5 +1,10 @@
 VVVVVV is a 2D platform game.
 Unlike other platform game you cannot jump but only invert the gravity.
-Graphism and music are heavily inspired by the Commodore C64 era.
+Graphics and music are heavily inspired by the Commodore C64 era.
 
-WWW: https://github.com/TerryCavanagh/VVVVVV
+The Make and Play Edition (games/vvvvvv@makeandplay) is a completely
+free, official version of VVVVVV that includes player levels, and the
+tools to create levels of your own! It does not include the original
+levels from the game.
+
+WWW: https://thelettervsixtim.es/
diff --git a/games/vvvvvv/pkg-message b/games/vvvvvv/pkg-message
deleted file mode 100644
index 3553d3ffdeb0..000000000000
--- a/games/vvvvvv/pkg-message
+++ /dev/null
@@ -1,9 +0,0 @@
-[
-{ type: install
-  message: <<EOM
-VVVVVV requires the data files from an official copy.
-
-Take the data.zip file and put it in ~/.local/share/VVVVVV
-EOM
-}
-]