[libcamera-devel,v3,6/7] v4l2: v4l2_compat: Use correct libcamera_dep dependency

Message ID 20200307211326.26994-7-laurent.pinchart@ideasonboard.com
State Superseded
Headers show
Series
  • Fix race condition and other build issues
Related show

Commit Message

Laurent Pinchart March 7, 2020, 9:13 p.m. UTC
The v4l2-compat shared library is declared as depending on
libcamera_deps. This is not correct, as libcamera_deps contains the
dependencies of libcamera itself. The correct dependency for users of
libcamera is libcamera_dep.

Fixing this allows dropping libcamera_includes from the list of includes
required by v4l2-compat, and libcamera from the link_with list, as they
are already contained in libcamera_dep. We however need to add an
explicit dependency on libdl which was previously provided by
libcamera_deps.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/v4l2/meson.build | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Kieran Bingham March 7, 2020, 10:52 p.m. UTC | #1
Hi Laurent,

On 07/03/2020 21:13, Laurent Pinchart wrote:
> The v4l2-compat shared library is declared as depending on
> libcamera_deps. This is not correct, as libcamera_deps contains the
> dependencies of libcamera itself. The correct dependency for users of
> libcamera is libcamera_dep.
> 
> Fixing this allows dropping libcamera_includes from the list of includes
> required by v4l2-compat, and libcamera from the link_with list, as they
> are already contained in libcamera_dep. We however need to add an
> explicit dependency on libdl which was previously provided by
> libcamera_deps.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Aha excellent, and also this brings in libcamera_api as a dependency to
v4l2_compat which it seems wasn't before!


From:

https://gitlab.com/libcamera/libcamera/-/jobs/463333443
before this patch to:
https://gitlab.com/libcamera/libcamera/-/jobs/463335113

Where it can clearly be seen that the v4l2_compat library is now built
much later in the sequences (and all generated files are now first which
is good).

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

> ---
>  src/v4l2/meson.build | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build
> index 14ee3594747d..91f4170da852 100644
> --- a/src/v4l2/meson.build
> +++ b/src/v4l2/meson.build
> @@ -5,11 +5,6 @@ v4l2_compat_sources = files([
>      'v4l2_compat_manager.cpp',
>  ])
>  
> -v4l2_compat_includes = [
> -    libcamera_includes,
> -    libcamera_internal_includes,
> -]
> -
>  v4l2_compat_cpp_args = [
>      # Meson enables large file support unconditionally, which redirect file
>      # operations to 64-bit versions. This results in some symbols being
> @@ -21,11 +16,18 @@ v4l2_compat_cpp_args = [
>      '-fvisibility=hidden',
>  ]
>  
> +v4l2_compat_deps = [
> +    cc.find_library('dl'),
> +]
> +
> +v4l2_compat_includes = [
> +    libcamera_internal_includes,

Hrm ... this could presumably now go straight into the
include_directories declaration below.

Do you think it will grow and merit staying as it's own array?

> +]
> +
>  v4l2_compat = shared_library('v4l2-compat',
>                               v4l2_compat_sources,
>                               name_prefix : '',
>                               install : true,
> -                             link_with : libcamera,
>                               include_directories : v4l2_compat_includes,
> -                             dependencies : libcamera_deps,
> +                             dependencies : [ libcamera_dep, v4l2_compat_deps ],
>                               cpp_args : v4l2_compat_cpp_args)
>
Laurent Pinchart March 7, 2020, 11:44 p.m. UTC | #2
Hi Kieran,

On Sat, Mar 07, 2020 at 10:52:29PM +0000, Kieran Bingham wrote:
> On 07/03/2020 21:13, Laurent Pinchart wrote:
> > The v4l2-compat shared library is declared as depending on
> > libcamera_deps. This is not correct, as libcamera_deps contains the
> > dependencies of libcamera itself. The correct dependency for users of
> > libcamera is libcamera_dep.
> > 
> > Fixing this allows dropping libcamera_includes from the list of includes
> > required by v4l2-compat, and libcamera from the link_with list, as they
> > are already contained in libcamera_dep. We however need to add an
> > explicit dependency on libdl which was previously provided by
> > libcamera_deps.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Aha excellent, and also this brings in libcamera_api as a dependency to
> v4l2_compat which it seems wasn't before!
> 
> From:
> 
> https://gitlab.com/libcamera/libcamera/-/jobs/463333443
> before this patch to:
> https://gitlab.com/libcamera/libcamera/-/jobs/463335113
> 
> Where it can clearly be seen that the v4l2_compat library is now built
> much later in the sequences (and all generated files are now first which
> is good).
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > ---
> >  src/v4l2/meson.build | 16 +++++++++-------
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build
> > index 14ee3594747d..91f4170da852 100644
> > --- a/src/v4l2/meson.build
> > +++ b/src/v4l2/meson.build
> > @@ -5,11 +5,6 @@ v4l2_compat_sources = files([
> >      'v4l2_compat_manager.cpp',
> >  ])
> >  
> > -v4l2_compat_includes = [
> > -    libcamera_includes,
> > -    libcamera_internal_includes,
> > -]
> > -
> >  v4l2_compat_cpp_args = [
> >      # Meson enables large file support unconditionally, which redirect file
> >      # operations to 64-bit versions. This results in some symbols being
> > @@ -21,11 +16,18 @@ v4l2_compat_cpp_args = [
> >      '-fvisibility=hidden',
> >  ]
> >  
> > +v4l2_compat_deps = [
> > +    cc.find_library('dl'),
> > +]
> > +
> > +v4l2_compat_includes = [
> > +    libcamera_internal_includes,
> 
> Hrm ... this could presumably now go straight into the
> include_directories declaration below.
> 
> Do you think it will grow and merit staying as it's own array?

I'm not sure, I don't mind much either way. I'll inline both
v4l2_compat_deps and v4l2_compat_includes.

> > +]
> > +
> >  v4l2_compat = shared_library('v4l2-compat',
> >                               v4l2_compat_sources,
> >                               name_prefix : '',
> >                               install : true,
> > -                             link_with : libcamera,
> >                               include_directories : v4l2_compat_includes,
> > -                             dependencies : libcamera_deps,
> > +                             dependencies : [ libcamera_dep, v4l2_compat_deps ],
> >                               cpp_args : v4l2_compat_cpp_args)
> >

Patch

diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build
index 14ee3594747d..91f4170da852 100644
--- a/src/v4l2/meson.build
+++ b/src/v4l2/meson.build
@@ -5,11 +5,6 @@  v4l2_compat_sources = files([
     'v4l2_compat_manager.cpp',
 ])
 
-v4l2_compat_includes = [
-    libcamera_includes,
-    libcamera_internal_includes,
-]
-
 v4l2_compat_cpp_args = [
     # Meson enables large file support unconditionally, which redirect file
     # operations to 64-bit versions. This results in some symbols being
@@ -21,11 +16,18 @@  v4l2_compat_cpp_args = [
     '-fvisibility=hidden',
 ]
 
+v4l2_compat_deps = [
+    cc.find_library('dl'),
+]
+
+v4l2_compat_includes = [
+    libcamera_internal_includes,
+]
+
 v4l2_compat = shared_library('v4l2-compat',
                              v4l2_compat_sources,
                              name_prefix : '',
                              install : true,
-                             link_with : libcamera,
                              include_directories : v4l2_compat_includes,
-                             dependencies : libcamera_deps,
+                             dependencies : [ libcamera_dep, v4l2_compat_deps ],
                              cpp_args : v4l2_compat_cpp_args)