From patchwork Fri May 18 04:52:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 136231 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp769035lji; Thu, 17 May 2018 21:54:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpDKgQVwjoz621MqBa7O96hIkxY4JmvFSw03In3gbcMyHvBRKlvAw1TswliVmRGhbSg+bgZ X-Received: by 2002:a62:78c:: with SMTP id 12-v6mr7874620pfh.178.1526619259540; Thu, 17 May 2018 21:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526619259; cv=none; d=google.com; s=arc-20160816; b=Q1j7I5+8Kdiefzn/cSyMNSJxEEexjnmw7x0uSI7/oZOn/Rb97R89xh2GO765wYFIoU fYeqKX0jU/6DN539JN8uSj5nax2l9nV4zIE+NGYTx/deL4NFgx2J/ItnNQAvHQmFByZK xZ913Yvnh2mUquE54jVOwj24W6eJlZdwqVc1bDC4CabKDhE8qd0BcMmPCmU121yZNZTv dizMsWuWFtD1Kezx9gXkpkbBIi48qU8uFOhXBLLglp7dM4nT61CbGXk6hVeSSLTH1yCE wch4RbAXpoIRG2HVcRrYSjJ965RcZQTfoGnZExJX0NlAVNoz93CxTmE6bxCfHqcjR+3H d9Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=2sGr2fqfNPJUmiBhzE6pSuGCearjfItYeHO3XBDRUAc=; b=A6R3ieO6cuRxaF5qDjQQwrSSxj4WOHYHHRdn54hT2LnkbzbTFQ94N3wSUsmtOUsonR aiTGAh31TrJ9h63jnUwNJRHNMS+MnNN543F6pvY3yR59Ne8Az+WxNpxpMP/AvRJmSvkc DzjhDKGgCg96KFBFxpOyaZWexBkJMKR6L1Oz0QkXNBZ7CA9QxskZ22oBQhcFSVLQD0oO cBBpkUkUb5XYmY3tjvhguk6eOWKGRpmrooRgBfZzG2BjZ6s6b/nMoZJz6jS8SmbWZv0U 7O24/Jg+rda2nbJs51txRRpvWaWzhuDNY+UCbPyNZGvbwIXyAP8hY4oTwcwqmLgOlha/ sC2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=N7CSX9VV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si5393579pga.543.2018.05.17.21.54.19; Thu, 17 May 2018 21:54:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=N7CSX9VV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751979AbeEREyP (ORCPT + 29 others); Fri, 18 May 2018 00:54:15 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:34238 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbeEREyJ (ORCPT ); Fri, 18 May 2018 00:54:09 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w4I4qbKH013482; Fri, 18 May 2018 13:52:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w4I4qbKH013482 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526619161; bh=2sGr2fqfNPJUmiBhzE6pSuGCearjfItYeHO3XBDRUAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7CSX9VVfjVsiGl4/zBymmAXY3SECXXqK6tmcPjFz09nXPXgtVWY3UKAD2LUb/9Gx WotgjHjW5wzWm0tEzkMXLnb+2KjLJ42wrN6ZlSTS67JJXuYOO9E3qcXvLZwflTTX6+ QSvdpKvKzSxgcBwi419PS/K00lr/krNpyBGGF3Sbcw1WrPpqjCOEm8zqRxFyTzscy2 3BlDWmZX6YOXtgPpcLuaF+AmXp67FVQSOR+njbmtnMMdgH4o9545C7aNGZnJtNnZg+ y5xmYhj9xBmY6WWLt9Op0HYeP3xbKgOVOP/H3enJbOLbU/ZcRTV0ajtqDsyJX8Q9BC W/d8WUFP3BKwg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Ulf Magnusson , Randy Dunlap , Masahiro Yamada , linux-kernel@vger.kernel.org, Philippe Ombredanne , Kate Stewart , Greg Kroah-Hartman , Arvind Prasanna Subject: [PATCH 4/5] kconfig: refactor ncurses package checks for building mconf Date: Fri, 18 May 2018 13:52:25 +0900 Message-Id: <1526619146-1895-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526619146-1895-1-git-send-email-yamada.masahiro@socionext.com> References: <1526619146-1895-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mconf (or its infrastructure, lxdiaglog) depends on ncurses. check-lxdialog.sh has additional checks in case pkg-config is not available. However, qconf and gconf already rely on pkg-config to check necessary packages. For simplification, drop the fallback code from check-lxdialog.sh and move/rename to mconf-cfg.sh to make it work in the same way as the other GUI frontends. Signed-off-by: Masahiro Yamada --- scripts/kconfig/Makefile | 44 +++++--------- scripts/kconfig/lxdialog/check-lxdialog.sh | 93 ------------------------------ scripts/kconfig/lxdialog/dialog.h | 2 +- scripts/kconfig/mconf-cfg.sh | 24 ++++++++ 4 files changed, 41 insertions(+), 122 deletions(-) delete mode 100755 scripts/kconfig/lxdialog/check-lxdialog.sh create mode 100755 scripts/kconfig/mconf-cfg.sh -- 2.7.4 diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index c222745..25a3d25 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -173,60 +173,48 @@ help: @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' @echo ' tinyconfig - Configure the tiniest possible kernel' -# lxdialog stuff -check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh - -# Use recursively expanded variables so we do not call gcc unless -# we really need to do so. (Do not call gcc as part of make mrproper) -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ - -DLOCALE - # =========================================================================== # Shared Makefile for the various kconfig executables: # conf: Used for defconfig, oldconfig and related targets # nconf: Used for the nconfig target. # Utilizes ncurses -# mconf: Used for the menuconfig target -# Utilizes the lxdialog package # object files used by all kconfig flavours -lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o -lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o - conf-objs := conf.o zconf.tab.o -mconf-objs := mconf.o zconf.tab.o $(lxdialog) nconf-objs := nconf.o zconf.tab.o nconf.gui.o kxgettext-objs := kxgettext.o zconf.tab.o -hostprogs-y := conf nconf mconf kxgettext +hostprogs-y := conf nconf kxgettext targets += zconf.lex.c clean-files += gconf.glade.h clean-files += config.pot linux.pot -# Check that we have the required ncurses stuff installed for lxdialog (menuconfig) -PHONY += $(obj)/dochecklxdialog -$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog -$(obj)/dochecklxdialog: - $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) - -always := dochecklxdialog - # Add environment specific flags -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) -HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) - +HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) \ + -DLOCALE +HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) \ + -DLOCALE # generated files seem to need this to find local include files HOSTCFLAGS_zconf.lex.o := -I$(src) HOSTCFLAGS_zconf.tab.o := -I$(src) -HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) - HOSTLOADLIBES_nconf = $(shell \ pkg-config --libs menuw panelw ncursesw 2>/dev/null \ || pkg-config --libs menu panel ncurses 2>/dev/null \ || echo "-lmenu -lpanel -lncurses" ) +# mconf: Used for the menuconfig target based on lxdialog +hostprogs-y += mconf +lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o +mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) + +HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) +$(foreach f, mconf.o $(lxdialog), \ + $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) + +$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg + # qconf: Used for the xconfig target based on Qt hostprogs-y += qconf qconf-cxxobjs := qconf.o diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh deleted file mode 100755 index 6c0bcd9..0000000 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# Check ncurses compatibility - -# What library to link -ldflags() -{ - pkg-config --libs ncursesw 2>/dev/null && exit - pkg-config --libs ncurses 2>/dev/null && exit - for ext in so a dll.a dylib ; do - for lib in ncursesw ncurses curses ; do - $cc -print-file-name=lib${lib}.${ext} | grep -q / - if [ $? -eq 0 ]; then - echo "-l${lib}" - exit - fi - done - done - exit 1 -} - -# Where is ncurses.h? -ccflags() -{ - if pkg-config --cflags ncursesw 2>/dev/null; then - echo '-DCURSES_LOC="" -DNCURSES_WIDECHAR=1' - elif pkg-config --cflags ncurses 2>/dev/null; then - echo '-DCURSES_LOC=""' - elif [ -f /usr/include/ncursesw/curses.h ]; then - echo '-I/usr/include/ncursesw -DCURSES_LOC=""' - echo ' -DNCURSES_WIDECHAR=1' - elif [ -f /usr/include/ncurses/ncurses.h ]; then - echo '-I/usr/include/ncurses -DCURSES_LOC=""' - elif [ -f /usr/include/ncurses/curses.h ]; then - echo '-I/usr/include/ncurses -DCURSES_LOC=""' - elif [ -f /usr/include/ncurses.h ]; then - echo '-DCURSES_LOC=""' - else - echo '-DCURSES_LOC=""' - fi -} - -# Temp file, try to clean up after us -tmp=.lxdialog.tmp -trap "rm -f $tmp" 0 1 2 3 15 - -# Check if we can link to ncurses -check() { - $cc -x c - -o $tmp 2>/dev/null <<'EOF' -#include CURSES_LOC -main() {} -EOF - if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries or the" 1>&2 - echo " *** required header files." 1>&2 - echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 - echo " *** " 1>&2 - echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2 - echo " *** depending on your distribution) and try again." 1>&2 - echo " *** " 1>&2 - exit 1 - fi -} - -usage() { - printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n" -} - -if [ $# -eq 0 ]; then - usage - exit 1 -fi - -cc="" -case "$1" in - "-check") - shift - cc="$@" - check - ;; - "-ccflags") - ccflags - ;; - "-ldflags") - shift - cc="$@" - ldflags - ;; - "*") - usage - exit 1 - ;; -esac diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index fcffd5b..52e30a0 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -35,7 +35,7 @@ #ifdef __sun__ #define CURS_MACROS #endif -#include CURSES_LOC +#include /* * Colors in ncurses 1.9.9e do not work properly since foreground and diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh new file mode 100755 index 0000000..7d5a4b2 --- /dev/null +++ b/scripts/kconfig/mconf-cfg.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +PKG="ncursesw" +PKG2="ncurses" + +if pkg-config --exists $PKG; then + echo cflags=\"-DNCURSES_WIDECHAR=1 $(pkg-config --cflags $PKG)\" + echo libs=\"$(pkg-config --libs $PKG)\" + exit 0 +fi + +if pkg-config --exists $PKG2; then + echo cflags=\"$(pkg-config --cflags $PKG2)\" + echo libs=\"$(pkg-config --libs $PKG2)\" + exit 0 +fi + +echo >&2 "*" +echo >&2 "* Unable to find the ncurses." +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" +echo >&2 "* depending on your distribution)" +echo >&2 "*" +exit 1