Message ID | 64b8db11-deeb-924f-7174-a7208190dce3@john-millikin.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] kconfig: Support building mconf with vendor sysroot ncurses. | expand |
On Wed, Dec 23, 2020 at 2:04 PM John Millikin <john@john-millikin.com> wrote: > > Changes the final fallback path in the ncurses locator for mconf > to support host compilers with a non-default sysroot. > > This is similar to the hardcoded search for ncurses under > '/usr/include', but can support compilers that keep their default > header and library directories elsewhere. > > For nconfig, do nothing because the only vendor compiler I'm aware > of with this layout (Apple Clang) ships an ncurses version that's too > old for nconfig anyway. > > Signed-off-by: John Millikin <john@john-millikin.com> > --- > Changes in v2: > - Replace the existing check for '/usr/include/ncurses.h' instead of > preserving it, per review feedback. > > scripts/kconfig/mconf-cfg.sh | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh > index aa68ec95620d..abb9252bde9e 100755 > --- a/scripts/kconfig/mconf-cfg.sh > +++ b/scripts/kconfig/mconf-cfg.sh > @@ -33,7 +33,10 @@ if [ -f /usr/include/ncurses/ncurses.h ]; then > exit 0 > fi > > -if [ -f /usr/include/ncurses.h ]; then > +# As a final fallback before giving up, check if $HOSTCC knows of a default > +# ncurses installation (e.g. from a vendor-specific sysroot). > +echo '#include <ncurses.h>' | "${HOSTCC}" -E - >/dev/null 2>&1 > +if [ $? -eq 0 ]; then I squash these two lines as follows: +if echo '#include <ncurses.h>' | "${HOSTCC}" -E - >/dev/null 2>&1; then This would be robust against 'set -e'. Applied to linux-kbuild. Thanks. > echo cflags=\"-D_GNU_SOURCE\" > echo libs=\"-lncurses\" > exit 0 > --
diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh index aa68ec95620d..abb9252bde9e 100755 --- a/scripts/kconfig/mconf-cfg.sh +++ b/scripts/kconfig/mconf-cfg.sh @@ -33,7 +33,10 @@ if [ -f /usr/include/ncurses/ncurses.h ]; then exit 0 fi -if [ -f /usr/include/ncurses.h ]; then +# As a final fallback before giving up, check if $HOSTCC knows of a default +# ncurses installation (e.g. from a vendor-specific sysroot). +echo '#include <ncurses.h>' | "${HOSTCC}" -E - >/dev/null 2>&1 +if [ $? -eq 0 ]; then echo cflags=\"-D_GNU_SOURCE\" echo libs=\"-lncurses\" exit 0
Changes the final fallback path in the ncurses locator for mconf to support host compilers with a non-default sysroot. This is similar to the hardcoded search for ncurses under '/usr/include', but can support compilers that keep their default header and library directories elsewhere. For nconfig, do nothing because the only vendor compiler I'm aware of with this layout (Apple Clang) ships an ncurses version that's too old for nconfig anyway. Signed-off-by: John Millikin <john@john-millikin.com> --- Changes in v2: - Replace the existing check for '/usr/include/ncurses.h' instead of preserving it, per review feedback. scripts/kconfig/mconf-cfg.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --