net/af_xdp: simplify meson build specification

Message ID 20190405153320.61694-1-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/af_xdp: simplify meson build specification |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson April 5, 2019, 3:33 p.m. UTC
  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@intel.com>
---
 drivers/net/af_xdp/meson.build | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
  

Comments

Ferruh Yigit April 5, 2019, 3:41 p.m. UTC | #1
On 4/5/2019 4:33 PM, Bruce Richardson wrote:
> 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@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')
> 

Looks good to me.
  
Ferruh Yigit April 5, 2019, 3:45 p.m. UTC | #2
On 4/5/2019 4:33 PM, Bruce Richardson wrote:
> 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@intel.com>

Squashed into relevant commit in next-net, thanks.
  

Patch

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')