Skip to contentSkip to conversation

libtracefs: Add Requires libtraceevent to pkg-config file

PATCH In review Steven Rostedt 2 participants 2 messages Jul 22, 2021 – Jul 23, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: Add Requires libtraceevent to pkg-config file

From e0e16d1a16749dccd3c00261e6dcb78f2e55e8ec Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <[email protected]>
Date: Thu, 22 Jul 2021 15:44:55 -0400
Subject: [PATCH] libtracefs: Add Requires libtraceevent to pkg-config file

If a developer uses libtracefs only, they should not need to know about libtraceevent just because libtracefs requires it.

The pkg-config pc file has an option to handle such cases, called "Requires:". Utilize this feature so that users using libtracefs only need to do:

  CFLAGS = `pkg-config --cflags --libs libtracefs`

And not:

  CFLAGS = `pkg-config --cflags --libs libtracefs libtraceevent`

As with the Requires option, pkg-config now produces:

 $ pkg-config --cflags --libs libtracefs
 -I/usr/local/include/tracefs -I/usr/local/include/traceevent -ltracefs -ltraceevent
---
 Makefile               | 3 ++-
 libtracefs.pc.template | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
Makefile +2 -1
index b509388..395b207 100644
@@ -215,7 +215,8 @@ define do_make_pkgconfig_file
 	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
 	sed -i "s|LIB_VERSION|${TRACEFS_VERSION}|g" ${PKG_CONFIG_FILE}; \
 	sed -i "s|LIB_DIR|${libdir_relative}|g" ${PKG_CONFIG_FILE}; \
-	sed -i "s|HEADER_DIR|$(includedir_relative)|g" ${PKG_CONFIG_FILE};
+	sed -i "s|HEADER_DIR|$(includedir_relative)|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|LIBTRACEEVENT_MIN|$(LIBTRACEEVENT_MIN_VERSION)|g" ${PKG_CONFIG_FILE};
 endef
 
 BUILD_PREFIX := $(BUILD_OUTPUT)/build_prefix
libtracefs.pc.template +1 -0
index a674fee..09b335b 100644
@@ -6,5 +6,6 @@ Name: libtracefs
 URL: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/
 Description: Library for accessing ftrace file system
 Version: LIB_VERSION
+Requires: libtraceevent > LIBTRACEEVENT_MIN
 Cflags: -I${includedir}
 Libs: -L${libdir} -ltracefs
Signature · 1 line
2.31.1
Tested-by on v1 1/1
#1 lore raw
Quoted 18 lines · Steven Rostedt

From e0e16d1a16749dccd3c00261e6dcb78f2e55e8ec Mon Sep 17 00:00:00 2001
From: "Steven Rostedt (VMware)" <[email protected]>
Date: Thu, 22 Jul 2021 15:44:55 -0400
Subject: [PATCH] libtracefs: Add Requires libtraceevent to pkg-config file

If a developer uses libtracefs only, they should not need to know about libtraceevent just because libtracefs requires it.

The pkg-config pc file has an option to handle such cases, called "Requires:". Utilize this feature so that users using libtracefs only need to do:

  CFLAGS = `pkg-config --cflags --libs libtracefs`

And not:

  CFLAGS = `pkg-config --cflags --libs libtracefs libtraceevent`
Quoted 7 lines

As with the Requires option, pkg-config now produces:

 $ pkg-config --cflags --libs libtracefs
 -I/usr/local/include/tracefs -I/usr/local/include/traceevent -ltracefs -ltraceevent

it works!

-- Daniel Bristot de Oliveira <[email protected]>