From patchwork Sun May 20 08:16:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10413281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3099F60353 for ; Sun, 20 May 2018 08:19:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21D69286BD for ; Sun, 20 May 2018 08:19:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 163AC28718; Sun, 20 May 2018 08:19:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B060728703 for ; Sun, 20 May 2018 08:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752541AbeETITD (ORCPT ); Sun, 20 May 2018 04:19:03 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:22132 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451AbeETISp (ORCPT ); Sun, 20 May 2018 04:18:45 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w4K8H4h5004008; Sun, 20 May 2018 17:17:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w4K8H4h5004008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526804229; bh=ADGuTHjs9MGaTk4AR46UNaqCWbIPH9cNIfOzx/hWGpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WldDayOR4JqbeCEuAKyTYkabtnoCEFp8x3WhVhoctw3M7xmZhRfi3nPofr48jn+S5 DVXRQU5wfmUGTLeVHjvSj0cOm5AuVs8JskEiKGLtlP6oBYa0F6mXdSVNsSWL1D3c/T wR1R5Ctpqs5V09hjhC5ua7rofd+OWHEbKBy725FAu32UXH37LOwSKPaVQ0jlhfVAtm bmIX9t5IERa92pQ0hckdBsoyil/z0GjbiEl2NXmpHIM+YmJqIw3CkxvwWA+pakkCrE kRP0l6xWojQOD14/djT4w6LdDANlfLZNYxnNmz1Hoo2mftYYBSKIvQZnXhf7tBV95m QPoJZGieD/KKg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf Date: Sun, 20 May 2018 17:16:53 +0900 Message-Id: <1526804213-8238-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526804213-8238-1-git-send-email-yamada.masahiro@socionext.com> References: <1526804213-8238-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Building nconf requires ncurses, but its presence is not checked. Check and configure necessary packages by a shell script like the other GUI frontends. Signed-off-by: Masahiro Yamada --- Changes in v2: - Add fallback code in case distributions cannot find ncurses by pkg-config. scripts/kconfig/Makefile | 16 ++++++++-------- scripts/kconfig/nconf-cfg.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 scripts/kconfig/nconf-cfg.sh diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 25a3d25..b90e801 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -176,15 +176,12 @@ help: # =========================================================================== # Shared Makefile for the various kconfig executables: # conf: Used for defconfig, oldconfig and related targets -# nconf: Used for the nconfig target. -# Utilizes ncurses # object files used by all kconfig flavours conf-objs := conf.o zconf.tab.o -nconf-objs := nconf.o zconf.tab.o nconf.gui.o kxgettext-objs := kxgettext.o zconf.tab.o -hostprogs-y := conf nconf kxgettext +hostprogs-y := conf kxgettext targets += zconf.lex.c clean-files += gconf.glade.h @@ -199,10 +196,13 @@ HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTC HOSTCFLAGS_zconf.lex.o := -I$(src) HOSTCFLAGS_zconf.tab.o := -I$(src) -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" ) +# nconf: Used for the nconfig target based on ncurses +hostprogs-y += nconf +nconf-objs := nconf.o zconf.tab.o nconf.gui.o + +HOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) + +$(obj)/nconf.o: $(obj)/.nconf-cfg # mconf: Used for the menuconfig target based on lxdialog hostprogs-y += mconf diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh new file mode 100644 index 0000000..8eb7948 --- /dev/null +++ b/scripts/kconfig/nconf-cfg.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +PKG="ncursesw menuw panelw" +PKG2="ncurses menu panel" + +if pkg-config --exists $PKG; then + echo libs=\"$(pkg-config --libs $PKG)\" + exit 0 +fi + +if pkg-config --exists $PKG2; then + echo libs=\"$(pkg-config --libs $PKG2)\" + exit 0 +fi + +# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses +# by pkg-config. +if [ -f /usr/include/ncursesw/ncurses.h ]; then + echo libs=\"-lncursesw -lmenuw -lpanelw\" + exit 0 +fi + +if [ -f /usr/include/ncurses.h ]; then + echo libs=\"-lncurses -lmenu -lpanel\" + 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