The configuration of lv_drivers is the same in lv-drivers and lvgl-demo-fb,
the later just pulls in its own already preconfigured variant of lv-drivers
as git submodule. Pull out the lv-drivers configuration into separate file
lv-drivers.inc, so it can be shared by lv-drivers and lvgl-demo-fb recipes.

Furthermore, as the configuration support in both recipes diverged already,
merge support for both sets of configuration options. This way, lv-drivers
grows support for DRM and SDL backend, and lvgl-demo-fb for WL backend. The
PACKAGECONFIG of each recipe is left unchanged so far to avoid breaking of
existing users.

Note that LVGL_CONFIG_USE_EVDEV is new and activated for both fbdev and drm,
since both of those backends need EVDEV support right now. The libinput input
support is not available yet.

Signed-off-by: Marek Vasut <[email protected]>
---
Cc: Fabio Estevam <[email protected]>
Cc: Khem Raj <[email protected]>
Cc: Martin Jansa <[email protected]>
---
 meta-oe/recipes-graphics/lvgl/lv-drivers.inc  | 44 +++++++++++++++++++
 .../recipes-graphics/lvgl/lv-drivers_8.3.0.bb | 26 +----------
 .../lvgl/lvgl-demo-fb_8.3.0.bb                | 17 +------
 3 files changed, 46 insertions(+), 41 deletions(-)
 create mode 100644 meta-oe/recipes-graphics/lvgl/lv-drivers.inc

diff --git a/meta-oe/recipes-graphics/lvgl/lv-drivers.inc 
b/meta-oe/recipes-graphics/lvgl/lv-drivers.inc
new file mode 100644
index 000000000..284d8421b
--- /dev/null
+++ b/meta-oe/recipes-graphics/lvgl/lv-drivers.inc
@@ -0,0 +1,44 @@
+PACKAGECONFIG[drm] = ",,libdrm"
+PACKAGECONFIG[fbdev] = ",,"
+PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
+PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
+
+LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', 
d)}"
+LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
+
+LVGL_CONFIG_USE_EVDEV = "${@bb.utils.contains_any('PACKAGECONFIG', 'drm 
fbdev', '1', '0', d)}"
+
+LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', 
'0', d)}"
+
+LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', 
d)}"
+
+LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', 
'1', '0', d)}"
+LVGL_CONFIG_WAYLAND_HOR_RES ?= "480"
+LVGL_CONFIG_WAYLAND_VER_RES ?= "320"
+
+EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
+
+do_configure:append() {
+    # If there is a configuration template, start from that
+    [ -r "${S}/lv_drv_conf_template.h" ] && cp -Lv 
"${S}/lv_drv_conf_template.h" "${S}/lv_drv_conf.h"
+
+    # Configure the software using sed
+    sed -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // Enabled 
by ${PN}|g" \
+        \
+        -e "s|\(^#  define USE_DRM \).*|#  define USE_DRM 
${LVGL_CONFIG_USE_DRM}|g" \
+        -e "s|\(^#  define DRM_CARD \).*|#  define DRM_CARD 
\"${LVGL_CONFIG_DRM_CARD}\"|g" \
+       \
+        -e "s|\(^#  define USE_EVDEV \).*|#  define USE_EVDEV 
${LVGL_CONFIG_USE_EVDEV}|g" \
+        \
+        -e "s|\(^#  define USE_FBDEV \).*|#  define USE_FBDEV 
${LVGL_CONFIG_USE_FBDEV}|g" \
+        \
+        -e "s|\(^# define USE_SDL \).*|#  define USE_SDL 
${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^#  define USE_SDL_GPU \).*|#  define USE_SDL_GPU 1|g" \
+        -e "s|\(^#  define SDL_DOUBLE_BUFFERED \).*|#  define 
SDL_DOUBLE_BUFFERED 1|g" \
+        \
+        -e "s|\(^#  define USE_WAYLAND \).*|#  define USE_WAYLAND 
${LVGL_CONFIG_USE_WAYLAND}|g" \
+        -e "s|\(^ *# *define *WAYLAND_HOR_RES 
*\).*|\1${LVGL_CONFIG_WAYLAND_HOR_RES}|g" \
+        -e "s|\(^ *# *define *WAYLAND_VER_RES 
*\).*|\1${LVGL_CONFIG_WAYLAND_VER_RES}|g" \
+        \
+        -i "${S}/lv_drv_conf.h"
+}
diff --git a/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb 
b/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb
index a0a2ee0aa..e2c5a342a 100644
--- a/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb
+++ b/meta-oe/recipes-graphics/lvgl/lv-drivers_8.3.0.bb
@@ -14,39 +14,15 @@ SRCREV = "71830257710f430b6d8d1c324f89f2eab52488f1"
 DEPENDS = "lvgl"
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland fbdev', d)}"
-PACKAGECONFIG[fbdev] = ",,"
-PACKAGECONFIG[wayland] = ",,libxkbcommon wayland"
-LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', 
'0', d)}"
-LVGL_CONFIG_USE_WAYLAND = "${@bb.utils.contains('PACKAGECONFIG', 'wayland', 
'1', '0', d)}"
+require lv-drivers.inc
 
 inherit cmake
 
 S = "${WORKDIR}/git"
 
-LVGL_CONFIG_WAYLAND_HOR_RES ?= "480"
-LVGL_CONFIG_WAYLAND_VER_RES ?= "320"
-
-EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
-
 TARGET_CFLAGS += "-DLV_CONF_INCLUDE_SIMPLE=1"
 TARGET_CFLAGS += "-I${STAGING_INCDIR}/lvgl"
 
-# Upstream does not support a default configuration
-# but propose a default "disabled" template, which is used as reference
-# More configuration can be done using external configuration variables
-do_configure:append() {
-    [ -r "${S}/lv_drv_conf.h" ] \
-        || sed -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // 
Enabled by ${PN}|g" \
-              \
-               -e "s|\(^#  define USE_FBDEV \).*|#  define USE_FBDEV 
${LVGL_CONFIG_USE_FBDEV}|g" \
-               -e "s|\(^#  define USE_EVDEV \).*|#  define USE_EVDEV 
${LVGL_CONFIG_USE_FBDEV}|g" \
-              \
-               -e "s|\(^#  define USE_WAYLAND \).*|#  define USE_WAYLAND 
${LVGL_CONFIG_USE_WAYLAND}|g" \
-              -e "s|\(^ *# *define *WAYLAND_HOR_RES 
*\).*|\1${LVGL_CONFIG_WAYLAND_HOR_RES}|g" \
-              -e "s|\(^ *# *define *WAYLAND_VER_RES 
*\).*|\1${LVGL_CONFIG_WAYLAND_VER_RES}|g" \
-          < "${S}/lv_drv_conf_template.h" > "${S}/lv_drv_conf.h"
-}
-
 FILES:${PN}-dev += "\
     ${includedir}/lvgl/lv_drivers/ \
     "
diff --git a/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb 
b/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb
index 33e7c94e6..32f833a02 100644
--- a/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb
+++ b/meta-oe/recipes-graphics/lvgl/lvgl-demo-fb_8.3.0.bb
@@ -11,30 +11,15 @@ SRCREV = "adf2c4490e17a1b9ec1902cc412a24b3b8235c8e"
 EXTRA_OEMAKE = "DESTDIR=${D}"
 
 PACKAGECONFIG ??= "drm"
-PACKAGECONFIG[drm] = ",,libdrm"
-PACKAGECONFIG[fbdev] = ",,"
-PACKAGECONFIG[sdl] = ",,virtual/libsdl2"
-LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', 
d)}"
-LVGL_CONFIG_DRM_CARD ?= "/dev/dri/card0"
-LVGL_CONFIG_USE_FBDEV = "${@bb.utils.contains('PACKAGECONFIG', 'fbdev', '1', 
'0', d)}"
-LVGL_CONFIG_USE_SDL = "${@bb.utils.contains('PACKAGECONFIG', 'sdl', '1', '0', 
d)}"
+require lv-drivers.inc
 
 inherit cmake
 
 S = "${WORKDIR}/git"
 
-EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
 TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
 
 do_configure:prepend() {
-       sed -i -e "s|\(^#  define USE_FBDEV \).*|#  define USE_FBDEV 
${LVGL_CONFIG_USE_FBDEV}|g" \
-               -e "s|\(^#  define USE_DRM \).*|#  define USE_DRM 
${LVGL_CONFIG_USE_DRM}|g" \
-               -e "s|\(^#  define DRM_CARD \).*|#  define DRM_CARD 
\"${LVGL_CONFIG_DRM_CARD}\"|g" \
-               -e "s|\(^# define USE_SDL \).*|#  define USE_SDL 
${LVGL_CONFIG_USE_SDL}|g" \
-               -e "s|\(^#  define USE_SDL_GPU \).*|#  define USE_SDL_GPU 1|g" \
-               -e "s|\(^#  define SDL_DOUBLE_BUFFERED \).*|#  define 
SDL_DOUBLE_BUFFERED 1|g" \
-       "${S}/lv_drv_conf.h"
-
        if [ "${LVGL_CONFIG_USE_DRM}" -eq 1 ] ; then
                # Add libdrm build dependency
                sed -i '/^target_link_libraries/ s@lvgl::drivers@& drm@' 
"${S}/CMakeLists.txt"
-- 
2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#103562): 
https://lists.openembedded.org/g/openembedded-devel/message/103562
Mute This Topic: https://lists.openembedded.org/mt/99769136/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to