Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From: Jason Wessel <jason.wessel@windriver.com> |
| 2 | Date: Sun, 3 Mar 2013 12:31:40 -0600 |
| 3 | Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses location |
| 4 | |
| 5 | Upstream-Status: Submitted |
| 6 | |
| 7 | [ based on: https://lkml.org/lkml/2013/3/3/103 ] |
| 8 | |
| 9 | This patch syncs up with the way the menuconfig ncurses / curses |
| 10 | is detected and the HOST_EXTRACFLAGS works in the Linux kernel |
| 11 | and it allows the menuconfig to work with a sysroot version |
| 12 | of the curses libraries. |
| 13 | |
| 14 | --- |
| 15 | |
| 16 | In some cross build environments such as the Yocto Project build |
| 17 | environment it provides an ncurses library that is compiled |
| 18 | differently than the host's version. This causes display corruption |
| 19 | problems when the host's curses includes are used instead of the |
| 20 | includes from the provided compiler are overridden. There is a second |
| 21 | case where there is no curses libraries at all on the host system and |
| 22 | menuconfig will just fail entirely. |
| 23 | |
| 24 | The solution is simply to allow an override variable in |
| 25 | check-lxdialog.sh for environments such as the Yocto Project. Adding |
| 26 | a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing |
| 27 | compiling and linking against the right headers and libraries. |
| 28 | |
| 29 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> |
| 30 | cc: Michal Marek <mmarek@suse.cz> |
| 31 | cc: 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 | for ext in so a dylib ; do |
| 48 | for lib in ncursesw ncurses curses ; do |
| 49 | $cc -print-file-name=lib${lib}.${ext} | grep -q / |
| 50 | @@ -19,6 +23,10 @@ ldflags() |
| 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 [ -f /usr/include/ncursesw/ncurses.h ]; then |
| 59 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"' |
| 60 | elif [ -f /usr/include/ncursesw/curses.h ]; then |
| 61 | --- a/scripts/kconfig/lxdialog/Makefile |
| 62 | +++ b/scripts/kconfig/lxdialog/Makefile |
| 63 | @@ -5,7 +5,7 @@ check-lxdialog := $(srctree)/$(src)/che |
| 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 |