[v1,2/3] meson: add a meson option to install examples source

Message ID 20240806134218.3619913-3-g.singh@nxp.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series meson options related changes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gagandeep Singh Aug. 6, 2024, 1:42 p.m. UTC
Adding a meson option "enable_examples_source_install"
to enable or disable installation of examples source code.

Default value is true.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 meson.build       | 7 ++++---
 meson_options.txt | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)
  

Comments

Bruce Richardson Aug. 6, 2024, 2:01 p.m. UTC | #1
On Tue, Aug 06, 2024 at 07:12:17PM +0530, Gagandeep Singh wrote:
> Adding a meson option "enable_examples_source_install"
> to enable or disable installation of examples source code.
> 
> Default value is true.
> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>  meson.build       | 7 ++++---
>  meson_options.txt | 2 ++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
Is installing sample code for DPDK a problem that we need to disable it? I
was expecting that such filtering out of unwanted files could be done via
packaging rather than us having to add lots of DPDK build options to
control these things.

/Bruce
  
Gagandeep Singh Aug. 7, 2024, 4:08 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Tuesday, August 6, 2024 7:32 PM
> To: Gagandeep Singh <G.Singh@nxp.com>
> Cc: dev@dpdk.org
> Subject: Re: [v1 2/3] meson: add a meson option to install examples source
> 
> On Tue, Aug 06, 2024 at 07:12:17PM +0530, Gagandeep Singh wrote:
> > Adding a meson option "enable_examples_source_install"
> > to enable or disable installation of examples source code.
> >
> > Default value is true.
> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> >  meson.build       | 7 ++++---
> >  meson_options.txt | 2 ++
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> >
> Is installing sample code for DPDK a problem that we need to disable it? I
> was expecting that such filtering out of unwanted files could be done via
> packaging rather than us having to add lots of DPDK build options to control
> these things.
> 
I understand your point that packaging could handle filtering out unwanted files.
However, adding a build option to disable DPDK examples source code installation provides
more control and flexibility for users who may have specific requirements or constraints.

While packaging can filter out files, this option allows users to avoid
downloading and compiling the examples altogether, which can be beneficial for:

- Users with limited disk space or network bandwidth
- Users who only need the core DPDK libraries and binaries and don't want the examples source code.

By default, the option is set to true, so the behavior remains unchanged.
This option is only for those who need more control over their build process.
I believe this optional flag adds flexibility without imposing unnecessary files on users and is a minor
and useful extension to the build system.

> /Bruce
  

Patch

diff --git a/meson.build b/meson.build
index 8b248d4505..7cdd54f088 100644
--- a/meson.build
+++ b/meson.build
@@ -88,12 +88,13 @@  subdir('app')
 # build docs
 subdir('doc')
 
-# build any examples explicitly requested - useful for developers - and
-# install any example code into the appropriate install path
+# build any examples explicitly requested
 subdir('examples')
-install_subdir('examples',
+if get_option('enable_examples_source_install')
+  install_subdir('examples',
         install_dir: get_option('datadir') + '/dpdk',
         exclude_files: ex_file_excludes)
+endif
 
 # build kernel modules
 subdir('kernel')
diff --git a/meson_options.txt b/meson_options.txt
index e6f83f3f92..4f498093e6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -26,6 +26,8 @@  option('enable_driver_sdk', type: 'boolean', value: false, description:
        'Install headers to build drivers.')
 option('enable_examples_bin_install', type: 'boolean', value: false, description:
        'Install examples binaries')
+option('enable_examples_source_install', type: 'boolean', value: true, description:
+       'Install examples source code')
 option('enable_kmods', type: 'boolean', value: true, description:
        '[Deprecated - will be removed in future release] build kernel modules')
 option('enable_libs', type: 'string', value: '', description: