Skip to contentSkip to conversation

lvgl: fix typo in lv-conf.inc

PATCH In review Christophe Chapuis 5 participants 26 messages Mar 16, 2024 – Mar 21, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/7 lvgl: fix typo in lv-conf.inc

Fix a typo in the first sed instruction, where the #if 0 is never changed to #if 1 at the beginning of lv_conf.h.

---
 meta-oe/recipes-graphics/lvgl/lv-conf.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -1
index cb676ac62..3dbdf769f 100644
@@ -24,7 +24,7 @@ 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 -e "s|#if 0 .*Set it to \"1\" to enable the content.*|#if 1 // Enabled by ${PN}|g" \
+    sed -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|g" \
         \
         -e "s|\(^#define LV_USE_LINUX_DRM \).*|#define LV_USE_LINUX_DRM ${LVGL_CONFIG_USE_DRM}|g" \
         \
Signature · 1 line
2.44.0
#1 lore raw

PATCH v4 2/7 lvgl: install lv_conf.h

Add an install append to copy the generated lv_conf.h as part of the lvgl package, so that it will be found and used by the recipes that want to use lvgl.

---
 meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +5 -0
index b84fc5a3d..58053d830 100644
@@ -26,6 +26,11 @@ ALLOW_EMPTY:${PN} = "1"
 PACKAGECONFIG ??= "drm"
 require lv-conf.inc
 
+do_install:append() {
+    install -d "${D}${includedir}/${PN}"
+    install -m 0644 "${S}/lv_conf.h" "${D}${includedir}/${PN}/lv_conf.h"
+}
+
 FILES:${PN}-dev += "\
     ${includedir}/${PN}/ \
     ${includedir}/${PN}/lvgl/ \
Signature · 1 line
2.44.0
Reviewed-by on v4 2/7
#2 lore raw

Re: [meta-oe][PATCH v4 2/7] lvgl: install lv_conf.h

Quoted 14 lines · Christophe Chapuis

Add an install append to copy the generated lv_conf.h as part of the lvgl package, so that it will be found and used by the recipes that want to use lvgl.

---
  meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 5 +++++
  1 file changed, 5 insertions(+)
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +0 -0
index b84fc5a3d..58053d830 100644

meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb ALLOW_EMPTY:${PN} = "1" · line 32

Quoted 7 lines
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +4 -0
@@ -26,6 +26,11 @@ ALLOW_EMPTY:${PN} = "1"
  PACKAGECONFIG ??= "drm"
  require lv-conf.inc
 
+do_install:append() {
+    install -d "${D}${includedir}/${PN}"
+    install -m 0644 "${S}/lv_conf.h" "${D}${includedir}/${PN}/lv_conf.h"
+}
#3 lore raw

PATCH v4 3/7 lvgl: remove useless FILES include

In reply to Christophe Chapuis

As ${includedir}${PN} is already listed in FILES, there is no need to add one of its subdirectories.

---
 meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 1 -
 1 file changed, 1 deletion(-)
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +0 -1
index 58053d830..8bd718efd 100644
@@ -33,7 +33,6 @@ do_install:append() {
 
 FILES:${PN}-dev += "\
     ${includedir}/${PN}/ \
-    ${includedir}/${PN}/lvgl/ \
     "
 SOLIBS = ".so"
 FILES_SOLIBSDEV = ""
Signature · 1 line
2.44.0
#5 lore raw

PATCH v4 4/7 lvgl: cleanup sed instructions in lv-conf.inc

In reply to Christophe Chapuis

Use back reference instead of repeating the search pattern. Later on this could lead to a more generic way of replacing values in the .h file.

---
 meta-oe/recipes-graphics/lvgl/lv-conf.inc | 28 +++++++++++------------
 1 file changed, 14 insertions(+), 14 deletions(-)
meta-oe/recipes-graphics/lvgl/lv-conf.inc +14 -14
index 3dbdf769f..e43a4d508 100644
@@ -26,29 +26,29 @@ do_configure:append() {
 
     sed -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|g" \
         \
-        -e "s|\(^#define LV_USE_LINUX_DRM \).*|#define LV_USE_LINUX_DRM ${LVGL_CONFIG_USE_DRM}|g" \
+        -e "s|\(^#define LV_USE_LINUX_DRM \).*|\1${LVGL_CONFIG_USE_DRM}|g" \
         \
-        -e "s|\(^#define LV_USE_LINUX_FBDEV \).*|#define LV_USE_LINUX_FBDEV ${LVGL_CONFIG_USE_FBDEV}|g" \
+        -e "s|\(^#define LV_USE_LINUX_FBDEV \).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
         \
-        -e "s|\(^#define LV_USE_SDL \).*|#define LV_USE_SDL ${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^#define LV_USE_DRAW_SDL \).*|#define LV_USE_DRAW_SDL ${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^    #define LV_SDL_BUF_COUNT \).*|    #define LV_SDL_BUF_COUNT 2|g" \
-        -e "s|\(^    #define LV_SDL_FULLSCREEN \).*|    #define LV_SDL_FULLSCREEN ${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
+        -e "s|\(^#define LV_USE_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^#define LV_USE_DRAW_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^ \+#define LV_SDL_BUF_COUNT \).*|\1 2|g" \
+        -e "s|\(^ \+#define LV_SDL_FULLSCREEN \).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
         \
-        -e "s|\(^#define LV_COLOR_DEPTH \).*|#define LV_COLOR_DEPTH ${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
-        -e "s|\(#define LV_MEM_CUSTOM .*\)0|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
+        -e "s|\(^#define LV_COLOR_DEPTH \).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
+        -e "s|\(#define LV_MEM_CUSTOM .*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
         \
         -e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
         -e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
         -e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
         \
-        -e "s|\(^#define LV_USE_EVDEV \).*|#define LV_USE_EVDEV ${LVGL_CONFIG_USE_EVDEV}|g" \
+        -e "s|\(^#define LV_USE_EVDEV \).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
         \
-        -e "s|\(^#define LV_USE_ASSERT_NULL \).*|#define LV_USE_ASSERT_NULL ${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MALLOC \).*|#define LV_USE_ASSERT_MALLOC ${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_STYLE \).*|#define LV_USE_ASSERT_STYLE ${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY \).*|#define LV_USE_ASSERT_MEM_INTEGRITY ${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|#define LV_USE_ASSERT_OBJ ${DEBUG_BUILD}|g" \
+        -e "s|\(^#define LV_USE_ASSERT_NULL \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^#define LV_USE_ASSERT_MALLOC \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^#define LV_USE_ASSERT_STYLE \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|\1${DEBUG_BUILD}|g" \
         \
         -i "${S}/lv_conf.h"
 }
Signature · 1 line
2.44.0
#7 lore raw

PATCH v4 5/7 lvgl: add more variables to lv-conf.inc

In reply to Christophe Chapuis

As it can be usefull to customize these other variables, let's add them in lv-conf.inc.

---
 meta-oe/recipes-graphics/lvgl/lv-conf.inc | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
meta-oe/recipes-graphics/lvgl/lv-conf.inc +17 -0
index e43a4d508..9ee9f283d 100644
@@ -12,8 +12,17 @@ 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_THEME_DEFAULT_DARK ?= "0"
+
 DEBUG_BUILD ??= "0"
 
 ALLOW_EMPTY:${PN} = "1"
@@ -37,6 +46,7 @@ do_configure:append() {
         \
         -e "s|\(^#define LV_COLOR_DEPTH \).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
         -e "s|\(#define LV_MEM_CUSTOM .*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
+        -e "s|\(^ \+#define LV_MEM_SIZE \).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
         \
         -e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
         -e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
@@ -50,5 +60,12 @@ do_configure:append() {
         -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY \).*|\1${DEBUG_BUILD}|g" \
         -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|\1${DEBUG_BUILD}|g" \
         \
+        -e "s|\(^#define LV_USE_LOG \).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
+        -e "s|\(^ \+#define LV_LOG_LEVEL \).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
+        -e "s|\(^ \+#define LV_LOG_PRINTF \).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
+        \
+        -e "s|\(^#define LV_USE_FONT_COMPRESSED \).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
+        -e "s|\(^ \+#define LV_THEME_DEFAULT_DARK \).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
+        \
         -i "${S}/lv_conf.h"
 }
Signature · 1 line
2.44.0
#9 lore raw

PATCH v4 6/7 lvgl: fix libdrm include

In reply to Christophe Chapuis

When DRM is activated for LVGL, it adds a dependency on drm.h. As for lvgl-demo-fb, add an include path to fix this usecase.

---
 meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +2 -0
index 8bd718efd..6a9a7411b 100644
@@ -21,6 +21,8 @@ inherit cmake
 EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
 S = "${WORKDIR}/git"
 
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
+
 ALLOW_EMPTY:${PN} = "1"
 
 PACKAGECONFIG ??= "drm"
Signature · 1 line
2.44.0
#10 lore raw

Re: [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

does this fix

https://errors.yoctoproject.org/Errors/Details/758522/

Quoted 25 lines · Christophe Chapuis

When DRM is activated for LVGL, it adds a dependency on drm.h. As for lvgl-demo-fb, add an include path to fix this usecase.

---
 meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +2 -1
index 8bd718efd..6a9a7411b 100644
@@ -21,6 +21,8 @@ inherit cmake
 EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
 S = "${WORKDIR}/git"
 
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
+
 ALLOW_EMPTY:${PN} = "1"
 
 PACKAGECONFIG ??= "drm"
--

2.44.0

#11 lore raw

Re: [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

Yes, it fixes exactly this issue.

Quoted 33 lines · Khem Raj

does this fix

https://errors.yoctoproject.org/Errors/Details/758522/

Review

Quoted 10 lines · Christophe Chapuis

When DRM is activated for LVGL, it adds a dependency on drm.h. As for lvgl-demo-fb, add an include path to fix this usecase.

---
 meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb

Quoted 15 lines

index 8bd718efd..6a9a7411b 100644

meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +2 -1
@@ -21,6 +21,8 @@ inherit cmake
 EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
 S = "${WORKDIR}/git"
 
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
+
 ALLOW_EMPTY:${PN} = "1"
 
 PACKAGECONFIG ??= "drm"
--

2.44.0

#12 lore raw

Re: [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

Ok thx

Quoted 38 lines · Christophe Chapuis

Yes, it fixes exactly this issue.

Quoted 33 lines · Khem Raj

does this fix

https://errors.yoctoproject.org/Errors/Details/758522/

Review

Quoted 10 lines · Christophe Chapuis

When DRM is activated for LVGL, it adds a dependency on drm.h. As for lvgl-demo-fb, add an include path to fix this usecase.

---
 meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb

Quoted 15 lines

index 8bd718efd..6a9a7411b 100644

meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +2 -1
@@ -21,6 +21,8 @@ inherit cmake
 EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
 S = "${WORKDIR}/git"
 
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"
+
 ALLOW_EMPTY:${PN} = "1"
 
 PACKAGECONFIG ??= "drm"
--

2.44.0

#13 lore raw

Re: [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

In reply to Christophe Chapuis
Quoted 13 lines · Christophe Chapuis

When DRM is activated for LVGL, it adds a dependency on drm.h. As for lvgl-demo-fb, add an include path to fix this usecase.

---
  meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 2 ++
  1 file changed, 2 insertions(+)
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +0 -0
index 8bd718efd..6a9a7411b 100644

meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb inherit cmake · line 24

Quoted 4 lines
meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +1 -0
@@ -21,6 +21,8 @@ inherit cmake
  EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
  S = "${WORKDIR}/git"
 
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"

Shouldn't this be conditional only if PACKAGECONFIG contains 'drm' ?

#14 lore raw

Re: [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

It could be conditional eventually; I just took the line from lvgl-demo-fb, where it wasn't.

Ideally, both should be moved in lv-conf.inc, where the lvgl drm setting is activated. But I didn't want to expand again the scope of this patchset, initially focused simply on adding some variables to lv-conf.inc.

Quoted 22 lines · Marek Vasut

Review

Quoted 9 lines · Christophe Chapuis

When DRM is activated for LVGL, it adds a dependency on drm.h. As for lvgl-demo-fb, add an include path to fix this usecase.

---
  meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb | 2 ++
  1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb

meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb inherit cmake · line 24

Quoted 8 lines

index 8bd718efd..6a9a7411b 100644

meta-oe/recipes-graphics/lvgl/lvgl_9.0.0.bb +1 -0
@@ -21,6 +21,8 @@ inherit cmake
  EXTRA_OECMAKE = "-DLIB_INSTALL_DIR=${baselib} -DBUILD_SHARED_LIBS=ON"
  S = "${WORKDIR}/git"
 
+TARGET_CFLAGS += "-I${STAGING_INCDIR}/libdrm"

Shouldn't this be conditional only if PACKAGECONFIG contains 'drm' ?

#15 lore raw

Re: [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

Quoted 6 lines · Christophe Chapuis

It could be conditional eventually; I just took the line from lvgl-demo-fb, where it wasn't.

Ideally, both should be moved in lv-conf.inc, where the lvgl drm setting is activated. But I didn't want to expand again the scope of this patchset, initially focused simply on adding some variables to lv-conf.inc.

I think I will just defer that decision to Khem.

My concern is that a system with SDL or fbdev backend may not have libdrm available, so I think it should be conditional.

I think this will handle that concern:

TARGET_CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)}"

Acked-by
#16 lore raw

Re: [oe] [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

The extra -I flag won't harm even when libdrm isn't there.

lvgl-demo-fb also doesn't do it conditionally based on drm PACKAGECONFIG.

If someone want's to fix this properly then should also use pkg-config (and tests/FindLibDRM.cmake in the lvgl repo), but lets not block this fix based on that.

This whole issue is just revealed by the typo fix in
https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/
which fixed lv-conf.inc to work for lvgl resulting in LV_USE_LINUX_DRM being respected based on PACKAGECONFIG drm.

Quoted 27 lines · Marek Vasut
Quoted 6 lines · Christophe Chapuis

It could be conditional eventually; I just took the line from lvgl-demo-fb, where it wasn't.

Ideally, both should be moved in lv-conf.inc, where the lvgl drm setting is activated. But I didn't want to expand again the scope of this patchset, initially focused simply on adding some variables to lv-conf.inc.

I think I will just defer that decision to Khem.

My concern is that a system with SDL or fbdev backend may not have libdrm available, so I think it should be conditional.

I think this will handle that concern:

TARGET_CFLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'drm', '-I${STAGING_INCDIR}/libdrm', '', d)}"

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

Reviewed-by
#17 lore raw

Re: [oe] [meta-oe][PATCH v4 6/7] lvgl: fix libdrm include

Quoted 7 lines · Martin Jansa

The extra -I flag won't harm even when libdrm isn't there.

lvgl-demo-fb also doesn't do it conditionally based on drm PACKAGECONFIG.

If someone want's to fix this properly then should also use pkg-config (and tests/FindLibDRM.cmake in the lvgl repo), but lets not block this fix based on that.

The CMake fix is already being worked on upstream.

For completeness:

#18 lore raw

PATCH v4 7/7 lvgl: lv-conf.inc: generalize sed instructions

In reply to Christophe Chapuis

Use [ \t] to detect optionnal spaces at the beginning of each line, and after the define.

---
 meta-oe/recipes-graphics/lvgl/lv-conf.inc | 46 +++++++++++------------
 1 file changed, 23 insertions(+), 23 deletions(-)
meta-oe/recipes-graphics/lvgl/lv-conf.inc +23 -23
index 9ee9f283d..2b5d4a14a 100644
@@ -35,37 +35,37 @@ do_configure:append() {
 
     sed -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|g" \
         \
-        -e "s|\(^#define LV_USE_LINUX_DRM \).*|\1${LVGL_CONFIG_USE_DRM}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_DRM[ \t]\).*|\1${LVGL_CONFIG_USE_DRM}|g" \
         \
-        -e "s|\(^#define LV_USE_LINUX_FBDEV \).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_FBDEV[ \t]\).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
         \
-        -e "s|\(^#define LV_USE_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^#define LV_USE_DRAW_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^ \+#define LV_SDL_BUF_COUNT \).*|\1 2|g" \
-        -e "s|\(^ \+#define LV_SDL_FULLSCREEN \).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_SDL[ \t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_DRAW_SDL[ \t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_BUF_COUNT[ \t]\).*|\1 2|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_FULLSCREEN[ \t]\).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
         \
-        -e "s|\(^#define LV_COLOR_DEPTH \).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
-        -e "s|\(#define LV_MEM_CUSTOM .*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
-        -e "s|\(^ \+#define LV_MEM_SIZE \).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
+        -e "s|\(^[ \t]*#define LV_COLOR_DEPTH[ \t]\).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
+        -e "s|\(^[ \t]*#define LV_MEM_CUSTOM[ \t].*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
+        -e "s|\(^[ \t]*#define LV_MEM_SIZE[ \t]\).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
         \
-        -e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM[ \t]\).*|\1 1|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_INCLUDE[ \t]\).*|\1 <stdint.h>|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[ \t]\).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
         \
-        -e "s|\(^#define LV_USE_EVDEV \).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_EVDEV[ \t]\).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
         \
-        -e "s|\(^#define LV_USE_ASSERT_NULL \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MALLOC \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_STYLE \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_NULL[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MALLOC[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_STYLE[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MEM_INTEGRITY[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_OBJ[ \t]\).*|\1${DEBUG_BUILD}|g" \
         \
-        -e "s|\(^#define LV_USE_LOG \).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
-        -e "s|\(^ \+#define LV_LOG_LEVEL \).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
-        -e "s|\(^ \+#define LV_LOG_PRINTF \).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LOG[ \t]\).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
+        -e "s|\(^[ \t]*#define LV_LOG_LEVEL[ \t]\).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
+        -e "s|\(^[ \t]*#define LV_LOG_PRINTF[ \t]\).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
         \
-        -e "s|\(^#define LV_USE_FONT_COMPRESSED \).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
-        -e "s|\(^ \+#define LV_THEME_DEFAULT_DARK \).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_FONT_COMPRESSED[ \t]\).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
+        -e "s|\(^[ \t]*#define LV_THEME_DEFAULT_DARK[ \t]\).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
         \
         -i "${S}/lv_conf.h"
 }
Signature · 1 line
2.44.0
#20 lore raw

RE: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

In reply to Christophe Chapuis
Quoted 82 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Tofe
Sent: den 16 mars 2024 11:01
To: [email protected]
Cc: Marek Vasut <[email protected]>; Khem Raj <[email protected]>; Fabio Estevam <[email protected]>; Christophe Chapuis <[email protected]>
Subject: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

Use [ \t] to detect optionnal spaces at the beginning of each line, and after the define.

---
 meta-oe/recipes-graphics/lvgl/lv-conf.inc | 46 +++++++++++------------
 1 file changed, 23 insertions(+), 23 deletions(-)
meta-oe/recipes- renamed from meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -0

graphics/lvgl/lv-conf.inc
index 9ee9f283d..2b5d4a14a 100644

meta-oe/recipes-graphics/lvgl/lv-conf.inc +23 -24
@@ -35,37 +35,37 @@ do_configure:append() {
 
     sed -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|g" \
         \
-        -e "s|\(^#define LV_USE_LINUX_DRM \).*|\1${LVGL_CONFIG_USE_DRM}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_DRM[ \t]\).*|\1${LVGL_CONFIG_USE_DRM}|g" \
         \
-        -e "s|\(^#define LV_USE_LINUX_FBDEV \).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_FBDEV[ \t]\).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
         \
-        -e "s|\(^#define LV_USE_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^#define LV_USE_DRAW_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^ \+#define LV_SDL_BUF_COUNT \).*|\1 2|g" \
-        -e "s|\(^ \+#define LV_SDL_FULLSCREEN \).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_SDL[ \t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_DRAW_SDL[ \t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_BUF_COUNT[ \t]\).*|\1 2|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_FULLSCREEN[ \t]\).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
         \
-        -e "s|\(^#define LV_COLOR_DEPTH \).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
-        -e "s|\(#define LV_MEM_CUSTOM .*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
-        -e "s|\(^ \+#define LV_MEM_SIZE \).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
+        -e "s|\(^[ \t]*#define LV_COLOR_DEPTH[ \t]\).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
+        -e "s|\(^[ \t]*#define LV_MEM_CUSTOM[ \t].*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
+        -e "s|\(^[ \t]*#define LV_MEM_SIZE[ \t]\).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
         \
-        -e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM[ \t]\).*|\1 1|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_INCLUDE[ \t]\).*|\1 <stdint.h>|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[ \t]\).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
         \
-        -e "s|\(^#define LV_USE_EVDEV \).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_EVDEV[ \t]\).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
         \
-        -e "s|\(^#define LV_USE_ASSERT_NULL \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MALLOC \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_STYLE \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_NULL[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MALLOC[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_STYLE[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MEM_INTEGRITY[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_OBJ[ \t]\).*|\1${DEBUG_BUILD}|g" \
         \
-        -e "s|\(^#define LV_USE_LOG \).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
-        -e "s|\(^ \+#define LV_LOG_LEVEL \).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
-        -e "s|\(^ \+#define LV_LOG_PRINTF \).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LOG[ \t]\).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
+        -e "s|\(^[ \t]*#define LV_LOG_LEVEL[ \t]\).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
+        -e "s|\(^[ \t]*#define LV_LOG_PRINTF[ \t]\).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
         \
-        -e "s|\(^#define LV_USE_FONT_COMPRESSED \).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
-        -e "s|\(^ \+#define LV_THEME_DEFAULT_DARK \).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_FONT_COMPRESSED[ \t]\).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
+        -e "s|\(^[ \t]*#define LV_THEME_DEFAULT_DARK[ \t]\).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
         \
         -i "${S}/lv_conf.h"
 }
--
Quoted 1 line

2.44.0

I would recommend the following:
* Use "\s" instead of "[ \t]".
* Enable extended regular expressions (ERE) by adding the -r option. Then you can change "\(...\)" to "(...)".
* Change "\(^....\)" to "^(...)" (with ERE enabled).
* Remove the "g" flag as none of the expressions are designed to match multiple times per line.

//Peter

#21 lore raw

Re: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

Quoted 78 lines · Peter Kjellerstedt
Quoted 78 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Tofe
Sent: den 16 mars 2024 11:01
To: [email protected]
Cc: Marek Vasut <[email protected]>; Khem Raj <[email protected]>; Fabio Estevam <[email protected]>; Christophe Chapuis <[email protected]>
Subject: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

Use [ \t] to detect optionnal spaces at the beginning of each line, and after the define.

---
  meta-oe/recipes-graphics/lvgl/lv-conf.inc | 46 +++++++++++------------
  1 file changed, 23 insertions(+), 23 deletions(-)
meta-oe/recipes- renamed from meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -0

graphics/lvgl/lv-conf.inc
index 9ee9f283d..2b5d4a14a 100644

meta-oe/recipes-graphics/lvgl/lv-conf.inc +23 -23
@@ -35,37 +35,37 @@ do_configure:append() {
 
      sed -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 // Enabled by ${PN}|g" \
          \
-        -e "s|\(^#define LV_USE_LINUX_DRM \).*|\1${LVGL_CONFIG_USE_DRM}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_DRM[ \t]\).*|\1${LVGL_CONFIG_USE_DRM}|g" \
          \
-        -e "s|\(^#define LV_USE_LINUX_FBDEV \).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_FBDEV[ \t]\).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \
          \
-        -e "s|\(^#define LV_USE_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^#define LV_USE_DRAW_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^ \+#define LV_SDL_BUF_COUNT \).*|\1 2|g" \
-        -e "s|\(^ \+#define LV_SDL_FULLSCREEN \).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_SDL[ \t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_DRAW_SDL[ \t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_BUF_COUNT[ \t]\).*|\1 2|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_FULLSCREEN[ \t]\).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \
          \
-        -e "s|\(^#define LV_COLOR_DEPTH \).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
-        -e "s|\(#define LV_MEM_CUSTOM .*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
-        -e "s|\(^ \+#define LV_MEM_SIZE \).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
+        -e "s|\(^[ \t]*#define LV_COLOR_DEPTH[ \t]\).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \
+        -e "s|\(^[ \t]*#define LV_MEM_CUSTOM[ \t].*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \
+        -e "s|\(^[ \t]*#define LV_MEM_SIZE[ \t]\).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \
          \
-        -e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM[ \t]\).*|\1 1|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_INCLUDE[ \t]\).*|\1 <stdint.h>|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[ \t]\).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \
          \
-        -e "s|\(^#define LV_USE_EVDEV \).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_EVDEV[ \t]\).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \
          \
-        -e "s|\(^#define LV_USE_ASSERT_NULL \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MALLOC \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_STYLE \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_NULL[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MALLOC[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_STYLE[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MEM_INTEGRITY[ \t]\).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_OBJ[ \t]\).*|\1${DEBUG_BUILD}|g" \
          \
-        -e "s|\(^#define LV_USE_LOG \).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
-        -e "s|\(^ \+#define LV_LOG_LEVEL \).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
-        -e "s|\(^ \+#define LV_LOG_PRINTF \).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_LOG[ \t]\).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \
+        -e "s|\(^[ \t]*#define LV_LOG_LEVEL[ \t]\).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \
+        -e "s|\(^[ \t]*#define LV_LOG_PRINTF[ \t]\).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \
          \
-        -e "s|\(^#define LV_USE_FONT_COMPRESSED \).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
-        -e "s|\(^ \+#define LV_THEME_DEFAULT_DARK \).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_FONT_COMPRESSED[ \t]\).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \
+        -e "s|\(^[ \t]*#define LV_THEME_DEFAULT_DARK[ \t]\).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \
Quoted 8 lines
Quoted 5 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
          -i "${S}/lv_conf.h"
  }
--

2.44.0

I would recommend the following:
* Use "\s" instead of "[ \t]".

I didn't know \s , where is this documented ? Is this similar to [[:space:]] ?

Quoted 5 lines

* Enable extended regular expressions (ERE) by adding the -r option. Then you can change "\(...\)" to "(...)".
* Change "\(^....\)" to "^(...)" (with ERE enabled).
* Remove the "g" flag as none of the expressions are designed to match multiple times per line.

Chris, do you want to send a follow up patch (I think this series is already applied), or shall I do that while preparing LVGL 9.1 series?

#22 lore raw

Re: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

I avoided \s because it's not well known, and I would also prefer using [[:space:]] as it is POSIX compliant.

I can propose a patch for this, taking Peter's remarks into account.

Quoted 142 lines · Marek Vasut
Quoted 2 lines · Peter Kjellerstedt
Quoted 2 lines

-----Original Message-----
From: [email protected] <

[email protected]> On Behalf Of Tofe

Quoted 3 lines
Quoted 3 lines

Sent: den 16 mars 2024 11:01
To: [email protected]
Cc: Marek Vasut <[email protected]>; Khem Raj <[email protected]>; Fabio

Estevam <[email protected]>; Christophe Chapuis <[email protected]>

Quoted 1 line
Quoted 1 line

Subject: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed

instructions

Quoted 10 lines

Review

Quoted 10 lines

Use [ \t] to detect optionnal spaces at the beginning of each line, and after the define.

---
  meta-oe/recipes-graphics/lvgl/lv-conf.inc | 46 +++++++++++------------
  1 file changed, 23 insertions(+), 23 deletions(-)
(quoted diff) +0 -0

b/meta-oe/recipes-

Quoted 7 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 36

Quoted 7 lines

graphics/lvgl/lv-conf.inc
index 9ee9f283d..2b5d4a14a 100644

meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -0
@@ -35,37 +35,37 @@ do_configure:append() {
 
      sed -e "s|#if 0 .*Set it to \"1\" to enable content.*|#if 1 //

Enabled by ${PN}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 38

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
-        -e "s|\(^#define LV_USE_LINUX_DRM

\).*|\1${LVGL_CONFIG_USE_DRM}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 38

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_DRM[

\t]\).*|\1${LVGL_CONFIG_USE_DRM}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 40

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
-        -e "s|\(^#define LV_USE_LINUX_FBDEV

\).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 40

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_LINUX_FBDEV[

\t]\).*|\1${LVGL_CONFIG_USE_FBDEV}|g" \

Quoted 3 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() {

Quoted 3 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -2
          \
-        -e "s|\(^#define LV_USE_SDL \).*|\1${LVGL_CONFIG_USE_SDL}|g" \
-        -e "s|\(^#define LV_USE_DRAW_SDL

\).*|\1${LVGL_CONFIG_USE_SDL}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 45

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -2
-        -e "s|\(^ \+#define LV_SDL_BUF_COUNT \).*|\1 2|g" \
-        -e "s|\(^ \+#define LV_SDL_FULLSCREEN

\).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 42

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_SDL[

\t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 43

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_DRAW_SDL[

\t]\).*|\1${LVGL_CONFIG_USE_SDL}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 45

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +2 -0
+        -e "s|\(^[ \t]*#define LV_SDL_BUF_COUNT[ \t]\).*|\1 2|g" \
+        -e "s|\(^[ \t]*#define LV_SDL_FULLSCREEN[

\t]\).*|\1${LVGL_CONFIG_SDL_FULLSCREEN}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 47

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
-        -e "s|\(^#define LV_COLOR_DEPTH

\).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 48

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
-        -e "s|\(#define LV_MEM_CUSTOM

.*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 49

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
-        -e "s|\(^ \+#define LV_MEM_SIZE

\).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 47

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_COLOR_DEPTH[

\t]\).*|\1${LVGL_CONFIG_LV_COLOR_DEPTH}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 48

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_MEM_CUSTOM[

\t].*\).*|\1${LVGL_CONFIG_LV_MEM_CUSTOM}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 49

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_MEM_SIZE[

\t]\).*|\1${LVGL_CONFIG_LV_MEM_SIZE}|g" \

Quoted 4 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() {

Quoted 4 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -3
          \
-        -e "s|\(#define LV_TICK_CUSTOM \).*|\1 1|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_INCLUDE \).*|\1 <stdint.h>|g" \
-        -e "s|\(#define LV_TICK_CUSTOM_SYS_TIME_EXPR \).*|extern

uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 52

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +2 -0
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM[ \t]\).*|\1 1|g" \
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_INCLUDE[ \t]\).*|\1

<stdint.h>|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 53

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_TICK_CUSTOM_SYS_TIME_EXPR[

\t]\).*|extern uint32_t custom_tick_get(void);\n\1 (custom_tick_get())|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 55

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
-        -e "s|\(^#define LV_USE_EVDEV

\).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 55

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_EVDEV[

\t]\).*|\1${LVGL_CONFIG_USE_EVDEV}|g" \

Quoted 3 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() {

Quoted 3 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -2
          \
-        -e "s|\(^#define LV_USE_ASSERT_NULL \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MALLOC \).*|\1${DEBUG_BUILD}|g"

\

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 60

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -2
-        -e "s|\(^#define LV_USE_ASSERT_STYLE \).*|\1${DEBUG_BUILD}|g" \
-        -e "s|\(^#define LV_USE_ASSERT_MEM_INTEGRITY

\).*|\1${DEBUG_BUILD}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 57

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -1
-        -e "s|\(^#define LV_USE_ASSERT_OBJ \).*|\1${DEBUG_BUILD}|g" \
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_NULL[

\t]\).*|\1${DEBUG_BUILD}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 58

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MALLOC[

\t]\).*|\1${DEBUG_BUILD}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 59

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_STYLE[

\t]\).*|\1${DEBUG_BUILD}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 60

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_MEM_INTEGRITY[

\t]\).*|\1${DEBUG_BUILD}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 61

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_ASSERT_OBJ[

\t]\).*|\1${DEBUG_BUILD}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 63

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
-        -e "s|\(^#define LV_USE_LOG

\).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 64

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
-        -e "s|\(^ \+#define LV_LOG_LEVEL

\).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 65

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
-        -e "s|\(^ \+#define LV_LOG_PRINTF

\).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 63

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_LOG[

\t]\).*|\1${LVGL_CONFIG_LV_USE_LOG}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 64

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_LOG_LEVEL[

\t]\).*|\1${LVGL_CONFIG_LV_LOG_LEVEL}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 65

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_LOG_PRINTF[

\t]\).*|\1${LVGL_CONFIG_LV_LOG_PRINTF}|g" \

Quoted 2 lines

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 67

Quoted 2 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
-        -e "s|\(^#define LV_USE_FONT_COMPRESSED

\).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 68

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
-        -e "s|\(^ \+#define LV_THEME_DEFAULT_DARK

\).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 67

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_USE_FONT_COMPRESSED[

\t]\).*|\1${LVGL_CONFIG_LV_USE_FONT_COMPRESSED}|g" \

Quoted 1 line

meta-oe/recipes-graphics/lvgl/lv-conf.inc do_configure:append() { · line 68

Quoted 1 line
meta-oe/recipes-graphics/lvgl/lv-conf.inc +1 -0
+        -e "s|\(^[ \t]*#define LV_THEME_DEFAULT_DARK[

\t]\).*|\1${LVGL_CONFIG_LV_THEME_DEFAULT_DARK}|g" \

Quoted 8 lines
Quoted 5 lines
meta-oe/recipes-graphics/lvgl/lv-conf.inc +0 -1
          \
          -i "${S}/lv_conf.h"
  }
--

2.44.0

I would recommend the following:
* Use "\s" instead of "[ \t]".

I didn't know \s , where is this documented ? Is this similar to [[:space:]] ?

Quoted 5 lines

* Enable extended regular expressions (ERE) by adding the -r option. Then you can change "\(...\)" to "(...)".
* Change "\(^....\)" to "^(...)" (with ERE enabled).
* Remove the "g" flag as none of the expressions are designed to match multiple times per line.

Chris, do you want to send a follow up patch (I think this series is already applied), or shall I do that while preparing LVGL 9.1 series?

#23 lore raw

Re: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

Quoted 4 lines · Christophe Chapuis

I avoided \s because it's not well known, and I would also prefer using [[:space:]] as it is POSIX compliant.

I can propose a patch for this, taking Peter's remarks into account.

Yes please, already reviewed too.

btw please stop top-posting .

#24 lore raw

RE: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

Quoted 10 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: den 18 mars 2024 23:00
To: Christophe Chapuis <[email protected]>
Cc: Peter Kjellerstedt <[email protected]>; openembedded- [email protected]; Khem Raj <[email protected]>; Fabio Estevam <[email protected]>
Subject: Re: [oe] [meta-oe][PATCH v4 7/7] lvgl: lv-conf.inc: generalize sed instructions

Quoted 3 lines
Quoted 2 lines · Christophe Chapuis

I avoided \s because it's not well known, and I would also prefer using [[:space:]] as it is POSIX compliant.

See chapter "5.6 regular expression extensions" in the sed info page for \s and a number of other similar sequences (for anyone used to Perl's regular expressions, \s is the normal way to match whitespace). And true, this is not POSIX, but neither is the -i option that is also used by the same command.

Quoted 2 lines
Quoted 2 lines

I can propose a patch for this, taking Peter's remarks into account.

Thank you.

Quoted 4 lines

Yes please, already reviewed too.

btw please stop top-posting .

//Peter