[PATCH v1 2/6] perf: build: Append libtraceevent path in PKG_CONFIG_LIBDIR

Leo Yan posted 6 patches 1 year, 8 months ago
There is a newer version of this series
[PATCH v1 2/6] perf: build: Append libtraceevent path in PKG_CONFIG_LIBDIR
Posted by Leo Yan 1 year, 8 months ago
When a user specifies the path for libtraceevent, it means a self-built
package is being used instead of the distro package. This commit appends
the specified path in the variable 'PKG_CONFIG_LIBDIR', so that later
pkg-config can retrieve version info from the self-built folder.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/Makefile.config | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 7f1e016a9253..f545e0c3c176 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -1181,7 +1181,10 @@ ifneq ($(NO_LIBTRACEEVENT),1)
     CFLAGS += -DHAVE_LIBTRACEEVENT $(LIBTRACEEVENT_CFLAGS)
     LDFLAGS += $(LIBTRACEEVENT_LDFLAGS)
     EXTLIBS += ${TRACEEVENTLIBS}
-    LIBTRACEEVENT_VERSION := $(shell PKG_CONFIG_PATH=$(LIBTRACEEVENT_DIR) $(PKG_CONFIG) --modversion libtraceevent)
+    ifdef LIBTRACEEVENT_DIR
+      PKG_CONFIG_LIBDIR := $(LIBTRACEEVENT_DIR):$(PKG_CONFIG_LIBDIR)
+    endif
+    LIBTRACEEVENT_VERSION := $(shell $(PKG_CONFIG) --modversion libtraceevent)
     LIBTRACEEVENT_VERSION_1 := $(word 1, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
     LIBTRACEEVENT_VERSION_2 := $(word 2, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
     LIBTRACEEVENT_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEEVENT_VERSION)))
-- 
2.34.1