diff mbox series

trace-cmd: Add Requires: libtracefs to libtracecmd.pc file

Message ID 20211109111426.7639b2a6@gandalf.local.home (mailing list archive)
State Accepted
Commit 466da801e4056cb9c16ef565e9001b476fdb9eaa
Headers show
Series trace-cmd: Add Requires: libtracefs to libtracecmd.pc file | expand

Commit Message

Steven Rostedt Nov. 9, 2021, 4:14 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

In order to not have users of libtracecmd having to also include the
includes and libraries for libtracefs and libraceevent, add a requires
field for libtracefs to the libtracecmd.pc file. As libtracefs requires
libtraceevent, it will pull that one in as well.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 libtracecmd.pc.template | 1 +
 scripts/utils.mk        | 1 +
 2 files changed, 2 insertions(+)

Comments

Yordan Karadzhov Nov. 10, 2021, 2:12 p.m. UTC | #1
On 9.11.21 г. 18:14 ч., Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> In order to not have users of libtracecmd having to also include the
> includes and libraries for libtracefs and libraceevent, add a requires
> field for libtracefs to the libtracecmd.pc file. As libtracefs requires
> libtraceevent, it will pull that one in as well.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>   libtracecmd.pc.template | 1 +
>   scripts/utils.mk        | 1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/libtracecmd.pc.template b/libtracecmd.pc.template
> index dc41076e..bcf4e39d 100644
> --- a/libtracecmd.pc.template
> +++ b/libtracecmd.pc.template
> @@ -6,5 +6,6 @@ Name: libtracecmd
>   URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
>   Description: Library for creating and reading trace-cmd data files
>   Version: LIB_VERSION
> +Requires: libtracefs >= LIBTRACEFS_MIN_VERSION

BTW this works also without the 'lib' prefix:

Requires: tracefs >= LIBTRACEFS_MIN_VERSION

cheers,
Yordan


>   Cflags: -I${includedir}
>   Libs: -L${libdir} -ltracecmd
> diff --git a/scripts/utils.mk b/scripts/utils.mk
> index 237b2fc9..6865a746 100644
> --- a/scripts/utils.mk
> +++ b/scripts/utils.mk
> @@ -169,6 +169,7 @@ define do_make_pkgconfig_file
>   	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
>   	sed -i "s|LIB_VERSION|${LIBTRACECMD_VERSION}|g" ${PKG_CONFIG_FILE}; \
>   	sed -i "s|LIB_DIR|$(libdir)|g" ${PKG_CONFIG_FILE}; \
> +	sed -i "s|LIBTRACEFS_MIN_VERSION|$(LIBTRACEFS_MIN_VERSION)|g" ${PKG_CONFIG_FILE}; \
>   	sed -i "s|HEADER_DIR|$(includedir)/trace-cmd|g" ${PKG_CONFIG_FILE};
>   endef
>   
>
Steven Rostedt Nov. 10, 2021, 4:17 p.m. UTC | #2
On Wed, 10 Nov 2021 16:12:12 +0200
Yordan Karadzhov <y.karadz@gmail.com> wrote:

> On 9.11.21 г. 18:14 ч., Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > 
> > In order to not have users of libtracecmd having to also include the
> > includes and libraries for libtracefs and libraceevent, add a requires
> > field for libtracefs to the libtracecmd.pc file. As libtracefs requires
> > libtraceevent, it will pull that one in as well.
> > 
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > ---
> >   libtracecmd.pc.template | 1 +
> >   scripts/utils.mk        | 1 +
> >   2 files changed, 2 insertions(+)
> > 
> > diff --git a/libtracecmd.pc.template b/libtracecmd.pc.template
> > index dc41076e..bcf4e39d 100644
> > --- a/libtracecmd.pc.template
> > +++ b/libtracecmd.pc.template
> > @@ -6,5 +6,6 @@ Name: libtracecmd
> >   URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
> >   Description: Library for creating and reading trace-cmd data files
> >   Version: LIB_VERSION
> > +Requires: libtracefs >= LIBTRACEFS_MIN_VERSION  
> 
> BTW this works also without the 'lib' prefix:
> 
> Requires: tracefs >= LIBTRACEFS_MIN_VERSION

I just tried that on Fedora, and get this:

# pkg-config --libs libtracecmd
Package tracefs was not found in the pkg-config search path.
Perhaps you should add the directory containing `tracefs.pc'
to the PKG_CONFIG_PATH environment variable
Package 'tracefs', required by 'libtracecmd', not found

-- Steve
Yordan Karadzhov Nov. 11, 2021, 8:12 a.m. UTC | #3
On 10.11.21 г. 18:17 ч., Steven Rostedt wrote:
> On Wed, 10 Nov 2021 16:12:12 +0200
> Yordan Karadzhov <y.karadz@gmail.com> wrote:
> 
>> On 9.11.21 г. 18:14 ч., Steven Rostedt wrote:
>>> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>>>
>>> In order to not have users of libtracecmd having to also include the
>>> includes and libraries for libtracefs and libraceevent, add a requires
>>> field for libtracefs to the libtracecmd.pc file. As libtracefs requires
>>> libtraceevent, it will pull that one in as well.
>>>
>>> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
>>> ---
>>>    libtracecmd.pc.template | 1 +
>>>    scripts/utils.mk        | 1 +
>>>    2 files changed, 2 insertions(+)
>>>
>>> diff --git a/libtracecmd.pc.template b/libtracecmd.pc.template
>>> index dc41076e..bcf4e39d 100644
>>> --- a/libtracecmd.pc.template
>>> +++ b/libtracecmd.pc.template
>>> @@ -6,5 +6,6 @@ Name: libtracecmd
>>>    URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
>>>    Description: Library for creating and reading trace-cmd data files
>>>    Version: LIB_VERSION
>>> +Requires: libtracefs >= LIBTRACEFS_MIN_VERSION
>>
>> BTW this works also without the 'lib' prefix:
>>
>> Requires: tracefs >= LIBTRACEFS_MIN_VERSION
> 
> I just tried that on Fedora, and get this:
> 
> # pkg-config --libs libtracecmd
> Package tracefs was not found in the pkg-config search path.
> Perhaps you should add the directory containing `tracefs.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'tracefs', required by 'libtracecmd', not found

OK, it looks like what matters is really the name of the .pc file (and the 'Name: ...' line). I was confused because 
'json-c.ps' has no 'lib' prefix. Looking into

/usr/local/lib/x86_64-linux-gnu/pkgconfig

I see that most of the configuration files do not have 'lib', however there is also a number of files starting with 
'lib'. I wonder if there is some rule about using this 'lib' prefix.

Thanks!
Yordan


> 
> -- Steve
>
Steven Rostedt Nov. 11, 2021, 2:12 p.m. UTC | #4
On Thu, 11 Nov 2021 10:12:46 +0200
Yordan Karadzhov <y.karadz@gmail.com> wrote:

> . Looking into
> 
> /usr/local/lib/x86_64-linux-gnu/pkgconfig
> 
> I see that most of the configuration files do not have 'lib', however there is also a number of files starting with 
> 'lib'. I wonder if there is some rule about using this 'lib' prefix.

Mostly just preference by those creating it. I used it to differentiate the
terms. "tracefs" is the file system that "libtracefs" manipulates.

And libtraceevents is because it's always been that. I'm not even sure if
I'm the one that called it.

It also should match the name of the repos. As we call the repos libtracefs
and libtraceevent, we should have the pkgconfig files match it as well. And
the name of the packages (.deb or .rpm) should match.

-- Steve
diff mbox series

Patch

diff --git a/libtracecmd.pc.template b/libtracecmd.pc.template
index dc41076e..bcf4e39d 100644
--- a/libtracecmd.pc.template
+++ b/libtracecmd.pc.template
@@ -6,5 +6,6 @@  Name: libtracecmd
 URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
 Description: Library for creating and reading trace-cmd data files
 Version: LIB_VERSION
+Requires: libtracefs >= LIBTRACEFS_MIN_VERSION
 Cflags: -I${includedir}
 Libs: -L${libdir} -ltracecmd
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 237b2fc9..6865a746 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -169,6 +169,7 @@  define do_make_pkgconfig_file
 	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
 	sed -i "s|LIB_VERSION|${LIBTRACECMD_VERSION}|g" ${PKG_CONFIG_FILE}; \
 	sed -i "s|LIB_DIR|$(libdir)|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|LIBTRACEFS_MIN_VERSION|$(LIBTRACEFS_MIN_VERSION)|g" ${PKG_CONFIG_FILE}; \
 	sed -i "s|HEADER_DIR|$(includedir)/trace-cmd|g" ${PKG_CONFIG_FILE};
 endef