Skip to contentSkip to conversation

package/sdl2: enable opengl support

PATCH New Romain Naour 2 participants 4 messages Feb 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 package/sdl2: enable opengl support

OpenGl support mean GLX so it require X11 support. Select automatically BR2_PACKAGE_SDL2_X11 to enable minimal X11 libraries support (libx11 and libxext).

---
v3: select BR2_PACKAGE_SDL2_X11 (ThomasP)

---
 package/sdl2/Config.in | 11 +++++++++++
 package/sdl2/sdl2.mk   |  8 +++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
package/sdl2/Config.in +11 -0
index 8fc14ee..6345133 100644
@@ -29,6 +29,17 @@ comment "X11 video driver needs X.org"
 	depends on !BR2_PACKAGE_XORG7
 	depends on BR2_USE_MMU
 
+config BR2_PACKAGE_SDL2_OPENGL
+	bool "OpenGL (GLX)"
+	depends on BR2_PACKAGE_HAS_LIBGL
+	depends on BR2_PACKAGE_XORG7
+	depends on BR2_USE_MMU # X11 video driver
+	select BR2_PACKAGE_SDL2_X11
+
+comment "OpenGL support needs X11 and an OpenGL provider"
+	depends on BR2_USE_MMU
+	depends on !BR2_PACKAGE_HAS_LIBGL || !BR2_PACKAGE_XORG7
+
 endif
 
 comment "sdl2 needs a toolchain w/ dynamic library"
package/sdl2/sdl2.mk +7 -1
index 2ec12e6..3f210f8 100644
@@ -18,7 +18,6 @@ SDL2_CONF_OPTS += \
 	--disable-esd \
 	--disable-dbus \
 	--disable-pulseaudio \
-	--disable-video-opengl \
 	--disable-video-opengles \
 	--disable-video-wayland
 
@@ -99,6 +98,13 @@ else
 SDL2_CONF_OPTS += --disable-video-x11 --without-x
 endif
 
+ifeq ($(BR2_PACKAGE_SDL2_OPENGL),y)
+SDL2_CONF_OPTS += --enable-video-opengl
+SDL2_DEPENDENCIES += libgl
+else
+SDL2_CONF_OPTS += --disable-video-opengl
+endif
+
 ifeq ($(BR2_PACKAGE_TSLIB),y)
 SDL2_DEPENDENCIES += tslib
 SDL2_CONF_OPTS += --enable-input-tslib
Signature · 1 line
2.9.3
#1 lore raw

PATCH v3 2/3 package/sdl2: enable OpenGL ES support

---
 package/sdl2/Config.in | 7 +++++++
 package/sdl2/sdl2.mk   | 8 +++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
package/sdl2/Config.in +7 -0
index 6345133..a2971ed 100644
@@ -40,6 +40,13 @@ comment "OpenGL support needs X11 and an OpenGL provider"
 	depends on BR2_USE_MMU
 	depends on !BR2_PACKAGE_HAS_LIBGL || !BR2_PACKAGE_XORG7
 
+config BR2_PACKAGE_SDL2_OPENGLES
+	bool "OpenGL ES"
+	depends on BR2_PACKAGE_HAS_LIBGLES
+
+comment "OpenGL ES support needs an OpenGL ES provider"
+	depends on !BR2_PACKAGE_HAS_LIBGLES
+
 endif
 
 comment "sdl2 needs a toolchain w/ dynamic library"
package/sdl2/sdl2.mk +7 -1
index 3f210f8..d2ee50d 100644
@@ -18,7 +18,6 @@ SDL2_CONF_OPTS += \
 	--disable-esd \
 	--disable-dbus \
 	--disable-pulseaudio \
-	--disable-video-opengles \
 	--disable-video-wayland
 
 # We must enable static build to get compilation successful.
@@ -105,6 +104,13 @@ else
 SDL2_CONF_OPTS += --disable-video-opengl
 endif
 
+ifeq ($(BR2_PACKAGE_SDL2_OPENGLES),y)
+SDL2_CONF_OPTS += --enable-video-opengles
+SDL2_DEPENDENCIES += libgles
+else
+SDL2_CONF_OPTS += --disable-video-opengles
+endif
+
 ifeq ($(BR2_PACKAGE_TSLIB),y)
 SDL2_DEPENDENCIES += tslib
 SDL2_CONF_OPTS += --enable-input-tslib
Signature · 1 line
2.9.3
#2 lore raw

PATCH v3 3/3 package/lugaru: new package

In reply to Romain Naour

Lugaru needs SDL2 library with OpenGL support which require X11 support. Otherwise Lugaru error out with "No dynamic GL support in video driver" message.

https://osslugaru.gitlab.io/

---
v3: drom custom CMAKE_INSTALL_<foo>DIR
add dependency BR2_USE_MMU
v2: bump to v1.2
fix build issue due an invalid conversion
fix musl issue on x86 x86_64 with incompatible posix_memalign declaration (pkg-test).
Build tested with pkg-test and coding style verified by check-package (v1).

---
 DEVELOPERS                                         |  1 +
 package/Config.in                                  |  1 +
 .../0001-ImageIO-fix-invalid-conversion.patch      | 35 ++++++++++++++++++++
 package/lugaru/Config.in                           | 38 ++++++++++++++++++++++
 package/lugaru/lugaru.hash                         |  2 ++
 package/lugaru/lugaru.mk                           | 30 +++++++++++++++++
 6 files changed, 107 insertions(+)
 create mode 100644 package/lugaru/0001-ImageIO-fix-invalid-conversion.patch
 create mode 100644 package/lugaru/Config.in
 create mode 100644 package/lugaru/lugaru.hash
 create mode 100644 package/lugaru/lugaru.mk
DEVELOPERS +1 -0
index 09a0a6e..c80fdb4 100644
@@ -1282,6 +1282,7 @@ F:	package/expedite/
 F:	package/iqvlinux/
 F:	package/liblinear/
 F:	package/linux-syscall-support/
+F:	package/lugaru/
 F:	package/mcelog/
 F:	package/openpowerlink/
 F:	package/stress-ng/
package/Config.in +1 -0
index deff0fe..aad0842 100644
@@ -222,6 +222,7 @@ menu "Games"
 	source "package/gnuchess/Config.in"
 	source "package/lbreakout2/Config.in"
 	source "package/ltris/Config.in"
+	source "package/lugaru/Config.in"
 	source "package/opentyrian/Config.in"
 	source "package/opentyrian-data/Config.in"
 	source "package/prboom/Config.in"
package/lugaru/0001-ImageIO-fix-invalid-conversion.patch new file +35 -0
new file mode 100644
index 0000000..6096477
@@ -0,0 +1,35 @@
+From 73e56ba8e91b6bae59220e6f25c1b7c15817edb5 Mon Sep 17 00:00:00 2001
+From: Romain Naour <[email protected]>
+Date: Sun, 12 Feb 2017 21:17:44 +0100
+Subject: [PATCH] ImageIO: fix invalid conversion
+
+Fixes:
+Source/Utils/ImageIO.cpp:125:27: error: invalid conversion from 'int' to 'boolean' [-fpermissive]
+     cinfo.quantize_colors = 0;
+                           ^
+
+quantize_colors type is bool, so it must be initialized to TRUE or FALSE.
+
+Patch status: upsteam
+
+Signed-off-by: Romain Naour <[email protected]>
+---
+ Source/Utils/ImageIO.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Source/Utils/ImageIO.cpp b/Source/Utils/ImageIO.cpp
+index 706c201..c19a63e 100644
+--- a/Source/Utils/ImageIO.cpp
++++ b/Source/Utils/ImageIO.cpp
+@@ -122,7 +122,7 @@ static bool load_jpg(const char* file_name, ImageRec& tex)
+     (void)jpeg_read_header(&cinfo, TRUE);
+ 
+     cinfo.out_color_space = JCS_RGB;
+-    cinfo.quantize_colors = 0;
++    cinfo.quantize_colors = FALSE;
+     (void)jpeg_calc_output_dimensions(&cinfo);
+     (void)jpeg_start_decompress(&cinfo);
+ 
+-- 
+2.9.3
+
package/lugaru/Config.in new file +38 -0
new file mode 100644
index 0000000..521c89a
@@ -0,0 +1,38 @@
+config BR2_PACKAGE_LUGARU
+	bool "lugaru"
+	depends on BR2_INSTALL_LIBSTDCPP
+	depends on BR2_PACKAGE_HAS_LIBGL # libglu
+	depends on BR2_PACKAGE_OPENAL_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_XORG7 # SDL2 OpenGL (GLX)
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11
+	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # openal
+	depends on BR2_USE_MMU # SDL2 OpenGL (GLX)
+	depends on !BR2_STATIC_LIBS # SDL2
+	select BR2_PACKAGE_JPEG
+	select BR2_PACKAGE_LIBGLU # GL/glu.h
+	select BR2_PACKAGE_LIBPNG
+	select BR2_PACKAGE_LIBVORBIS
+	select BR2_PACKAGE_OPENAL
+	select BR2_PACKAGE_SDL2
+	select BR2_PACKAGE_SDL2_OPENGL
+	select BR2_PACKAGE_ZLIB
+	help
+	  Lugaru (pronounced Loo-GAH-roo) is a cross-platform
+	  third-person action game. The main character, Turner, is an
+	  anthropomorphic rebel bunny rabbit with impressive combat
+	  skills. In his quest to find those responsible for
+	  slaughtering his village, he uncovers a far-reaching
+	  conspiracy involving the corrupt leaders of the rabbit
+	  republic and the starving wolves from a nearby den. Turner
+	  takes it upon himself to fight against their plot and save
+	  his fellow rabbits from slavery.
+
+	  https://osslugaru.gitlab.io/
+
+comment "lugaru needs X11 and a toolchain w/ C++, OpenGL backend, gcc >= 4.7, NPTL, dynamic library"
+	depends on BR2_PACKAGE_OPENAL_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_XORG7
+	depends on BR2_USE_MMU
+	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_PACKAGE_HAS_LIBGL || \
+		!BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 || !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \
+		BR2_STATIC_LIBS
package/lugaru/lugaru.hash new file +2 -0
new file mode 100644
index 0000000..6ba2bca
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 f3ea477caf78911c69939fbdc163f9f6517c7ef2267e716a0e050be1a166ef97 lugaru-1.2.tar.xz
package/lugaru/lugaru.mk new file +30 -0
new file mode 100644
index 0000000..7704931
@@ -0,0 +1,30 @@
+################################################################################
+#
+# lugaru
+#
+################################################################################
+
+LUGARU_VERSION = 1.2
+LUGARU_SITE = https://bitbucket.org/osslugaru/lugaru/downloads
+LUGARU_SOURCE = lugaru-$(LUGARU_VERSION).tar.xz
+
+LUGARU_LICENSE = GPLv2+, CC-BY-SA-3.0 (Wolfire and Slib assets), \
+	CC-BY-SA-4.0 (OSS Lugaru, Jendraz and Philtron R. assets)
+LUGARU_LICENSE_FILES = COPYING.txt CONTENT-LICENSE.txt
+
+LUGARU_DEPENDENCIES = host-pkgconf jpeg libgl libglu libpng libvorbis \
+	openal sdl2 zlib
+
+# Avoid incompatible posix_memalign declaration on x86 and x86_64 with
+# musl.
+# https://gcc.gnu.org/ml/gcc-patches/2015-05/msg01425.html
+ifeq ($(BR2_TOOLCHAIN_USES_MUSL):$(BR2_i386)$(BR2_x86_64),y:y)
+define LUGARU_REMOVE_PEDANTIC
+	$(SED) 's% -pedantic%%' $(@D)/CMakeLists.txt
+endef
+LUGARU_POST_PATCH_HOOKS += LUGARU_REMOVE_PEDANTIC
+endif
+
+LUGARU_CONF_OPTS = -DSYSTEM_INSTALL=ON
+
+$(eval $(cmake-package))
Signature · 1 line
2.9.3
#3 lore raw

PATCH v3 1/3 package/sdl2: enable opengl support

In reply to Romain Naour

Hello,

Quoted 11 lines · Romain Naour

OpenGl support mean GLX so it require X11 support. Select automatically BR2_PACKAGE_SDL2_X11 to enable minimal X11 libraries support (libx11 and libxext).

---
v3: select BR2_PACKAGE_SDL2_X11 (ThomasP)

---
 package/sdl2/Config.in | 11 +++++++++++
 package/sdl2/sdl2.mk   |  8 +++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

All three applied to next, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com