[PATCH v3] kbuild: check for pkg-config on make {menu,n,g.x}config

STALE3046d

3 messages, 2 authors, 2018-06-06 · open the first message on its own page

[PATCH v3] kbuild: check for pkg-config on make {menu,n,g.x}config

From: Randy Dunlap <rdunlap@infradead.org>
Date: 2018-06-04 03:00:08

From: Randy Dunlap <rdunlap@infradead.org>

Each of 'make {menu,n,g,x}config' uses (needs) pkg-config to make sure
that other required files are present and to determine build flags
settings, but none of these check that pkg-config itself is present.
Add a check for all 4 of these targets and update
Documentation/process/changes.rst to mention 'pkg-config'.

Fixes kernel bugzilla #77511:
https://bugzilla.kernel.org/show_bug.cgi?id=77511

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Bjørn Forsman <redacted>
---
Strictly speaking, pkg-config is not required if someone is only
using 'make {menu,n}config' since there are fallbacks for those
two targets.

 Documentation/process/changes.rst  |    8 ++++++++
 scripts/kconfig/Makefile           |    6 ++++++
 scripts/kconfig/check-pkgconfig.sh |   12 ++++++++++++
 3 files changed, 26 insertions(+)
--- linux-next-20180601.orig/scripts/kconfig/Makefile
+++ linux-next-20180601/scripts/kconfig/Makefile
@@ -214,11 +214,17 @@ $(obj)/gconf.o: $(obj)/.gconf-cfg
 $(obj)/zconf.tab.o: $(obj)/zconf.lex.c
 
 # check if necessary packages are available, and configure build flags
+# pkg-config check
+define check_pkg_config
+	$(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh FORCE
+endef
+
 define filechk_conf_cfg
 	$(CONFIG_SHELL) $<
 endef
 
 $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
+	$(call check_pkg_config)
 	$(call filechk,conf_cfg)
 
 clean-files += .*conf-cfg
--- /dev/null
+++ linux-next-20180601/scripts/kconfig/check-pkgconfig.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Check for pkg-config presence
+
+pkgcfg=`command -v pkg-config`
+
+if [ "$pkgcfg" = "" ]; then
+	echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
+	exit 1		# error
+fi
+
+exit 0
--- linux-next-20180601.orig/Documentation/process/changes.rst
+++ linux-next-20180601/Documentation/process/changes.rst
@@ -81,6 +81,14 @@ The build system has, as of 4.13, switch
 rather than incremental linking (`ld -r`) for built-in.a intermediate steps.
 This requires binutils 2.20 or newer.
 
+pkg-config
+----------
+
+The build system, as of 4.18, requires pkg-config to check for installed
+kconfig tools and to determine flags settings for use in
+'make {menu,n,g,x}config'.  Previously pkg-config was being used but not
+verified or documented.
+
 Flex
 ----
 

Re: [PATCH v3] kbuild: check for pkg-config on make {menu,n,g.x}config

From: Masahiro Yamada <hidden>
Date: 2018-06-05 06:55:01

Hi Randy,


2018-06-04 11:59 GMT+09:00 Randy Dunlap [off-list ref]:
quoted hunk
From: Randy Dunlap <rdunlap@infradead.org>

Each of 'make {menu,n,g,x}config' uses (needs) pkg-config to make sure
that other required files are present and to determine build flags
settings, but none of these check that pkg-config itself is present.
Add a check for all 4 of these targets and update
Documentation/process/changes.rst to mention 'pkg-config'.

Fixes kernel bugzilla #77511:
https://bugzilla.kernel.org/show_bug.cgi?id=77511

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Bjørn Forsman <redacted>
---
Strictly speaking, pkg-config is not required if someone is only
using 'make {menu,n}config' since there are fallbacks for those
two targets.

 Documentation/process/changes.rst  |    8 ++++++++
 scripts/kconfig/Makefile           |    6 ++++++
 scripts/kconfig/check-pkgconfig.sh |   12 ++++++++++++
 3 files changed, 26 insertions(+)
--- linux-next-20180601.orig/scripts/kconfig/Makefile
+++ linux-next-20180601/scripts/kconfig/Makefile
@@ -214,11 +214,17 @@ $(obj)/gconf.o: $(obj)/.gconf-cfg
 $(obj)/zconf.tab.o: $(obj)/zconf.lex.c

 # check if necessary packages are available, and configure build flags
+# pkg-config check
+define check_pkg_config
+       $(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh FORCE

Passing FORCE to check-pkg-config.sh strange.



How about calling your script from filechk_conf_cfg, like this?


define filechk_conf_cfg
        $(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \
        $(CONFIG_SHELL) $<
endef





quoted hunk
+endef
+
 define filechk_conf_cfg
        $(CONFIG_SHELL) $<
 endef

 $(obj)/.%conf-cfg: $(src)/%conf-cfg.sh FORCE
+       $(call check_pkg_config)
        $(call filechk,conf_cfg)

 clean-files += .*conf-cfg
--- /dev/null
+++ linux-next-20180601/scripts/kconfig/check-pkgconfig.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Check for pkg-config presence
+
+pkgcfg=`command -v pkg-config`
+
+if [ "$pkgcfg" = "" ]; then
+       echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
+       exit 1          # error
+fi
+
+exit 0

You can remove 'exit 0' at the end.
and move the 'pkgcfg' to the conditional line.

How about something like this?


if [ -z $(command -v pkg-config) ]; then
        echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
        exit 1
fi


Thanks.


quoted hunk
--- linux-next-20180601.orig/Documentation/process/changes.rst
+++ linux-next-20180601/Documentation/process/changes.rst
@@ -81,6 +81,14 @@ The build system has, as of 4.13, switch
 rather than incremental linking (`ld -r`) for built-in.a intermediate steps.
 This requires binutils 2.20 or newer.

+pkg-config
+----------
+
+The build system, as of 4.18, requires pkg-config to check for installed
+kconfig tools and to determine flags settings for use in
+'make {menu,n,g,x}config'.  Previously pkg-config was being used but not
+verified or documented.
+
 Flex
 ----


--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Best Regards
Masahiro Yamada

Re: [PATCH v3] kbuild: check for pkg-config on make {menu,n,g.x}config

From: Randy Dunlap <rdunlap@infradead.org>
Date: 2018-06-06 00:41:58

On 06/04/2018 11:53 PM, Masahiro Yamada wrote:
Hi Randy,


2018-06-04 11:59 GMT+09:00 Randy Dunlap [off-list ref]:
quoted
From: Randy Dunlap <rdunlap@infradead.org>

Each of 'make {menu,n,g,x}config' uses (needs) pkg-config to make sure
that other required files are present and to determine build flags
settings, but none of these check that pkg-config itself is present.
Add a check for all 4 of these targets and update
Documentation/process/changes.rst to mention 'pkg-config'.

Fixes kernel bugzilla #77511:
https://bugzilla.kernel.org/show_bug.cgi?id=77511

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Bjørn Forsman <redacted>
---
Strictly speaking, pkg-config is not required if someone is only
using 'make {menu,n}config' since there are fallbacks for those
two targets.

OK, I made your suggested changes and will test it later and then resend it.

thanks,
-- 
~Randy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help