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

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Sep 24 17:23:28 CEST 2021


Hi Javier,

On 24/09/2021 11:31, 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
> that 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>

This seems quite reasonable to me.

Tested locally, and I can see this gets added by meson at the install
stage, and now creates (more) appropriately named and versioned
(symlinked) outputs.

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> ---
> 
>  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,
>                                      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,
> 


More information about the libcamera-devel mailing list