From patchwork Fri Jan 11 12:38:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Boccassi X-Patchwork-Id: 49720 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 741D01BBEC; Fri, 11 Jan 2019 13:38:21 +0100 (CET) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 1F73C1BBD7 for ; Fri, 11 Jan 2019 13:38:17 +0100 (CET) Received: by mail-wm1-f66.google.com with SMTP id m1so2250296wml.2 for ; Fri, 11 Jan 2019 04:38:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=at/ShoWR4TDQZNWQODkTXeVx8C70rHCKxOBz1+5PHx4=; b=p8yWsrZLx3zbA7k7/8Ogev9S0oTQGX9WhhPzViYa7Aa9TUmx+piqLtbvsIxW5fgxLS CWdlkbHD++SyvxiU2QYlSK2hDUuuZWFhcIgVyygM7FXixEnVJrdWCLB/+75vopXbPAl+ DVFp0XXp+MwDmbNmLUB07PCtctJzHf+1Xd1gX97OgT73yF+/tshKt9UWWrkEWxZ+01rS HyEhu72MhHb8Y4Riqhw5Jp/JdQ85aRjuhj+hME8n+RHroIKVNc2o00A3H114TVW9u2j3 CS5kfv0b4J5CBotegbEkAGhIZOz+35Q2tVhy5di1cOo0pXjz+8VESwCQa+VW7urKUlAL HAUg== X-Gm-Message-State: AJcUukeIXAF5jKGJnr/CsZRgIfxj9Zt9fILTS8w3l7FPZuCZbNaV9UZ9 nNj6+lIBLxZ2HuzhOUTOPlvtDAE3d8w= X-Google-Smtp-Source: ALg8bN5tupA76h+zEUbZ833KCn+KuSmuyDF/Eiqw4pwj441+q+hCEea+DB7foEDX6G4k5yzyo3oq8w== X-Received: by 2002:a1c:cbc7:: with SMTP id b190mr2327590wmg.13.1547210296320; Fri, 11 Jan 2019 04:38:16 -0800 (PST) Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556]) by smtp.gmail.com with ESMTPSA id q9sm47799288wrv.26.2019.01.11.04.38.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jan 2019 04:38:15 -0800 (PST) From: Luca Boccassi To: dev@dpdk.org Cc: bruce.richardson@intel.com, Luca Boccassi Date: Fri, 11 Jan 2019 12:38:08 +0000 Message-Id: <20190111123809.8789-2-bluca@debian.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111123809.8789-1-bluca@debian.org> References: <20190103175725.5836-1-bluca@debian.org> <20190111123809.8789-1-bluca@debian.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 2/3] build: use dependency() instead of find_library() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Whenever possible (if the library ships a pkg-config file) use meson's dependency() function to look for it, as it will automatically add it to the Requires.private list if needed, to allow for static builds to succeed for reverse dependencies of DPDK. Otherwise the recursive dependencies are not parsed, and users doing static builds have to resolve them manually by themselves. When using this API avoid additional checks that are superfluos and take extra time, and avoid adding the linker flag manually which causes it to be duplicated. An internal checker has been added to Meson 0.42 to detect libpcap, which ships a custom tool rather than a pkg-config file, so bump the minimum Meson version from 0.41 to 0.42. Signed-off-by: Luca Boccassi --- v2: split libbsd change in a separate commit, remove CC to stable as a meson bump will be required drivers/crypto/ccp/meson.build | 1 - drivers/crypto/openssl/meson.build | 1 - drivers/crypto/qat/meson.build | 1 - drivers/meson.build | 2 +- drivers/net/bnx2x/meson.build | 2 +- drivers/net/mlx4/meson.build | 6 +++--- drivers/net/mlx5/meson.build | 6 +++--- drivers/net/pcap/meson.build | 5 ++--- lib/librte_bpf/meson.build | 4 ++-- lib/librte_telemetry/meson.build | 2 +- meson.build | 2 +- 11 files changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/crypto/ccp/meson.build b/drivers/crypto/ccp/meson.build index e43b00591..915c4c854 100644 --- a/drivers/crypto/ccp/meson.build +++ b/drivers/crypto/ccp/meson.build @@ -18,4 +18,3 @@ sources = files('rte_ccp_pmd.c', 'ccp_pmd_ops.c') ext_deps += dep -pkgconfig_extra_libs += '-lcrypto' diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build index c2a0dd8ba..80e5e8835 100644 --- a/drivers/crypto/openssl/meson.build +++ b/drivers/crypto/openssl/meson.build @@ -8,4 +8,3 @@ endif deps += 'bus_vdev' sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c') ext_deps += dep -pkgconfig_extra_libs += '-lcrypto' diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build index 9cc98d2c2..21f969735 100644 --- a/drivers/crypto/qat/meson.build +++ b/drivers/crypto/qat/meson.build @@ -13,6 +13,5 @@ if dep.found() 'qat_sym.c', 'qat_sym_session.c') qat_ext_deps += dep - pkgconfig_extra_libs += '-lcrypto' qat_cflags += '-DBUILD_QAT_SYM' endif diff --git a/drivers/meson.build b/drivers/meson.build index c3c66bbc0..91bc6dc3f 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -46,7 +46,7 @@ foreach class:driver_classes # set up internal deps. Drivers can append/override as necessary deps = std_deps # ext_deps: Stores external library dependency got - # using dependency() or cc.find_library(). For most cases, we + # using dependency() (preferred) or find_library(). For most cases, we # probably also need to specify the "-l" flags in # pkgconfig_extra_libs variable too, so that it can be reflected # in the pkgconfig output for static builds diff --git a/drivers/net/bnx2x/meson.build b/drivers/net/bnx2x/meson.build index e3c688869..dd189ffc4 100644 --- a/drivers/net/bnx2x/meson.build +++ b/drivers/net/bnx2x/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation -dep = cc.find_library('z', required: false) +dep = dependency('zlib', required: false) build = dep.found() ext_deps += dep cflags += '-DZLIB_CONST' diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 7de571e2a..4ba4e93b6 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -14,9 +14,9 @@ if pmd_dlopen ] endif libs = [ - cc.find_library('mnl', required:false), - cc.find_library('mlx4', required:false), - cc.find_library('ibverbs', required:false), + dependency('libmnl', required:false), + dependency('libmlx4', required:false), + dependency('libibverbs', required:false), ] build = true foreach lib:libs diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 8ba19e818..161c5641f 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -14,9 +14,9 @@ if pmd_dlopen ] endif libs = [ - cc.find_library('mnl', required:false), - cc.find_library('mlx5', required:false), - cc.find_library('ibverbs', required:false), + dependency('libmnl', required:false), + dependency('libmlx5', required:false), + dependency('libibverbs', required:false), ] build = true foreach lib:libs diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build index 0c4e0201a..89c9d7a74 100644 --- a/drivers/net/pcap/meson.build +++ b/drivers/net/pcap/meson.build @@ -1,12 +1,11 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -pcap_dep = cc.find_library('pcap', required: false) -if pcap_dep.found() and cc.has_header('pcap.h', dependencies: pcap_dep) +pcap_dep = dependency('pcap', required: false) +if pcap_dep.found() build = true else build = false endif sources = files('rte_eth_pcap.c') ext_deps += pcap_dep -pkgconfig_extra_libs += '-lpcap' diff --git a/lib/librte_bpf/meson.build b/lib/librte_bpf/meson.build index bc0cd78f9..c3b1f698e 100644 --- a/lib/librte_bpf/meson.build +++ b/lib/librte_bpf/meson.build @@ -18,8 +18,8 @@ install_headers = files('bpf_def.h', deps += ['mbuf', 'net', 'ethdev'] -dep = cc.find_library('elf', required: false) -if dep.found() == true and cc.has_header('libelf.h', dependencies: dep) +dep = dependency('libelf', required: false) +if dep.found() sources += files('bpf_load_elf.c') ext_deps += dep endif diff --git a/lib/librte_telemetry/meson.build b/lib/librte_telemetry/meson.build index 9492f544e..cafb26f08 100644 --- a/lib/librte_telemetry/meson.build +++ b/lib/librte_telemetry/meson.build @@ -6,7 +6,7 @@ headers = files('rte_telemetry.h', 'rte_telemetry_internal.h', 'rte_telemetry_pa deps += ['metrics', 'ethdev'] cflags += '-DALLOW_EXPERIMENTAL_API' -jansson = cc.find_library('jansson', required: false) +jansson = dependency('jansson', required: false) if jansson.found() ext_deps += jansson dpdk_app_link_libraries += ['telemetry'] diff --git a/meson.build b/meson.build index d500507c5..35126106a 100644 --- a/meson.build +++ b/meson.build @@ -5,7 +5,7 @@ project('DPDK', 'C', version: '19.02.0-rc1', license: 'BSD', default_options: ['buildtype=release', 'default_library=static'], - meson_version: '>= 0.41' + meson_version: '>= 0.42' ) # set up some global vars for compiler, platform, configuration, etc.