[dpdk-dev] [PATCH] net/af_xdp: simplify meson build specification

Bruce Richardson bruce.richardson at intel.com
Fri Apr 5 17:33:20 CEST 2019


The build spec has lots of levels of indentation, which can be reduced by
not explicitly checking for linux, but for the needed header and library
files needed for the driver.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/af_xdp/meson.build | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index 840c93728..7904840f0 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -1,19 +1,16 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2019 Intel Corporation
 
-if host_machine.system() == 'linux'
-	bpf_dep = dependency('libbpf', required: false)
-	if bpf_dep.found()
-		build = true
-	else
-		bpf_dep = cc.find_library('bpf', required: false)
-		if bpf_dep.found() and cc.has_header('bpf/xsk.h', dependencies: bpf_dep) and cc.has_header('linux/if_xdp.h')
-			build = true
-			pkgconfig_extra_libs += '-lbpf'
-		else
-			build = false
-		endif
-	endif
+sources = files('rte_eth_af_xdp.c')
+
+bpf_dep = dependency('libbpf', required: false)
+if not bpf_dep.found()
+	bpf_dep = cc.find_library('bpf', required: false)
+endif
+
+if bpf_dep.found() and cc.has_header('bpf/xsk.h') and cc.has_header('linux/if_xdp.h')
 	ext_deps += bpf_dep
+	pkgconfig_extra_libs += '-lbpf'
+else
+	build = false
 endif
-sources = files('rte_eth_af_xdp.c')
-- 
2.20.1



More information about the dev mailing list