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: 136415 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3213511lji; Sun, 20 May 2018 01:19:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrDOwtx/jkSe1suTUNDtzQQGSjXlHMEtZf7H5IX25uvDpXwcgJ8qlEc3QaLXHcQbYorwx20 X-Received: by 2002:a17:902:6ac6:: with SMTP id i6-v6mr16369984plt.31.1526804345035; Sun, 20 May 2018 01:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526804345; cv=none; d=google.com; s=arc-20160816; b=po9aCsuMjVtJ3gTKWvDQbGsOeIHS3k7dnVakiN4yL784TVcgpfEtHtRxcJ0aEWsTiu lEb75MtqwjhsqvAchkH2iXzwagIke+TBcIX8S2J060l7TnHiJRxDkLA8DVlKDt+r7HU6 bLozXC+sySj2KYAmfLaZBbrNl/W9LcQVVwSae41BNflk18HUqWHAxGFxX+19RdRnUNdA eQfbJZ8R2I5gAa6gx+9wRNmKywA3np6Lg1EpCGi0iS0rEHdfkiSlJvT82swjGlAUYE42 5e3KJJyJWzyHq2KoDvd8vI/0AAH37aD8QLNYU07ufICqWZaT121YwRPcAy5vaayU5Avr AA2w== 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=ADGuTHjs9MGaTk4AR46UNaqCWbIPH9cNIfOzx/hWGpg=; b=EwxR5AOvNnTmH/RlHiiGmk/4NWK3psWJxTn2OPNFHSry/OQD6kagvXp0TIFghTpRyL m+CrKwy6upLz4Ob2Lj47W0YkCRJt/6kiuhXuBSFrS2ukhZwRvC5dXmvquEcNM99jZ3yG cIzwBwZ+h8T0z48GIOFEak0ZVAITnS2+mOF7VcilFSjVwBaivnFJ9+FVNt+PyaBl/jAd o7SJSERRUScxGN56R6nsNWLHJNUGUEmYM/n5j2E6IR/trn9LyrnlyfbcN/tIMV6vk5XN 9YTDpcVN9Q9eUqDzLwr9KDicgiNocufgPJcOPXLbanL2BAdEjLuYlkI+Wptiu9XQGT9b +Hzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=WldDayOR; 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 e2-v6si9165184pga.647.2018.05.20.01.19.04; Sun, 20 May 2018 01:19:05 -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=WldDayOR; 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 S1752537AbeETITD (ORCPT + 29 others); 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.7.4 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