git: a17aa793a974 - main - graphics/sdl3_ttf: add port

From: Dmitry Marakasov <amdmi3_at_FreeBSD.org>
Date: Tue, 04 Feb 2025 16:53:27 UTC
The branch main has been updated by amdmi3:

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

commit a17aa793a974d87d899d2e7b129b488c8125c708
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2025-02-04 16:47:48 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2025-02-04 16:52:33 +0000

    graphics/sdl3_ttf: add port
    
    This library is a wrapper around the FreeType and Harfbuzz libraries,
    allowing you to use TrueType fonts to render text in SDL applications.
    
    It allows a programmer to use multiple TrueType fonts without having
    to code a font rendering routine themselves. With the power of
    outline fonts and antialiasing, high quality text output can be
    obtained without much effort.
---
 Mk/Uses/sdl.mk              |  5 ++++-
 graphics/Makefile           |  1 +
 graphics/sdl3_ttf/Makefile  | 37 +++++++++++++++++++++++++++++++++++++
 graphics/sdl3_ttf/distinfo  |  3 +++
 graphics/sdl3_ttf/pkg-descr |  7 +++++++
 graphics/sdl3_ttf/pkg-plist | 13 +++++++++++++
 6 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/Mk/Uses/sdl.mk b/Mk/Uses/sdl.mk
index 1586df618323..4c29f13f0e64 100644
--- a/Mk/Uses/sdl.mk
+++ b/Mk/Uses/sdl.mk
@@ -70,13 +70,16 @@ _SDL_ttf2_LIB_DEPENDS=		libSDL2_ttf.so:graphics/sdl2_ttf
 _SDL_ttf2_REQUIRES=		sdl2
 
 # These are the current supported SDL3 modules
-_SDL_USE_ALL+=	sdl3 image3
+_SDL_USE_ALL+=	sdl3 image3 ttf3
 
 _SDL_sdl3_LIB_DEPENDS=		libSDL3.so:devel/sdl3
 
 _SDL_image3_LIB_DEPENDS=	libSDL3_image.so:graphics/sdl3_image
 _SDL_image3_REQUIRES=		sdl3
 
+_SDL_ttf3_LIB_DEPENDS=		libSDL3_ttf.so:graphics/sdl3_ttf
+_SDL_ttf3_REQUIRES=		sdl3
+
 # Basic checks
 .  if !empty(sdl_ARGS)
 IGNORE=		USES=sdl takes no arguments
diff --git a/graphics/Makefile b/graphics/Makefile
index 3f0e06030d6e..c72b9a5b82d1 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -1151,6 +1151,7 @@
     SUBDIR += sdl2_image
     SUBDIR += sdl2_ttf
     SUBDIR += sdl3_image
+    SUBDIR += sdl3_ttf
     SUBDIR += sdl_gfx
     SUBDIR += sdl_image
     SUBDIR += sdl_ttf
diff --git a/graphics/sdl3_ttf/Makefile b/graphics/sdl3_ttf/Makefile
new file mode 100644
index 000000000000..b98b7ea65aae
--- /dev/null
+++ b/graphics/sdl3_ttf/Makefile
@@ -0,0 +1,37 @@
+PORTNAME=	sdl3_ttf
+DISTVERSIONPREFIX=	preview-
+DISTVERSION=	3.1.0
+CATEGORIES=	graphics
+
+MAINTAINER=	amdmi3@FreeBSD.org
+COMMENT=	Library to use TrueType fonts to render text in SDL applications
+WWW=		https://github.com/libsdl-org/SDL_ttf
+
+LICENSE=	ZLIB
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+LIB_DEPENDS=	libfreetype.so:print/freetype2
+
+USES=		cmake sdl
+USE_GITHUB=	yes
+GH_ACCOUNT=	libsdl-org
+GH_PROJECT=	SDL_ttf
+USE_SDL=	sdl3
+CMAKE_OFF=	SDLTTF_SAMPLES
+USE_LDCONFIG=	yes
+
+PORTDOCS=	*
+
+OPTIONS_DEFINE=	HARFBUZZ DOCS
+OPTIONS_DEFAULT=HARFBUZZ
+OPTIONS_SUB=	yes
+
+HARFBUZZ_DESC=	Enable HarfBuzz support
+HARFBUZZ_LIB_DEPENDS=	libharfbuzz.so:print/harfbuzz
+HARFBUZZ_CMAKE_BOOL=	SDLTTF_HARFBUZZ
+
+post-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/CHANGES.txt ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}/
+
+.include <bsd.port.mk>
diff --git a/graphics/sdl3_ttf/distinfo b/graphics/sdl3_ttf/distinfo
new file mode 100644
index 000000000000..15304e48ff0d
--- /dev/null
+++ b/graphics/sdl3_ttf/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1738686984
+SHA256 (libsdl-org-SDL_ttf-preview-3.1.0_GH0.tar.gz) = 2e4e28a098bd2a6dda85d3de5d1edb440af66f8e4d4e5d3be30a3a8628583699
+SIZE (libsdl-org-SDL_ttf-preview-3.1.0_GH0.tar.gz) = 1574695
diff --git a/graphics/sdl3_ttf/pkg-descr b/graphics/sdl3_ttf/pkg-descr
new file mode 100644
index 000000000000..4b0feb36dbcd
--- /dev/null
+++ b/graphics/sdl3_ttf/pkg-descr
@@ -0,0 +1,7 @@
+This library is a wrapper around the FreeType and Harfbuzz libraries,
+allowing you to use TrueType fonts to render text in SDL applications.
+
+It allows a programmer to use multiple TrueType fonts without having
+to code a font rendering routine themselves. With the power of
+outline fonts and antialiasing, high quality text output can be
+obtained without much effort.
diff --git a/graphics/sdl3_ttf/pkg-plist b/graphics/sdl3_ttf/pkg-plist
new file mode 100644
index 000000000000..3a628b6c6bd9
--- /dev/null
+++ b/graphics/sdl3_ttf/pkg-plist
@@ -0,0 +1,13 @@
+include/SDL3_ttf/SDL_textengine.h
+include/SDL3_ttf/SDL_ttf.h
+lib/cmake/SDL3_ttf/Findharfbuzz.cmake
+lib/cmake/SDL3_ttf/Findplutosvg.cmake
+lib/cmake/SDL3_ttf/PkgConfigHelper.cmake
+lib/cmake/SDL3_ttf/SDL3_ttf-shared-targets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL3_ttf/SDL3_ttf-shared-targets.cmake
+lib/cmake/SDL3_ttf/SDL3_ttfConfig.cmake
+lib/cmake/SDL3_ttf/SDL3_ttfConfigVersion.cmake
+lib/libSDL3_ttf.so
+lib/libSDL3_ttf.so.0
+lib/libSDL3_ttf.so.0.1.0
+libdata/pkgconfig/sdl3-ttf.pc