From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com
Subject: [PATCH v5 8/9] buildtools/chkincs: use a staging directory for headers
Date: Fri, 26 Sep 2025 14:41:01 +0200 [thread overview]
Message-ID: <20250926124103.750844-9-david.marchand@redhat.com> (raw)
In-Reply-To: <20250926124103.750844-1-david.marchand@redhat.com>
A problem with the current headers check is that it relies on
meson dependencies objects that come with their include_directories
directives, and all of those point at the library / driver sources.
This means that we won't detect a public header including a private
(as in, not exported) header, or a driver only header.
To address this issue, a staging directory is added and every header
is copied to it.
Drivers and library headers are staged to two different directories
and the check is updated accordingly.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v4:
- split global_inc (isolating config include path from EAL headers),
- moved all changes under buildtools/chkincs,
Changes since v3:
- removed update of global_inc (which was unneeded, and probably was
what triggered a Windows clang build issue reported by CI),
- moved all staging operations under a check on check_includes= option,
- moved staging directories under buildtools/chkincs/,
- renamed all variables to reflect those concern the headers check,
- made chkincs binaries depend on staging deps instead of having the
libraries/drivers depend on them,
- added C++ check for driver headers (missed in v3),
---
buildtools/chkincs/meson.build | 67 +++++++++++++++----
| 32 +++++++++
.../chkincs/staging/drivers/meson.build | 12 ++++
buildtools/chkincs/staging/meson.build | 30 +++++++++
meson.build | 6 +-
5 files changed, 131 insertions(+), 16 deletions(-)
create mode 100644 buildtools/chkincs/stage-headers.py
create mode 100644 buildtools/chkincs/staging/drivers/meson.build
create mode 100644 buildtools/chkincs/staging/meson.build
diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index ac7df41304..50cb542f23 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -6,6 +6,15 @@ if not get_option('check_includes')
subdir_done()
endif
+stage_headers_cmd = py3 + files('stage-headers.py')
+
+includes = [config_inc]
+deps = []
+includes_drivers = []
+deps_drivers = []
+
+subdir('staging')
+
gen_c_file_for_header = find_program('gen_c_file_for_header.py')
gen_c_files = generator(gen_c_file_for_header,
output: '@BASENAME@.c',
@@ -18,18 +27,7 @@ endif
cflags += no_wvla_cflag
sources = files('main.c')
-sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_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
-# add the rest of the libs to the dependencies
-foreach l:dpdk_libs_enabled
- deps += get_variable('shared_rte_' + l)
-endforeach
+sources += gen_c_files.process(dpdk_arch_headers + dpdk_headers)
executable('chkincs', sources,
c_args: cflags,
@@ -49,6 +47,27 @@ executable('chkincs-all', sources,
dependencies: deps,
install: false)
+sources_drivers = files('main.c')
+sources_drivers += gen_c_files.process(dpdk_drivers_headers)
+
+executable('chkincs-drv', sources_drivers,
+ c_args: cflags,
+ include_directories: includes + includes_drivers,
+ dependencies: deps + deps_drivers,
+ install: false)
+
+executable('chkincs-drv-exp', sources_drivers,
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
+ include_directories: includes + includes_drivers,
+ dependencies: deps + deps_drivers,
+ install: false)
+
+executable('chkincs-drv-all', sources_drivers,
+ c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'],
+ include_directories: includes + includes_drivers,
+ dependencies: deps + deps_drivers,
+ install: false)
+
# run tests for c++ builds also
if not add_languages('cpp', required: false)
subdir_done()
@@ -59,7 +78,7 @@ gen_cpp_files = generator(gen_c_file_for_header,
arguments: ['@INPUT@', '@OUTPUT@'])
cpp_sources = files('main.cpp')
-cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers)
+cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers)
executable('chkincs-cpp', cpp_sources,
cpp_args: ['-include', 'rte_config.h', cflags],
@@ -79,3 +98,25 @@ executable('chkincs-cpp-all', cpp_sources,
include_directories: includes,
dependencies: deps,
install: false)
+
+cpp_sources_drivers = files('main.cpp')
+cpp_sources_drivers += gen_cpp_files.process(dpdk_drivers_headers)
+
+executable('chkincs-drv-cpp', cpp_sources_drivers,
+ cpp_args: ['-include', 'rte_config.h', cflags],
+ include_directories: includes + includes_drivers,
+ dependencies: deps + deps_drivers,
+ install: false)
+
+executable('chkincs-drv-cpp-exp', cpp_sources_drivers,
+ cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'],
+ include_directories: includes + includes_drivers,
+ dependencies: deps + deps_drivers,
+ install: false)
+
+executable('chkincs-drv-cpp-all', cpp_sources_drivers,
+ cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API',
+ '-DALLOW_INTERNAL_API'],
+ include_directories: includes + includes_drivers,
+ dependencies: deps + deps_drivers,
+ install: false)
--git a/buildtools/chkincs/stage-headers.py b/buildtools/chkincs/stage-headers.py
new file mode 100644
index 0000000000..3057c6a26f
--- /dev/null
+++ b/buildtools/chkincs/stage-headers.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2025 Red Hat, Inc.
+
+"""
+Headers staging script for DPDK build system.
+"""
+
+import sys
+import os
+import shutil
+from pathlib import Path
+
+def main():
+ if len(sys.argv) < 4:
+ print("Usage: stage-headers.py <staging_dir> <meson_stamp> [headers...]")
+ sys.exit(1)
+
+ staging_dir = Path(sys.argv[1])
+ meson_stamp = Path(sys.argv[2])
+ headers = sys.argv[3:]
+
+ staging_dir.mkdir(parents=True, exist_ok=True)
+
+ for header in headers:
+ file = Path(header)
+ shutil.copy2(file, staging_dir / file.name)
+
+ meson_stamp.touch()
+
+if __name__ == "__main__":
+ main()
diff --git a/buildtools/chkincs/staging/drivers/meson.build b/buildtools/chkincs/staging/drivers/meson.build
new file mode 100644
index 0000000000..c89fe8529a
--- /dev/null
+++ b/buildtools/chkincs/staging/drivers/meson.build
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2025 Red Hat, Inc.
+
+includes += include_directories('.')
+deps += declare_dependency(sources:
+ custom_target('drivers_headers_staging',
+ output: 'drivers_headers_staging.stamp',
+ command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@',
+ dpdk_drivers_headers],
+ install: false,
+ )
+)
diff --git a/buildtools/chkincs/staging/meson.build b/buildtools/chkincs/staging/meson.build
new file mode 100644
index 0000000000..c66cce4831
--- /dev/null
+++ b/buildtools/chkincs/staging/meson.build
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2025 Red Hat, Inc.
+
+subdir('drivers')
+
+includes += include_directories('.')
+deps += declare_dependency(sources:
+ custom_target('arch_headers_staging',
+ output: 'arch_headers_staging.stamp',
+ command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@',
+ dpdk_arch_headers + dpdk_arch_indirect_headers],
+ install: false,
+ )
+)
+deps += declare_dependency(sources:
+ custom_target('headers_staging',
+ output: 'headers_staging.stamp',
+ command: [stage_headers_cmd, meson.current_build_dir(), '@OUTPUT@',
+ dpdk_headers + dpdk_indirect_headers],
+ install: false,
+ )
+)
+deps += declare_dependency(sources:
+ custom_target('generic_headers_staging',
+ output: 'generic_headers_staging.stamp',
+ command: [stage_headers_cmd, join_paths(meson.current_build_dir(), 'generic'),
+ '@OUTPUT@', dpdk_generic_headers],
+ install: false,
+ )
+)
diff --git a/meson.build b/meson.build
index 9f0b06179b..7f90d3bdc3 100644
--- a/meson.build
+++ b/meson.build
@@ -69,9 +69,9 @@ elif host_machine.cpu_family().startswith('riscv')
endif
# configure the build, and make sure configs here and in config folder are
-# able to be included in any file. We also store a global array of include dirs
-# for passing to pmdinfogen scripts
-global_inc = [include_directories('.', 'config',
+# able to be included in any file
+config_inc = [include_directories('.', 'config')]
+global_inc = [config_inc, include_directories(
'lib/eal/include',
'lib/eal/@0@/include'.format(host_machine.system()),
'lib/eal/@0@/include'.format(arch_subdir),
--
2.51.0
next prev parent reply other threads:[~2025-09-26 12:42 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
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 ` David Marchand [this message]
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=20250926124103.750844-9-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/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).