git: 4a7895fb5fee - main - devel/sdl3: add port: Cross-platform multimedia development API, version 3 preview

From: Dmitry Marakasov <amdmi3_at_FreeBSD.org>
Date: Mon, 10 Jun 2024 13:36:53 UTC
The branch main has been updated by amdmi3:

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

commit 4a7895fb5fee143cd2b5a0e4fbe57ff1b964017c
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2024-06-07 16:09:22 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2024-06-10 13:36:24 +0000

    devel/sdl3: add port: Cross-platform multimedia development API, version 3 preview
---
 devel/Makefile                        |   1 +
 devel/sdl3/Makefile                   | 142 ++++++++++++++++++++++++++++++++++
 devel/sdl3/distinfo                   |   3 +
 devel/sdl3/files/patch-CMakeLists.txt |  36 +++++++++
 devel/sdl3/pkg-descr                  |   6 ++
 devel/sdl3/pkg-plist                  |  94 ++++++++++++++++++++++
 6 files changed, 282 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 8037ae7e3440..f7d768a1a9ef 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -7820,6 +7820,7 @@
     SUBDIR += sdl12-compat
     SUBDIR += sdl20
     SUBDIR += sdl2pp
+    SUBDIR += sdl3
     SUBDIR += sdl_console
     SUBDIR += sdlmm
     SUBDIR += sdlskk
diff --git a/devel/sdl3/Makefile b/devel/sdl3/Makefile
new file mode 100644
index 000000000000..9f644efcb25a
--- /dev/null
+++ b/devel/sdl3/Makefile
@@ -0,0 +1,142 @@
+PORTNAME=	sdl3
+DISTVERSION=	3.1.2
+CATEGORIES=	devel
+
+MAINTAINER=	amdmi3@FreeBSD.org
+COMMENT=	Cross-platform multimedia development API (version 3 preview)
+WWW=		https://www.libsdl.org/ \
+		https://github.com/libsdl-org/SDL
+
+LICENSE=	ZLIB
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+USES=		cmake iconv pkgconfig
+USE_GITHUB=	yes
+GH_ACCOUNT=	libsdl-org
+GH_PROJECT=	SDL
+GH_TAGNAME=	9a4fc81
+CMAKE_OFF=	SDL_RPATH
+CMAKE_ON=	CMAKE_DISABLE_FIND_PACKAGE_Git
+USE_LDCONFIG=	yes
+
+PORTSCOUT=	limitw:1,even
+
+OPTIONS_DEFINE=		CSD DBUS FCITX IBUS JOYSTICK HIDAPI \
+			SAMPLERATE UDEV
+OPTIONS_GROUP=		AUDIO VIDEO
+OPTIONS_GROUP_AUDIO=	ALSA JACK OSS PIPEWIRE PULSEAUDIO SNDIO
+OPTIONS_GROUP_VIDEO=	KMSDRM OPENGL OPENGLES VULKAN \
+			WAYLAND X11
+OPTIONS_DEFAULT=	JOYSTICK OSS KMSDRM OPENGL \
+			OPENGLES VULKAN WAYLAND X11
+OPTIONS_DEFINE_powerpc=	ALTIVEC
+OPTIONS_DEFINE_powerpc64=	ALTIVEC
+OPTIONS_DEFAULT_powerpc=	ALTIVEC
+OPTIONS_DEFAULT_powerpc64=	ALTIVEC
+
+AUDIO_DESC=		Audio drivers
+VIDEO_DESC=		Video drivers
+
+CSD_DESC=		Client-side decorations for Wayland via libdecor
+FCITX_DESC=		fcitx support
+HIDAPI_DESC=		Use HIDAPI for low level joystick drivers
+IBUS_DESC=		IBus support
+JOYSTICK_DESC=		Joystick and haptic support
+KMSDRM_DESC=		KMSDRM display support
+OPENGLES_DESC=		OpenGL ES rendering support
+UDEV_DESC=		Use udev for input device detection
+VULKAN_DESC=		Vulkan rendering support
+
+ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
+ALSA_CMAKE_BOOL=	SDL_ALSA
+ALSA_CMAKE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_ALSA
+
+ALTIVEC_CMAKE_BOOL=	SDL_ALTIVEC
+
+CSD_LIB_DEPENDS=	libdecor-0.so:x11-toolkits/libdecor
+CSD_CMAKE_BOOL=		SDL_WAYLAND_LIBDECOR
+CSD_IMPLIES=		WAYLAND
+
+DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
+DBUS_CMAKE_BOOL=	SDL_DBUS
+
+FCITX_LIB_DEPENDS=	libfcitx-config.so:chinese/fcitx
+FCITX_IMPLIES=		DBUS
+
+HIDAPI_CMAKE_BOOL=	SDL_HIDAPI
+HIDAPI_IMPLIES=		JOYSTICK
+
+IBUS_LIB_DEPENDS=	libibus-1.0.so:textproc/ibus
+IBUS_CMAKE_BOOL=	SDL_IBUS
+IBUS_IMPLIES=		DBUS
+
+JACK_LIB_DEPENDS=	libjack.so:audio/jack
+JACK_CMAKE_BOOL=	SDL_JACK
+
+JOYSTICK_BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+JOYSTICK_LIB_DEPENDS=	libinotify.so:devel/libinotify
+JOYSTICK_CMAKE_BOOL=	SDL_HIDAPI_JOYSTICK SDL_HIDAPI_LIBUSB SDL_VIRTUAL_JOYSTICK
+
+KMSDRM_USES=		gl
+KMSDRM_USE=		GL=gbm
+KMSDRM_CMAKE_BOOL=	SDL_KMSDRM
+
+OPENGL_USES=		gl
+OPENGL_USE=		GL=opengl
+OPENGL_CMAKE_BOOL=	SDL_OPENGL
+
+OPENGLES_USES=		gl
+OPENGLES_USE=		GL=egl,glesv1,glesv2
+OPENGLES_CMAKE_BOOL=	SDL_OPENGLES
+
+OSS_CMAKE_BOOL=		SDL_OSS
+
+PIPEWIRE_LIB_DEPENDS=	libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_CMAKE_BOOL=	SDL_PIPEWIRE
+PIPEWIRE_BROKEN=	does not build
+
+PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
+PULSEAUDIO_CMAKE_BOOL=	SDL_PULSEAUDIO
+
+SAMPLERATE_LIB_DEPENDS=	libsamplerate.so:audio/libsamplerate
+SAMPLERATE_CMAKE_BOOL=	SDL_LIBSAMPLERATE
+SAMPLERATE_BOOL_OFF=	CMAKE_DISABLE_FIND_PACKAGE_SampleRate
+
+SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio
+SNDIO_CMAKE_BOOL=	SDL_SNDIO
+
+UDEV_BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+UDEV_LIB_DEPENDS=	libudev.so:devel/libudev-devd
+UDEV_CMAKE_BOOL=	SDL_LIBUDEV
+
+VULKAN_LIB_DEPENDS=	libvulkan.so:graphics/vulkan-loader
+VULKAN_CMAKE_BOOL=	SDL_VULKAN SDL_RENDER_VULKAN
+
+WAYLAND_BUILD_DEPENDS=	wayland-protocols>0:graphics/wayland-protocols \
+			${LOCALBASE}/include/linux/input.h:devel/evdev-proto
+WAYLAND_LIB_DEPENDS=	libwayland-egl.so:graphics/wayland \
+			libxkbcommon.so:x11/libxkbcommon
+WAYLAND_CMAKE_BOOL=	SDL_WAYLAND
+WAYLAND_IMPLIES=	OPENGLES
+
+X11_USES=		xorg
+X11_USE=		XORG=x11,xcursor,xext,xi,xfixes,xrandr,xrender,xscrnsaver
+X11_CMAKE_BOOL=		SDL_X11
+
+.include <bsd.port.options.mk>
+
+# Similar to x11/pixman
+.if ${ARCH} == "armv6" || ${ARCH} == "armv7"
+BUILD_DEPENDS+=	${LOCALBASE}/bin/as:devel/binutils
+CFLAGS+=	-B${LOCALBASE}/bin -no-integrated-as
+.endif
+
+post-patch:
+	@${REINPLACE_CMD} -e '/dep_option.*Dynamically load/ s|ON|OFF|' \
+		${WRKSRC}/CMakeLists.txt
+
+post-patch-FCITX-off:
+	@${REINPLACE_CMD} -e 's|HAVE_FCITX TRUE|HAVE_FCITX FALSE|g' \
+		${WRKSRC}/CMakeLists.txt
+
+.include <bsd.port.mk>
diff --git a/devel/sdl3/distinfo b/devel/sdl3/distinfo
new file mode 100644
index 000000000000..5dff1e3a4bfb
--- /dev/null
+++ b/devel/sdl3/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1717772637
+SHA256 (libsdl-org-SDL-3.1.2-9a4fc81_GH0.tar.gz) = 238a7920b1cd053cee9f28f185abd6e82a6a1dfc72669aa3400625c0582ecaf5
+SIZE (libsdl-org-SDL-3.1.2-9a4fc81_GH0.tar.gz) = 6929806
diff --git a/devel/sdl3/files/patch-CMakeLists.txt b/devel/sdl3/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..a857a412993a
--- /dev/null
+++ b/devel/sdl3/files/patch-CMakeLists.txt
@@ -0,0 +1,36 @@
+--- CMakeLists.txt.orig	2024-06-06 17:59:48 UTC
++++ CMakeLists.txt
+@@ -280,7 +280,7 @@ set_option(SDL_ASSEMBLY            "Enable assembly ro
+ 
+ option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
+ set_option(SDL_ASSEMBLY            "Enable assembly routines" ${SDL_ASSEMBLY_DEFAULT})
+-dep_option(SDL_AVX                 "Use AVX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
++#[[ dep_option(SDL_AVX                 "Use AVX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_AVX2                "Use AVX2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_AVX512F             "Use AVX512F assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_SSE                 "Use SSE assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+@@ -289,7 +289,7 @@ dep_option(SDL_MMX                 "Use MMX assembly r
+ dep_option(SDL_SSE4_1              "Use SSE4.1 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_SSE4_2              "Use SSE4.2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+ dep_option(SDL_MMX                 "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
+-dep_option(SDL_ALTIVEC             "Use Altivec assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_POWERPC32 OR SDL_CPU_POWERPC64" OFF)
++dep_option(SDL_ALTIVEC             "Use Altivec assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_POWERPC32 OR SDL_CPU_POWERPC64" OFF) ]]
+ dep_option(SDL_ARMSIMD             "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
+ dep_option(SDL_ARMNEON             "Use NEON assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF)
+ dep_option(SDL_ARMNEON_BLITTERS    "Use NEON assembly blitters on ARM32" OFF "SDL_VIDEO;SDL_ASSEMBLY;SDL_ARMNEON;SDL_CPU_ARM32" OFF)
+@@ -639,6 +639,7 @@ if(SDL_ASSEMBLY)
+ if(SDL_ASSEMBLY)
+   set(HAVE_ASSEMBLY TRUE)
+ 
++#[[
+   if(SDL_MMX)
+     cmake_push_check_state()
+     if(USE_GCC OR USE_CLANG OR USE_INTELCC)
+@@ -830,6 +831,7 @@ if(SDL_ASSEMBLY)
+       set(HAVE_AVX512F TRUE)
+     endif()
+   endif()
++  ]]
+ 
+   if(USE_GCC OR USE_CLANG)
+     # TODO: Those all seem to be quite GCC specific - needs to be
diff --git a/devel/sdl3/pkg-descr b/devel/sdl3/pkg-descr
new file mode 100644
index 000000000000..a77137b4989f
--- /dev/null
+++ b/devel/sdl3/pkg-descr
@@ -0,0 +1,6 @@
+This library is designed to make it easy to write games that run on UNIX,
+Win32, MacOS X and other platforms using the various native high-performance
+media interfaces (for video, audio, etc) and presenting a single source-code
+level API to your application. This is a fairly low level API, but using this,
+completely portable applications can be written with a great deal of
+flexibility.
diff --git a/devel/sdl3/pkg-plist b/devel/sdl3/pkg-plist
new file mode 100644
index 000000000000..b42b5c6669f8
--- /dev/null
+++ b/devel/sdl3/pkg-plist
@@ -0,0 +1,94 @@
+include/SDL3/SDL.h
+include/SDL3/SDL_assert.h
+include/SDL3/SDL_atomic.h
+include/SDL3/SDL_audio.h
+include/SDL3/SDL_begin_code.h
+include/SDL3/SDL_bits.h
+include/SDL3/SDL_blendmode.h
+include/SDL3/SDL_camera.h
+include/SDL3/SDL_clipboard.h
+include/SDL3/SDL_close_code.h
+include/SDL3/SDL_copying.h
+include/SDL3/SDL_cpuinfo.h
+include/SDL3/SDL_dialog.h
+include/SDL3/SDL_egl.h
+include/SDL3/SDL_endian.h
+include/SDL3/SDL_error.h
+include/SDL3/SDL_events.h
+include/SDL3/SDL_filesystem.h
+include/SDL3/SDL_gamepad.h
+include/SDL3/SDL_guid.h
+include/SDL3/SDL_haptic.h
+include/SDL3/SDL_hidapi.h
+include/SDL3/SDL_hints.h
+include/SDL3/SDL_init.h
+include/SDL3/SDL_intrin.h
+include/SDL3/SDL_iostream.h
+include/SDL3/SDL_joystick.h
+include/SDL3/SDL_keyboard.h
+include/SDL3/SDL_keycode.h
+include/SDL3/SDL_loadso.h
+include/SDL3/SDL_locale.h
+include/SDL3/SDL_log.h
+include/SDL3/SDL_main.h
+include/SDL3/SDL_main_impl.h
+include/SDL3/SDL_messagebox.h
+include/SDL3/SDL_metal.h
+include/SDL3/SDL_misc.h
+include/SDL3/SDL_mouse.h
+include/SDL3/SDL_mutex.h
+include/SDL3/SDL_oldnames.h
+include/SDL3/SDL_opengl.h
+include/SDL3/SDL_opengl_glext.h
+include/SDL3/SDL_opengles.h
+include/SDL3/SDL_opengles2.h
+include/SDL3/SDL_opengles2_gl2.h
+include/SDL3/SDL_opengles2_gl2ext.h
+include/SDL3/SDL_opengles2_gl2platform.h
+include/SDL3/SDL_opengles2_khrplatform.h
+include/SDL3/SDL_pen.h
+include/SDL3/SDL_pixels.h
+include/SDL3/SDL_platform.h
+include/SDL3/SDL_platform_defines.h
+include/SDL3/SDL_power.h
+include/SDL3/SDL_properties.h
+include/SDL3/SDL_rect.h
+include/SDL3/SDL_render.h
+include/SDL3/SDL_revision.h
+include/SDL3/SDL_scancode.h
+include/SDL3/SDL_sensor.h
+include/SDL3/SDL_stdinc.h
+include/SDL3/SDL_storage.h
+include/SDL3/SDL_surface.h
+include/SDL3/SDL_system.h
+include/SDL3/SDL_test.h
+include/SDL3/SDL_test_assert.h
+include/SDL3/SDL_test_common.h
+include/SDL3/SDL_test_compare.h
+include/SDL3/SDL_test_crc32.h
+include/SDL3/SDL_test_font.h
+include/SDL3/SDL_test_fuzzer.h
+include/SDL3/SDL_test_harness.h
+include/SDL3/SDL_test_log.h
+include/SDL3/SDL_test_md5.h
+include/SDL3/SDL_test_memory.h
+include/SDL3/SDL_test_random.h
+include/SDL3/SDL_thread.h
+include/SDL3/SDL_time.h
+include/SDL3/SDL_timer.h
+include/SDL3/SDL_touch.h
+include/SDL3/SDL_version.h
+include/SDL3/SDL_video.h
+include/SDL3/SDL_vulkan.h
+lib/cmake/SDL3/SDL3Config.cmake
+lib/cmake/SDL3/SDL3ConfigVersion.cmake
+lib/cmake/SDL3/SDL3headersTargets.cmake
+lib/cmake/SDL3/SDL3sharedTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL3/SDL3sharedTargets.cmake
+lib/cmake/SDL3/SDL3testTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/SDL3/SDL3testTargets.cmake
+lib/libSDL3.so
+lib/libSDL3.so.0
+lib/libSDL3.so.0.1.2
+lib/libSDL3_test.a
+libdata/pkgconfig/sdl3.pc