[libcamera-devel,0/2] meson cleanups
mbox series

Message ID 20210507055841.141700-1-umang.jain@ideasonboard.com
Headers show
Series
  • meson cleanups
Related show

Message

Umang Jain May 7, 2021, 5:58 a.m. UTC
Split off these 2 patches cleanup patches from 
[ipa: meson: Install mojom generated interface headers to
 include path]
as these are independent candidates that can be reviewed/merged.

None of the patches introduces any functional changes.

Umang Jain (2):
  meson: Replace obselete join_paths() with '/' operator
  libcamera: Use get_option('includedir') instead of raw 'include'

 Documentation/meson.build              |  3 +--
 include/libcamera/ipa/meson.build      |  2 +-
 include/libcamera/meson.build          | 10 +++++-----
 meson.build                            |  3 +--
 src/ipa/meson.build                    |  2 +-
 src/ipa/raspberrypi/data/meson.build   |  2 +-
 src/ipa/vimc/data/meson.build          |  2 +-
 src/libcamera/meson.build              |  2 +-
 src/libcamera/proxy/worker/meson.build |  4 ++--
 9 files changed, 14 insertions(+), 16 deletions(-)

Comments

Laurent Pinchart May 8, 2021, 12:05 a.m. UTC | #1
Hi Umang,

Thank you for the patch.

On Fri, May 07, 2021 at 11:28:40AM +0530, Umang Jain wrote:
> Since meson v0.49.0, join_paths() is equivalent to '/' hence,
> drop and replace it with '/' short-hand in meson files.
> 
> This commit does not introduce any functional changes.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

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

> ---
>  Documentation/meson.build              |  3 +--
>  include/libcamera/ipa/meson.build      |  2 +-
>  include/libcamera/meson.build          | 10 +++++-----
>  meson.build                            |  3 +--
>  src/ipa/meson.build                    |  2 +-
>  src/ipa/raspberrypi/data/meson.build   |  2 +-
>  src/ipa/vimc/data/meson.build          |  2 +-
>  src/libcamera/meson.build              |  2 +-
>  src/libcamera/proxy/worker/meson.build |  4 ++--
>  9 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/meson.build b/Documentation/meson.build
> index 9950465d..a82ee7c8 100644
> --- a/Documentation/meson.build
> +++ b/Documentation/meson.build
> @@ -1,7 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
> -doc_install_dir = join_paths(get_option('datadir'), 'doc',
> -                             'libcamera-@0@'.format(libcamera_version))
> +doc_install_dir = get_option('datadir') / 'doc' / 'libcamera-@0@'.format(libcamera_version)
>  
>  #
>  # Doxygen
> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
> index 2d72c1fc..40c4e737 100644
> --- a/include/libcamera/ipa/meson.build
> +++ b/include/libcamera/ipa/meson.build
> @@ -7,7 +7,7 @@ libcamera_ipa_headers = files([
>  ])
>  
>  install_headers(libcamera_ipa_headers,
> -                subdir: join_paths(libcamera_include_dir, 'ipa'))
> +                subdir: libcamera_include_dir / 'ipa')
>  
>  libcamera_generated_ipa_headers = []
>  
> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
> index c7b8ee8e..4a5b915e 100644
> --- a/include/libcamera/meson.build
> +++ b/include/libcamera/meson.build
> @@ -21,7 +21,7 @@ libcamera_public_headers = files([
>      'transform.h',
>  ])
>  
> -include_dir = join_paths(libcamera_include_dir, 'libcamera')
> +include_dir = libcamera_include_dir / 'libcamera'
>  
>  subdir('internal')
>  subdir('ipa')
> @@ -48,7 +48,7 @@ foreach header : control_source_files
>                                       output : header + '.h',
>                                       command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
>                                       install : true,
> -                                     install_dir : join_paths('include', include_dir))
> +                                     install_dir : 'include' / include_dir)
>  endforeach
>  
>  libcamera_public_headers += control_headers
> @@ -63,7 +63,7 @@ formats_h = custom_target('formats_h',
>                            output : 'formats.h',
>                            command : [gen_formats, '-o', '@OUTPUT@', '@INPUT@'],
>                            install : true,
> -                          install_dir : join_paths('include', include_dir))
> +                          install_dir : 'include' / include_dir)
>  libcamera_public_headers += formats_h
>  
>  # libcamera.h
> @@ -72,7 +72,7 @@ libcamera_h = custom_target('gen-header',
>                              output : 'libcamera.h',
>                              command : [gen_header, meson.current_source_dir(), '@OUTPUT@'],
>                              install : true,
> -                            install_dir : join_paths('include', include_dir))
> +                            install_dir : 'include' / include_dir)
>  
>  libcamera_public_headers += libcamera_h
>  
> @@ -86,4 +86,4 @@ libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
>  configure_file(input : 'version.h.in',
>                 output : 'version.h',
>                 configuration : libcamera_version_config,
> -               install_dir : join_paths('include', include_dir))
> +               install_dir : 'include' / include_dir)
> diff --git a/meson.build b/meson.build
> index 13d88301..46eb1b46 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -148,8 +148,7 @@ endif
>  # Create a symlink from the build root to the source root. This is used when
>  # running libcamera from the build directory to locate resources in the source
>  # directory (such as IPA configuration files).
> -run_command('ln', '-fsT', meson.source_root(),
> -            join_paths(meson.build_root(), 'source'))
> +run_command('ln', '-fsT', meson.source_root(), meson.build_root() / 'source')
>  
>  configure_file(output : 'config.h', configuration : config_h)
>  
> diff --git a/src/ipa/meson.build b/src/ipa/meson.build
> index b3f24f42..5b5684a1 100644
> --- a/src/ipa/meson.build
> +++ b/src/ipa/meson.build
> @@ -28,7 +28,7 @@ ipa_names = []
>  foreach pipeline : pipelines
>      if ipas.contains(pipeline)
>          subdir(pipeline)
> -        ipa_names += join_paths(ipa_install_dir, ipa_name + '.so')
> +        ipa_names += ipa_install_dir / ipa_name + '.so'
>      endif
>  endforeach
>  
> diff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build
> index 253fb9d7..92ad3272 100644
> --- a/src/ipa/raspberrypi/data/meson.build
> +++ b/src/ipa/raspberrypi/data/meson.build
> @@ -10,4 +10,4 @@ conf_files = files([
>  ])
>  
>  install_data(conf_files,
> -             install_dir : join_paths(ipa_data_dir, 'raspberrypi'))
> +             install_dir : ipa_data_dir / 'raspberrypi')
> diff --git a/src/ipa/vimc/data/meson.build b/src/ipa/vimc/data/meson.build
> index 6532662c..42ec651c 100644
> --- a/src/ipa/vimc/data/meson.build
> +++ b/src/ipa/vimc/data/meson.build
> @@ -5,4 +5,4 @@ conf_files = files([
>  ])
>  
>  install_data(conf_files,
> -             install_dir : join_paths(ipa_data_dir, 'vimc'))
> +             install_dir : ipa_data_dir / 'vimc')
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index e0a48aa2..99b09b3a 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -102,7 +102,7 @@ endforeach
>  
>  libcamera_sources += control_sources
>  
> -gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')
> +gen_version = meson.source_root() / 'utils' / 'gen-version.sh'
>  
>  version_cpp = vcs_tag(command : [gen_version, meson.build_root()],
>                        input : 'version.cpp.in',
> diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build
> index 3796103e..40dada9d 100644
> --- a/src/libcamera/proxy/worker/meson.build
> +++ b/src/libcamera/proxy/worker/meson.build
> @@ -1,6 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
> -proxy_install_dir = join_paths(get_option('libexecdir'), 'libcamera')
> +proxy_install_dir = get_option('libexecdir') / 'libcamera'
>  
>  # generate {pipeline}_ipa_proxy_worker.cpp
>  foreach mojom : ipa_mojoms
> @@ -25,4 +25,4 @@ foreach mojom : ipa_mojoms
>  endforeach
>  
>  config_h.set('IPA_PROXY_DIR',
> -             '"' + join_paths(get_option('prefix'), proxy_install_dir) + '"')
> +             '"' + get_option('prefix') / proxy_install_dir + '"')
Laurent Pinchart May 8, 2021, 12:06 a.m. UTC | #2
Hi Umang,

Thank you for the patch.

On Fri, May 07, 2021 at 11:28:41AM +0530, Umang Jain wrote:
> In most cases, file paths in meson files start with get_option().
> To maintain a consistent theme, use meson's get_option('includedir')
> universal option over raw 'include'. This option is defaulted to
> 'include' string value, hence this commit does not introduce any
> functional changes.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

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

> ---
>  include/libcamera/meson.build | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
> index 4a5b915e..086c958b 100644
> --- a/include/libcamera/meson.build
> +++ b/include/libcamera/meson.build
> @@ -48,7 +48,7 @@ foreach header : control_source_files
>                                       output : header + '.h',
>                                       command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
>                                       install : true,
> -                                     install_dir : 'include' / include_dir)
> +                                     install_dir : get_option('includedir') / include_dir)
>  endforeach
>  
>  libcamera_public_headers += control_headers
> @@ -63,7 +63,7 @@ formats_h = custom_target('formats_h',
>                            output : 'formats.h',
>                            command : [gen_formats, '-o', '@OUTPUT@', '@INPUT@'],
>                            install : true,
> -                          install_dir : 'include' / include_dir)
> +                          install_dir : get_option('includedir') / include_dir)
>  libcamera_public_headers += formats_h
>  
>  # libcamera.h
> @@ -72,7 +72,7 @@ libcamera_h = custom_target('gen-header',
>                              output : 'libcamera.h',
>                              command : [gen_header, meson.current_source_dir(), '@OUTPUT@'],
>                              install : true,
> -                            install_dir : 'include' / include_dir)
> +                            install_dir : get_option('includedir') / include_dir)
>  
>  libcamera_public_headers += libcamera_h
>  
> @@ -86,4 +86,4 @@ libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
>  configure_file(input : 'version.h.in',
>                 output : 'version.h',
>                 configuration : libcamera_version_config,
> -               install_dir : 'include' / include_dir)
> +               install_dir : get_option('includedir') / include_dir)
Kieran Bingham May 11, 2021, 10:52 a.m. UTC | #3
Hi Umang,

On 07/05/2021 06:58, Umang Jain wrote:
> Since meson v0.49.0, join_paths() is equivalent to '/' hence,
> drop and replace it with '/' short-hand in meson files.
> 

While the '/' operator caught me off guard when I first saw it, I do
prefer it now, so I like this change.

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

> This commit does not introduce any functional changes.
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>  Documentation/meson.build              |  3 +--
>  include/libcamera/ipa/meson.build      |  2 +-
>  include/libcamera/meson.build          | 10 +++++-----
>  meson.build                            |  3 +--
>  src/ipa/meson.build                    |  2 +-
>  src/ipa/raspberrypi/data/meson.build   |  2 +-
>  src/ipa/vimc/data/meson.build          |  2 +-
>  src/libcamera/meson.build              |  2 +-
>  src/libcamera/proxy/worker/meson.build |  4 ++--
>  9 files changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/Documentation/meson.build b/Documentation/meson.build
> index 9950465d..a82ee7c8 100644
> --- a/Documentation/meson.build
> +++ b/Documentation/meson.build
> @@ -1,7 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
> -doc_install_dir = join_paths(get_option('datadir'), 'doc',
> -                             'libcamera-@0@'.format(libcamera_version))
> +doc_install_dir = get_option('datadir') / 'doc' / 'libcamera-@0@'.format(libcamera_version)
>  
>  #
>  # Doxygen
> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
> index 2d72c1fc..40c4e737 100644
> --- a/include/libcamera/ipa/meson.build
> +++ b/include/libcamera/ipa/meson.build
> @@ -7,7 +7,7 @@ libcamera_ipa_headers = files([
>  ])
>  
>  install_headers(libcamera_ipa_headers,
> -                subdir: join_paths(libcamera_include_dir, 'ipa'))
> +                subdir: libcamera_include_dir / 'ipa')
>  
>  libcamera_generated_ipa_headers = []
>  
> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
> index c7b8ee8e..4a5b915e 100644
> --- a/include/libcamera/meson.build
> +++ b/include/libcamera/meson.build
> @@ -21,7 +21,7 @@ libcamera_public_headers = files([
>      'transform.h',
>  ])
>  
> -include_dir = join_paths(libcamera_include_dir, 'libcamera')
> +include_dir = libcamera_include_dir / 'libcamera'
>  
>  subdir('internal')
>  subdir('ipa')
> @@ -48,7 +48,7 @@ foreach header : control_source_files
>                                       output : header + '.h',
>                                       command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
>                                       install : true,
> -                                     install_dir : join_paths('include', include_dir))
> +                                     install_dir : 'include' / include_dir)
>  endforeach
>  
>  libcamera_public_headers += control_headers
> @@ -63,7 +63,7 @@ formats_h = custom_target('formats_h',
>                            output : 'formats.h',
>                            command : [gen_formats, '-o', '@OUTPUT@', '@INPUT@'],
>                            install : true,
> -                          install_dir : join_paths('include', include_dir))
> +                          install_dir : 'include' / include_dir)
>  libcamera_public_headers += formats_h
>  
>  # libcamera.h
> @@ -72,7 +72,7 @@ libcamera_h = custom_target('gen-header',
>                              output : 'libcamera.h',
>                              command : [gen_header, meson.current_source_dir(), '@OUTPUT@'],
>                              install : true,
> -                            install_dir : join_paths('include', include_dir))
> +                            install_dir : 'include' / include_dir)
>  
>  libcamera_public_headers += libcamera_h
>  
> @@ -86,4 +86,4 @@ libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
>  configure_file(input : 'version.h.in',
>                 output : 'version.h',
>                 configuration : libcamera_version_config,
> -               install_dir : join_paths('include', include_dir))
> +               install_dir : 'include' / include_dir)
> diff --git a/meson.build b/meson.build
> index 13d88301..46eb1b46 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -148,8 +148,7 @@ endif
>  # Create a symlink from the build root to the source root. This is used when
>  # running libcamera from the build directory to locate resources in the source
>  # directory (such as IPA configuration files).
> -run_command('ln', '-fsT', meson.source_root(),
> -            join_paths(meson.build_root(), 'source'))
> +run_command('ln', '-fsT', meson.source_root(), meson.build_root() / 'source')
>  
>  configure_file(output : 'config.h', configuration : config_h)
>  
> diff --git a/src/ipa/meson.build b/src/ipa/meson.build
> index b3f24f42..5b5684a1 100644
> --- a/src/ipa/meson.build
> +++ b/src/ipa/meson.build
> @@ -28,7 +28,7 @@ ipa_names = []
>  foreach pipeline : pipelines
>      if ipas.contains(pipeline)
>          subdir(pipeline)
> -        ipa_names += join_paths(ipa_install_dir, ipa_name + '.so')
> +        ipa_names += ipa_install_dir / ipa_name + '.so'
>      endif
>  endforeach
>  
> diff --git a/src/ipa/raspberrypi/data/meson.build b/src/ipa/raspberrypi/data/meson.build
> index 253fb9d7..92ad3272 100644
> --- a/src/ipa/raspberrypi/data/meson.build
> +++ b/src/ipa/raspberrypi/data/meson.build
> @@ -10,4 +10,4 @@ conf_files = files([
>  ])
>  
>  install_data(conf_files,
> -             install_dir : join_paths(ipa_data_dir, 'raspberrypi'))
> +             install_dir : ipa_data_dir / 'raspberrypi')
> diff --git a/src/ipa/vimc/data/meson.build b/src/ipa/vimc/data/meson.build
> index 6532662c..42ec651c 100644
> --- a/src/ipa/vimc/data/meson.build
> +++ b/src/ipa/vimc/data/meson.build
> @@ -5,4 +5,4 @@ conf_files = files([
>  ])
>  
>  install_data(conf_files,
> -             install_dir : join_paths(ipa_data_dir, 'vimc'))
> +             install_dir : ipa_data_dir / 'vimc')
> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> index e0a48aa2..99b09b3a 100644
> --- a/src/libcamera/meson.build
> +++ b/src/libcamera/meson.build
> @@ -102,7 +102,7 @@ endforeach
>  
>  libcamera_sources += control_sources
>  
> -gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')
> +gen_version = meson.source_root() / 'utils' / 'gen-version.sh'
>  
>  version_cpp = vcs_tag(command : [gen_version, meson.build_root()],
>                        input : 'version.cpp.in',
> diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build
> index 3796103e..40dada9d 100644
> --- a/src/libcamera/proxy/worker/meson.build
> +++ b/src/libcamera/proxy/worker/meson.build
> @@ -1,6 +1,6 @@
>  # SPDX-License-Identifier: CC0-1.0
>  
> -proxy_install_dir = join_paths(get_option('libexecdir'), 'libcamera')
> +proxy_install_dir = get_option('libexecdir') / 'libcamera'
>  
>  # generate {pipeline}_ipa_proxy_worker.cpp
>  foreach mojom : ipa_mojoms
> @@ -25,4 +25,4 @@ foreach mojom : ipa_mojoms
>  endforeach
>  
>  config_h.set('IPA_PROXY_DIR',
> -             '"' + join_paths(get_option('prefix'), proxy_install_dir) + '"')
> +             '"' + get_option('prefix') / proxy_install_dir + '"')
>
Kieran Bingham May 11, 2021, 10:56 a.m. UTC | #4
Hi Umang,

On 08/05/2021 01:06, Laurent Pinchart wrote:
> Hi Umang,
> 
> Thank you for the patch.
> 
> On Fri, May 07, 2021 at 11:28:41AM +0530, Umang Jain wrote:
>> In most cases, file paths in meson files start with get_option().
>> To maintain a consistent theme, use meson's get_option('includedir')
>> universal option over raw 'include'. This option is defaulted to
>> 'include' string value, hence this commit does not introduce any
>> functional changes.
>>

Ah, yes this is a beneficial change, (even if it doesn't functionally
change the current default output)

I wonder if merging "get_option('includedir') / include_dir)" into a
single variable as it's used 4 times in the same file makes sense, but
this already is fine, so I'll merge these too (assuming all tests still
pass etc).

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

>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
>> ---
>>  include/libcamera/meson.build | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
>> index 4a5b915e..086c958b 100644
>> --- a/include/libcamera/meson.build
>> +++ b/include/libcamera/meson.build
>> @@ -48,7 +48,7 @@ foreach header : control_source_files
>>                                       output : header + '.h',
>>                                       command : [gen_controls, '-o', '@OUTPUT@', '@INPUT@'],
>>                                       install : true,
>> -                                     install_dir : 'include' / include_dir)
>> +                                     install_dir : get_option('includedir') / include_dir)
>>  endforeach
>>  
>>  libcamera_public_headers += control_headers
>> @@ -63,7 +63,7 @@ formats_h = custom_target('formats_h',
>>                            output : 'formats.h',
>>                            command : [gen_formats, '-o', '@OUTPUT@', '@INPUT@'],
>>                            install : true,
>> -                          install_dir : 'include' / include_dir)
>> +                          install_dir : get_option('includedir') / include_dir)
>>  libcamera_public_headers += formats_h
>>  
>>  # libcamera.h
>> @@ -72,7 +72,7 @@ libcamera_h = custom_target('gen-header',
>>                              output : 'libcamera.h',
>>                              command : [gen_header, meson.current_source_dir(), '@OUTPUT@'],
>>                              install : true,
>> -                            install_dir : 'include' / include_dir)
>> +                            install_dir : get_option('includedir') / include_dir)
>>  
>>  libcamera_public_headers += libcamera_h
>>  
>> @@ -86,4 +86,4 @@ libcamera_version_config.set('LIBCAMERA_VERSION_PATCH', version[2])
>>  configure_file(input : 'version.h.in',
>>                 output : 'version.h',
>>                 configuration : libcamera_version_config,
>> -               install_dir : 'include' / include_dir)
>> +               install_dir : get_option('includedir') / include_dir)
>