diff mbox series

tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable

Message ID b2638649e04e516e0aecabd928aa3f63ed50c409.1677150173.git.bertrand.marquis@arm.com (mailing list archive)
State New, archived
Headers show
Series tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable | expand

Commit Message

Bertrand Marquis Feb. 23, 2023, 1:03 p.m. UTC
Replace PKG_CONFIG variable name with PKG_CONFIG_FILE for the name of
the pkg-config file.
This is preventing a conflict in some build systems where PKG_CONFIG
actually contains the path to the pkg-config executable to use, as the
default assignment in libs.mk is using a weak assignment (?=).

This problem has been found when trying to build the latest version of
Xen tools using buildroot.

Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 tools/libs/ctrl/Makefile |  2 +-
 tools/libs/libs.mk       | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Anthony PERARD Feb. 23, 2023, 2:44 p.m. UTC | #1
On Thu, Feb 23, 2023 at 01:03:03PM +0000, Bertrand Marquis wrote:
> Replace PKG_CONFIG variable name with PKG_CONFIG_FILE for the name of
> the pkg-config file.
> This is preventing a conflict in some build systems where PKG_CONFIG
> actually contains the path to the pkg-config executable to use, as the
> default assignment in libs.mk is using a weak assignment (?=).
> 
> This problem has been found when trying to build the latest version of
> Xen tools using buildroot.
> 
> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>

Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
diff mbox series

Patch

diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 094e84b8d819..5fe0bfad0c7e 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -4,7 +4,7 @@  include $(XEN_ROOT)/tools/Rules.mk
 include Makefile.common
 
 LIBHEADER := xenctrl.h xenctrl_compat.h
-PKG_CONFIG := xencontrol.pc
+PKG_CONFIG_FILE := xencontrol.pc
 PKG_CONFIG_NAME := Xencontrol
 
 NO_HEADERS_CHK := y
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index ffb6c9f064f1..8115aa58a671 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -1,7 +1,7 @@ 
 # Common Makefile for building a lib.
 #
 # Variables taken as input:
-#   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
+#   PKG_CONFIG_FILE: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
 #   version-script: Specify the name of a version script to the linker.
@@ -30,7 +30,7 @@  endif
 
 version-script ?= lib$(LIB_FILE_NAME).map.tmp
 
-PKG_CONFIG ?= $(LIB_FILE_NAME).pc
+PKG_CONFIG_FILE ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
@@ -39,13 +39,13 @@  PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-TARGETS += $(PKG_CONFIG)
-$(PKG_CONFIG): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG): PKG_CONFIG_LIBDIR = $(libdir)
+TARGETS += $(PKG_CONFIG_FILE)
+$(PKG_CONFIG_FILE): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG_FILE): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG_FILE): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
-PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
+PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG_FILE)
 
 LIBHEADER ?= $(LIB_FILE_NAME).h
 LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
@@ -108,7 +108,7 @@  install:: all
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR)
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
 	for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
-	$(INSTALL_DATA) $(PKG_CONFIG) $(DESTDIR)$(PKG_INSTALLDIR)
+	$(INSTALL_DATA) $(PKG_CONFIG_FILE) $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
 uninstall::