glew: build for EGL in non-X11 distros
PATCH 1/1 glew: build for EGL in non-X11 distros
The glew 2.0.0 release added support for building for EGL:
http://glew.sourceforge.net/log.html
Add PACKAGECONFIG options for 'opengl' (ie the previous default, with dependencies on opengl and X11) and 'egl', which depends on EGL only and allows glew to be built for non-X11 distros.
--- .../glew/glew/linux-egl-no-libGL.patch | 38 ++++++++++++++++++++++ meta/recipes-graphics/glew/glew_2.0.0.bb | 22 ++++++++----- 2 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 meta/recipes-graphics/glew/glew/linux-egl-no-libGL.patch
meta/recipes-graphics/glew/glew/linux-egl-no-libGL.patch new file +38 -0
@@ -0,0 +1,38 @@ +From b1317a2faff15ba91b38c2fe5fed24e18003c198 Mon Sep 17 00:00:00 2001 +From: Andre McCurdy <[email protected]> +Date: Sun, 18 Dec 2016 07:01:12 -0800 +Subject: [PATCH] linux-egl no libGL + +libGL is not required when building with -DGLEW_EGL + +Upstream-Status: Pending + +Signed-off-by: Andre McCurdy <[email protected]> +--- + config/Makefile.linux-clang-egl | 2 +- + config/Makefile.linux-egl | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/config/Makefile.linux-clang-egl b/config/Makefile.linux-clang-egl +index ca06419..ea8c703 100644 +--- a/config/Makefile.linux-clang-egl ++++ b/config/Makefile.linux-clang-egl +@@ -1,4 +1,4 @@ + include config/Makefile.linux-clang + +-LDFLAGS.GL = -lEGL -lGL ++LDFLAGS.GL = -lEGL + CFLAGS.EXTRA += -DGLEW_EGL +diff --git a/config/Makefile.linux-egl b/config/Makefile.linux-egl +index bcdc3cb..3bee77b 100644 +--- a/config/Makefile.linux-egl ++++ b/config/Makefile.linux-egl +@@ -1,4 +1,4 @@ + include config/Makefile.linux + +-LDFLAGS.GL = -lEGL -lGL ++LDFLAGS.GL = -lEGL + CFLAGS.EXTRA += -DGLEW_EGL +-- +1.9.1 +
meta/recipes-graphics/glew/glew_2.0.0.bb +13 -9
@@ -2,14 +2,13 @@ SUMMARY = "OpenGL extension loading library" DESCRIPTION = "The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library." HOMEPAGE = "http://glew.sourceforge.net/" BUGTRACKER = "http://sourceforge.net/tracker/?group_id=67586" -SECTION = "x11" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=2ac251558de685c6b9478d89be3149c2" -DEPENDS = "virtual/libx11 virtual/libgl libglu libxext libxi libxmu" - SRC_URI = "${SOURCEFORGE_MIRROR}/project/glew/glew/${PV}/glew-${PV}.tgz \ - file://no-strip.patch" + file://no-strip.patch \ + file://linux-egl-no-libGL.patch \ +" SRC_URI[md5sum] = "2a2cd7c98f13854d2fcddae0d2b20411" SRC_URI[sha256sum] = "c572c30a4e64689c342ba1624130ac98936d7af90c3103f9ce12b8a0c5736764"
@@ -19,12 +18,17 @@ UPSTREAM_CHECK_REGEX = "/glew/(?P<pver>(\d+[\.\-_]*)+)/" inherit lib_package pkgconfig distro_features_check -REQUIRED_DISTRO_FEATURES = "x11" +REQUIRED_DISTRO_FEATURES = "opengl" + +PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'opengl', 'egl', d)}" + +PACKAGECONFIG[opengl] = "SYSTEM='linux',,virtual/libx11 virtual/libgl libglu libxext libxi libxmu" +PACKAGECONFIG[egl] = "SYSTEM='linux-egl' GLEW_NO_GLU='-DGLEW_NO_GLU',,virtual/egl" -# Override SYSTEM to avoid calling config.guess, we're cross-compiling. Pass -# our CFLAGS via POPT as that's the optimisation variable and safely -# overwritten. -EXTRA_OEMAKE = "SYSTEM='linux' \ +# Override SYSTEM (via PACKAGECONFIG_CONFARGS) to avoid calling config.guess, +# we're cross-compiling. Pass our CFLAGS via POPT as that's the optimisation +# variable and safely overwritten. +EXTRA_OEMAKE = "${PACKAGECONFIG_CONFARGS} \ CC='${CC}' LD='${CC}' STRIP='' \ LDFLAGS.EXTRA='${LDFLAGS}' \ POPT='${CFLAGS}' \
Signature · 1 line
1.9.1
Quoted 4 lines · Andre McCurdy
Add PACKAGECONFIG options for 'opengl' (ie the previous default, with dependencies on opengl and X11) and 'egl', which depends on EGL only and allows glew to be built for non-X11 distros.
Can it build both or is this definitely a build time choice?
Ross
Quoted 8 lines · Ross
Quoted 4 lines · Andre McCurdy
Add PACKAGECONFIG options for 'opengl' (ie the previous default, with dependencies on opengl and X11) and 'egl', which depends on EGL only and allows glew to be built for non-X11 distros.
Can it build both or is this definitely a build time choice?
Build time choice, one or the other.
Quoted 8 lines · Andre McCurdy
The glew 2.0.0 release added support for building for EGL:
http://glew.sourceforge.net/log.html
Add PACKAGECONFIG options for 'opengl' (ie the previous default, with dependencies on opengl and X11) and 'egl', which depends on EGL only and allows glew to be built for non-X11 distros.
This failed on the nightly-no-x11 build on the AB:
tmp/linux-egl/default/shared/visualinfo.o: In function `main':/usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:177: undefined reference to glGetString' /usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:178: undefined reference to glGetString' /usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:179: undefined reference to glGetString' /usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:181: undefined reference to glGetString'
collect2: error: ld returned 1 exit status
(which is DISTRO=poky, DISTRO_FEATURES_remove=x11)
Ross
Quoted 24 lines · Ross
Quoted 8 lines · Andre McCurdy
The glew 2.0.0 release added support for building for EGL:
http://glew.sourceforge.net/log.html
Add PACKAGECONFIG options for 'opengl' (ie the previous default, with dependencies on opengl and X11) and 'egl', which depends on EGL only and allows glew to be built for non-X11 distros.
This failed on the nightly-no-x11 build on the AB:
tmp/linux-egl/default/shared/visualinfo.o: In function `main':/usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:177: undefined reference toglGetString' /usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:178: undefined reference toglGetString'/usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:179: undefined reference toglGetString' /usr/src/debug/glew/2.0.0-r0/glew-2.0.0/src/visualinfo.c:181: undefined reference toglGetString'
collect2: error: ld returned 1 exit status
Quoted 1 line
(which is DISTRO=poky, DISTRO_FEATURES_remove=x11)
Sorry about that. I was testing against an embedded 3D driver which blurs the lines a little between libEGL and libGLESv2. With mesa LDFLAGS needs to explicitly include either libGL, libGLESv1, libGLESv2 or libGLESv3. I'll send a v2 patch which adds PACKAGECONFIG options for each case.