From patchwork Sun May 20 08:16:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 136417 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3213622lji; Sun, 20 May 2018 01:19:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrcETcohvwZTwINHJkro844qV2k6Jq99mQcU5YUQsCYKTZ4ALoFvU8NI9Eafia4sUnSA5Z+ X-Received: by 2002:a62:12d4:: with SMTP id 81-v6mr15789688pfs.243.1526804354032; Sun, 20 May 2018 01:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526804354; cv=none; d=google.com; s=arc-20160816; b=spoMCxon5bcmeYRGS/GwhwdiZEyPjK8H+AK4Zk1/m/rS4XgvgUYGu1T2fqyimnT51c y5FQ/wnsAQqzrW0Azxfa+DXroN2BqBVbZoxo6qRDaqi+YfG54v5wjp1lDNxDI+gh0wNi AFvDmOkjGMKnsVWZtdfZs1oY/4p4fkmhRCE6hY7zBgF9LArAqRRD8QiPZifsD/KggnNi S5ol1DkL3v5AFIF9OAXU0P19HSpfOiqNPNl/Rz72DYP3qldNqouEj7bzqcl6wuCRA1zR uAmsK8SOXh7T2AQBKxzbqqTTYzCx8CiWFsV8ygxIcnQbc3zDdJynYI9Lzcmry2G1A5so Vi8A== 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=gW3sIH1xa3weBIcrcZ6+uFcEALNZMgNpMXy03jEkPYc=; b=ocufFJrx3lPMV5O1yhIvTPlqwB/MNZe7os3gFfyYG2MX6AeUzcygb8yY7CeLIf7RrS GbjMg3P08uONdmZMzT6uzEjZj02z1Hl9jcSFhf8YbD5PLnC6AQHWLGcKx/sL4bMXcx4z Q8+w218Aer9p29qrZFkhB6P2oUBRIup1KSfvVAI3mJsWgSvYG9yU3n/HInswnAvVk3GM 0UE/+wGvGx7B45hV6cAVRaCw6riHc2xaFGUuDF6bpUE7oAWx6UPlz1tO2MTS1PDH3yEi dtmD/Ki/YTkqTyXyv0UIg0aLIK8ZHLUX4ZIuJj4GeWeyYK4zZ3nCPlOi65t9assXm3d3 wwUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Bd/rXcwW; 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 a5-v6si1029818plp.178.2018.05.20.01.19.13; Sun, 20 May 2018 01:19:14 -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=Bd/rXcwW; 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 S1752585AbeETITL (ORCPT + 29 others); Sun, 20 May 2018 04:19:11 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:22123 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbeETISp (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 w4K8H4h2004008; Sun, 20 May 2018 17:17:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w4K8H4h2004008 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526804227; bh=gW3sIH1xa3weBIcrcZ6+uFcEALNZMgNpMXy03jEkPYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bd/rXcwWaCRZXMMoXYz+VZQl/F8D5o9AtBOzf8Lqxel+BHvtUIERnmdgahGAh0Veq UemKWn/ivuzHF5nJF7MJnNlXLegwtMxv9lYcMR0apiQCND4MU9EyqIblCEDG/oVup2 g3N2E7HYc5HpKJW09bGGSSzd0urzu+0Hl66VTNQHpncyg1/67pLVjz844N3tsSCBKx iWniHeyK7MSFEiKeloQ6LT5JZ+SV+LTQsP+hiaEEyHOmsY7gEvjs4ZElw8XNeGiKJ8 jzcGfKtWdMcYm+FsrgLl4SHEYWd2voxbP6Jp6oqeajUMrn6pMAAU4TY6D6xiw/3EoV IbJpwDzy7+jog== 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 2/5] kconfig: refactor Qt package checks for building qconf Date: Sun, 20 May 2018 17:16:50 +0900 Message-Id: <1526804213-8238-3-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 Currently, the necessary package checks for building qconf is surrounded by ifeq ($(MAKECMDGOALS),xconfig) ... endif. Then, Make will restart when .tmp_qtcheck is generated. To simplify the Makefile, move the scripting to a separate file, and use filechk. The shell script is executed everytime xconfig is run, but it is not a costly script. Signed-off-by: Masahiro Yamada Tested-by: Randy Dunlap Acked-by: Randy Dunlap --- Changes in v2: None scripts/kconfig/Makefile | 73 +++++++++++++++++--------------------------- scripts/kconfig/qconf-cfg.sh | 25 +++++++++++++++ 2 files changed, 53 insertions(+), 45 deletions(-) create mode 100755 scripts/kconfig/qconf-cfg.sh -- 2.7.4 diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 5def877..e9a87bf 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -188,8 +188,6 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ # Utilizes ncurses # mconf: Used for the menuconfig target # Utilizes the lxdialog package -# qconf: Used for the xconfig target -# Based on Qt which needs to be installed to compile it # gconf: Used for the gconfig target # Based on GTK+ which needs to be installed to compile it # object files used by all kconfig flavours @@ -201,14 +199,12 @@ 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 -qconf-cxxobjs := qconf.o -qconf-objs := zconf.tab.o gconf-objs := gconf.o zconf.tab.o -hostprogs-y := conf nconf mconf kxgettext qconf gconf +hostprogs-y := conf nconf mconf kxgettext gconf targets += zconf.lex.c -clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck +clean-files := .tmp_gtkcheck clean-files += gconf.glade.h clean-files += config.pot linux.pot @@ -228,9 +224,6 @@ HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTC HOSTCFLAGS_zconf.lex.o := -I$(src) HOSTCFLAGS_zconf.tab.o := -I$(src) -HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) - HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ -Wno-missing-prototypes @@ -241,34 +234,22 @@ 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" ) -$(obj)/qconf.o: $(obj)/.tmp_qtcheck - -ifeq ($(MAKECMDGOALS),xconfig) -$(obj)/.tmp_qtcheck: $(src)/Makefile --include $(obj)/.tmp_qtcheck - -# Qt needs some extra effort... -$(obj)/.tmp_qtcheck: - @set -e; $(kecho) " CHECK qt"; \ - if pkg-config --exists Qt5Core; then \ - cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ - libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ - moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ - elif pkg-config --exists QtCore; then \ - cflags=`pkg-config --cflags QtCore QtGui`; \ - libs=`pkg-config --libs QtCore QtGui`; \ - moc=`pkg-config --variable=moc_location QtCore`; \ - else \ - echo >&2 "*"; \ - echo >&2 "* Could not find Qt via pkg-config."; \ - echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ - echo >&2 "*"; \ - exit 1; \ - fi; \ - echo "KC_QT_CFLAGS=$$cflags" > $@; \ - echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$moc" >> $@ -endif + +# qconf: Used for the xconfig target based on Qt +hostprogs-y += qconf +qconf-cxxobjs := qconf.o +qconf-objs := zconf.tab.o + +HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) +HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) + +$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc + +quiet_cmd_moc = MOC $@ + cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@ + +$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg + $(call cmd,moc) $(obj)/gconf.o: $(obj)/.tmp_gtkcheck @@ -298,15 +279,17 @@ endif $(obj)/zconf.tab.o: $(obj)/zconf.lex.c -$(obj)/qconf.o: $(obj)/qconf.moc - -quiet_cmd_moc = MOC $@ - cmd_moc = $(KC_QT_MOC) -i $< -o $@ - -$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck - $(call cmd,moc) - # Extract gconf menu items for i18n support $(obj)/gconf.glade.h: $(obj)/gconf.glade $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ $(obj)/gconf.glade + +# check if necessary packages are available, and configure build flags +define filechk_conf_cfg + $(CONFIG_SHELL) $< +endef + +$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE + $(call filechk,conf_cfg) + +clean-files += .*conf-cfg diff --git a/scripts/kconfig/qconf-cfg.sh b/scripts/kconfig/qconf-cfg.sh new file mode 100755 index 0000000..0862e15 --- /dev/null +++ b/scripts/kconfig/qconf-cfg.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +PKG="Qt5Core Qt5Gui Qt5Widgets" +PKG2="QtCore QtGui" + +if pkg-config --exists $PKG; then + echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\" + echo libs=\"$(pkg-config --libs $PKG)\" + echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\" + exit 0 +fi + +if pkg-config --exists $PKG2; then + echo cflags=\"$(pkg-config --cflags $PKG2)\" + echo libs=\"$(pkg-config --libs $PKG2)\" + echo moc=\"$(pkg-config --variable=moc_location QtCore)\" + exit 0 +fi + +echo >&2 "*" +echo >&2 "* Could not find Qt via pkg-config." +echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH" +echo >&2 "*" +exit 1