[libcamera-devel] [PATCH 04/16] libcamera: Rename libcamera pkg-config generation

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Jun 25 13:11:46 CEST 2021


Hi Kieran,

On Fri, Jun 25, 2021 at 10:04:45AM +0100, Kieran Bingham wrote:
> On 25/06/2021 04:18, Laurent Pinchart wrote:
> > On Fri, Jun 25, 2021 at 02:35:27AM +0100, Kieran Bingham wrote:
> >> The libcamera library is moved to the first positional argument of the
> >> pkg-config generator to automatically populate the name and filebase
> >> values for the package.
> >>
> >> As part of this, the shared library name is adjusted to the full library
> >> name 'libcamera', without relying upon the automatic 'lib' prefix which
> >> better represents the component and naming of the library.
> >>
> >> As a result of this, the pkgconfig file is now named 'libcamera.pc' as
> >> opposed to 'camera.pc', and applications desiring to reference libcamera
> >> will need to search for 'libcamera' as a dependency rather than
> >> 'camera'.
> >>
> >> The library itself is still created and installed as 'libcamera.so'.
> >>
> >> An example meson.build file would need to be adjusted as the following:
> >>
> >> -      dependency('camera', required : true),
> >> +      dependency('libcamera', required : true),
> >>
> >> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> >> ---
> >>  src/libcamera/meson.build | 7 +++----
> >>  1 file changed, 3 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> >> index e4c60e736697..387d20843203 100644
> >> --- a/src/libcamera/meson.build
> >> +++ b/src/libcamera/meson.build
> >> @@ -135,8 +135,9 @@ libcamera_deps = [
> >>  # runtime if the library is running from an installed location by checking
> >>  # for the presence or abscence of the dynamic tag.
> >>  
> >> -libcamera = shared_library('camera',
> >> +libcamera = shared_library('libcamera',
> >>                             libcamera_sources,
> >> +                           name_prefix : '',
> > 
> > While I like the end-result for pkg-config, I'm not too fond of this
> > particular change as we work around the normal usage of shared_library()
> > here to change the name of the .pc file. Could we keep this unchanged,
> > and set filebase to 'libcamera' below instead ?
> 
> But ... it's the same principle on the shared-library too.
> 
> Our project is called 'libcamera' ... not 'camera'...
> 
> I can update the commit message to say "Rename the shared library to
> maintain the correct and intentional naming of the project" if you prefer?

Outside of meson, "the shared library" is libcamera.so, and that's not
renamed, so I assume you mean the meson shared_library here.

My (small) concern is that meson handles prefixes automatically, and we
work around it here for the purpose of getting the pkgconfig named
differently. It seems to be the wrong place. I however don't mind too
much, so you can go either way. If you decide to expand the commit
message, could you state "Update the meson shared_library module name"
or something similar to make it clear we're not renaming libcamera.so ?

> We still create a shared library called 'libcamera.so' ... the /only/
> place where this differs is in the linker command where it becomes
> -lcamera ... but that's not really user facing, thanks to the pkg-config
> ... (and neither is the definition here I guess).
> 
> > Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > 
> >>                             install : true,
> >>                             include_directories : includes,
> >>                             build_rpath : '/',
> >> @@ -157,10 +158,8 @@ libcamera_dep = declare_dependency(sources : [
> >>                                     link_with : libcamera)
> >>  
> >>  pkg_mod = import('pkgconfig')
> >> -pkg_mod.generate(libraries: libcamera,
> >> +pkg_mod.generate(libcamera,
> >>                   version : '1.0',
> >> -                 name : 'libcamera',
> >> -                 filebase : 'camera',
> >>                   description : 'Complex Camera Support Library',
> >>                   subdirs : 'libcamera')
> >>  
> > 

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list