[OE-core] [PATCH] glew: build for EGL in non-X11 distros

Andre McCurdy armccurdy at gmail.com
Sun Dec 18 17:02:36 UTC 2016


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.

Signed-off-by: Andre McCurdy <armccurdy at gmail.com>
---
 .../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

diff --git a/meta/recipes-graphics/glew/glew/linux-egl-no-libGL.patch b/meta/recipes-graphics/glew/glew/linux-egl-no-libGL.patch
new file mode 100644
index 0000000..48fab16
--- /dev/null
+++ b/meta/recipes-graphics/glew/glew/linux-egl-no-libGL.patch
@@ -0,0 +1,38 @@
+From b1317a2faff15ba91b38c2fe5fed24e18003c198 Mon Sep 17 00:00:00 2001
+From: Andre McCurdy <armccurdy at gmail.com>
+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 <armccurdy at gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-graphics/glew/glew_2.0.0.bb b/meta/recipes-graphics/glew/glew_2.0.0.bb
index 489dd7c..e5bf3cb 100644
--- a/meta/recipes-graphics/glew/glew_2.0.0.bb
+++ b/meta/recipes-graphics/glew/glew_2.0.0.bb
@@ -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}' \
-- 
1.9.1




More information about the Openembedded-core mailing list