* [PATCH v2 1/5] kbuild: do not display CHK for filechk
2018-05-20 8:16 [PATCH v2 0/5] kconfig: refactor package checks for GUI frontends Masahiro Yamada
@ 2018-05-20 8:16 ` Masahiro Yamada
2018-05-20 8:16 ` [PATCH v2 2/5] kconfig: refactor Qt package checks for building qconf Masahiro Yamada
` (3 subsequent siblings)
4 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-20 8:16 UTC (permalink / raw)
To: linux-kbuild
Cc: Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson, Sam Ravnborg,
Masahiro Yamada, Michal Marek, linux-kernel
filechk displays two short logs; CHK for creating a temporary file,
and UPD for really updating the target.
IMHO, the build system can be quiet when the target file has not
been updated.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Changes in v2: None
scripts/Kbuild.include | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 50cee53..c7fedc5 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -57,7 +57,6 @@ kecho := $($(quiet)kecho)
# to specify a valid file as first prerequisite (often the kbuild file)
define filechk
$(Q)set -e; \
- $(kecho) ' CHK $@'; \
mkdir -p $(dir $@); \
$(filechk_$(1)) < $< > $@.tmp; \
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 2/5] kconfig: refactor Qt package checks for building qconf
2018-05-20 8:16 [PATCH v2 0/5] kconfig: refactor package checks for GUI frontends Masahiro Yamada
2018-05-20 8:16 ` [PATCH v2 1/5] kbuild: do not display CHK for filechk Masahiro Yamada
@ 2018-05-20 8:16 ` Masahiro Yamada
2018-05-20 9:45 ` Sam Ravnborg
2018-05-20 8:16 ` [PATCH v2 3/5] kconfig: refactor GTK+ package checks for building gconf Masahiro Yamada
` (2 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-20 8:16 UTC (permalink / raw)
To: linux-kbuild
Cc: Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson, Sam Ravnborg,
Masahiro Yamada, linux-kernel
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 <yamada.masahiro@socionext.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
---
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
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
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v2 2/5] kconfig: refactor Qt package checks for building qconf
2018-05-20 8:16 ` [PATCH v2 2/5] kconfig: refactor Qt package checks for building qconf Masahiro Yamada
@ 2018-05-20 9:45 ` Sam Ravnborg
0 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2018-05-20 9:45 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson,
linux-kernel
Hi Masahiro
This commit (and the rest of the series) do wonders for the
readability of the Makefile - nice work.
Some nits below.
On Sun, May 20, 2018 at 05:16:50PM +0900, Masahiro Yamada wrote:
> 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 <yamada.masahiro@socionext.com>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> ---
>
> 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
>
> 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)
Nice way to access the variables generated earlier.
> +
> +$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc
qconf.moc has a dependency on qconf-cfg so the first
dependency could be dropped here I think.
> +
> +quiet_cmd_moc = MOC $@
> + cmd_moc = $(shell . $(obj)/.qconf-cfg && echo $$moc) -i $< -o $@
> +
> +$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
> + $(call cmd,moc)
We will in this makefile only support qconf.h => qconf.moc
So it may be simpler to read the makefile if we in the above
uses explicit filenames.
> -
> -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
quiet_cmd_intl = INTL @$
cmd_intl = $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) $<
$(obj)/gconf.glade.h: $(obj)/gconf.glade
$(cmd,intl)
To make this step visible in normal build
> +# check if necessary packages are available, and configure build flags
> +define filechk_conf_cfg
> + $(CONFIG_SHELL) $<
> +endef
I cannot remember the particulars, but I think we could use $(shell ...)
in the above. If it has any positive effect is doubtful.
> +
> +$(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
The old code only checked ionly for Qt5Core / QtCore - so what you do here is
likely an extra improvement.
This change is not included in your changelog.
Sam
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 3/5] kconfig: refactor GTK+ package checks for building gconf
2018-05-20 8:16 [PATCH v2 0/5] kconfig: refactor package checks for GUI frontends Masahiro Yamada
2018-05-20 8:16 ` [PATCH v2 1/5] kbuild: do not display CHK for filechk Masahiro Yamada
2018-05-20 8:16 ` [PATCH v2 2/5] kconfig: refactor Qt package checks for building qconf Masahiro Yamada
@ 2018-05-20 8:16 ` Masahiro Yamada
2018-05-20 8:16 ` [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf Masahiro Yamada
2018-05-20 8:16 ` [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf Masahiro Yamada
4 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-20 8:16 UTC (permalink / raw)
To: linux-kbuild
Cc: Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson, Sam Ravnborg,
Masahiro Yamada, linux-kernel
Refactor the package checks for gconf in the same way as for qconf.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
---
Changes in v2: None
scripts/kconfig/Makefile | 43 +++++++++----------------------------------
scripts/kconfig/gconf-cfg.sh | 23 +++++++++++++++++++++++
2 files changed, 32 insertions(+), 34 deletions(-)
create mode 100755 scripts/kconfig/gconf-cfg.sh
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index e9a87bf..c222745 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
-# gconf: Used for the gconfig target
-# Based on GTK+ which needs to be installed to compile it
# object files used by all kconfig flavours
lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
@@ -199,12 +197,10 @@ 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
-gconf-objs := gconf.o zconf.tab.o
-hostprogs-y := conf nconf mconf kxgettext gconf
+hostprogs-y := conf nconf mconf kxgettext
targets += zconf.lex.c
-clean-files := .tmp_gtkcheck
clean-files += gconf.glade.h
clean-files += config.pot linux.pot
@@ -224,10 +220,6 @@ HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTC
HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src)
-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
-
HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOSTLOADLIBES_nconf = $(shell \
@@ -251,31 +243,14 @@ quiet_cmd_moc = MOC $@
$(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
$(call cmd,moc)
-$(obj)/gconf.o: $(obj)/.tmp_gtkcheck
-
-ifeq ($(MAKECMDGOALS),gconfig)
--include $(obj)/.tmp_gtkcheck
-
-# GTK+ needs some extra effort, too...
-$(obj)/.tmp_gtkcheck:
- @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \
- if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \
- touch $@; \
- else \
- echo >&2 "*"; \
- echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \
- echo >&2 "*"; \
- false; \
- fi \
- else \
- echo >&2 "*"; \
- echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \
- echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \
- echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \
- echo >&2 "*"; \
- false; \
- fi
-endif
+# gconf: Used for the gconfig target based on GTK+
+hostprogs-y += gconf
+gconf-objs := gconf.o zconf.tab.o
+
+HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
+HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
+
+$(obj)/gconf.o: $(obj)/.gconf-cfg
$(obj)/zconf.tab.o: $(obj)/zconf.lex.c
diff --git a/scripts/kconfig/gconf-cfg.sh b/scripts/kconfig/gconf-cfg.sh
new file mode 100755
index 0000000..533b3d8
--- /dev/null
+++ b/scripts/kconfig/gconf-cfg.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"
+
+if ! pkg-config --exists $PKG; then
+ echo >&2 "*"
+ echo >&2 "* Unable to find the GTK+ installation. Please make sure that"
+ echo >&2 "* the GTK+ 2.0 development package is correctly installed."
+ echo >&2 "* You need $PKG"
+ echo >&2 "*"
+ exit 1
+fi
+
+if ! pkg-config --atleast-version=2.0.0 gtk+-2.0; then
+ echo >&2 "*"
+ echo >&2 "* GTK+ is present but version >= 2.0.0 is required."
+ echo >&2 "*"
+ exit 1
+fi
+
+echo cflags=\"$(pkg-config --cflags $PKG)\"
+echo libs=\"$(pkg-config --libs $PKG)\"
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf
2018-05-20 8:16 [PATCH v2 0/5] kconfig: refactor package checks for GUI frontends Masahiro Yamada
` (2 preceding siblings ...)
2018-05-20 8:16 ` [PATCH v2 3/5] kconfig: refactor GTK+ package checks for building gconf Masahiro Yamada
@ 2018-05-20 8:16 ` Masahiro Yamada
2018-05-20 10:06 ` Sam Ravnborg
2018-05-20 23:36 ` Randy Dunlap
2018-05-20 8:16 ` [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf Masahiro Yamada
4 siblings, 2 replies; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-20 8:16 UTC (permalink / raw)
To: linux-kbuild
Cc: Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson, Sam Ravnborg,
Masahiro Yamada, linux-kernel, Thomas Gleixner,
Philippe Ombredanne, Greg Kroah-Hartman, Arvind Prasanna
The mconf (or its infrastructure, lxdiaglog) depends on ncurses.
Move and rename check-lxdialog.sh to mconf-cfg.sh to make it work in
the same way as for qconf and gconf.
According to Randy's report, we still need to carry the fallback code
in case the pkg-config fails to find ncurses.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---
Changes in v2:
- Restore fallback detection for openSUSE etc.
scripts/kconfig/Makefile | 44 +++++---------
scripts/kconfig/lxdialog/check-lxdialog.sh | 93 ------------------------------
scripts/kconfig/lxdialog/dialog.h | 2 +-
scripts/kconfig/mconf-cfg.sh | 38 ++++++++++++
4 files changed, 55 insertions(+), 122 deletions(-)
delete mode 100755 scripts/kconfig/lxdialog/check-lxdialog.sh
create mode 100755 scripts/kconfig/mconf-cfg.sh
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index c222745..25a3d25 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -173,60 +173,48 @@ help:
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
@echo ' tinyconfig - Configure the tiniest possible kernel'
-# lxdialog stuff
-check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
-
-# Use recursively expanded variables so we do not call gcc unless
-# we really need to do so. (Do not call gcc as part of make mrproper)
-HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
- -DLOCALE
-
# ===========================================================================
# Shared Makefile for the various kconfig executables:
# conf: Used for defconfig, oldconfig and related targets
# nconf: Used for the nconfig target.
# Utilizes ncurses
-# mconf: Used for the menuconfig target
-# Utilizes the lxdialog package
# object files used by all kconfig flavours
-lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
-lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
-
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
-hostprogs-y := conf nconf mconf kxgettext
+hostprogs-y := conf nconf kxgettext
targets += zconf.lex.c
clean-files += gconf.glade.h
clean-files += config.pot linux.pot
-# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
-PHONY += $(obj)/dochecklxdialog
-$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog
-$(obj)/dochecklxdialog:
- $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
-
-always := dochecklxdialog
-
# Add environment specific flags
-HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
-HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS))
-
+HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) \
+ -DLOCALE
+HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) \
+ -DLOCALE
# generated files seem to need this to find local include files
HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src)
-HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
-
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" )
+# mconf: Used for the menuconfig target based on lxdialog
+hostprogs-y += mconf
+lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
+mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog))
+
+HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
+$(foreach f, mconf.o $(lxdialog), \
+ $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
+
+$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg
+
# qconf: Used for the xconfig target based on Qt
hostprogs-y += qconf
qconf-cxxobjs := qconf.o
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
deleted file mode 100755
index 6c0bcd9..0000000
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-# Check ncurses compatibility
-
-# What library to link
-ldflags()
-{
- pkg-config --libs ncursesw 2>/dev/null && exit
- pkg-config --libs ncurses 2>/dev/null && exit
- for ext in so a dll.a dylib ; do
- for lib in ncursesw ncurses curses ; do
- $cc -print-file-name=lib${lib}.${ext} | grep -q /
- if [ $? -eq 0 ]; then
- echo "-l${lib}"
- exit
- fi
- done
- done
- exit 1
-}
-
-# Where is ncurses.h?
-ccflags()
-{
- if pkg-config --cflags ncursesw 2>/dev/null; then
- echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
- elif pkg-config --cflags ncurses 2>/dev/null; then
- echo '-DCURSES_LOC="<ncurses.h>"'
- elif [ -f /usr/include/ncursesw/curses.h ]; then
- echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
- echo ' -DNCURSES_WIDECHAR=1'
- elif [ -f /usr/include/ncurses/ncurses.h ]; then
- echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
- elif [ -f /usr/include/ncurses/curses.h ]; then
- echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
- elif [ -f /usr/include/ncurses.h ]; then
- echo '-DCURSES_LOC="<ncurses.h>"'
- else
- echo '-DCURSES_LOC="<curses.h>"'
- fi
-}
-
-# Temp file, try to clean up after us
-tmp=.lxdialog.tmp
-trap "rm -f $tmp" 0 1 2 3 15
-
-# Check if we can link to ncurses
-check() {
- $cc -x c - -o $tmp 2>/dev/null <<'EOF'
-#include CURSES_LOC
-main() {}
-EOF
- if [ $? != 0 ]; then
- echo " *** Unable to find the ncurses libraries or the" 1>&2
- echo " *** required header files." 1>&2
- echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2
- echo " *** " 1>&2
- echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2
- echo " *** depending on your distribution) and try again." 1>&2
- echo " *** " 1>&2
- exit 1
- fi
-}
-
-usage() {
- printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n"
-}
-
-if [ $# -eq 0 ]; then
- usage
- exit 1
-fi
-
-cc=""
-case "$1" in
- "-check")
- shift
- cc="$@"
- check
- ;;
- "-ccflags")
- ccflags
- ;;
- "-ldflags")
- shift
- cc="$@"
- ldflags
- ;;
- "*")
- usage
- exit 1
- ;;
-esac
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index fcffd5b..52e30a0 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -35,7 +35,7 @@
#ifdef __sun__
#define CURS_MACROS
#endif
-#include CURSES_LOC
+#include <ncurses.h>
/*
* Colors in ncurses 1.9.9e do not work properly since foreground and
diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
new file mode 100755
index 0000000..f5fe183
--- /dev/null
+++ b/scripts/kconfig/mconf-cfg.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+PKG="ncursesw"
+PKG2="ncurses"
+
+if pkg-config --exists $PKG; then
+ echo cflags=\"-DNCURSES_WIDECHAR=1 $(pkg-config --cflags $PKG)\"
+ echo libs=\"$(pkg-config --libs $PKG)\"
+ exit 0
+fi
+
+if pkg-config --exists $PKG2; then
+ echo cflags=\"$(pkg-config --cflags $PKG2)\"
+ 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 cflags=\"-DNCURSES_WIDECHAR=1 -I/usr/include/ncursesw\"
+ echo libs=\"-lncursesw\"
+ exit 0
+fi
+
+if [ -f /usr/include/ncurses.h ]; then
+ echo cflags=\"\"
+ echo libs=\"-lncurses\"
+ 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
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf
2018-05-20 8:16 ` [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf Masahiro Yamada
@ 2018-05-20 10:06 ` Sam Ravnborg
2018-05-22 6:48 ` Masahiro Yamada
2018-05-20 23:36 ` Randy Dunlap
1 sibling, 1 reply; 18+ messages in thread
From: Sam Ravnborg @ 2018-05-20 10:06 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson,
linux-kernel, Thomas Gleixner, Philippe Ombredanne,
Greg Kroah-Hartman, Arvind Prasanna
Hi Masahiro
On Sun, May 20, 2018 at 05:16:52PM +0900, Masahiro Yamada wrote:
> The mconf (or its infrastructure, lxdiaglog) depends on ncurses.
> Move and rename check-lxdialog.sh to mconf-cfg.sh to make it work in
> the same way as for qconf and gconf.
>
> According to Randy's report, we still need to carry the fallback code
> in case the pkg-config fails to find ncurses.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> -
> -# Use recursively expanded variables so we do not call gcc unless
> -# we really need to do so. (Do not call gcc as part of make mrproper)
> -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
> - -DLOCALE
...
> # Add environment specific flags
> -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
> -HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS))
> -
> +HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) \
> + -DLOCALE
> +HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) \
> + -DLOCALE
Any chance that the ugly hack in check.sh could be ported over to use pkg-config?
There should be no need to specify both $(shell ...) AND $(CONFIG_SHELL)
This was not introduced by this commit, but as the Makefile is cleaned up include this too.
Sam
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf
2018-05-20 10:06 ` Sam Ravnborg
@ 2018-05-22 6:48 ` Masahiro Yamada
2018-05-22 15:49 ` Sam Ravnborg
0 siblings, 1 reply; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-22 6:48 UTC (permalink / raw)
To: Sam Ravnborg
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Randy Dunlap,
Ulf Magnusson, Linux Kernel Mailing List, Thomas Gleixner,
Philippe Ombredanne, Greg Kroah-Hartman, Arvind Prasanna
2018-05-20 19:06 GMT+09:00 Sam Ravnborg <sam@ravnborg.org>:
> Hi Masahiro
>
> On Sun, May 20, 2018 at 05:16:52PM +0900, Masahiro Yamada wrote:
>> The mconf (or its infrastructure, lxdiaglog) depends on ncurses.
>> Move and rename check-lxdialog.sh to mconf-cfg.sh to make it work in
>> the same way as for qconf and gconf.
>>
>> According to Randy's report, we still need to carry the fallback code
>> in case the pkg-config fails to find ncurses.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>> -
>> -# Use recursively expanded variables so we do not call gcc unless
>> -# we really need to do so. (Do not call gcc as part of make mrproper)
>> -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
>> - -DLOCALE
> ...
>
>> # Add environment specific flags
>> -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
>> -HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS))
>> -
>> +HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) \
>> + -DLOCALE
>> +HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) \
>> + -DLOCALE
>
> Any chance that the ugly hack in check.sh could be ported over to use pkg-config?
>
> There should be no need to specify both $(shell ...) AND $(CONFIG_SHELL)
> This was not introduced by this commit, but as the Makefile is cleaned up include this too.
>
Rather, I have been wondering if we could rip off the gettext stuff entirely...
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf
2018-05-22 6:48 ` Masahiro Yamada
@ 2018-05-22 15:49 ` Sam Ravnborg
0 siblings, 0 replies; 18+ messages in thread
From: Sam Ravnborg @ 2018-05-22 15:49 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Randy Dunlap,
Ulf Magnusson, Linux Kernel Mailing List, Thomas Gleixner,
Philippe Ombredanne, Greg Kroah-Hartman, Arvind Prasanna
Hi Masahiro.
> > Any chance that the ugly hack in check.sh could be ported over to use pkg-config?
> >
> Rather, I have been wondering if we could rip off the gettext stuff entirely...
I did a little research.
update-po-conifg is broken in current kernel
The part of the Makefile that implement update-po-config hasseen very little
activity the last 5+ years
There is very few hits on google for "update-po-config", first
real hit was something related to a path I made loong time ago.
So it looks like the infrastructure could be dropped in the kernel.
I did not try to check if any other users of kconfig utilize this,
but I do not recall anyone that have mentioned this.
So ack from me to kill gettext support.
Sam
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf
2018-05-20 8:16 ` [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf Masahiro Yamada
2018-05-20 10:06 ` Sam Ravnborg
@ 2018-05-20 23:36 ` Randy Dunlap
1 sibling, 0 replies; 18+ messages in thread
From: Randy Dunlap @ 2018-05-20 23:36 UTC (permalink / raw)
To: Masahiro Yamada, linux-kbuild
Cc: Luis R . Rodriguez, Ulf Magnusson, Sam Ravnborg, linux-kernel,
Thomas Gleixner, Philippe Ombredanne, Greg Kroah-Hartman,
Arvind Prasanna
On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
> The mconf (or its infrastructure, lxdiaglog) depends on ncurses.
> Move and rename check-lxdialog.sh to mconf-cfg.sh to make it work in
> the same way as for qconf and gconf.
>
> According to Randy's report, we still need to carry the fallback code
> in case the pkg-config fails to find ncurses.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
> new file mode 100755
> index 0000000..f5fe183
> --- /dev/null
> +++ b/scripts/kconfig/mconf-cfg.sh
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +
> +PKG="ncursesw"
> +PKG2="ncurses"
> +
> +if pkg-config --exists $PKG; then
> + echo cflags=\"-DNCURSES_WIDECHAR=1 $(pkg-config --cflags $PKG)\"
> + echo libs=\"$(pkg-config --libs $PKG)\"
> + exit 0
> +fi
> +
> +if pkg-config --exists $PKG2; then
> + echo cflags=\"$(pkg-config --cflags $PKG2)\"
> + 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 cflags=\"-DNCURSES_WIDECHAR=1 -I/usr/include/ncursesw\"
> + echo libs=\"-lncursesw\"
> + exit 0
> +fi
> +
> +if [ -f /usr/include/ncurses.h ]; then
> + echo cflags=\"\"
> + echo libs=\"-lncurses\"
> + exit 0
> +fi
> +
> +echo >&2 "*"
> +echo >&2 "* Unable to find the ncurses."
the ncurses package."
> +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
> +echo >&2 "* depending on your distribution)"
distribution)."
> +echo >&2 "*"
> +exit 1
>
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-20 8:16 [PATCH v2 0/5] kconfig: refactor package checks for GUI frontends Masahiro Yamada
` (3 preceding siblings ...)
2018-05-20 8:16 ` [PATCH v2 4/5] kconfig: refactor ncurses package checks for building mconf Masahiro Yamada
@ 2018-05-20 8:16 ` Masahiro Yamada
2018-05-20 23:31 ` Randy Dunlap
2018-05-20 23:41 ` Randy Dunlap
4 siblings, 2 replies; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-20 8:16 UTC (permalink / raw)
To: linux-kbuild
Cc: Luis R . Rodriguez, Randy Dunlap, Ulf Magnusson, Sam Ravnborg,
Masahiro Yamada, linux-kernel
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 <yamada.masahiro@socionext.com>
---
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
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-20 8:16 ` [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf Masahiro Yamada
@ 2018-05-20 23:31 ` Randy Dunlap
2018-05-20 23:41 ` Randy Dunlap
1 sibling, 0 replies; 18+ messages in thread
From: Randy Dunlap @ 2018-05-20 23:31 UTC (permalink / raw)
To: Masahiro Yamada, linux-kbuild
Cc: Luis R . Rodriguez, Ulf Magnusson, Sam Ravnborg, linux-kernel
On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
> 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 <yamada.masahiro@socionext.com>
> ---
>
> Changes in v2:
> - Add fallback code in case distributions cannot find
> ncurses by pkg-config.
>
Hi,
Patch 4/5 for mconf works for me, but this one is failing.
$ make ARCH=x86_64 O=xx64 nconfig
make[1]: Entering directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
GEN ./Makefile
UPD scripts/kconfig/.nconf-cfg
HOSTCC scripts/kconfig/nconf.o
In file included from ../scripts/kconfig/nconf.c:15:0:
../scripts/kconfig/nconf.h:19:18: fatal error: menu.h: No such file or directory
#include <menu.h>
^
compilation terminated.
scripts/Makefile.host:107: recipe for target 'scripts/kconfig/nconf.o' failed
make[2]: *** [scripts/kconfig/nconf.o] Error 1
/home/rdunlap/lnx/next/linux-next-20180517/Makefile:525: recipe for target 'nconfig' failed
make[1]: *** [nconfig] Error 2
make[1]: Leaving directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
xx64/scripts/kconfig/.nconf-cfg contains:
libs="-lncursesw -lmenuw -lpanelw"
There are several menu.h files in /usr/include:
$ find . -name menu.h
./ncurses6/ncursesw/menu.h
./ncurses6/ncurses/menu.h
./ncursesw/menu.h
./claws-mail/gtk/menu.h
./ncurses/menu.h
> 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
>
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-20 8:16 ` [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf Masahiro Yamada
2018-05-20 23:31 ` Randy Dunlap
@ 2018-05-20 23:41 ` Randy Dunlap
2018-05-21 4:48 ` Masahiro Yamada
1 sibling, 1 reply; 18+ messages in thread
From: Randy Dunlap @ 2018-05-20 23:41 UTC (permalink / raw)
To: Masahiro Yamada, linux-kbuild
Cc: Luis R . Rodriguez, Ulf Magnusson, Sam Ravnborg, linux-kernel
On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
> 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 <yamada.masahiro@socionext.com>
> ---
>
> 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
> +
I guess this one needs clags, especially -I, like the mconf patch contains...
> +# 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."
the ncurses package."
> +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
> +echo >&2 "* depending on your distribution)"
distribution)."
> +echo >&2 "*"
> +exit 1
>
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-20 23:41 ` Randy Dunlap
@ 2018-05-21 4:48 ` Masahiro Yamada
2018-05-21 4:51 ` Randy Dunlap
0 siblings, 1 reply; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-21 4:48 UTC (permalink / raw)
To: Randy Dunlap
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Ulf Magnusson,
Sam Ravnborg, Linux Kernel Mailing List
2018-05-21 8:41 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
> On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
>> 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 <yamada.masahiro@socionext.com>
>> ---
>>
>
>> 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
>> +
>
> I guess this one needs clags, especially -I, like the mconf patch contains...
I thought so.
But, the current scripts/kconfig/Makefile
adds 'pkg-config --libs' to nconf,
but does nothing about 'pkg-config --cflags' for nconf.
Therefore, I kept the current behavior just in case.
The nconfig in the current version is not working for you, right?
>
>> +# 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."
>
> the ncurses package."
>
>> +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
>> +echo >&2 "* depending on your distribution)"
>
> distribution)."
>
>> +echo >&2 "*"
>> +exit 1
>>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-21 4:48 ` Masahiro Yamada
@ 2018-05-21 4:51 ` Randy Dunlap
2018-05-21 4:58 ` Masahiro Yamada
0 siblings, 1 reply; 18+ messages in thread
From: Randy Dunlap @ 2018-05-21 4:51 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Ulf Magnusson,
Sam Ravnborg, Linux Kernel Mailing List
On 05/20/2018 09:48 PM, Masahiro Yamada wrote:
> 2018-05-21 8:41 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>> On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
>>> 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 <yamada.masahiro@socionext.com>
>>> ---
>>>
>>
>>> 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
>>> +
>>
>> I guess this one needs clags, especially -I, like the mconf patch contains...
>
>
>
> I thought so.
>
> But, the current scripts/kconfig/Makefile
> adds 'pkg-config --libs' to nconf,
> but does nothing about 'pkg-config --cflags' for nconf.
> Therefore, I kept the current behavior just in case.
>
>
> The nconfig in the current version is not working for you, right?
That's correct.
Info:
$ make ARCH=x86_64 O=xx64 nconfig
make[1]: Entering directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
GEN ./Makefile
UPD scripts/kconfig/.nconf-cfg
HOSTCC scripts/kconfig/nconf.o
In file included from ../scripts/kconfig/nconf.c:15:0:
../scripts/kconfig/nconf.h:19:18: fatal error: menu.h: No such file or directory
#include <menu.h>
^
compilation terminated.
scripts/Makefile.host:107: recipe for target 'scripts/kconfig/nconf.o' failed
make[2]: *** [scripts/kconfig/nconf.o] Error 1
/home/rdunlap/lnx/next/linux-next-20180517/Makefile:525: recipe for target 'nconfig' failed
make[1]: *** [nconfig] Error 2
make[1]: Leaving directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2
xx64/scripts/kconfig/.nconf-cfg contains:
libs="-lncursesw -lmenuw -lpanelw"
>>> +# 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."
>>
>> the ncurses package."
>>
>>> +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
>>> +echo >&2 "* depending on your distribution)"
>>
>> distribution)."
>>
>>> +echo >&2 "*"
>>> +exit 1
>>>
>
>
>
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-21 4:51 ` Randy Dunlap
@ 2018-05-21 4:58 ` Masahiro Yamada
2018-05-21 6:24 ` Randy Dunlap
0 siblings, 1 reply; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-21 4:58 UTC (permalink / raw)
To: Randy Dunlap
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Ulf Magnusson,
Sam Ravnborg, Linux Kernel Mailing List
2018-05-21 13:51 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
> On 05/20/2018 09:48 PM, Masahiro Yamada wrote:
>> 2018-05-21 8:41 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>>> On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
>>>> 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 <yamada.masahiro@socionext.com>
>>>> ---
>>>>
>>>
>>>> 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
>>>> +
>>>
>>> I guess this one needs clags, especially -I, like the mconf patch contains...
>>
>>
>>
>> I thought so.
>>
>> But, the current scripts/kconfig/Makefile
>> adds 'pkg-config --libs' to nconf,
>> but does nothing about 'pkg-config --cflags' for nconf.
>> Therefore, I kept the current behavior just in case.
>>
>>
>> The nconfig in the current version is not working for you, right?
>
> That's correct.
>
>
> Info:
>
> $ make ARCH=x86_64 O=xx64 nconfig
> make[1]: Entering directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
> GEN ./Makefile
> UPD scripts/kconfig/.nconf-cfg
> HOSTCC scripts/kconfig/nconf.o
> In file included from ../scripts/kconfig/nconf.c:15:0:
> ../scripts/kconfig/nconf.h:19:18: fatal error: menu.h: No such file or directory
> #include <menu.h>
> ^
> compilation terminated.
> scripts/Makefile.host:107: recipe for target 'scripts/kconfig/nconf.o' failed
> make[2]: *** [scripts/kconfig/nconf.o] Error 1
> /home/rdunlap/lnx/next/linux-next-20180517/Makefile:525: recipe for target 'nconfig' failed
> make[1]: *** [nconfig] Error 2
> make[1]: Leaving directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
> Makefile:146: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
>
>
> xx64/scripts/kconfig/.nconf-cfg contains:
> libs="-lncursesw -lmenuw -lpanelw"
>
Sorry, I mean
the nconfig in the Linus tree is not working, right?
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-21 4:58 ` Masahiro Yamada
@ 2018-05-21 6:24 ` Randy Dunlap
2018-05-21 6:58 ` Masahiro Yamada
0 siblings, 1 reply; 18+ messages in thread
From: Randy Dunlap @ 2018-05-21 6:24 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Ulf Magnusson,
Sam Ravnborg, Linux Kernel Mailing List
On 05/20/2018 09:58 PM, Masahiro Yamada wrote:
> 2018-05-21 13:51 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>> On 05/20/2018 09:48 PM, Masahiro Yamada wrote:
>>> 2018-05-21 8:41 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>>>> On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
>>>>> 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 <yamada.masahiro@socionext.com>
>>>>> ---
>>>>>
>>>>
>>>>> 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
>>>>> +
>>>>
>>>> I guess this one needs clags, especially -I, like the mconf patch contains...
>>>
>>>
>>>
>>> I thought so.
>>>
>>> But, the current scripts/kconfig/Makefile
>>> adds 'pkg-config --libs' to nconf,
>>> but does nothing about 'pkg-config --cflags' for nconf.
>>> Therefore, I kept the current behavior just in case.
>>>
>>>
>>> The nconfig in the current version is not working for you, right?
>>
>> That's correct.
>>
>>
>> Info:
>>
>> $ make ARCH=x86_64 O=xx64 nconfig
>> make[1]: Entering directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
>> GEN ./Makefile
>> UPD scripts/kconfig/.nconf-cfg
>> HOSTCC scripts/kconfig/nconf.o
>> In file included from ../scripts/kconfig/nconf.c:15:0:
>> ../scripts/kconfig/nconf.h:19:18: fatal error: menu.h: No such file or directory
>> #include <menu.h>
>> ^
>> compilation terminated.
>> scripts/Makefile.host:107: recipe for target 'scripts/kconfig/nconf.o' failed
>> make[2]: *** [scripts/kconfig/nconf.o] Error 1
>> /home/rdunlap/lnx/next/linux-next-20180517/Makefile:525: recipe for target 'nconfig' failed
>> make[1]: *** [nconfig] Error 2
>> make[1]: Leaving directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
>> Makefile:146: recipe for target 'sub-make' failed
>> make: *** [sub-make] Error 2
>>
>>
>> xx64/scripts/kconfig/.nconf-cfg contains:
>> libs="-lncursesw -lmenuw -lpanelw"
>>
>
> Sorry, I mean
> the nconfig in the Linus tree is not working, right?
It works just fine. In a new linux-4.17-rc6 tree:
$ make ARCH=x86_64 O=xx64 V=1 nconfig
make -C /home/rdunlap/lnx/lnx-417-rc6/xx64 KBUILD_SRC=/home/rdunlap/lnx/lnx-417-rc6 \
-f /home/rdunlap/lnx/lnx-417-rc6/Makefile nconfig
make[1]: Entering directory '/home/rdunlap/lnx/lnx-417-rc6/xx64'
make -f ../scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
ln -fsn .. source
/bin/sh ../scripts/mkmakefile \
.. . 4 17
GEN ./Makefile
make -f ../scripts/Makefile.build obj=scripts/kconfig nconfig
gcc -Wp,-MD,scripts/kconfig/.nconf.o.d -Iscripts/kconfig -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I/usr/include/ncursesw -DCURSES_LOC="<curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/nconf.o ../scripts/kconfig/nconf.c
gcc -Wp,-MD,scripts/kconfig/.nconf.gui.o.d -Iscripts/kconfig -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I/usr/include/ncursesw -DCURSES_LOC="<curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/nconf.gui.o ../scripts/kconfig/nconf.gui.c
gcc -o scripts/kconfig/nconf scripts/kconfig/nconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/nconf.gui.o -lmenu -lpanel -lncurses
scripts/kconfig/nconf Kconfig
make[1]: Leaving directory '/home/rdunlap/lnx/lnx-417-rc6/xx64'
--
~Randy
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v2 5/5] kconfig: refactor ncurses package checks for building nconf
2018-05-21 6:24 ` Randy Dunlap
@ 2018-05-21 6:58 ` Masahiro Yamada
0 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2018-05-21 6:58 UTC (permalink / raw)
To: Randy Dunlap
Cc: Linux Kbuild mailing list, Luis R . Rodriguez, Ulf Magnusson,
Sam Ravnborg, Linux Kernel Mailing List
Randy,
2018-05-21 15:24 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
> On 05/20/2018 09:58 PM, Masahiro Yamada wrote:
>> 2018-05-21 13:51 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>>> On 05/20/2018 09:48 PM, Masahiro Yamada wrote:
>>>> 2018-05-21 8:41 GMT+09:00 Randy Dunlap <rdunlap@infradead.org>:
>>>>> On 05/20/2018 01:16 AM, Masahiro Yamada wrote:
>>>>>> 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 <yamada.masahiro@socionext.com>
>>>>>> ---
>>>>>>
>>>>>
>>>>>> 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
>>>>>> +
>>>>>
>>>>> I guess this one needs clags, especially -I, like the mconf patch contains...
>>>>
>>>>
>>>>
>>>> I thought so.
>>>>
>>>> But, the current scripts/kconfig/Makefile
>>>> adds 'pkg-config --libs' to nconf,
>>>> but does nothing about 'pkg-config --cflags' for nconf.
>>>> Therefore, I kept the current behavior just in case.
>>>>
>>>>
>>>> The nconfig in the current version is not working for you, right?
>>>
>>> That's correct.
>>>
>>>
>>> Info:
>>>
>>> $ make ARCH=x86_64 O=xx64 nconfig
>>> make[1]: Entering directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
>>> GEN ./Makefile
>>> UPD scripts/kconfig/.nconf-cfg
>>> HOSTCC scripts/kconfig/nconf.o
>>> In file included from ../scripts/kconfig/nconf.c:15:0:
>>> ../scripts/kconfig/nconf.h:19:18: fatal error: menu.h: No such file or directory
>>> #include <menu.h>
>>> ^
>>> compilation terminated.
>>> scripts/Makefile.host:107: recipe for target 'scripts/kconfig/nconf.o' failed
>>> make[2]: *** [scripts/kconfig/nconf.o] Error 1
>>> /home/rdunlap/lnx/next/linux-next-20180517/Makefile:525: recipe for target 'nconfig' failed
>>> make[1]: *** [nconfig] Error 2
>>> make[1]: Leaving directory '/home/rdunlap/lnx/next/linux-next-20180517/xx64'
>>> Makefile:146: recipe for target 'sub-make' failed
>>> make: *** [sub-make] Error 2
>>>
>>>
>>> xx64/scripts/kconfig/.nconf-cfg contains:
>>> libs="-lncursesw -lmenuw -lpanelw"
>>>
>>
>> Sorry, I mean
>> the nconfig in the Linus tree is not working, right?
>
> It works just fine. In a new linux-4.17-rc6 tree:
>
> $ make ARCH=x86_64 O=xx64 V=1 nconfig
> make -C /home/rdunlap/lnx/lnx-417-rc6/xx64 KBUILD_SRC=/home/rdunlap/lnx/lnx-417-rc6 \
> -f /home/rdunlap/lnx/lnx-417-rc6/Makefile nconfig
> make[1]: Entering directory '/home/rdunlap/lnx/lnx-417-rc6/xx64'
> make -f ../scripts/Makefile.build obj=scripts/basic
> rm -f .tmp_quiet_recordmcount
> ln -fsn .. source
> /bin/sh ../scripts/mkmakefile \
> .. . 4 17
> GEN ./Makefile
> make -f ../scripts/Makefile.build obj=scripts/kconfig nconfig
> gcc -Wp,-MD,scripts/kconfig/.nconf.o.d -Iscripts/kconfig -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I/usr/include/ncursesw -DCURSES_LOC="<curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/nconf.o ../scripts/kconfig/nconf.c
> gcc -Wp,-MD,scripts/kconfig/.nconf.gui.o.d -Iscripts/kconfig -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 -I/usr/include/ncursesw -DCURSES_LOC="<curses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/nconf.gui.o ../scripts/kconfig/nconf.gui.c
> gcc -o scripts/kconfig/nconf scripts/kconfig/nconf.o scripts/kconfig/zconf.tab.o scripts/kconfig/nconf.gui.o -lmenu -lpanel -lncurses
> scripts/kconfig/nconf Kconfig
> make[1]: Leaving directory '/home/rdunlap/lnx/lnx-417-rc6/xx64'
>
Ah, I see.
The output from check-lxdialog.sh is passed
to all objects:
# lxdialog stuff
check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
# Use recursively expanded variables so we do not call gcc unless
# we really need to do so. (Do not call gcc as part of make mrproper)
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
-DLOCALE
In fact, the ncurses options are passed even to the text-based
scripts/kconfig/conf.
masahiro@pug:~/ref/linux$ make V=1 oldconfig
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig oldconfig
gcc -Wp,-MD,scripts/kconfig/.conf.o.d -Wall -Wmissing-prototypes
-Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
-D_GNU_SOURCE -I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"
-DNCURSES_WIDECHAR=1 -DLOCALE -c -o scripts/kconfig/conf.o
scripts/kconfig/conf.c
bison -oscripts/kconfig/zconf.tab.c -t -l scripts/kconfig/zconf.y
flex -oscripts/kconfig/zconf.lex.c -L scripts/kconfig/zconf.l
gcc -Wp,-MD,scripts/kconfig/.zconf.tab.o.d -Wall
-Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
-std=gnu89 -D_GNU_SOURCE -I/usr/include/ncursesw
-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1 -DLOCALE
-Iscripts/kconfig -c -o scripts/kconfig/zconf.tab.o
scripts/kconfig/zconf.tab.c
gcc -o scripts/kconfig/conf scripts/kconfig/conf.o
scripts/kconfig/zconf.tab.o
scripts/kconfig/conf --oldconfig Kconfig
I am fixing it, but forgot to mention that in my commit log.
Thanks!
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 18+ messages in thread