commit:     479af026b82f5c3a17a945092b7cf85381c2be7d
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  2 02:48:07 2025 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Tue Sep  2 03:44:40 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=479af026

media-libs/libsdl3: add 3.2.22

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 media-libs/libsdl3/Manifest                        |   1 +
 .../libsdl3/files/libsdl3-3.2.22-openvr.patch      |  16 ++
 media-libs/libsdl3/libsdl3-3.2.22.ebuild           | 193 +++++++++++++++++++++
 3 files changed, 210 insertions(+)

diff --git a/media-libs/libsdl3/Manifest b/media-libs/libsdl3/Manifest
index 8f75a2222864..182c13a341f0 100644
--- a/media-libs/libsdl3/Manifest
+++ b/media-libs/libsdl3/Manifest
@@ -1 +1,2 @@
 DIST SDL3-3.2.20.tar.gz 15895143 BLAKE2B 
343b7f7c4569607efbf1cadfcbc23f328fe78a5e9b8c07ad0010d7333f6654e2595252ab17d0dbfb5bf9b4e93914ffc1167bcb523c526d448001b700d8e7af81
 SHA512 
ce3fbf7cb04c90e1a8e7769538543b4ad98673e6a0801410c2505d686375bc33392330852db6b84d53d09535a29fea8addb2b9f3680f6887e57d99c12e61b4c8
+DIST SDL3-3.2.22.tar.gz 15895755 BLAKE2B 
10f8f09c944c6c8b8de3aa381b6f859f13bad95e92c5aa57ef5b1da503bb14e1bab155956a5342c771d4fda0edc9d320ecefd33851b0c89adb9786d17c1d1663
 SHA512 
e19f02c9b4c4f8029d9ba59c84c2cf90cacbcb4a8b79aff90316313cbfde5a54821e0e785300c04d71a498cf85e8fae9519aeb60abac4a1f78d185026cd88f66

diff --git a/media-libs/libsdl3/files/libsdl3-3.2.22-openvr.patch 
b/media-libs/libsdl3/files/libsdl3-3.2.22-openvr.patch
new file mode 100644
index 000000000000..da3d1a5998ff
--- /dev/null
+++ b/media-libs/libsdl3/files/libsdl3-3.2.22-openvr.patch
@@ -0,0 +1,16 @@
+Not looked into what led to this "Fixed build" commit[1] (maybe compatibility
+with another compiler due to that scoped declaration higher up), but it instead
+breaks it for us with both gcc and clang. Quick revert for now.
+
+SDL_openvrvideo.c:1543:5: error: 'hint' undeclared (first use in this function)
+
+[1] 
https://github.com/libsdl-org/SDL/commit/08c82a37814386be38bec7524ec57ff0e548be0b
+--- a/src/video/openvr/SDL_openvrvideo.c
++++ b/src/video/openvr/SDL_openvrvideo.c
+@@ -1541,5 +1541,5 @@
+     }
+ 
+-    hint = SDL_GetHint("SDL_OPENVR_INPUT_PROFILE");
++    const char *hint = SDL_GetHint("SDL_OPENVR_INPUT_PROFILE");
+     char *loadpath = 0;
+     EVRInputError err;

diff --git a/media-libs/libsdl3/libsdl3-3.2.22.ebuild 
b/media-libs/libsdl3/libsdl3-3.2.22.ebuild
new file mode 100644
index 000000000000..27caf2aaa923
--- /dev/null
+++ b/media-libs/libsdl3/libsdl3-3.2.22.ebuild
@@ -0,0 +1,193 @@
+# Copyright 2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake-multilib dot-a
+
+DESCRIPTION="Simple Direct Media Layer"
+HOMEPAGE="https://www.libsdl.org/";
+SRC_URI="https://www.libsdl.org/release/SDL3-${PV}.tar.gz";
+S=${WORKDIR}/SDL3-${PV}
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86"
+
+IUSE="
+       X alsa aqua dbus doc ibus io-uring jack kms opengl oss pipewire
+       pulseaudio sndio test udev usb vulkan wayland
+       cpu_flags_ppc_altivec cpu_flags_x86_avx cpu_flags_x86_avx2
+       cpu_flags_x86_avx512f cpu_flags_x86_mmx cpu_flags_x86_sse
+       cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_sse4_1
+       cpu_flags_x86_sse4_2
+"
+REQUIRED_USE="
+       ibus? ( dbus )
+       kms? ( opengl )
+       wayland? ( opengl )
+"
+RESTRICT="!test? ( test )"
+
+# dlopen/dbus-only: dbus, ibus, libudev, liburing, vulkan-loader
+RDEPEND="
+       virtual/libiconv[${MULTILIB_USEDEP}]
+       X? (
+               x11-libs/libX11[${MULTILIB_USEDEP}]
+               x11-libs/libXScrnSaver[${MULTILIB_USEDEP}]
+               x11-libs/libXcursor[${MULTILIB_USEDEP}]
+               x11-libs/libXext[${MULTILIB_USEDEP}]
+               x11-libs/libXfixes[${MULTILIB_USEDEP}]
+               x11-libs/libXi[${MULTILIB_USEDEP}]
+               x11-libs/libXrandr[${MULTILIB_USEDEP}]
+       )
+       alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+       dbus? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+       ibus? ( app-i18n/ibus )
+       io-uring? ( sys-libs/liburing:=[${MULTILIB_USEDEP}] )
+       jack? ( virtual/jack[${MULTILIB_USEDEP}] )
+       kms? (
+               media-libs/mesa[gbm(+),${MULTILIB_USEDEP}]
+               x11-libs/libdrm[${MULTILIB_USEDEP}]
+       )
+       opengl? ( media-libs/libglvnd[X?,${MULTILIB_USEDEP}] )
+       pipewire? ( media-video/pipewire:=[${MULTILIB_USEDEP}] )
+       pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
+       sndio? ( media-sound/sndio:=[${MULTILIB_USEDEP}] )
+       udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+       usb? ( virtual/libusb:1[${MULTILIB_USEDEP}] )
+       wayland? (
+               dev-libs/wayland[${MULTILIB_USEDEP}]
+               gui-libs/libdecor[${MULTILIB_USEDEP}]
+               x11-libs/libxkbcommon[${MULTILIB_USEDEP}]
+       )
+       vulkan? ( media-libs/vulkan-loader[${MULTILIB_USEDEP}] )
+"
+DEPEND="
+       ${RDEPEND}
+       X? ( x11-base/xorg-proto )
+       test? (
+               dev-util/vulkan-headers
+               media-libs/libglvnd
+       )
+       vulkan? ( dev-util/vulkan-headers )
+"
+BDEPEND="
+       doc? (
+               app-text/doxygen
+               media-gfx/graphviz
+       )
+       wayland? ( dev-util/wayland-scanner )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-openvr.patch
+)
+
+src_prepare() {
+       cmake_src_prepare
+
+       # unbundle libglvnd and vulkan headers
+       rm -r src/video/khronos || die
+       ln -s -- "${ESYSROOT}"/usr/include src/video/khronos || die
+}
+
+src_configure() {
+       lto-guarantee-fat
+
+       local mycmakeargs=(
+               -DSDL_ASSERTIONS=disabled
+               -DSDL_DBUS=$(usex dbus)
+               -DSDL_DEPS_SHARED=no # link rather than dlopen() where possible
+               -DSDL_LIBURING=$(usex io-uring)
+               -DSDL_RPATH=no
+               -DSDL_STATIC=no
+               -DSDL_TESTS=$(usex test)
+
+               # audio
+               -DSDL_ALSA=$(usex alsa)
+               -DSDL_JACK=$(usex jack)
+               -DSDL_OSS=$(usex oss)
+               -DSDL_PIPEWIRE=$(usex pipewire)
+               -DSDL_PULSEAUDIO=$(usex pulseaudio)
+               -DSDL_SNDIO=$(usex sndio)
+
+               # input
+               -DSDL_HIDAPI_LIBUSB=$(usex usb)
+               -DSDL_IBUS=$(use ibus)
+               -DSDL_LIBUDEV=$(usex udev)
+
+               # video
+               -DSDL_COCOA=$(usex aqua)
+               -DSDL_DIRECTX=no
+               -DSDL_KMSDRM=$(usex kms)
+               -DSDL_OPENGL=$(usex opengl)
+               -DSDL_OPENGLES=$(usex opengl)
+               # openvr is not packaged, but support only needs libglvnd 
(dlopen)
+               -DSDL_OPENVR=$(usex opengl)
+               -DSDL_ROCKCHIP=no
+               -DSDL_RPI=no
+               -DSDL_VIVANTE=no
+               -DSDL_VULKAN=$(usex vulkan)
+               -DSDL_WAYLAND=$(usex wayland)
+               -DSDL_X11=$(usex X)
+               # SDL disallows this by default, allow it but warn in 
pkg_postinst
+               $(use !X && use !wayland && echo -DSDL_UNIX_CONSOLE_BUILD=yes)
+
+               # cpu instruction sets
+               -DSDL_ALTIVEC=$(usex cpu_flags_ppc_altivec)
+               -DSDL_AVX=$(usex cpu_flags_x86_avx)
+               -DSDL_AVX2=$(usex cpu_flags_x86_avx2)
+               -DSDL_AVX512F=$(usex cpu_flags_x86_avx512f)
+               -DSDL_MMX=$(usex cpu_flags_x86_mmx)
+               -DSDL_SSE=$(usex cpu_flags_x86_sse)
+               -DSDL_SSE2=$(usex cpu_flags_x86_sse2)
+               -DSDL_SSE3=$(usex cpu_flags_x86_sse3)
+               -DSDL_SSE4_1=$(usex cpu_flags_x86_sse4_1)
+               -DSDL_SSE4_2=$(usex cpu_flags_x86_sse4_2)
+       )
+
+       cmake-multilib_src_configure
+}
+
+src_compile() {
+       cmake-multilib_src_compile
+
+       if use doc; then
+               cd docs && doxygen || die
+       fi
+}
+
+src_test() {
+       unset "${!SDL_@}" # ignore users' preferences for tests
+
+       cmake-multilib_src_test
+}
+
+src_install() {
+       local DOCS=( {BUGS,WhatsNew}.txt {CREDITS,README}.md docs/*.md )
+       cmake-multilib_src_install
+
+       strip-lto-bytecode
+
+       rm -r -- "${ED}"/usr/share/licenses || die
+
+       use doc && dodoc -r docs/output/html/
+}
+
+pkg_postinst() {
+       # skipping audio/video can make sense given many packages only use SDL
+       # for input, but still warn given off-by-default and may be unexpected
+       if use !X && use !aqua && use !kms && use !wayland; then
+               ewarn
+               ewarn "All typical display drivers (e.g. USE=wayland) are 
disabled,"
+               ewarn "applications using SDL for display may not function 
properly."
+       fi
+
+       if use !alsa && use !jack && use !oss && use !pipewire &&
+               use !pulseaudio && use !sndio; then
+               ewarn
+               ewarn "All typical audio drivers (e.g. USE=pipewire) are 
disabled,"
+               ewarn "applications using SDL for audio may not function 
properly."
+       fi
+}

Reply via email to