Skip to content

Commit b464ef5

Browse files
committed
kconfig: refactor GTK+ package checks for building gconf
Refactor the package checks for gconf in the same way as for qconf. Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Randy Dunlap <[email protected]> Acked-by: Randy Dunlap <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]>
1 parent 0b669a5 commit b464ef5

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

scripts/kconfig/Makefile

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
188188
# Utilizes ncurses
189189
# mconf: Used for the menuconfig target
190190
# Utilizes the lxdialog package
191-
# gconf: Used for the gconfig target
192-
# Based on GTK+ which needs to be installed to compile it
193191
# object files used by all kconfig flavours
194192

195193
lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
@@ -199,12 +197,10 @@ conf-objs := conf.o zconf.tab.o
199197
mconf-objs := mconf.o zconf.tab.o $(lxdialog)
200198
nconf-objs := nconf.o zconf.tab.o nconf.gui.o
201199
kxgettext-objs := kxgettext.o zconf.tab.o
202-
gconf-objs := gconf.o zconf.tab.o
203200

204-
hostprogs-y := conf nconf mconf kxgettext gconf
201+
hostprogs-y := conf nconf mconf kxgettext
205202

206203
targets += zconf.lex.c
207-
clean-files := .tmp_gtkcheck
208204
clean-files += gconf.glade.h
209205
clean-files += config.pot linux.pot
210206

@@ -224,10 +220,6 @@ HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTC
224220
HOSTCFLAGS_zconf.lex.o := -I$(src)
225221
HOSTCFLAGS_zconf.tab.o := -I$(src)
226222

227-
HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
228-
HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
229-
-Wno-missing-prototypes
230-
231223
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
232224

233225
HOSTLOADLIBES_nconf = $(shell \
@@ -251,31 +243,14 @@ quiet_cmd_moc = MOC $@
251243
$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
252244
$(call cmd,moc)
253245

254-
$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
255-
256-
ifeq ($(MAKECMDGOALS),gconfig)
257-
-include $(obj)/.tmp_gtkcheck
258-
259-
# GTK+ needs some extra effort, too...
260-
$(obj)/.tmp_gtkcheck:
261-
@if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
262-
if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
263-
touch $@; \
264-
else \
265-
echo >&2 "*"; \
266-
echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \
267-
echo >&2 "*"; \
268-
false; \
269-
fi \
270-
else \
271-
echo >&2 "*"; \
272-
echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \
273-
echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \
274-
echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
275-
echo >&2 "*"; \
276-
false; \
277-
fi
278-
endif
246+
# gconf: Used for the gconfig target based on GTK+
247+
hostprogs-y += gconf
248+
gconf-objs := gconf.o zconf.tab.o
249+
250+
HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
251+
HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
252+
253+
$(obj)/gconf.o: $(obj)/.gconf-cfg
279254

280255
$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
281256

scripts/kconfig/gconf-cfg.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0
3+
4+
PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"
5+
6+
if ! pkg-config --exists $PKG; then
7+
echo >&2 "*"
8+
echo >&2 "* Unable to find the GTK+ installation. Please make sure that"
9+
echo >&2 "* the GTK+ 2.0 development package is correctly installed."
10+
echo >&2 "* You need $PKG"
11+
echo >&2 "*"
12+
exit 1
13+
fi
14+
15+
if ! pkg-config --atleast-version=2.0.0 gtk+-2.0; then
16+
echo >&2 "*"
17+
echo >&2 "* GTK+ is present but version >= 2.0.0 is required."
18+
echo >&2 "*"
19+
exit 1
20+
fi
21+
22+
echo cflags=\"$(pkg-config --cflags $PKG)\"
23+
echo libs=\"$(pkg-config --libs $PKG)\"

0 commit comments

Comments
 (0)