aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-22 03:22:19 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-28 05:25:21 -0400
commit0b669a5076fd8c4b0dc6f21e41f93b1102c52925 (patch)
tree77110d10e30ff33c7070cfbf9cd893b00d983fae /scripts
parente6ecfb45072c98bc3229d79a4a98093677f2a11f (diff)
kconfig: refactor Qt package checks for building qconf
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. In the old code, 'pkg-config --exists' only checked Qt5Core / QtCore, but the set of necessary packages should be checked. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Tested-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile73
-rwxr-xr-xscripts/kconfig/qconf-cfg.sh25
2 files changed, 53 insertions, 45 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 5def8779d7d8..e9a87bff370b 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -188,8 +188,6 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
188# Utilizes ncurses 188# Utilizes ncurses
189# mconf: Used for the menuconfig target 189# mconf: Used for the menuconfig target
190# Utilizes the lxdialog package 190# Utilizes the lxdialog package
191# qconf: Used for the xconfig target
192# Based on Qt which needs to be installed to compile it
193# gconf: Used for the gconfig target 191# gconf: Used for the gconfig target
194# Based on GTK+ which needs to be installed to compile it 192# Based on GTK+ which needs to be installed to compile it
195# object files used by all kconfig flavours 193# object files used by all kconfig flavours
@@ -201,14 +199,12 @@ conf-objs := conf.o zconf.tab.o
201mconf-objs := mconf.o zconf.tab.o $(lxdialog) 199mconf-objs := mconf.o zconf.tab.o $(lxdialog)
202nconf-objs := nconf.o zconf.tab.o nconf.gui.o 200nconf-objs := nconf.o zconf.tab.o nconf.gui.o
203kxgettext-objs := kxgettext.o zconf.tab.o 201kxgettext-objs := kxgettext.o zconf.tab.o
204qconf-cxxobjs := qconf.o
205qconf-objs := zconf.tab.o
206gconf-objs := gconf.o zconf.tab.o 202gconf-objs := gconf.o zconf.tab.o
207 203
208hostprogs-y := conf nconf mconf kxgettext qconf gconf 204hostprogs-y := conf nconf mconf kxgettext gconf
209 205
210targets += zconf.lex.c 206targets += zconf.lex.c
211clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck 207clean-files := .tmp_gtkcheck
212clean-files += gconf.glade.h 208clean-files += gconf.glade.h
213clean-files += config.pot linux.pot 209clean-files += config.pot linux.pot
214 210
@@ -228,9 +224,6 @@ HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTC
228HOSTCFLAGS_zconf.lex.o := -I$(src) 224HOSTCFLAGS_zconf.lex.o := -I$(src)
229HOSTCFLAGS_zconf.tab.o := -I$(src) 225HOSTCFLAGS_zconf.tab.o := -I$(src)
230 226
231HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
232HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
233
234HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` 227HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
235HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 228HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
236 -Wno-missing-prototypes 229 -Wno-missing-prototypes
@@ -241,34 +234,22 @@ HOSTLOADLIBES_nconf = $(shell \
241 pkg-config --libs menuw panelw ncursesw 2>/dev/null \ 234 pkg-config --libs menuw panelw ncursesw 2>/dev/null \
242 || pkg-config --libs menu panel ncurses 2>/dev/null \ 235 || pkg-config --libs menu panel ncurses 2>/dev/null \
243 || echo "-lmenu -lpanel -lncurses" ) 236 || echo "-lmenu -lpanel -lncurses" )
244$(obj)/qconf.o: $(obj)/.tmp_qtcheck 237
245 238# qconf: Used for the xconfig target based on Qt
246ifeq ($(MAKECMDGOALS),xconfig) 239hostprogs-y += qconf
247$(obj)/.tmp_qtcheck: $(src)/Makefile 240qconf-cxxobjs := qconf.o
248-include $(obj)/.tmp_qtcheck 241qconf-objs := zconf.tab.o
249 242
250# Qt needs some extra effort... 243HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
251$(obj)/.tmp_qtcheck: 244HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
252 @set -e; $(kecho) " CHECK qt"; \ 245
253 if pkg-config --exists Qt5Core; then \ 246$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc
254 cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ 247
255 libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ 248quiet_cmd_moc = MOC $@
256 moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ 249 cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@
257 elif pkg-config --exists QtCore; then \ 250
258 cflags=`pkg-config --cflags QtCore QtGui`; \ 251$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
259 libs=`pkg-config --libs QtCore QtGui`; \ 252 $(call cmd,moc)
260 moc=`pkg-config --variable=moc_location QtCore`; \
261 else \
262 echo >&2 "*"; \
263 echo >&2 "* Could not find Qt via pkg-config."; \
264 echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
265 echo >&2 "*"; \
266 exit 1; \
267 fi; \
268 echo "KC_QT_CFLAGS=$$cflags" > $@; \
269 echo "KC_QT_LIBS=$$libs" >> $@; \
270 echo "KC_QT_MOC=$$moc" >> $@
271endif
272 253
273$(obj)/gconf.o: $(obj)/.tmp_gtkcheck 254$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
274 255
@@ -298,15 +279,17 @@ endif
298 279
299$(obj)/zconf.tab.o: $(obj)/zconf.lex.c 280$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
300 281
301$(obj)/qconf.o: $(obj)/qconf.moc
302
303quiet_cmd_moc = MOC $@
304 cmd_moc = $(KC_QT_MOC) -i $< -o $@
305
306$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck
307 $(call cmd,moc)
308
309# Extract gconf menu items for i18n support 282# Extract gconf menu items for i18n support
310$(obj)/gconf.glade.h: $(obj)/gconf.glade 283$(obj)/gconf.glade.h: $(obj)/gconf.glade
311 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ 284 $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \
312 $(obj)/gconf.glade 285 $(obj)/gconf.glade
286
287# check if necessary packages are available, and configure build flags
288define filechk_conf_cfg
289 $(CONFIG_SHELL) $<
290endef
291
292$(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
293 $(call filechk,conf_cfg)
294
295clean-files += .*conf-cfg
diff --git a/scripts/kconfig/qconf-cfg.sh b/scripts/kconfig/qconf-cfg.sh
new file mode 100755
index 000000000000..0862e1562536
--- /dev/null
+++ b/scripts/kconfig/qconf-cfg.sh
@@ -0,0 +1,25 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4PKG="Qt5Core Qt5Gui Qt5Widgets"
5PKG2="QtCore QtGui"
6
7if pkg-config --exists $PKG; then
8 echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\"
9 echo libs=\"$(pkg-config --libs $PKG)\"
10 echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\"
11 exit 0
12fi
13
14if pkg-config --exists $PKG2; then
15 echo cflags=\"$(pkg-config --cflags $PKG2)\"
16 echo libs=\"$(pkg-config --libs $PKG2)\"
17 echo moc=\"$(pkg-config --variable=moc_location QtCore)\"
18 exit 0
19fi
20
21echo >&2 "*"
22echo >&2 "* Could not find Qt via pkg-config."
23echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"
24echo >&2 "*"
25exit 1