Skip to contentSkip to conversation

cml1.bbclass: Handle ncurses-native being available via pkg-config

PATCH New Nathan Rossi 1 participant 1 message Nov 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cml1.bbclass: Handle ncurses-native being available via pkg-config

The linux kernel will by default use pkg-config to get ncurses(w) paths, falling back to absolute path checks otherwise. If the build host does not have ncurses installed this will fail as pkg-config will not search the native sysroot for ncurses.

To more all kernel/kconfig sources, inject the equivalent native pkg-config variables similar to what is done by the pkg-config-native script. This only affects the menuconfig python task itself and the oe_terminal call inside it.

---
Currently in linux-yocto this is solved via the CROSS_CURSES_LIB/INC with the following patch:

http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto/commit/?id=1714a5ad9cf61f4d0f4b8432f327cca2998aba77

Busybox carries a similar patch within oe-core.

Mainline linux and u-boot do not currently work without ncurses being on the build host.

---
 meta/classes/cml1.bbclass | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/classes/cml1.bbclass +8 -0
index 9b9866f4c3..d319d66ab2 100644
@@ -40,6 +40,14 @@ python do_menuconfig() {
     except OSError:
         mtime = 0
 
+    # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
+    d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig")
+    d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig")
+    d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}")
+    d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1")
+    # ensure that environment variables are overwritten with this tasks 'd' values
+    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
+
     oe_terminal("sh -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
                 d.getVar('PN') + ' Configuration', d)
 

---
2.28.0