Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
---
v1 -> v2: - added a patch to select opengl dependency
          - removed extra space on _LDFLAGS
          - replaced customloops with foreach

 ...0001-sdl-2.0.8-tests-confiure-opengl.patch | 168 +++++++++++++++++
 patches/SDL2_test-2.0.8/series                |   4 +
 rules/sdl2-test.in                            |  11 ++
 rules/sdl2-test.make                          | 172 ++++++++++++++++++
 4 files changed, 355 insertions(+)
 create mode 100644 
patches/SDL2_test-2.0.8/0001-sdl-2.0.8-tests-confiure-opengl.patch
 create mode 100644 patches/SDL2_test-2.0.8/series
 create mode 100644 rules/sdl2-test.in
 create mode 100644 rules/sdl2-test.make

diff --git a/patches/SDL2_test-2.0.8/0001-sdl-2.0.8-tests-confiure-opengl.patch 
b/patches/SDL2_test-2.0.8/0001-sdl-2.0.8-tests-confiure-opengl.patch
new file mode 100644
index 000000000..9583b6a05
--- /dev/null
+++ b/patches/SDL2_test-2.0.8/0001-sdl-2.0.8-tests-confiure-opengl.patch
@@ -0,0 +1,168 @@
+From: Jaret Cantu <jaret.ca...@timesys.com>
+Date: Tue, 16 Jan 2018 12:16:16 -0500
+Subject: [PATCH] sdl-2.0.8: tests: confiure opengl
+
+    Allow OpenGL to be configured manually
+
+    The autodetection uses the presence of a header file which
+    SDL2 always installs, regardless of whether or not OpenGL was
+    enabled.  This causes the SDL2 tests to use OpenGL when SDL2
+    itself was not configured for it.
+
+    Configure certain tests not to build, depending on the
+    configuration.  Tests which require OpenGL development files
+    will fail when no OpenGL is detected (which should be obvious,
+    but it apparently wasn't for whoever designed this).
+---
+ test/Makefile.in | 10 ++++++----
+ test/configure   | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 63 insertions(+), 4 deletions(-)
+
+diff --git a/test/Makefile.in b/test/Makefile.in
+index bc9c24ab92db..6f16fceb47a4 100644
+--- a/test/Makefile.in
++++ b/test/Makefile.in
+@@ -28,9 +28,6 @@ TARGETS = \
+       testfilesystem$(EXE) \
+       testgamecontroller$(EXE) \
+       testgesture$(EXE) \
+-      testgl2$(EXE) \
+-      testgles$(EXE) \
+-      testgles2$(EXE) \
+       testhaptic$(EXE) \
+       testhittesting$(EXE) \
+       testhotplug$(EXE) \
+@@ -55,7 +52,6 @@ TARGETS = \
+       testrumble$(EXE) \
+       testscale$(EXE) \
+       testsem$(EXE) \
+-      testshader$(EXE) \
+       testshape$(EXE) \
+       testsprite2$(EXE) \
+       testspriteminimal$(EXE) \
+@@ -69,6 +65,12 @@ TARGETS = \
+       testyuv$(EXE) \
+       torturethread$(EXE) \
+       
++@HAVE_GL_TRUE@TARGETS+= testshader$(EXE) testgl2$(EXE)
++
++@HAVE_GLES_TRUE@TARGETS+= testgles$(EXE)
++
++@HAVE_GLES2_TRUE@TARGETS+= testgles2$(EXE)
++
+ all: Makefile $(TARGETS) copydatafiles
+ 
+ Makefile: $(srcdir)/Makefile.in
+diff --git a/test/configure b/test/configure
+index 61c32fba1bec..d7468613e439 100755
+--- a/test/configure
++++ b/test/configure
+@@ -589,6 +589,12 @@ XLIB
+ GLES2LIB
+ GLESLIB
+ GLLIB
++HAVE_GLES_TRUE
++HAVE_GLES_FALSE
++HAVE_GLES2_TRUE
++HAVE_GLES2_FALSE
++HAVE_GL_TRUE
++HAVE_GL_FALSE
+ CPP
+ XMKMF
+ SDL_CONFIG
+@@ -661,6 +667,9 @@ ac_user_opts='
+ enable_option_checking
+ with_sdl_prefix
+ with_sdl_exec_prefix
++enable_gles1
++enable_gles2
++enable_opengl
+ enable_sdltest
+ with_x
+ '
+@@ -3812,6 +3821,7 @@ fi
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL support" >&5
+ $as_echo_n "checking for OpenGL support... " >&6; }
++if test x$enable_opengl = x; then
+ have_opengl=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+@@ -3833,11 +3843,27 @@ have_opengl=yes
+ 
+ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
++else
++
++have_opengl=$enable_opengl
++
++fi
++
++if test x$have_opengl = xyes; then
++  HAVE_GL_TRUE=
++  HAVE_GL_FALSE='#'
++else
++  HAVE_GL_TRUE='#'
++  HAVE_GL_FALSE=
++fi
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5
+ $as_echo "$have_opengl" >&6; }
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES support" >&5
+ $as_echo_n "checking for OpenGL ES support... " >&6; }
++if test x$enable_gles1 = x; then
+ have_opengles=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+@@ -3863,11 +3889,27 @@ have_opengles=yes
+ 
+ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
++else
++
++have_opengles=$enable_gles1
++
++fi
++
++if test x$have_opengles = xyes; then
++  HAVE_GLES_TRUE=
++  HAVE_GLES_FALSE='#'
++else
++  HAVE_GLES_TRUE='#'
++  HAVE_GLES_FALSE=
++fi
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5
+ $as_echo "$have_opengles" >&6; }
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5
+ $as_echo_n "checking for OpenGL ES2 support... " >&6; }
++if test x$enable_gles2 = x; then
+ have_opengles2=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+@@ -3895,6 +3937,21 @@ have_opengles2=yes
+ 
+ fi
+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++
++else
++
++have_opengles2=$enable_gles2
++
++fi
++
++if test x$have_opengles2 = xyes; then
++  HAVE_GLES2_TRUE=
++  HAVE_GLES2_FALSE='#'
++else
++  HAVE_GLES2_TRUE='#'
++  HAVE_GLES2_FALSE=
++fi
++
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5
+ $as_echo "$have_opengles2" >&6; }
+ 
diff --git a/patches/SDL2_test-2.0.8/series b/patches/SDL2_test-2.0.8/series
new file mode 100644
index 000000000..2b00568e6
--- /dev/null
+++ b/patches/SDL2_test-2.0.8/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-sdl-2.0.8-tests-confiure-opengl.patch
+# 9ab87edfe61979b30ca249a22add3cf4  - git-ptx-patches magic
diff --git a/rules/sdl2-test.in b/rules/sdl2-test.in
new file mode 100644
index 000000000..f822c965c
--- /dev/null
+++ b/rules/sdl2-test.in
@@ -0,0 +1,11 @@
+## SECTION=multimedia_sdl
+
+config SDL2_TEST
+       tristate
+       prompt "SDL2 test"
+       select SDL2
+       help
+         Simple DirectMedia Layer is a cross-platform multimedia
+         library designed to provide low level access to audio,
+         keyboard, mouse, joystick, 3D hardware via OpenGL, and
+         2D video framebuffer.
diff --git a/rules/sdl2-test.make b/rules/sdl2-test.make
new file mode 100644
index 000000000..9b4fd6dc3
--- /dev/null
+++ b/rules/sdl2-test.make
@@ -0,0 +1,172 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2018 by Michael Grzeschik
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_SDL2_TEST) += sdl2-test
+
+#
+# Paths and names
+#
+SDL2_TEST_VERSION      = $(SDL2_VERSION)
+SDL2_TEST_MD5          = $(SDL2_MD5)
+SDL2_TEST              = SDL2_test-$(SDL2_VERSION)
+SDL2_TEST_SUFFIX       = $(SDL2_SUFFIX)
+SDL2_TEST_URL          = $(SDL2_URL)
+SDL2_TEST_SOURCE       = $(SDL2_SOURCE)
+SDL2_TEST_DIR          = $(BUILDDIR)/$(SDL2_TEST)
+SDL2_TEST_SUBDIR       := test
+SDL2_TESTS_LICENSE     := zlib
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+SDL2_TEST_ENV          := \
+       $(CROSS_ENV) \
+       SDL_LIBS="-lSDL2 -lunwind -lunwind-generic"
+
+#
+# autoconf
+#
+SDL2_TEST_CONF_TOOL    := autoconf
+SDL2_TEST_CONF_OPT     := \
+       $(CROSS_AUTOCONF_USR) \
+       --$(call ptx/endis,PTXCONF_SDL2_OPENGL)-opengl \
+       --$(call ptx/endis,PTXCONF_SDL2_OPENGLES1)-gles1 \
+       --$(call ptx/endis,PTXCONF_SDL2_OPENGLES2)-gles2
+
+ifdef PTXCONF_SDL2_PULSEAUDIO
+SDL2_TEST_LDFLAGS      := \
+       -Wl,-rpath-link,$(SYSROOT)/usr/lib/pulseaudio
+endif
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+SDL2_TEST_TOOLS := \
+       checkkeys \
+       controllermap \
+       loopwave \
+       loopwavequeue \
+       testatomic \
+       testaudiocapture \
+       testaudiohotplug \
+       testaudioinfo \
+       testautomation \
+       testbounds \
+       testcustomcursor \
+       testdisplayinfo \
+       testdraw2 \
+       testdrawchessboard \
+       testdropfile \
+       testerror \
+       testfile \
+       testfilesystem \
+       testgamecontroller \
+       testgesture \
+       testhaptic \
+       testhittesting \
+       testhotplug \
+       testiconv \
+       testime \
+       testintersections \
+       testjoystick \
+       testkeys \
+       testloadso \
+       testlock \
+       testmessage \
+       testmultiaudio \
+       testnative \
+       testoverlay2 \
+       testplatform \
+       testpower \
+       testqsort \
+       testrelative \
+       testrendercopyex \
+       testrendertarget \
+       testresample \
+       testrumble \
+       testscale \
+       testsem \
+       testshape \
+       testsprite2 \
+       testspriteminimal \
+       teststreaming \
+       testthread \
+       testtimer \
+       testver \
+       testviewport \
+       testvulkan \
+       testwm2 \
+       testyuv \
+       torturethread
+
+ifdef PTXCONF_SDL2_OPENGL
+SDL2_TEST_TOOLS += \
+       testgl2 \
+       testshader
+endif
+
+ifdef PTXCONF_SDL2_OPENGLES1
+SDL2_TEST_TOOLS += testgles
+endif
+
+ifdef PTXCONF_SDL2_OPENGLES2
+SDL2_TEST_TOOLS += testgles2
+endif
+
+SDL2_TEST_DATA := \
+       axis.bmp \
+       button.bmp \
+       controllermap.bmp \
+       icon.bmp \
+       sample.bmp \
+       testyuv.bmp \
+       sample.wav \
+       picture.xbm
+
+$(STATEDIR)/sdl2-test.install:
+       @$(call targetinfo)
+       @$(foreach file, $(SDL2_TEST_TOOLS), \
+            install -vD -m 0755 $(SDL2_TEST_DIR)/$(SDL2_TEST_SUBDIR)/$(file) \
+              $(SDL2_TEST_PKGDIR)/usr/bin/$(file)$(ptx/nl))
+       @$(foreach file, $(SDL2_TEST_DATA), \
+            install -vD -m 0644 $(SDL2_TEST_DIR)/$(SDL2_TEST_SUBDIR)/$(file) \
+              $(SDL2_TEST_PKGDIR)/usr/bin/$(file)$(ptx/nl))
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/sdl2-test.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init, sdl2-test)
+       @$(call install_fixup, sdl2-test,PRIORITY,optional)
+       @$(call install_fixup, sdl2-test,SECTION,base)
+       @$(call install_fixup, sdl2-test,AUTHOR,"Michael Grzeschik 
<m...@pengutronix.de>")
+       @$(call install_fixup, sdl2-test,DESCRIPTION,missing)
+
+       @$(foreach file, $(SDL2_TEST_TOOLS), \
+               $(call install_copy, sdl2-test, 0, 0, 755, 
$(SDL2_TEST_PKGDIR)/usr/bin/$(file), \
+                               /usr/bin/sdl2-$(file))$(ptx/nl))
+
+       @$(foreach file, $(SDL2_TEST_DATA), \
+               $(call install_copy, sdl2-test, 0, 0, 644, -, 
/usr/bin/$(file))$(ptx/nl))
+
+       @$(call install_finish, sdl2-test)
+
+       @$(call touch)
+
+# vim: syntax=make
-- 
2.18.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to