Selaa lähdekoodia

lvgl: add 9.2.2 for scarthgap

Scarthgap ships LVGL 9.1, but swupdategui-rs needs at least 9.2: in 9.1
the enums used by the GUI are not typedefs and helpers like lv_pct()
are static inline, so bindgen does not generate bindings for them.

Backport the recipe for 9.2.2 from meta-openembedded walnascar
(07330a9). It still configures LVGL by editing lv_conf.h, like the 9.1
recipe; the Kconfig based configuration was introduced with 9.4.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
Stefano Babic 2 päivää sitten
vanhempi
commit
647ecf3841

+ 32 - 0
recipes-graphics/lvgl/files/0001-thorvg-fix-build-with-gcc-15.patch

@@ -0,0 +1,32 @@
+From a9e41f7e9590c757e74877cace6442dd676223ff Mon Sep 17 00:00:00 2001
+From: Martin Jansa <martin.jansa@gmail.com>
+Date: Fri, 21 Mar 2025 10:25:43 +0000
+Subject: [PATCH] thorvg: fix build with gcc-15
+
+* add missing include to fix:
+  src/libs/thorvg/thorvg.h:357:20: error: 'uint8_t' has not been declared
+  357 |     Result opacity(uint8_t o) noexcept;
+      |                    ^~~~~~~
+
+* not needed with latest master where it was resolved differently in
+  fc5c15638 feat(thorvg): use LVGL's malloc/realloc/zalloc/free (#7772)
+  which includes stdlib/lv_string.h which includes misc/lv_types.h which
+  includes stdint
+
+Upstream-Status: Pending [not needed with latest master where it was resolved differently in fc5c15638 feat(thorvg): use LVGL's malloc/realloc/zalloc/free (#7772)]
+
+Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
+---
+ src/libs/thorvg/thorvg.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/src/libs/thorvg/thorvg.h
++++ b/src/libs/thorvg/thorvg.h
+@@ -12,6 +12,7 @@
+ #define TVG_BUILD 1
+ 
+ 
++#include <cstdint>
+ #include <functional>
+ #include <memory>
+ #include <string>

+ 98 - 0
recipes-graphics/lvgl/lv-conf.inc

@@ -0,0 +1,98 @@
+PACKAGECONFIG ??= "drm"
+
+PACKAGECONFIG[drm] = ",,libdrm"
+PACKAGECONFIG[fbdev] = ",,"
+PACKAGECONFIG[gridnav] = ",,"
+PACKAGECONFIG[thorvg] = ",,"
+PACKAGECONFIG[sdl] = ",,virtual/libsdl2 libsdl2-image"
+
+# Add libdrm include if drm is selected in PACKAGECONFIG
+TARGET_CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)}"
+
+LVGL_CONFIG_USE_DRM = "${@bb.utils.contains('PACKAGECONFIG', 'drm', '1', '0', d)}"
+
+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_SDL_FULLSCREEN ?= "0"
+
+LVGL_CONFIG_LV_MEM_CUSTOM ?= "0"
+LVGL_CONFIG_LV_MEM_SIZE ?= "(64 * 1024U)"
+LVGL_CONFIG_LV_COLOR_DEPTH ?= "32"
+
+LVGL_CONFIG_LV_USE_LOG    ?= "0"
+LVGL_CONFIG_LV_LOG_LEVEL  ?= "LV_LOG_LEVEL_WARN"
+LVGL_CONFIG_LV_LOG_PRINTF ?= "0"
+
+LVGL_CONFIG_LV_USE_FONT_COMPRESSED ?= "0"
+
+LVGL_CONFIG_LV_USE_GRIDNAV = "${@bb.utils.contains('PACKAGECONFIG', 'gridnav', '1', '0', d)}"
+
+LVGL_CONFIG_LV_THEME_DEFAULT_DARK ?= "0"
+
+LVGL_CONFIG_USE_LOTTIE = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_VECTOR_GRAPHICS = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_THORVG_INTERNAL = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_MATRIX = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+LVGL_CONFIG_USE_FLOAT = "${@bb.utils.contains('PACKAGECONFIG', 'thorvg', '1', '0', d)}"
+
+DEBUG_BUILD ??= "0"
+
+ALLOW_EMPTY:${PN} = "1"
+
+EXTRA_OECMAKE += "-Dinstall:BOOL=ON -DLIB_INSTALL_DIR=${baselib}"
+
+do_configure:append() {
+    # If there is a configuration template, start from that
+    [ -r "${S}/lv_conf_template.h" ] && cp -Lv "${S}/lv_conf_template.h" "${S}/lv_conf.h"
+
+    sed -r -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LINUX_DRM[[:space:]]).*|\1${LVGL_CONFIG_USE_DRM}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LINUX_FBDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_FBDEV}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \
+        -e "s|^([[:space:]]*#define LV_USE_DRAW_SDL[[:space:]]).*|\1${LVGL_CONFIG_USE_SDL}|" \
+        -e "s|^([[:space:]]*#define LV_SDL_BUF_COUNT[[:space:]]).*|\1 2|" \
+        -e "s|^([[:space:]]*#define LV_SDL_FULLSCREEN[[:space:]]).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_COLOR_DEPTH[[:space:]]).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|" \
+        -e "s|^([[:space:]]*#define LV_MEM_CUSTOM[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|" \
+        -e "s|^([[:space:]]*#define LV_MEM_SIZE[[:space:]]).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_TICK_CUSTOM[[:space:]]).*|\1 1|" \
+        -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_INCLUDE[[:space:]]).*|\1 <stdint.h>|" \
+        -e "s|^([[:space:]]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[[:space:]]).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_EVDEV[[:space:]]).*|\1${LVGL_CONFIG_USE_EVDEV}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_NULL[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_MALLOC[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_STYLE[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_MEM_INTEGRITY[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        -e "s|^([[:space:]]*#define LV_USE_ASSERT_OBJ[[:space:]]).*|\1${DEBUG_BUILD}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LOG[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_LOG}|" \
+        -e "s|^([[:space:]]*#define LV_LOG_LEVEL[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|" \
+        -e "s|^([[:space:]]*#define LV_LOG_PRINTF[[:space:]]).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_FONT_COMPRESSED[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|" \
+        -e "s|^([[:space:]]*#define LV_USE_GRIDNAV[[:space:]]).*|\1${LVGL_CONFIG_LV_USE_GRIDNAV}|" \
+        -e "s|^([[:space:]]*#define LV_THEME_DEFAULT_DARK[[:space:]]).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_VECTOR_GRAPHIC[[:space:]]).*|\1${LVGL_CONFIG_USE_VECTOR_GRAPHICS}|" \
+        -e "s|^([[:space:]]*#define LV_USE_THORVG_INTERNAL[[:space:]]).*|\1${LVGL_CONFIG_USE_THORVG_INTERNAL}|" \
+        -e "s|^([[:space:]]*#define LV_USE_MATRIX[[:space:]]).*|\1${LVGL_CONFIG_USE_MATRIX}|" \
+        -e "s|^([[:space:]]*#define LV_USE_FLOAT[[:space:]]).*|\1${LVGL_CONFIG_USE_FLOAT}|" \
+        \
+        -e "s|^([[:space:]]*#define LV_USE_LOTTIE[[:space:]]).*|\1${LVGL_CONFIG_USE_LOTTIE}|" \
+        -i "${S}/lv_conf.h"
+}

+ 29 - 0
recipes-graphics/lvgl/lvgl_9.2.2.bb

@@ -0,0 +1,29 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: MIT
+
+# Backported from meta-openembedded walnascar (07330a9): swupdategui-rs
+# needs LVGL >= 9.2 (typedef enums and non-inline helpers for bindgen).
+
+HOMEPAGE = "https://lvgl.io/"
+DESCRIPTION = "LVGL is an OSS graphics library to create embedded GUI"
+SUMMARY = "Light and Versatile Graphics Library"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=bf1198c89ae87f043108cea62460b03a"
+
+SRC_URI = "\
+	git://github.com/lvgl/lvgl;protocol=https;branch=release/v9.2 \
+    file://0001-thorvg-fix-build-with-gcc-15.patch \
+	"
+SRCREV = "7f07a129e8d77f4984fff8e623fd5be18ff42e74"
+
+inherit cmake
+
+EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
+S = "${WORKDIR}/git"
+
+require lv-conf.inc
+
+do_install:append() {
+    install -m 0644 "${S}/lv_conf.h" "${D}${includedir}/${BPN}/lv_conf.h"
+}