diff mbox series

[master] libsdl2: Add PACKAGECONFIG option for tests

Message ID 20250819221357.997067-1-a-christidis@ti.com
State New
Headers show
Series [master] libsdl2: Add PACKAGECONFIG option for tests | expand

Commit Message

Antonios Christidis Aug. 19, 2025, 10:13 p.m. UTC
From: Antonios Christidis <a-christidis@ti.com>

The SDL2 software comes with its own set of tests. Create a
PACKAGECONFIG option to enable the building of such.

Signed-off-by: Antonios Christidis <a-christidis@ti.com>
---
 meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Alexander Kanavin Aug. 20, 2025, 7:14 a.m. UTC | #1
On Wed, 20 Aug 2025 at 00:14, Antonios Christidis via
lists.openembedded.org <a-christidis=ti.com@lists.openembedded.org>
wrote:
> +do_install:append() {
> +       if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then
> +               install -d ${D}${bindir}/sdl2_tests
> +               cp -r ${B}/test/* ${D}${bindir}/sdl2_tests
> +
> +               # Delete any leftover cmake files within the sdl2_tests dir
> +               find ${D}${bindir}/sdl2_tests -type f -name "*.cmake" -delete
> +       fi
> +}

The PACKAGECONFIG is okay, but this isn't. If you want to install the
tests, you should also add run-ptest script, ptest package, and ensure
they pass. Ideally, you should also make a patch to sdl that does the
installation and offer that to upstream, rather than do it in a custom
do_install snippet.

Alex
diff mbox series

Patch

diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb
index 98291e0f80..01f834aba9 100644
--- a/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb
+++ b/meta/recipes-graphics/libsdl2/libsdl2_2.32.8.bb
@@ -79,9 +79,20 @@  PACKAGECONFIG[pulseaudio] = "-DSDL_PULSEAUDIO=ON,-DSDL_PULSEAUDIO=OFF,pulseaudio
 PACKAGECONFIG[vulkan]    = "-DSDL_VULKAN=ON,-DSDL_VULKAN=OFF"
 PACKAGECONFIG[wayland]    = "-DSDL_WAYLAND=ON,-DSDL_WAYLAND=OFF,wayland-native wayland wayland-protocols libxkbcommon"
 PACKAGECONFIG[x11]        = "-DSDL_X11=ON,-DSDL_X11=OFF,virtual/libx11 libxext libxrandr libxrender"
+PACKAGECONFIG[tests]      = "-DSDL_TESTS=ON,-DSDL_TESTS=OFF"
 
 CFLAGS:append:class-native = " -DNO_SHARED_MEMORY"
 
+do_install:append() {
+	if ${@bb.utils.contains('PACKAGECONFIG', 'tests', 'true', 'false', d)}; then
+		install -d ${D}${bindir}/sdl2_tests
+		cp -r ${B}/test/* ${D}${bindir}/sdl2_tests
+
+		# Delete any leftover cmake files within the sdl2_tests dir
+		find ${D}${bindir}/sdl2_tests -type f -name "*.cmake" -delete
+	fi
+}
+
 FILES:${PN} += "${datadir}/licenses/SDL2/LICENSE.txt"
 
 BBCLASSEXTEND = "native nativesdk"