[libcamera-devel] [PATCH v3 2/5] meson: Shared Object version handling

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Oct 12 17:45:17 CEST 2022


Quoting Laurent Pinchart (2022-10-12 15:51:16)
> Hi Kieran,
> 
> Thank you for the patch.
> 
> On Mon, Oct 10, 2022 at 06:32:11PM +0100, Kieran Bingham via libcamera-devel wrote:
> > The libcamera project is not yet ready to declare ABI nor API stability,
> > but it will benefit the community to be able to provide more regular
> > release cycles to determine 'versioned' points of history.
> > 
> > Ideally, these releases will be made at any ABI breakage, but can be
> > made at arbitary time based points along the way.
> > 
> > To support releases which may not be ABI stable, declare the soversion
> > of both the libcamera and libcamera-base library to be dependant upon
> > both the major and minor component of the project version.
> > 
> > As part of this, introduce a new 'Versions' summary section to highlight
> > the different version components that may become apparent within any
> > given build.
> > 
> > Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
> > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > 
> > ---
> > v3:
> >  - fix typo
> >  - Use libcamera_version directly for SONAME.
> >  - Fix ordering of EXCLUDE_PATTERNS
> >  - Use meson.project_version() in the event the git versions
> >    are incorrect.
> >  - No need to present libcamera_version anymore
> >    - Guaranteed to be the same as 'project_version'
> > 
> > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > ---
> >  Documentation/Doxyfile.in      |  4 +++-
> >  meson.build                    | 23 +++++++++++++++++++++++
> >  src/libcamera/base/meson.build |  1 +
> >  src/libcamera/meson.build      |  1 +
> >  4 files changed, 28 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> > index 88dfcddaebf6..e87bb2b42c5e 100644
> > --- a/Documentation/Doxyfile.in
> > +++ b/Documentation/Doxyfile.in
> > @@ -51,7 +51,9 @@ EXCLUDE_PATTERNS       = @TOP_BUILDDIR@/include/libcamera/ipa/*_serializer.h \
> >                           @TOP_BUILDDIR@/include/libcamera/ipa/ipu3_*.h \
> >                           @TOP_BUILDDIR@/include/libcamera/ipa/raspberrypi_*.h \
> >                           @TOP_BUILDDIR@/include/libcamera/ipa/rkisp1_*.h \
> > -                         @TOP_BUILDDIR@/include/libcamera/ipa/vimc_*.h
> > +                         @TOP_BUILDDIR@/include/libcamera/ipa/vimc_*.h \
> > +                         @TOP_BUILDDIR@/src/libcamera/libcamera.so* \
> > +                         @TOP_BUILDDIR@/src/libcamera/base/libcamera-base.so*
> 
> I'm still getting
> 
> warning: source 'libcamera/build/x86-gcc-10.4.0/src/libcamera/libcamera.so.0' is not a readable file or directory... skipping.
> warning: source 'libcamera/build/x86-gcc-10.4.0/src/libcamera/libcamera.so' is not a readable file or directory... skipping.
> warning: source 'libcamera/build/x86-gcc-10.4.0/src/libcamera/base/libcamera-base.so.0' is not a readable file or directory... skipping.
> 
> despite this.

Ah, that's a pain, I thought it had gone - but ... it must have been
because I cleaned my tree or such.
 
> I was hoping that EXCLUDE_SYMLINKS would fix it, but that's not the
> case. Doxygen prints the warning before checking if the file is a
> symlink. It should be easily fixable in Doxygen, I may even send a
> patch. Should we set EXCLUDE_SYMLINKS to prepare for that, and drop the
> EXCLUDE_PATTERNS change ?

What is the EXCLUDE_SYMLINKS change?

I'm happy to add that, or we can drop this here and fix it later.

Certainly no point adding lines that don't affect it though.

> 
> >  
> >  EXCLUDE_SYMBOLS        = libcamera::BoundMethodArgs \
> >                           libcamera::BoundMethodBase \
> > diff --git a/meson.build b/meson.build
> > index 2c6173b4f97e..3e2bcc0de2c3 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -26,6 +26,29 @@ endif
> >  
> >  libcamera_version = libcamera_git_version.split('+')[0]
> >  
> > +# A shallow clone, or a clone without a reachable tag equivalent to the
> > +# meson.project_version() could leave the project in a mis-described state.
> > +# Produce a warning in this event, and fix to a best effort.
> 
> For a moment I wondered what we should do if there's a git tag more
> recent than the meson project version. Then I thought whoever does that
> would probably deserve an Undefined Behaviour (TM) that would have at
> least a 50% change of sudo rm -rf /. As we're nice people, let's just
> ignore this case :-)
> 
> > +if libcamera_version != meson.project_version()
> > +    warning('The sources disagree about the version: '
> > +            + libcamera_version + ' != ' + meson.project_version())
> > +
> > +    libcamera_version = meson.project_version()
> > +    libcamera_git_version = libcamera_version + '+' + libcamera_git_version.split('+')[1]
> > +    summary({'Source version override': true}, section : 'Versions')
> 
> Maybe bool_yn to match the the rest of our summary sections ? It will by
> default (on terminals that support it) print YES in green and NO in red,
> so if we phrased this message the other way around (for instance 'Source
> version match' : false) it would appear more prominantly as something
> bad. Entirely up to you.

Source version match : NO

sounds reasonable. I'll try it out.

> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
> > +endif
> > +
> > +# Until we make ABI compatible releases, the full libcamera version is used as
> > +# the soname.
> > +libcamera_soversion = libcamera_version
> > +
> > +summary({
> > +            'project': meson.project_version(),
> > +            'sources': libcamera_git_version,
> > +            'soname': libcamera_soversion,
> > +        },
> > +        section : 'Versions')
> > +
> >  # This script generates the .tarball-version file on a 'meson dist' command.
> >  meson.add_dist_script('utils/run-dist.sh')
> >  
> > diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
> > index 7a75914ab2a8..7a7fd7e4ca87 100644
> > --- a/src/libcamera/base/meson.build
> > +++ b/src/libcamera/base/meson.build
> > @@ -51,6 +51,7 @@ libcamera_base_args = [ '-DLIBCAMERA_BASE_PRIVATE' ]
> >  libcamera_base_lib = shared_library('libcamera-base',
> >                                      [libcamera_base_sources, libcamera_base_headers],
> >                                      version : libcamera_version,
> > +                                    soversion : libcamera_soversion,
> >                                      name_prefix : '',
> >                                      install : true,
> >                                      cpp_args : libcamera_base_args,
> > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> > index 7fcbb2ddc9e7..5f39d2e2c60a 100644
> > --- a/src/libcamera/meson.build
> > +++ b/src/libcamera/meson.build
> > @@ -161,6 +161,7 @@ libcamera_deps = [
> >  libcamera = shared_library('libcamera',
> >                             libcamera_sources,
> >                             version : libcamera_version,
> > +                           soversion : libcamera_soversion,
> >                             name_prefix : '',
> >                             install : true,
> >                             include_directories : includes,
> 
> -- 
> Regards,
> 
> Laurent Pinchart


More information about the libcamera-devel mailing list