[libcamera-devel] [PATCH v2] meson: Set a SONAME version in the libcamera libraries

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Sep 28 04:02:34 CEST 2021


Hi Javier,

Thank you for the patch.

On Mon, Sep 27, 2021 at 09:44:08AM +0200, Javier Martinez Canillas wrote:
> The libcamera and libcamera-base libraries are currently unversioned, but
> donwstream users expect these to have a proper SONAME version in order to
> package them.
> 
> A stable release has not yet happened because the project is still under
> development and the API/ABI might change. But having a versioned SONAME
> would allow distributions to package libcamera, without the need to add
> any downstream patch to set the version.
> 
> Since the "0.0.0" version is already used in different places, let's also
> use it as the library version and use just "0" as the SONAME version. That
> is aligned with the convention used by other projects:
> 
> $ ls /lib64/libcamera*so* -1
> /lib64/libcamera-base.so
> /lib64/libcamera-base.so.0.0.0
> /lib64/libcamera.so
> /lib64/libcamera.so.0
> /lib64/libcamera.so.0.0.0
> 
> $ objdump -p /lib64/libcamera.so.0.0.0 | grep SONAME
>   SONAME               libcamera.so.0
> 
> Signed-off-by: Javier Martinez Canillas <javierm at redhat.com>
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> 
> Changes in v2:
> - Drop the RFC prefix since other folks agree with the approach.
> - Fix wording in commit message as pointed out by Paul Elder.
> - Add Kieran and Paul Reviewed-by tags. Thanks a lot!
> 
>  meson.build                    | 1 +
>  src/libcamera/base/meson.build | 2 ++
>  src/libcamera/meson.build      | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index a49c484fe64..bf07f37a5f0 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -23,6 +23,7 @@ if libcamera_git_version == ''
>  endif
>  
>  libcamera_version = libcamera_git_version.split('+')[0]
> +libcamera_soversion = libcamera_version.split('.')[0]
>  
>  # Configure the build environment.
>  cc = meson.get_compiler('c')
> diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
> index 8e125744d82..6b5049e5de5 100644
> --- a/src/libcamera/base/meson.build
> +++ b/src/libcamera/base/meson.build
> @@ -29,6 +29,8 @@ 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,

According to the meson documentation of soversion,

"If this is not specified, the first part of version is used instead
(see below). For example, if version is 3.6.0 and soversion is not
defined, it is set to 3."

Can we drop soversion ? I've tested it locally and it seems to work.
With that change,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

>                                      name_prefix : '',
>                                      install : true,
>                                      cpp_args : libcamera_base_args,
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index bf82d38be75..7b1a541a322 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -128,6 +128,8 @@ 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