[Buildroot] [PATCH 7/8] package/sdl3_mixer: new package

Alsey Coleman Miller <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <[email protected]>
SDL3_mixer is the multi-channel audio mixer library for SDL3. It plays
AIFF, AU, VOC and WAVE, MIDI through the built-in timidity, and MP3,
Ogg Vorbis and FLAC through the bundled dr_mp3, stb_vorbis and dr_flac
decoders, none of which need a dependency.

The better decoders are built when their libraries are already in the
configuration: flac, mpg123, opusfile, wavpack, fluidsynth, libxmp for
modules and game-music-emu for console chiptunes. Ogg Vorbis comes from
vorbisfile or tremor and never both, since upstream errors out when the
two are enabled together, so tremor is used only when libvorbis is
absent.

VENDORED is off so the copies of those libraries in the tarball are not
used, DEPS_SHARED off so they are linked rather than dlopen()ed, and
STRICT on so a decoder that cannot find its library fails the build
instead of being dropped silently.

Built with CMake, like sdl3 itself, rather than with the autotools setup
the SDL2 counterpart uses.

Signed-off-by: Alsey Coleman Miller <[email protected]>
---
 DEVELOPERS                         |   1 +
 package/Config.in                  |   1 +
 package/sdl3_mixer/Config.in       |  17 +++++
 package/sdl3_mixer/sdl3_mixer.hash |   3 +
 package/sdl3_mixer/sdl3_mixer.mk   | 103 +++++++++++++++++++++++++++++
 5 files changed, 125 insertions(+)
 create mode 100644 package/sdl3_mixer/Config.in
 create mode 100644 package/sdl3_mixer/sdl3_mixer.hash
 create mode 100644 package/sdl3_mixer/sdl3_mixer.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 56b01fa5cc..964fe9a597 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -172,6 +172,7 @@ N:	Alsey Coleman Miller <[email protected]>
 F:	package/liblc3/
 F:	package/plutosvg/
 F:	package/plutovg/
+F:	package/sdl3_mixer/
 
 N:	Alvaro G. M <[email protected]>
 F:	package/dcron/
diff --git a/package/Config.in b/package/Config.in
index 5e1601036c..853d3bd07d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -369,6 +369,7 @@ comment "Graphic libraries"
 	source "package/sdl3/Config.in"
 	source "package/sdl3_gfx/Config.in"
 	source "package/sdl3_image/Config.in"
+	source "package/sdl3_mixer/Config.in"
 	source "package/sdl3_ttf/Config.in"
 	source "package/spirv-headers/Config.in"
 	source "package/tk/Config.in"
diff --git a/package/sdl3_mixer/Config.in b/package/sdl3_mixer/Config.in
new file mode 100644
index 0000000000..cfefb4719b
--- /dev/null
+++ b/package/sdl3_mixer/Config.in
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_SDL3_MIXER
+	bool "sdl3_mixer"
+	depends on BR2_PACKAGE_SDL3
+	help
+	  SDL3_mixer is a multi-channel audio mixer library for
+	  SDL3. It plays AIFF, AU, VOC and WAVE samples, MIDI
+	  through the built-in timidity, and MP3, Ogg Vorbis and
+	  FLAC through the bundled dr_mp3, stb_vorbis and dr_flac
+	  decoders.
+
+	  The higher quality decoders are used instead when their
+	  libraries are enabled in the configuration (flac, mpg123,
+	  libvorbis or tremor, opusfile, wavpack, fluidsynth), and
+	  module and console chiptune playback is added by libxmp
+	  and game-music-emu.
+
+	  https://github.com/libsdl-org/SDL_mixer
diff --git a/package/sdl3_mixer/sdl3_mixer.hash b/package/sdl3_mixer/sdl3_mixer.hash
new file mode 100644
index 0000000000..44602037e1
--- /dev/null
+++ b/package/sdl3_mixer/sdl3_mixer.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  182a07c745375e113dc740d43964ff21b0be29f29f59876c4dbc4db3d32f6901  SDL3_mixer-3.2.4.tar.gz
+sha256  e36997fe492c48e7ed873065cc3a694f38e8189a328d3709099ffdc9a8843f4c  LICENSE.txt
diff --git a/package/sdl3_mixer/sdl3_mixer.mk b/package/sdl3_mixer/sdl3_mixer.mk
new file mode 100644
index 0000000000..beff679466
--- /dev/null
+++ b/package/sdl3_mixer/sdl3_mixer.mk
@@ -0,0 +1,103 @@
+################################################################################
+#
+# sdl3_mixer
+#
+################################################################################
+
+SDL3_MIXER_VERSION = 3.2.4
+SDL3_MIXER_SOURCE = SDL3_mixer-$(SDL3_MIXER_VERSION).tar.gz
+SDL3_MIXER_SITE = https://www.libsdl.org/projects/SDL_mixer/release
+SDL3_MIXER_LICENSE = Zlib
+SDL3_MIXER_LICENSE_FILES = LICENSE.txt
+SDL3_MIXER_CPE_ID_VENDOR = libsdl
+SDL3_MIXER_CPE_ID_PRODUCT = sdl_mixer
+SDL3_MIXER_INSTALL_STAGING = YES
+SDL3_MIXER_DEPENDENCIES = sdl3 host-pkgconf
+
+# AIFF, AU, VOC and WAVE, plus the bundled dr_flac, dr_mp3, stb_vorbis and
+# timidity decoders, need no dependency and are left enabled by default.
+# STRICT makes the build fail when a decoder we asked for cannot find its
+# library, instead of silently dropping it. DEPS_SHARED=OFF links the
+# decoder libraries directly rather than dlopen()ing them at runtime.
+SDL3_MIXER_CONF_OPTS = \
+	-DSDLMIXER_VENDORED=OFF \
+	-DSDLMIXER_DEPS_SHARED=OFF \
+	-DSDLMIXER_STRICT=ON \
+	-DSDLMIXER_TESTS=OFF \
+	-DSDLMIXER_EXAMPLES=OFF \
+	-DSDLMIXER_INSTALL_MAN=OFF
+
+ifeq ($(BR2_PACKAGE_GAME_MUSIC_EMU),y)
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_GME=ON
+SDL3_MIXER_DEPENDENCIES += game-music-emu
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_GME=OFF
+endif
+
+# MOD playback goes through libxmp; libxmp-lite is not packaged.
+ifeq ($(BR2_PACKAGE_LIBXMP),y)
+SDL3_MIXER_CONF_OPTS += \
+	-DSDLMIXER_MOD=ON \
+	-DSDLMIXER_MOD_XMP=ON \
+	-DSDLMIXER_MOD_XMP_LITE=OFF
+SDL3_MIXER_DEPENDENCIES += libxmp
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_MOD=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_FLAC),y)
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_FLAC_LIBFLAC=ON
+SDL3_MIXER_DEPENDENCIES += flac
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_FLAC_LIBFLAC=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_MPG123),y)
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_MP3_MPG123=ON
+SDL3_MIXER_DEPENDENCIES += mpg123
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_MP3_MPG123=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_FLUIDSYNTH),y)
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_MIDI_FLUIDSYNTH=ON
+SDL3_MIXER_DEPENDENCIES += fluidsynth
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_MIDI_FLUIDSYNTH=OFF
+endif
+
+# Opus is decoded through opusfile, which pulls in opus and libogg.
+ifeq ($(BR2_PACKAGE_OPUSFILE),y)
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_OPUS=ON
+SDL3_MIXER_DEPENDENCIES += opusfile
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_OPUS=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_WAVPACK),y)
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_WAVPACK=ON
+SDL3_MIXER_DEPENDENCIES += wavpack
+else
+SDL3_MIXER_CONF_OPTS += -DSDLMIXER_WAVPACK=OFF
+endif
+
+# Ogg Vorbis comes from either vorbisfile or tremor, never both; upstream
+# errors out when the two are enabled together. tremor is the integer-only
+# decoder, so it is only used when libvorbis is absent.
+ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
+SDL3_MIXER_CONF_OPTS += \
+	-DSDLMIXER_VORBIS_VORBISFILE=ON \
+	-DSDLMIXER_VORBIS_TREMOR=OFF
+SDL3_MIXER_DEPENDENCIES += libvorbis
+else ifeq ($(BR2_PACKAGE_TREMOR),y)
+SDL3_MIXER_CONF_OPTS += \
+	-DSDLMIXER_VORBIS_VORBISFILE=OFF \
+	-DSDLMIXER_VORBIS_TREMOR=ON
+SDL3_MIXER_DEPENDENCIES += tremor
+else
+SDL3_MIXER_CONF_OPTS += \
+	-DSDLMIXER_VORBIS_VORBISFILE=OFF \
+	-DSDLMIXER_VORBIS_TREMOR=OFF
+endif
+
+$(eval $(cmake-package))
-- 
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.