All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: check for pkg-config on make menu/n/g/xconfig
@ 2018-03-11 20:12 Randy Dunlap
  2018-03-11 21:00 ` Bjørn Forsman
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2018-03-11 20:12 UTC (permalink / raw)
  To: linux-kbuild, Masahiro Yamada; +Cc: LKML

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, but none of these check that
pkg-config itself is present.  Add a check for all 4 of these targets.

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

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
I'm also OK with just documenting the pkg-config requirement in
Documentation/Changes (= Documentation/process/changes.rst).

+ chmod +x scripts/kconfig/check-pkgconfig.sh

 scripts/kconfig/Makefile           |   15 ++++++++++++++-
 scripts/kconfig/check-pkgconfig.sh |   13 +++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

--- lnx-416-rc3.orig/scripts/kconfig/Makefile
+++ lnx-416-rc3/scripts/kconfig/Makefile
@@ -160,6 +160,9 @@ help:
 	@echo  '  xenconfig       - Enable additional options for xen dom0 and guest kernel support'
 	@echo  '  tinyconfig	  - Configure the tiniest possible kernel'
 
+# pkg-config check
+check-pkgconfig  := $(srctree)/$(src)/check-pkgconfig.sh
+
 # lxdialog stuff
 check-lxdialog  := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
 
@@ -205,7 +208,17 @@ $(addprefix $(obj)/, mconf.o $(lxdialog)
 $(obj)/dochecklxdialog:
 	$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
 
-always := dochecklxdialog
+# Check that we have pkg-config (used by each of menu/n/g/xconfig)
+PHONY += $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, mconf.o): $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, nconf.o): $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, gconf.o): $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, qconf.o): $(obj)/docheckpkgconfig
+
+$(obj)/docheckpkgconfig:
+	$(Q)$(CONFIG_SHELL) $(check-pkgconfig)
+
+always := docheckpkgconfig dochecklxdialog
 
 # Add environment specific flags
 HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
--- /dev/null
+++ lnx-416-rc3/scripts/kconfig/check-pkgconfig.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Check for pkg-config presence
+
+pkgcfg=`which pkg-config >/dev/null 2>&1`
+found=$?
+
+if [ $found -ne 0 ]; then
+	echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
+	exit 1		# error
+fi
+
+exit 0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: check for pkg-config on make menu/n/g/xconfig
  2018-03-11 20:12 [PATCH] kbuild: check for pkg-config on make menu/n/g/xconfig Randy Dunlap
@ 2018-03-11 21:00 ` Bjørn Forsman
  2018-03-12 17:44   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Bjørn Forsman @ 2018-03-11 21:00 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: linux-kbuild, Masahiro Yamada, LKML

On 11 March 2018 at 21:12, Randy Dunlap <rdunlap@infradead.org> wrote:
> +pkgcfg=`which pkg-config >/dev/null 2>&1`

Please use "command -v" instead of "which". command -v is in POSIX, so
the shell will have it for sure (builtin). which is not a builtin, it
is an external command that may or may not be installed on the system.

Best regards,
Bjørn Forsman

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kbuild: check for pkg-config on make menu/n/g/xconfig
  2018-03-11 21:00 ` Bjørn Forsman
@ 2018-03-12 17:44   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2018-03-12 17:44 UTC (permalink / raw)
  To: Bjørn Forsman; +Cc: linux-kbuild, Masahiro Yamada, LKML

On 03/11/2018 02:00 PM, Bjørn Forsman wrote:
> On 11 March 2018 at 21:12, Randy Dunlap <rdunlap@infradead.org> wrote:
>> +pkgcfg=`which pkg-config >/dev/null 2>&1`
> 
> Please use "command -v" instead of "which". command -v is in POSIX, so
> the shell will have it for sure (builtin). which is not a builtin, it
> is an external command that may or may not be installed on the system.

Will do. Thanks.

Just waiting to see if there are any other comments...

-- 
~Randy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-12 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 20:12 [PATCH] kbuild: check for pkg-config on make menu/n/g/xconfig Randy Dunlap
2018-03-11 21:00 ` Bjørn Forsman
2018-03-12 17:44   ` Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.