DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: David Marchand <david.marchand@redhat.com>
Cc: <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [PATCH v4 6/7] buildtools/chkincs: use a staging directory for headers
Date: Fri, 26 Sep 2025 10:06:01 +0100	[thread overview]
Message-ID: <aNZXeXui-n59iRAb@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <CAJFAV8zjD5M7DDapTZfjCzusm-w5ufBJq+0C3wkFeKt5o79rGQ@mail.gmail.com>

On Fri, Sep 26, 2025 at 10:14:31AM +0200, David Marchand wrote:
> On Thu, 25 Sept 2025 at 16:47, Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> > > diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
> > > index 49dbc55254..376556f5f4 100644
> > > --- a/buildtools/chkincs/meson.build
> > > +++ b/buildtools/chkincs/meson.build
> > > @@ -12,38 +12,47 @@ gen_c_files = generator(gen_c_file_for_header,
> > >          arguments: ['@INPUT@', '@OUTPUT@'])
> > >
> > >  cflags = machine_args
> > > +cflags += '-Wno-missing-field-initializers'
> > >  cflags += no_wvla_cflag
> > > +cflags += '-I' + dpdk_source_root + '/config'
> > > +cflags += '-I' + dpdk_build_root
> > > +cflags += '-I' + dpdk_chkinc_staging_dir
> > >
> >
> > Two minor suggestions, 1) should we not use "include_directories()" here to
> > pass these properly? and 2) would using the existing "global_inc" value as
> > include path not work ok? Is the reason for not using the latter the fact
> > it includes too many source dirs?
> 
> 1) include_directories() requires a source directory to exist, so I
> would need to keep almost empty directories with minimal meson.build
> in them.
> 
Ack.

> 2) Indeed, global_inc is not usable as is.
> 
> meson.build:global_inc = [include_directories('.', 'config',
> meson.build-    'lib/eal/include',
> meson.build-    'lib/eal/@0@/include'.format(host_machine.system()),
> meson.build-    'lib/eal/@0@/include'.format(arch_subdir),
> meson.build-)]
> 
> global_inc refers to the EAL sources, so anything in those directories
> is reachable.
> There are a number of non exported headers in there, like
> lib/eal/include/rte_eal_paging.h or Windows specific/internal headers
> in lib/eal/windows/include.
> 
> I can split it as two variables.
>

Ok, thanks. Was just making suggestions to try and improve things.
 
> >
> > >  sources = files('main.c')
> > >  sources += gen_c_files.process(dpdk_chkinc_headers)
> > >
> > > -# some driver SDK headers depend on these two buses, which are mandatory in build
> > > -# so we always include them in deps list
> > > -deps = [get_variable('shared_rte_bus_vdev'), get_variable('shared_rte_bus_pci')]
> > > -if dpdk_conf.has('RTE_BUS_VMBUS')
> > > -    deps += get_variable('shared_rte_bus_vmbus')
> > > -endif
> 
> [snip]
> 
> > > diff --git a/drivers/meson.build b/drivers/meson.build
> > > index f25f425565..dae1e83ca4 100644
> > > --- a/drivers/meson.build
> > > +++ b/drivers/meson.build
> > > @@ -245,7 +245,31 @@ foreach subpath:subdirs
> > >          if get_option('enable_driver_sdk')
> > >              install_headers(driver_sdk_headers)
> > >          endif
> > > -        dpdk_chkinc_headers += driver_sdk_headers
> > > +        dpdk_chkinc_headers += headers
> > > +        dpdk_chkinc_drivers_headers += driver_sdk_headers
> > > +
> > > +        if get_option('check_includes')
> > > +            if headers.length() > 0
> > > +                dpdk_chkinc_staging_deps += declare_dependency(sources:
> > > +                        custom_target(lib_name + '_header_staging',
> > > +                                output: lib_name + '_header_staging.stamp',
> > > +                                command: [stage_headers_cmd, dpdk_chkinc_staging_dir, '@OUTPUT@',
> > > +                                    headers],
> > > +                                install: false,
> > > +                        )
> > > +                )
> >
> > Rather than using an external script and custom target for this, would the
> > configure_file() meson function, with "copy" set to true also work for us?
> > https://mesonbuild.com/Reference-manual_functions.html#configure_file
> 
> I don't like configure_file().
> Touching any of those headers will trigger a meson reconfigure, right?
> I think I am not the only one who dislike meson reconfigurations that
> pollutes your terminal a lot when you do many compilations (Thomas?).
> 
> But let's say this is acceptable.
> 
> I had tried but configure_file() won't accept outputting to a specific
> directory, or I am doing it wrong?
> Trying again as an example in lib/meson.build:
>         foreach header: headers + indirect_headers
>             configure_file(input: header,
>                 output: 'staging/@BASENAME@.h',
>                 copy: true,
>                 install: false,
>             )
>         endforeach
> 
> Gives:
> ../lib/meson.build:221:12: ERROR: configure_file keyword argument
> "output" Output 'staging/@BASENAME@.h' must not contain a path
> segment.
> 
> 
> Relooking *again* at all this (la nuit porte conseil), if we tracked
> headers in global variables, for "normal" headers, arch headers,
> generic headers and drivers headers, all of the changes could be
> isolated in the buildtools/chkincs directory.
> This would also make it possible to factorize install_headers() calls,
> and avoid drivers doing it behind drivers/meson.build back (I spotted
> one).
> 
> I just pushed an experiment:
> - single headers install:
> https://github.com/david-marchand/dpdk/commit/headers_rework~2
> - chkincs rework (still not using configure_file):
> https://github.com/david-marchand/dpdk/commit/headers_rework~1
> 
> WDYT?
> 

Those changes seem good to me.

One final idea/suggestion (apologies for the many suggestions here). Rather
than having a new script and dependency tracking for the header copies,
would it be easier to do the header copy as part of the existing C file
generation script? It's already writing a C file to an output directory,
would it make sense to have that script just copy the header file to the
same location too?

/Bruce


  reply	other threads:[~2025-09-26  9:06 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 11:26 [RFC 0/6] Add a stricter headers check David Marchand
2024-11-27 11:26 ` [RFC 1/6] baseband/acc: fix exported header David Marchand
2024-11-27 11:26 ` [RFC 2/6] drivers: drop export of driver headers David Marchand
2024-11-27 11:26 ` [RFC 3/6] eventdev: do not include driver header in DMA adapter David Marchand
2024-11-27 13:49   ` [EXTERNAL] " Amit Prakash Shukla
2024-11-27 11:26 ` [RFC 4/6] drivers: fix exported headers David Marchand
2024-11-27 11:26 ` [RFC 5/6] build: install indirect headers to a dedicated directory David Marchand
2024-11-27 11:42   ` Bruce Richardson
2024-12-10 13:36     ` David Marchand
2024-11-27 11:26 ` [RFC 6/6] buildtools: externally check exported headers David Marchand
2024-12-13 10:50 ` [PATCH v2 0/6] Add a stricter headers check David Marchand
2024-12-13 10:50   ` [PATCH v2 1/6] baseband/acc: fix exported header David Marchand
2024-12-13 11:01     ` Bruce Richardson
2024-12-13 10:50   ` [PATCH v2 2/6] drivers: drop export of driver headers David Marchand
2024-12-13 11:03     ` Bruce Richardson
2024-12-16  9:13       ` Andrew Rybchenko
2024-12-13 10:50   ` [PATCH v2 3/6] eventdev: do not include driver header in DMA adapter David Marchand
2024-12-13 11:04     ` Bruce Richardson
2024-12-13 10:50   ` [PATCH v2 4/6] drivers: fix exported headers David Marchand
2024-12-13 11:14     ` Bruce Richardson
2024-12-13 13:46       ` David Marchand
2024-12-16  8:15         ` David Marchand
2024-12-13 17:10     ` Stephen Hemminger
2024-12-13 10:50   ` [PATCH v2 5/6] build: install indirect headers to a dedicated directory David Marchand
2024-12-13 10:50   ` [PATCH v2 6/6] buildtools: externally check exported headers David Marchand
2024-12-13 11:27   ` [PATCH v2 0/6] Add a stricter headers check Bruce Richardson
2024-12-13 13:38     ` David Marchand
2025-09-24 17:25 ` [PATCH v3 0/7] " David Marchand
2025-09-24 17:25   ` [PATCH v3 1/7] baseband/acc: fix exported header David Marchand
2025-09-24 17:25   ` [PATCH v3 2/7] drivers: drop export of driver headers David Marchand
2025-09-24 17:25   ` [PATCH v3 3/7] eventdev: do not include driver header in DMA adapter David Marchand
2025-09-24 17:25   ` [PATCH v3 4/7] gpudev: fix driver header for Windows David Marchand
2025-09-25  7:53     ` Bruce Richardson
2025-09-25  8:43       ` David Marchand
2025-09-24 17:25   ` [PATCH v3 5/7] drivers: fix some exported headers David Marchand
2025-09-24 17:25   ` [PATCH v3 6/7] buildtools/chkincs: use a staging directory for headers David Marchand
2025-09-25  8:00     ` Bruce Richardson
2025-09-25  8:42       ` David Marchand
2025-09-25  9:22         ` Bruce Richardson
2025-09-25 10:29           ` David Marchand
2025-09-25 10:31             ` Bruce Richardson
2025-09-25  9:31         ` Bruce Richardson
2025-09-25 10:17           ` Morten Brørup
2025-09-25 10:22             ` Bruce Richardson
2025-09-25 10:22           ` David Marchand
2025-09-25 10:31             ` Bruce Richardson
2025-09-24 17:25   ` [PATCH v3 7/7] power: separate public and driver headers David Marchand
2025-09-25 12:31 ` [PATCH v4 0/7] Add a stricter headers check David Marchand
2025-09-25 12:31   ` [PATCH v4 1/7] baseband/acc: fix exported header David Marchand
2025-09-25 12:31   ` [PATCH v4 2/7] drivers: drop export of driver headers David Marchand
2025-09-25 12:34     ` [EXTERNAL] " Akhil Goyal
2025-09-25 12:31   ` [PATCH v4 3/7] eventdev: do not include driver header in DMA adapter David Marchand
2025-09-25 12:31   ` [PATCH v4 4/7] gpudev: fix driver header for Windows David Marchand
2025-09-25 12:43     ` Bruce Richardson
2025-09-25 12:31   ` [PATCH v4 5/7] drivers: fix some exported headers David Marchand
2025-09-25 12:44     ` Bruce Richardson
2025-09-25 12:31   ` [PATCH v4 6/7] buildtools/chkincs: use a staging directory for headers David Marchand
2025-09-25 14:46     ` Bruce Richardson
2025-09-26  8:14       ` David Marchand
2025-09-26  9:06         ` Bruce Richardson [this message]
2025-09-26  9:18           ` David Marchand
2025-09-25 12:31   ` [PATCH v4 7/7] power: separate public and driver headers David Marchand
2025-09-26 12:40 ` [PATCH v5 0/9] Add a stricter headers check David Marchand
2025-09-26 12:40   ` [PATCH v5 1/9] baseband/acc: fix exported header David Marchand
2025-09-26 12:40   ` [PATCH v5 2/9] drivers: drop export of driver headers David Marchand
2025-09-26 12:40   ` [PATCH v5 3/9] eventdev: do not include driver header in DMA adapter David Marchand
2025-09-26 12:40   ` [PATCH v5 4/9] gpudev: fix driver header for Windows David Marchand
2025-09-26 12:40   ` [PATCH v5 5/9] drivers: fix some exported headers David Marchand
2025-09-26 12:40   ` [PATCH v5 6/9] eal/arm: fix C++ build for 32-bit memcpy David Marchand
2025-09-26 13:01     ` Bruce Richardson
2025-09-26 19:55     ` Morten Brørup
2025-09-26 12:41   ` [PATCH v5 7/9] build: factorize headers installation David Marchand
2025-09-26 13:08     ` Bruce Richardson
2025-09-26 12:41   ` [PATCH v5 8/9] buildtools/chkincs: use a staging directory for headers David Marchand
2025-09-26 12:41   ` [PATCH v5 9/9] power: separate public and driver headers David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aNZXeXui-n59iRAb@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).