Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992673AbbHHUEg (ORCPT ); Sat, 8 Aug 2015 16:04:36 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:35855 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992558AbbHHUEd (ORCPT ); Sat, 8 Aug 2015 16:04:33 -0400 Message-ID: <55C660CF.5010103@gmail.com> Date: Sat, 08 Aug 2015 13:04:31 -0700 From: Florian Fainelli User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Brian Norris CC: linux-kernel@vger.kernel.org, rui.zhang@intel.com, jacob.jun.pan@linux.intel.com, gregory.0xf0@gmail.com, Anand Moon Subject: Re: [PATCH] tools/thermal: tmon: Allow overriding pkg-config References: <1438988284-8453-1-git-send-email-f.fainelli@gmail.com> <20150807231310.GE60523@google.com> In-Reply-To: <20150807231310.GE60523@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2838 Lines: 78 Le 08/07/15 16:13, Brian Norris a écrit : > On Fri, Aug 07, 2015 at 03:58:02PM -0700, Florian Fainelli wrote: >> Some build systems might not ship with a proper pkg-config >> infrastructure, so picking up the host pkg-config might cause us to link >> with ncursesw which may not be present in the build environment. >> >> Allow an external build system to override the pkg-config value (e.g: >> set it to /bin/false if we do not have anything). > > Is that really the best approach? I see other Makefiles that leave > PKG_CONFIG as a variable (which is fine), but not to allow full > override; they do something like: For one, OpenWrt does provide a host pkg-config which is built as part of the build process (does not rely on the existing host pkg-config), setting CROSS_COMPILE to e.g: $(STAGING_DIR)/host/bin/ would look a little weird to me. The other build environment (stblinux) does not have a valid pkg-config at all and this is what motivated this change in the first place. > > PKG_CONFIG := $(CROSS_COMPILE)pkg-config > > So, I suppose you could then alias your my-foo-cross-pkg-config to > /bin/false, or something like that. > > Another alternative: supply empty $PKG_CONFIG_LIBDIR and > $PKG_CONFIG_PATH variables, so pkg-config finds nothing. (Bonus: no > patch needed here!) Humm, true that should work as well, I will give this some more testing, thanks! > > Brian > >> Fixes: 96a0d99c72cc ("tools/thermal: tmon: use pkg-config to determine library dependencies") >> Signed-off-by: Florian Fainelli >> --- >> tools/thermal/tmon/Makefile | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile >> index 2e83dd3655a2..3777ab59d08c 100644 >> --- a/tools/thermal/tmon/Makefile >> +++ b/tools/thermal/tmon/Makefile >> @@ -11,6 +11,7 @@ TARGET=tmon >> >> INSTALL_PROGRAM=install -m 755 -p >> DEL_FILE=rm -f >> +PKG_CONFIG?=pkg-config >> >> # Static builds might require -ltinfo, for instance >> ifneq ($(findstring -static, $(LDFLAGS)),) >> @@ -18,8 +19,8 @@ STATIC := --static >> endif >> >> TMON_LIBS=-lm -lpthread >> -TMON_LIBS += $(shell pkg-config --libs $(STATIC) panelw ncursesw 2> /dev/null || \ >> - pkg-config --libs $(STATIC) panel ncurses 2> /dev/null || \ >> +TMON_LIBS += $(shell $(PKG_CONFIG) --libs $(STATIC) panelw ncursesw 2> /dev/null || \ >> + $(PKG_CONFIG) --libs $(STATIC) panel ncurses 2> /dev/null || \ >> echo -lpanel -lncurses) >> >> OBJS = tmon.o tui.o sysfs.o pid.o >> -- >> 2.1.0 >> -- Florian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/