Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alsey Coleman Miller <alseycmiller@gmail.com>
To: buildroot@buildroot.org
Cc: Michael Fischer <mf@go-sys.de>,
	Alsey Coleman Miller <alseycmiller@gmail.com>
Subject: [Buildroot] [PATCH 3/8] package/sdl3: add ALSA and test program options, follow dbus
Date: Sun, 16 Aug 2026 15:18:25 -0400	[thread overview]
Message-ID: <20260816191830.533747-4-alseycmiller@gmail.com> (raw)
In-Reply-To: <20260816191830.533747-1-alseycmiller@gmail.com>

SDL_ALSA had no option at all, so whether the ALSA audio driver was
built depended on what SDL's own detection found in the sysroot when it
happened to configure. Add BR2_PACKAGE_SDL3_ALSA and pass
SDL_ALSA_SHARED=OFF with it, so libasound is linked rather than
dlopen()ed - a dlopen leaves nothing in the ELF, and the library is then
absent from the target unless something else pulls it in.

SDL_DBUS was off unconditionally, which loses screensaver inhibition and
the D-Bus parts of the Wayland backend; make it follow BR2_PACKAGE_DBUS.

Add BR2_PACKAGE_SDL3_TESTS for the test programs, which are useful for
checking the video and audio drivers on the target.

Finally, name the backends that were left unset - OSS, JACK, sndio,
PipeWire, RPI - and turn the examples off. SDL probes for each of these
and builds against whatever it finds, so leaving them out makes the
result depend on which unrelated packages are enabled.

Signed-off-by: Alsey Coleman Miller <alseycmiller@gmail.com>
---
 package/sdl3/Config.in | 15 +++++++++++++++
 package/sdl3/sdl3.mk   | 38 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/package/sdl3/Config.in b/package/sdl3/Config.in
index 7bce4ceaba..ed43879862 100644
--- a/package/sdl3/Config.in
+++ b/package/sdl3/Config.in
@@ -75,6 +75,21 @@ config BR2_PACKAGE_SDL3_OPENGLES
 comment "OpenGL ES support needs an OpenGL ES provider"
 	depends on !BR2_PACKAGE_HAS_LIBGLES
 
+config BR2_PACKAGE_SDL3_ALSA
+	bool "ALSA audio"
+	depends on BR2_PACKAGE_ALSA_LIB
+	help
+	  Enable the ALSA audio driver.
+
+comment "ALSA audio needs alsa-lib"
+	depends on !BR2_PACKAGE_ALSA_LIB
+
+config BR2_PACKAGE_SDL3_TESTS
+	bool "build test programs"
+	help
+	  Build and install the SDL3 test programs, which are useful
+	  for checking the video and audio drivers on the target.
+
 endif
 
 comment "sdl3 needs a toolchain w/ dynamic library, threads, wchar"
diff --git a/package/sdl3/sdl3.mk b/package/sdl3/sdl3.mk
index ecbcbf4bc2..7c92ee9bc8 100644
--- a/package/sdl3/sdl3.mk
+++ b/package/sdl3/sdl3.mk
@@ -13,23 +13,59 @@ SDL3_CPE_ID_VENDOR = libsdl
 SDL3_CPE_ID_PRODUCT = simple_directmedia_layer
 SDL3_INSTALL_STAGING = YES
 
+SDL3_DEPENDENCIES = host-pkgconf
+
+# The audio and video backends this does not have a Buildroot option for are
+# named explicitly rather than left out: SDL probes for each of them and
+# builds against whatever it happens to find in the sysroot, so an unlisted
+# backend makes the result depend on which other packages are enabled.
 SDL3_CONF_OPTS = \
-	-DSDL_DBUS=OFF \
 	-DSDL_DUMMYVIDEO=OFF \
+	-DSDL_EXAMPLES=OFF \
 	-DSDL_HIDAPI=OFF \
 	-DSDL_IBUS=OFF \
 	-DSDL_INSTALL_DOCS=OFF \
+	-DSDL_JACK=OFF \
 	-DSDL_JOYSTICK_MFI=OFF \
 	-DSDL_JOYSTICK_VIRTUAL=OFF \
 	-DSDL_OFFSCREEN=OFF \
+	-DSDL_OSS=OFF \
+	-DSDL_PIPEWIRE=OFF \
 	-DSDL_PULSEAUDIO=OFF \
 	-DSDL_RENDER_D3D=OFF \
 	-DSDL_RPATH=OFF \
+	-DSDL_RPI=OFF \
+	-DSDL_SNDIO=OFF \
 	-DSDL_STATIC=ON \
 	-DSDL_UNIX_CONSOLE_BUILD=ON \
 	-DSDL_VIVANTE=OFF \
 	-DSDL_VULKAN=OFF
 
+ifeq ($(BR2_PACKAGE_SDL3_ALSA),y)
+SDL3_DEPENDENCIES += alsa-lib
+# SDL_ALSA_SHARED makes SDL dlopen() libasound at runtime rather than link it,
+# which leaves nothing in the ELF for Buildroot to see and the library absent
+# from the target unless something else pulls it in.
+SDL3_CONF_OPTS += -DSDL_ALSA=ON -DSDL_ALSA_SHARED=OFF
+else
+SDL3_CONF_OPTS += -DSDL_ALSA=OFF
+endif
+
+# SDL uses D-Bus for screensaver inhibition and for parts of the Wayland
+# backend, so it follows dbus rather than being off unconditionally.
+ifeq ($(BR2_PACKAGE_DBUS),y)
+SDL3_DEPENDENCIES += dbus
+SDL3_CONF_OPTS += -DSDL_DBUS=ON
+else
+SDL3_CONF_OPTS += -DSDL_DBUS=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_SDL3_TESTS),y)
+SDL3_CONF_OPTS += -DSDL_TESTS=ON
+else
+SDL3_CONF_OPTS += -DSDL_TESTS=OFF
+endif
+
 # SDL3 fails to build in Thumb mode on some ARM architectures
 ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 SDL3_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2026-08-16 19:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16 19:18 [Buildroot] [PATCH 0/8] package/sdl3*: complete the SDL3 family Alsey Coleman Miller
2026-08-16 19:18 ` [Buildroot] [PATCH 1/8] package/plutovg: new package Alsey Coleman Miller
2026-08-16 19:18 ` [Buildroot] [PATCH 2/8] package/plutosvg: " Alsey Coleman Miller
2026-08-16 19:18 ` Alsey Coleman Miller [this message]
2026-08-16 19:18 ` [Buildroot] [PATCH 4/8] package/sdl3_image: bump to version 3.4.4 Alsey Coleman Miller
2026-08-16 19:18 ` [Buildroot] [PATCH 5/8] package/sdl3_ttf: do not build the samples or install man pages Alsey Coleman Miller
2026-08-16 19:18 ` [Buildroot] [PATCH 6/8] package/sdl3_ttf: build plutosvg support when available Alsey Coleman Miller
2026-08-16 19:18 ` [Buildroot] [PATCH 7/8] package/sdl3_mixer: new package Alsey Coleman Miller
2026-08-16 19:18 ` [Buildroot] [PATCH 8/8] package/sdl3_net: " Alsey Coleman Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260816191830.533747-4-alseycmiller@gmail.com \
    --to=alseycmiller@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=mf@go-sys.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox