git: 447a6897ddde - main - games/fs2open: Fix configure with CMake >= 3.28.0

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Thu, 28 Dec 2023 23:03:44 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=447a6897dddebd4ad863c2a11556707a0392cf6b

commit 447a6897dddebd4ad863c2a11556707a0392cf6b
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2023-12-28 20:12:53 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2023-12-28 23:03:32 +0000

    games/fs2open: Fix configure with CMake >= 3.28.0
    
    While here, "unbundle" devel/jansson which is automatically linked
    to if installed. Otherwise, a bundled copy is built and statically
    linked to.
    
    PR:             275730
    Approved by:    portmgr (blanket)
---
 games/fs2open/Makefile                       |  2 ++
 games/fs2open/files/patch-lib_freetype.cmake | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/games/fs2open/Makefile b/games/fs2open/Makefile
index af2f7428912e..39217bef2638 100644
--- a/games/fs2open/Makefile
+++ b/games/fs2open/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	fs2open
 DISTVERSIONPREFIX=	release_
 DISTVERSION=	23_2_1
+PORTREVISION=	1
 CATEGORIES=	games
 
 MAINTAINER=	pkubaj@FreeBSD.org
@@ -13,6 +14,7 @@ LICENSE_FILE=	${WRKSRC}/Copying.md
 LICENSE_PERMS=	dist-mirror auto-accept
 
 LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg \
+		libjansson.so:devel/jansson \
 		libpng.so:graphics/png \
 		libfreetype.so:print/freetype2
 
diff --git a/games/fs2open/files/patch-lib_freetype.cmake b/games/fs2open/files/patch-lib_freetype.cmake
new file mode 100644
index 000000000000..f68461c60d94
--- /dev/null
+++ b/games/fs2open/files/patch-lib_freetype.cmake
@@ -0,0 +1,27 @@
+Fix configure with CMake >= 3.28.0 where the FindFreetype module uses
+freetype-config.cmake if found, which already defines the freetype
+target.
+ 
+--- lib/freetype.cmake.orig	2023-11-03 16:14:29 UTC
++++ lib/freetype.cmake
+@@ -1,7 +1,7 @@
+ 
+-add_library(freetype INTERFACE)
+-
+ if(PLATFORM_WINDOWS OR PLATFORM_MAC)
++	add_library(freetype INTERFACE)
++
+ 	# We use prebuilt binaries for windows and mac
+ 	get_prebuilt_path(PREBUILT_PATH)
+ 	set(FREETYPE_ROOT_DIR "${PREBUILT_PATH}/freetype")
+@@ -21,6 +21,10 @@ else()
+ 
+ else()
+ 	find_package(Freetype REQUIRED)
++
++	if(NOT TARGET freetype)
++		add_library(freetype INTERFACE)
++	endif()
+ 
+ 	target_include_directories(freetype INTERFACE ${FREETYPE_INCLUDE_DIRS})
+ 	target_link_libraries(freetype INTERFACE ${FREETYPE_LIBRARIES})