From aa3c71ca2b6006105e1919bcf3eaf2c12d342256 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 25 Feb 2021 00:07:42 +0100 Subject: prereq: Use check-lxdialog.sh to determine curses library Curses detection in adk/config/Makefile is a mess - pkg-config was designed to avoid exactly that, so make it a required tool on all host OSs and call check-lxdialog.sh from mconf sources which uses it to define the required curses LIBS and CFLAGS from prereq.sh. Since pkg-config output also contains the right arguments for libtinfo (which depends on the chosen curses variant), no mismatches between the two may happen anymore. While being at it, sync check-lxdialog.sh with current linux sources so it covers installations with widechar support as well. Signed-off-by: Phil Sutter --- scripts/prereq.sh | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/prereq.sh b/scripts/prereq.sh index 8f42a7c60..bd0b525d8 100755 --- a/scripts/prereq.sh +++ b/scripts/prereq.sh @@ -304,6 +304,24 @@ if ! which git >/dev/null 2>&1; then fi printf "found\n" +printf " ---> checking if pkg-config is installed.. " +if ! which pkg-config >/dev/null 2>&1; then + printf "not found\n" + out=1 +else + printf "found\n" +fi + +printf " ---> checking if ncurses is installed.. " +check_lxdialog=${topdir}/adk/config/lxdialog/check-lxdialog.sh +CURSES_CFLAGS=$(/bin/sh ${check_lxdialog} -ccflags | tr '\n' ' ') +CURSES_LIBS=$(/bin/sh ${check_lxdialog} -ldflags ${CC}) +if [ $? -eq 0 ]; then + printf "found\n" +else + printf "not found\n" + out=1 +fi # creating prereq.mk echo "ADK_TOPDIR:=$(readlink -nf . 2>/dev/null || pwd -P)" > $topdir/prereq.mk @@ -327,6 +345,8 @@ echo "ARCH_FOR_BUILD:=$(${CC} -dumpmachine | sed \ -e 's/mipsel-.*/mipsel/' \ -e 's/i[3-9]86/x86/' \ )" >>prereq.mk +echo "CURSES_LIBS:=${CURSES_LIBS}" >> $topdir/prereq.mk +echo "CURSES_CFLAGS:=${CURSES_CFLAGS}" >> $topdir/prereq.mk if [ "$CC" = "clang" ]; then echo "HOST_CC:=${CC} -fbracket-depth=1024" >> $topdir/prereq.mk @@ -423,17 +443,6 @@ fi rm test.c test 2>/dev/null rm Makefile.tmp 2>/dev/null -# for make kernelconfig pkg-config is required to find ncurses -if [ $os = "Darwin" ]; then - printf " ---> checking if pkg-config is installed.. " - if ! which pkg-config >/dev/null 2>&1; then - printf "not found\n" - out=1 - else - printf "found\n" - fi -fi - # error out on any required prerequisite if [ $out -ne 0 ]; then exit -- cgit v1.2.3