1From: Jason Wessel <jason.wessel@windriver.com> 2Date: Sun, 3 Mar 2013 12:31:40 -0600 3Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses location 4 5Upstream-Status: Submitted 6 7[ based on: https://lkml.org/lkml/2013/3/3/103 ] 8 9This patch syncs up with the way the menuconfig ncurses / curses 10is detected and the HOST_EXTRACFLAGS works in the Linux kernel 11and it allows the menuconfig to work with a sysroot version 12of the curses libraries. 13 14--- 15 16In some cross build environments such as the Yocto Project build 17environment it provides an ncurses library that is compiled 18differently than the host's version. This causes display corruption 19problems when the host's curses includes are used instead of the 20includes from the provided compiler are overridden. There is a second 21case where there is no curses libraries at all on the host system and 22menuconfig will just fail entirely. 23 24The solution is simply to allow an override variable in 25check-lxdialog.sh for environments such as the Yocto Project. Adding 26a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing 27compiling and linking against the right headers and libraries. 28 29Signed-off-by: Jason Wessel <jason.wessel@windriver.com> 30cc: Michal Marek <mmarek@suse.cz> 31cc: linux-kbuild@vger.kernel.org 32--- 33 scripts/kconfig/lxdialog/Makefile | 2 +- 34 scripts/kconfig/lxdialog/check-lxdialog.sh | 8 ++++++++ 35 2 files changed, 9 insertions(+), 1 deletion(-) 36 37--- a/scripts/kconfig/lxdialog/check-lxdialog.sh 38+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh 39@@ -4,6 +4,10 @@ 40 # What library to link 41 ldflags() 42 { 43+ if [ x"$CROSS_CURSES_LIB" != x ]; then 44+ echo "$CROSS_CURSES_LIB" 45+ exit 46+ fi 47 pkg-config --libs ncursesw 2>/dev/null && exit 48 pkg-config --libs ncurses 2>/dev/null && exit 49 for ext in so a dll.a dylib ; do 50@@ -21,6 +25,10 @@ 51 # Where is ncurses.h? 52 ccflags() 53 { 54+ if [ x"$CROSS_CURSES_INC" != x ]; then 55+ echo "$CROSS_CURSES_INC" 56+ exit 57+ fi 58 if pkg-config --cflags ncursesw 2>/dev/null; then 59 echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1' 60 elif pkg-config --cflags ncurses 2>/dev/null; then 61--- a/scripts/kconfig/lxdialog/Makefile 62+++ b/scripts/kconfig/lxdialog/Makefile 63@@ -5,7 +5,7 @@ 64 65 # Use reursively expanded variables so we do not call gcc unless 66 # we really need to do so. (Do not call gcc as part of make mrproper) 67-HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 68+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 69 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 70 71 HOST_EXTRACFLAGS += -DLOCALE 72