From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: bruce.richardson@intel.com,
"Thomas Monjalon" <thomas@monjalon.net>,
"Jiawen Wu" <jiawenwu@trustnetic.com>,
"Jian Wang" <jianwang@trustnetic.com>,
"Zaiyu Wang" <zaiyuwang@trustnetic.com>,
"Wathsala Vithanage" <wathsala.vithanage@arm.com>,
"Tyler Retzlaff" <roretzla@linux.microsoft.com>,
"Min Zhou" <zhoumin@loongson.cn>,
"David Christensen" <drc@linux.ibm.com>,
"Stanisław Kardach" <stanislaw.kardach@gmail.com>,
"Sun Yuechi" <sunyuechi@iscas.ac.cn>,
"Konstantin Ananyev" <konstantin.ananyev@huawei.com>
Subject: [PATCH v5 7/9] build: factorize headers installation
Date: Fri, 26 Sep 2025 14:41:00 +0200 [thread overview]
Message-ID: <20250926124103.750844-8-david.marchand@redhat.com> (raw)
In-Reply-To: <20250926124103.750844-1-david.marchand@redhat.com>
Gather all headers in global variables, put headers installation
in a single location and make the headers check use them instead of
dpdk_chkinc_headers.
This rework reveals a number of issues:
- net/txgbe driver was directly installing its header, bypassing
drivers/meson.build and skipping the headers check,
- arch headers were not checked except for x86,
- some driver headers were not checked,
For the last point, a build warning must be disabled (like it is
globally in DPDK) for headers from raw drivers.
Finally, checkpatches is updated to avoid reintroductions of
install_headers().
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
buildtools/chkincs/meson.build | 7 +++++--
config/meson.build | 3 +--
devtools/checkpatches.sh | 9 +++++++++
drivers/meson.build | 7 ++-----
drivers/net/txgbe/meson.build | 2 +-
lib/eal/arm/include/meson.build | 3 +--
lib/eal/include/meson.build | 3 +--
lib/eal/loongarch/include/meson.build | 3 +--
lib/eal/ppc/include/meson.build | 3 +--
lib/eal/riscv/include/meson.build | 3 +--
lib/eal/x86/include/meson.build | 6 ++----
lib/meson.build | 10 +++-------
meson.build | 15 ++++++++++++++-
13 files changed, 42 insertions(+), 32 deletions(-)
diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index 49dbc55254..ac7df41304 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -12,10 +12,13 @@ gen_c_files = generator(gen_c_file_for_header,
arguments: ['@INPUT@', '@OUTPUT@'])
cflags = machine_args
+if cc.has_argument('-Wno-missing-field-initializers')
+ cflags += '-Wno-missing-field-initializers'
+endif
cflags += no_wvla_cflag
sources = files('main.c')
-sources += gen_c_files.process(dpdk_chkinc_headers)
+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
@@ -56,7 +59,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_chkinc_headers)
+cpp_sources += gen_cpp_files.process(dpdk_arch_headers + dpdk_headers + dpdk_drivers_headers)
executable('chkincs-cpp', cpp_sources,
cpp_args: ['-include', 'rte_config.h', cflags],
diff --git a/config/meson.build b/config/meson.build
index 55497f0bf5..f737b67c36 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -456,8 +456,7 @@ endif
# set the install path for the drivers
dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)
-install_headers(['rte_config.h'],
- subdir: get_option('include_subdir_arch'))
+dpdk_arch_headers += files('rte_config.h')
# enable VFIO only if it is linux OS
dpdk_conf.set('RTE_EAL_VFIO', is_linux)
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 35037aa8f1..d4b86922c9 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -87,6 +87,15 @@ check_forbidden_additions() { # <patch>
-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
"$1" || res=1
+ # don't call directly install_headers()
+ awk -v FOLDERS="lib drivers" \
+ -v SKIP_FILES='meson.build' \
+ -v EXPRESSIONS="\\\<install_headers\\\>" \
+ -v RET_ON_FAIL=1 \
+ -v MESSAGE='Using install_headers()' \
+ -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+ "$1" || res=1
+
# refrain from using compiler attribute without defining a common macro
awk -v FOLDERS="lib drivers app examples" \
-v SKIP_FILES='lib/eal/include/rte_common.h' \
diff --git a/drivers/meson.build b/drivers/meson.build
index f25f425565..424acb03a7 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -241,11 +241,8 @@ foreach subpath:subdirs
dpdk_extra_ldflags += pkgconfig_extra_libs
- install_headers(headers)
- if get_option('enable_driver_sdk')
- install_headers(driver_sdk_headers)
- endif
- dpdk_chkinc_headers += driver_sdk_headers
+ dpdk_headers += headers
+ dpdk_drivers_headers += driver_sdk_headers
if headers.length() > 0
dpdk_includes += include_directories(drv_path)
diff --git a/drivers/net/txgbe/meson.build b/drivers/net/txgbe/meson.build
index 4dbbf597bb..5cdec017ed 100644
--- a/drivers/net/txgbe/meson.build
+++ b/drivers/net/txgbe/meson.build
@@ -31,4 +31,4 @@ elif arch_subdir == 'arm'
sources += files('txgbe_rxtx_vec_neon.c')
endif
-install_headers('rte_pmd_txgbe.h')
+headers = files('rte_pmd_txgbe.h')
diff --git a/lib/eal/arm/include/meson.build b/lib/eal/arm/include/meson.build
index 657bf58569..822ddac520 100644
--- a/lib/eal/arm/include/meson.build
+++ b/lib/eal/arm/include/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation.
-arch_headers = files(
+dpdk_arch_headers += files(
'rte_atomic_32.h',
'rte_atomic_64.h',
'rte_atomic.h',
@@ -28,4 +28,3 @@ arch_headers = files(
'rte_spinlock.h',
'rte_vect.h',
)
-install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
diff --git a/lib/eal/include/meson.build b/lib/eal/include/meson.build
index d903577caa..aef5824e5f 100644
--- a/lib/eal/include/meson.build
+++ b/lib/eal/include/meson.build
@@ -64,7 +64,7 @@ driver_sdk_headers = files(
)
# special case install the generic headers, since they go in a subdir
-generic_headers = files(
+dpdk_generic_headers += files(
'generic/rte_atomic.h',
'generic/rte_byteorder.h',
'generic/rte_cpuflags.h',
@@ -78,4 +78,3 @@ generic_headers = files(
'generic/rte_spinlock.h',
'generic/rte_vect.h',
)
-install_headers(generic_headers, subdir: 'generic')
diff --git a/lib/eal/loongarch/include/meson.build b/lib/eal/loongarch/include/meson.build
index 6e8d12601a..574aa6dac2 100644
--- a/lib/eal/loongarch/include/meson.build
+++ b/lib/eal/loongarch/include/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2022 Loongson Technology Corporation Limited
-arch_headers = files(
+dpdk_arch_headers += files(
'rte_atomic.h',
'rte_byteorder.h',
'rte_cpuflags.h',
@@ -15,4 +15,3 @@ arch_headers = files(
'rte_spinlock.h',
'rte_vect.h',
)
-install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
diff --git a/lib/eal/ppc/include/meson.build b/lib/eal/ppc/include/meson.build
index fa64330f01..87887187b8 100644
--- a/lib/eal/ppc/include/meson.build
+++ b/lib/eal/ppc/include/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
-arch_headers = files(
+dpdk_arch_headers += files(
'rte_altivec.h',
'rte_atomic.h',
'rte_byteorder.h',
@@ -16,4 +16,3 @@ arch_headers = files(
'rte_spinlock.h',
'rte_vect.h',
)
-install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
diff --git a/lib/eal/riscv/include/meson.build b/lib/eal/riscv/include/meson.build
index 481c7d50a4..a7a387fb8a 100644
--- a/lib/eal/riscv/include/meson.build
+++ b/lib/eal/riscv/include/meson.build
@@ -3,7 +3,7 @@
# Copyright(c) 2022 SiFive
# Copyright(c) 2022 Semihalf
-arch_headers = files(
+dpdk_arch_headers += files(
'rte_atomic.h',
'rte_byteorder.h',
'rte_cpuflags.h',
@@ -17,4 +17,3 @@ arch_headers = files(
'rte_spinlock.h',
'rte_vect.h',
)
-install_headers(arch_headers, subdir: get_option('include_subdir_arch'))
diff --git a/lib/eal/x86/include/meson.build b/lib/eal/x86/include/meson.build
index 52d2f8e969..71f149e821 100644
--- a/lib/eal/x86/include/meson.build
+++ b/lib/eal/x86/include/meson.build
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2017 Intel Corporation
-arch_headers = files(
+dpdk_arch_headers += files(
'rte_atomic.h',
'rte_byteorder.h',
'rte_cpuflags.h',
@@ -16,11 +16,9 @@ arch_headers = files(
'rte_spinlock.h',
'rte_vect.h',
)
-arch_indirect_headers = files(
+dpdk_arch_indirect_headers += files(
'rte_atomic_32.h',
'rte_atomic_64.h',
'rte_byteorder_32.h',
'rte_byteorder_64.h',
)
-install_headers(arch_headers + arch_indirect_headers, subdir: get_option('include_subdir_arch'))
-dpdk_chkinc_headers += arch_headers
diff --git a/lib/meson.build b/lib/meson.build
index a67efaf718..d79740a4c3 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -208,13 +208,9 @@ foreach l:libraries
dpdk_libs_enabled += name
dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1)
- install_headers(headers)
- install_headers(indirect_headers)
- if get_option('enable_driver_sdk')
- install_headers(driver_sdk_headers)
- endif
- dpdk_chkinc_headers += headers
- dpdk_chkinc_headers += driver_sdk_headers
+ dpdk_headers += headers
+ dpdk_indirect_headers += indirect_headers
+ dpdk_drivers_headers += driver_sdk_headers
libname = 'rte_' + name
includes += include_directories(l)
diff --git a/meson.build b/meson.build
index 2423884df7..9f0b06179b 100644
--- a/meson.build
+++ b/meson.build
@@ -37,7 +37,12 @@ dpdk_libraries = []
dpdk_static_libraries = []
dpdk_shared_lib_deps = []
dpdk_static_lib_deps = []
-dpdk_chkinc_headers = []
+dpdk_arch_headers = []
+dpdk_arch_indirect_headers = []
+dpdk_generic_headers = []
+dpdk_headers = []
+dpdk_indirect_headers = []
+dpdk_drivers_headers = []
dpdk_driver_classes = []
dpdk_drivers = []
dpdk_extra_ldflags = []
@@ -106,6 +111,14 @@ if get_option('check_includes')
subdir('buildtools/chkincs')
endif
+install_headers(dpdk_arch_headers + dpdk_arch_indirect_headers,
+ subdir: get_option('include_subdir_arch'))
+install_headers(dpdk_headers + dpdk_indirect_headers)
+install_headers(dpdk_generic_headers, subdir: 'generic')
+if get_option('enable_driver_sdk')
+ install_headers(dpdk_drivers_headers)
+endif
+
# write the build config
build_cfg = 'rte_build_config.h'
configure_file(output: build_cfg,
--
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 ` David Marchand [this message]
2025-09-26 13:08 ` [PATCH v5 7/9] build: factorize headers installation 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=20250926124103.750844-8-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=drc@linux.ibm.com \
--cc=jianwang@trustnetic.com \
--cc=jiawenwu@trustnetic.com \
--cc=konstantin.ananyev@huawei.com \
--cc=roretzla@linux.microsoft.com \
--cc=stanislaw.kardach@gmail.com \
--cc=sunyuechi@iscas.ac.cn \
--cc=thomas@monjalon.net \
--cc=wathsala.vithanage@arm.com \
--cc=zaiyuwang@trustnetic.com \
--cc=zhoumin@loongson.cn \
/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).