package/sdl2: enable opengl support
PATCH v2 1/3 package/sdl2: enable opengl support
OpenGl support mean GLX so it require X11 support.
---
v2: no change
--- package/sdl2/Config.in | 8 ++++++++ package/sdl2/sdl2.mk | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
package/sdl2/Config.in +8 -0
@@ -29,6 +29,14 @@ 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 + +comment "OpenGL support needs X11 and an OpenGL provider" + depends on !BR2_PACKAGE_HAS_LIBGL || !BR2_PACKAGE_XORG7 + endif comment "sdl2 needs a toolchain w/ dynamic library"
package/sdl2/sdl2.mk +7 -1
@@ -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
PATCH v2 2/3 package/sdl2: enable OpenGL ES support
---
v2: no change
--- package/sdl2/Config.in | 7 +++++++ package/sdl2/sdl2.mk | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
package/sdl2/Config.in +7 -0
@@ -37,6 +37,13 @@ config BR2_PACKAGE_SDL2_OPENGL comment "OpenGL support needs X11 and an OpenGL provider" 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
@@ -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
PATCH v2 3/3 package/lugaru: new package
In reply to Romain NaourLugaru needs SDL2 library with OpenGL support which require X11 support. Otherwise Lugaru error out with "No dynamic GL support in video driver" message.
---
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 | 36 ++++++++++++++++++++++ package/lugaru/lugaru.hash | 2 ++ package/lugaru/lugaru.mk | 32 +++++++++++++++++++ 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
@@ -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
@@ -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
@@ -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 +36 -0
@@ -0,0 +1,36 @@ +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_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_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
@@ -0,0 +1,2 @@ +# Locally calculated +sha256 f3ea477caf78911c69939fbdc163f9f6517c7ef2267e716a0e050be1a166ef97 lugaru-1.2.tar.xz
package/lugaru/lugaru.mk new file +32 -0
@@ -0,0 +1,32 @@ +################################################################################ +# +# 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 \ + -DCMAKE_INSTALL_BINDIR=games \ + -DCMAKE_INSTALL_DATADIR=share/games + +$(eval $(cmake-package))
Signature · 1 line
2.9.3
PATCH v2 3/3 package/lugaru: new package
Hello,
package/lugaru/lugaru.mk line 30
Quoted 3 lines · Romain Naour
package/lugaru/lugaru.mk new file +3
-0+LUGARU_CONF_OPTS = -DSYSTEM_INSTALL=ON \ + -DCMAKE_INSTALL_BINDIR=games \ + -DCMAKE_INSTALL_DATADIR=share/games
Why are we passing custom CMAKE_INSTALL_<foo>DIR here?
The rest of the patch looks good to me.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 3/3 package/lugaru: new package
Hi Thomas, All,
Le 26/02/2017 ? 14:59, Thomas Petazzoni a ?crit :
Quoted 9 lines
Hello,
package/lugaru/lugaru.mk line 30
Quoted 3 lines · Romain Naour
package/lugaru/lugaru.mk new file +3
-0+LUGARU_CONF_OPTS = -DSYSTEM_INSTALL=ON \ + -DCMAKE_INSTALL_BINDIR=games \ + -DCMAKE_INSTALL_DATADIR=share/gamesWhy are we passing custom CMAKE_INSTALL_<foo>DIR here?
We have to set SYSTEM_INSTALL otherwise the application "will default to looking for the data in the 'Data' directory next to the binary"
But I've keep the custom CMAKE_INSTALL_<foo>DIR from the example in COMPILING.md file... We can remove them.
Thanks for the review.
Best regards,
Romain
Quoted 7 lines
The rest of the patch looks good to me.
Thanks!
Thomas
PATCH v2 1/3 package/sdl2: enable opengl support
In reply to Romain NaourHello,
package/sdl2/Config.in comment "X11 video driver needs X.org" · line 35
Quoted 4 lines · Romain Naour
package/sdl2/Config.in +4
-0+config BR2_PACKAGE_SDL2_OPENGL + bool "OpenGL (GLX)" + depends on BR2_PACKAGE_HAS_LIBGL + depends on BR2_PACKAGE_XORG7
Are you sure this doesn't need BR2_PACKAGE_SDL2_X11 ? I.e what happens if you build SDL2 with BR2_PACKAGE_SDL2_OPENGL=y but BR2_PACKAGE_SDL2_X11 disabled ?
package/sdl2/sdl2.mk else · line 103
Quoted 3 lines
package/sdl2/sdl2.mk +3
-0+ifeq ($(BR2_PACKAGE_SDL2_OPENGL),y) +SDL2_CONF_OPTS += --enable-video-opengl +SDL2_DEPENDENCIES += libgl
Also, is libgl sufficient here? What happens if you select nvidia-driver as the OpenGL provider for example? It doesn't depend on any X.org package, so are you sure by the time SDL2 runs its configure script, enough things have been built?
Can you verify by enabling nvidia-driver, and then running "make sdl2" ?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 1/3 package/sdl2: enable opengl support
Hi Thomas, All,
Le 26/02/2017 ? 14:57, Thomas Petazzoni a ?crit :
Quoted 4 lines
Hello,
On Sat, 25 Feb 2017 14:35:58 +0100, Romain Naour wrote:
Quoted 8 lines
package/sdl2/Config.in comment "X11 video driver needs X.org" · line 35
Quoted 4 lines
package/sdl2/Config.in +4
-0+config BR2_PACKAGE_SDL2_OPENGL + bool "OpenGL (GLX)" + depends on BR2_PACKAGE_HAS_LIBGL + depends on BR2_PACKAGE_XORG7Are you sure this doesn't need
BR2_PACKAGE_SDL2_X11? I.e what happens if you build SDL2 with BR2_PACKAGE_SDL2_OPENGL=y butBR2_PACKAGE_SDL2_X11disabled ?
OpenGL (GLX) option only check for the following headers:
#include <GL/gl.h>
#include <GL/glx.h>
So, SDL2 build fine even without BR2_PACKAGE_SDL2_X11.
However you're probably right since GLX mean OpenGL with X11 support and selecting BR2_PACKAGE_SDL2_X11 allow to enable additional X11 libraries support. I'll add a select BR2_PACKAGE_SDL2_X11 since it was enabled for my runtime test.
Quoted 9 lines
package/sdl2/sdl2.mk else · line 103
Quoted 4 lines
package/sdl2/sdl2.mk +3
-0+ifeq ($(BR2_PACKAGE_SDL2_OPENGL),y) +SDL2_CONF_OPTS += --enable-video-opengl +SDL2_DEPENDENCIES += libglAlso, is libgl sufficient here? What happens if you select nvidia-driver as the OpenGL provider for example? It doesn't depend on any X.org package, so are you sure by the time SDL2 runs its configure script, enough things have been built?
nvidia-driver is an libgl provider only if BR2_PACKAGE_NVIDIA_DRIVER_XORG=y, so the libgl provider select a minimal set of X11 libraries that are already build when sdl2 build start.
This is also the case when mesa3d is used as libgl provider.
Quoted 2 lines
Can you verify by enabling nvidia-driver, and then running "make sdl2" ?
I tried with this deconfig fragment a sdl2 build fine.
BR2_PACKAGE_SDL2=y
BR2_PACKAGE_SDL2_OPENGL=y
BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XSERVER_XORG_SERVER=y
BR2_PACKAGE_NVIDIA_DRIVER=y
Best regards,
Romain
Quoted 5 lines
Thanks,
Thomas
PATCH v2 1/3 package/sdl2: enable opengl support
Hello,
Quoted 4 lines · Romain Naour
So, SDL2 build fine even without
BR2_PACKAGE_SDL2_X11.
However you're probably right since GLX mean OpenGL with X11 support and selectingBR2_PACKAGE_SDL2_X11allow to enable additional X11 libraries support. I'll add a selectBR2_PACKAGE_SDL2_X11since it was enabled for my runtime test.
OK.
Quoted 8 lines
Quoted 4 lines
Also, is libgl sufficient here? What happens if you select nvidia-driver as the OpenGL provider for example? It doesn't depend on any X.org package, so are you sure by the time SDL2 runs its configure script, enough things have been built?
nvidia-driver is an libgl provider only if BR2_PACKAGE_NVIDIA_DRIVER_XORG=y, so the libgl provider select a minimal set of X11 libraries that are already build when sdl2 build start.
Selects yes, but it doesn't not have a <pkg>_DEPENDENCIES on them, so you are not guaranteed they are available before sdl2 is built.
Obvisouly, if BR2_PACKAGE_SDL2_X11 is now selected by BR2_PACKAGE_SDL2_OPENGL, then you're sure the X11 libs will be built before sdl2.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH v2 1/3 package/sdl2: enable opengl support
Hi Thomas, All,
Le 26/02/2017 ? 16:54, Thomas Petazzoni a ?crit :
Quoted 16 lines
Hello,
Quoted 4 lines · Romain Naour
So, SDL2 build fine even without
BR2_PACKAGE_SDL2_X11.
However you're probably right since GLX mean OpenGL with X11 support and selectingBR2_PACKAGE_SDL2_X11allow to enable additional X11 libraries support. I'll add a selectBR2_PACKAGE_SDL2_X11since it was enabled for my runtime test.OK.
Quoted 5 lines
Quoted 4 lines
Also, is libgl sufficient here? What happens if you select nvidia-driver as the OpenGL provider for example? It doesn't depend on any X.org package, so are you sure by the time SDL2 runs its configure script, enough things have been built?
Quoted 6 lines
Quoted 3 lines
nvidia-driver is an libgl provider only if BR2_PACKAGE_NVIDIA_DRIVER_XORG=y, so the libgl provider select a minimal set of X11 libraries that are already build when sdl2 build start.
Selects yes, but it doesn't not have a <pkg>_DEPENDENCIES on them, so you are not guaranteed they are available before sdl2 is built.
Haa indeed...
For mesa3d case, we can this minimal set of x11 libraries ...
MESA3D_DEPENDENCIES += \ xproto_xf86driproto \ xproto_dri2proto \ xproto_glproto \ xlib_libX11 \ xlib_libXext \ xlib_libXdamage \ xlib_libXfixes \ libxcb
... but for nvidia there is none.
However, it doesn't seems to be a problem for sdl2 (at least at build time).
I'll resend the series.
Best regards,
Romain
Quoted 9 lines
Obvisouly, if
BR2_PACKAGE_SDL2_X11is now selected byBR2_PACKAGE_SDL2_OPENGL, then you're sure the X11 libs will be built before sdl2.Thanks!
Thomas