git: 992a6c76c867 - main - graphics/sdl3_image: add port

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

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

commit 992a6c76c867a240b70fbc88a2ff0dac12cda2e5
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2025-02-04 16:44:45 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2025-02-04 16:52:33 +0000

    graphics/sdl3_image: add port
    
    This is a simple library to load images of various formats as SDL surfaces.
    It can load BMP, GIF, JPEG, LBM, PCX, PNG, PNM (PPM/PGM/PBM), QOI,
    TGA, XCF, XPM, and simple SVG format images. It can also load AVIF,
    JPEG-XL, TIFF, and WebP images, depending on build options
---
 Mk/Uses/sdl.mk                |  5 ++++-
 graphics/Makefile             |  1 +
 graphics/sdl3_image/Makefile  | 52 +++++++++++++++++++++++++++++++++++++++++++
 graphics/sdl3_image/distinfo  |  3 +++
 graphics/sdl3_image/pkg-descr |  4 ++++
 graphics/sdl3_image/pkg-plist | 11 +++++++++
 6 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/Mk/Uses/sdl.mk b/Mk/Uses/sdl.mk
index 7bbc4bb67014..1586df618323 100644
--- a/Mk/Uses/sdl.mk
+++ b/Mk/Uses/sdl.mk
@@ -70,10 +70,13 @@ _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
+_SDL_USE_ALL+=	sdl3 image3
 
 _SDL_sdl3_LIB_DEPENDS=		libSDL3.so:devel/sdl3
 
+_SDL_image3_LIB_DEPENDS=	libSDL3_image.so:graphics/sdl3_image
+_SDL_image3_REQUIRES=		sdl3
+
 # Basic checks
 .  if !empty(sdl_ARGS)
 IGNORE=		USES=sdl takes no arguments
diff --git a/graphics/Makefile b/graphics/Makefile
index 855e4c382138..3f0e06030d6e 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -1150,6 +1150,7 @@
     SUBDIR += sdl2_gpu
     SUBDIR += sdl2_image
     SUBDIR += sdl2_ttf
+    SUBDIR += sdl3_image
     SUBDIR += sdl_gfx
     SUBDIR += sdl_image
     SUBDIR += sdl_ttf
diff --git a/graphics/sdl3_image/Makefile b/graphics/sdl3_image/Makefile
new file mode 100644
index 000000000000..82fcb46fc783
--- /dev/null
+++ b/graphics/sdl3_image/Makefile
@@ -0,0 +1,52 @@
+PORTNAME=	sdl3_image
+DISTVERSIONPREFIX=	release-
+DISTVERSION=	3.2.0
+CATEGORIES=	graphics
+
+MAINTAINER=	amdmi3@FreeBSD.org
+COMMENT=	Simple library to load images of various formats as SDL surfaces
+WWW=		https://github.com/libsdl-org/SDL_image
+
+LICENSE=	ZLIB
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+USES=		cmake sdl
+USE_GITHUB=	yes
+GH_ACCOUNT=	libsdl-org
+GH_PROJECT=	SDL_image
+USE_SDL=	sdl3
+CMAKE_OFF=	SDLIMAGE_DEPS_SHARED \
+		SDLIMAGE_SAMPLES \
+		SDLIMAGE_BACKEND_STB
+USE_LDCONFIG=	yes
+
+OPTIONS_DEFINE=	AVIF JPEG JXL PNG TIFF WEBP TEST
+OPTIONS_DEFAULT=AVIF JPEG JXL PNG TIFF WEBP
+OPTIONS_SUB=	yes
+
+AVIF_LIB_DEPENDS=	libavif.so:graphics/libavif
+AVIF_CMAKE_BOOL=	SDLIMAGE_AVIF
+
+JPEG_USES=		jpeg
+JPEG_CMAKE_BOOL=	SDLIMAGE_JPG
+
+JXL_LIB_DEPENDS=	libjxl.so:graphics/libjxl
+JXL_CMAKE_BOOL=		SDLIMAGE_JXL
+
+PNG_LIB_DEPENDS=	libpng.so:graphics/png
+PNG_CMAKE_BOOL=		SDLIMAGE_PNG
+
+TIFF_LIB_DEPENDS=	libtiff.so:graphics/tiff
+TIFF_CMAKE_BOOL=	SDLIMAGE_TIF
+
+TEST_USES=		display:test
+TEST_CMAKE_BOOL=	SDLIMAGE_TESTS
+TEST_TEST_TARGET=	test
+
+WEBP_LIB_DEPENDS=	libwebp.so:graphics/webp
+WEBP_CMAKE_BOOL=	SDLIMAGE_WEBP
+
+post-extract:
+	@${RM} -rf ${WRKSRC}/external
+
+.include <bsd.port.mk>
diff --git a/graphics/sdl3_image/distinfo b/graphics/sdl3_image/distinfo
new file mode 100644
index 000000000000..a05a50c3ba7d
--- /dev/null
+++ b/graphics/sdl3_image/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1738684901
+SHA256 (libsdl-org-SDL_image-release-3.2.0_GH0.tar.gz) = b9afb6901635f60b64b1f7925f8b13eb9eca4cef6af5001ec00d7e5f8f142a0a
+SIZE (libsdl-org-SDL_image-release-3.2.0_GH0.tar.gz) = 10751802
diff --git a/graphics/sdl3_image/pkg-descr b/graphics/sdl3_image/pkg-descr
new file mode 100644
index 000000000000..b5a71ce2135b
--- /dev/null
+++ b/graphics/sdl3_image/pkg-descr
@@ -0,0 +1,4 @@
+This is a simple library to load images of various formats as SDL surfaces.
+It can load BMP, GIF, JPEG, LBM, PCX, PNG, PNM (PPM/PGM/PBM), QOI,
+TGA, XCF, XPM, and simple SVG format images. It can also load AVIF,
+JPEG-XL, TIFF, and WebP images, depending on build options
diff --git a/graphics/sdl3_image/pkg-plist b/graphics/sdl3_image/pkg-plist
new file mode 100644
index 000000000000..bbc3461594e9
--- /dev/null
+++ b/graphics/sdl3_image/pkg-plist
@@ -0,0 +1,11 @@
+include/SDL3_image/SDL_image.h
+%%JXL%%lib/cmake/SDL3_image/Findlibjxl.cmake
+%%WEBP%%lib/cmake/SDL3_image/Findwebp.cmake
+lib/cmake/SDL3_image/SDL3_image-shared-targets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL3_image/SDL3_image-shared-targets.cmake
+lib/cmake/SDL3_image/SDL3_imageConfig.cmake
+lib/cmake/SDL3_image/SDL3_imageConfigVersion.cmake
+lib/libSDL3_image.so
+lib/libSDL3_image.so.0
+lib/libSDL3_image.so.0.2.0
+libdata/pkgconfig/sdl3-image.pc