From patchwork Tue Apr 23 22:06:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 53026 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 AED831B486; Wed, 24 Apr 2019 00:06:55 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id BFBBA1B43F for ; Wed, 24 Apr 2019 00:06:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 15:06:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,387,1549958400"; d="scan'208";a="133795821" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 15:06:52 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 23 Apr 2019 23:06:41 +0100 Message-Id: <20190423220644.54589-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190423220644.54589-1-bruce.richardson@intel.com> References: <20190423220644.54589-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/4] examples: install examples as part of ninja install 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" When we install dpdk onto a system, we want to put the examples into the /usr/share/dpdk (or /usr/local/share/dpdk) directory for reference. Signed-off-by: Bruce Richardson --- examples/meson.build | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index e4babf6bf..1a6134f12 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -8,12 +8,20 @@ endif execinfo = cc.find_library('execinfo', required: false) -allow_skips = true # don't flag an error if we can't build an app +all_examples = run_command('sh', '-c', + 'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done' + ).stdout().split() +# install all example code on install - irrespective of whether the example in +# question is to be built as part of this build or not. +foreach ex:all_examples + install_subdir(ex, + install_dir: get_option('datadir') + '/dpdk/examples', + exclude_files: 'meson.build') +endforeach if get_option('examples').to_lower() == 'all' - dirs = run_command('sh', '-c', - 'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done') - examples = dirs.stdout().split() + examples = all_examples + allow_skips = true # don't flag an error if we can't build an app else examples = get_option('examples').split(',') allow_skips = false # error out if we can't build a requested app From patchwork Tue Apr 23 22:06:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 53027 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 165D71B4CD; Wed, 24 Apr 2019 00:06:59 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 7C7A81B442 for ; Wed, 24 Apr 2019 00:06:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 15:06:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,387,1549958400"; d="scan'208";a="133795828" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 15:06:54 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 23 Apr 2019 23:06:42 +0100 Message-Id: <20190423220644.54589-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190423220644.54589-1-bruce.richardson@intel.com> References: <20190423220644.54589-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/4] examples: simplify getting list of all examples 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" Using find rather than shelling out to a one-liner script is easier to read and understand, as well as allowing shorter lines in the code. Signed-off-by: Bruce Richardson --- examples/meson.build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index 1a6134f12..19f2686b2 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -8,8 +8,9 @@ endif execinfo = cc.find_library('execinfo', required: false) -all_examples = run_command('sh', '-c', - 'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done' +all_examples = run_command('find', meson.current_source_dir(), + '-maxdepth', '1', '-mindepth', '1', + '-type', 'd', '-printf', '%f ' ).stdout().split() # install all example code on install - irrespective of whether the example in # question is to be built as part of this build or not. From patchwork Tue Apr 23 22:06:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 53028 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 34A5F1B4E1; Wed, 24 Apr 2019 00:07:02 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 185A71B4CD for ; Wed, 24 Apr 2019 00:06:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 15:06:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,387,1549958400"; d="scan'208";a="133795844" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 15:06:56 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 23 Apr 2019 23:06:43 +0100 Message-Id: <20190423220644.54589-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190423220644.54589-1-bruce.richardson@intel.com> References: <20190423220644.54589-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/4] devtools/test-meson-builds: add testing of pkg-config file 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" The pkg-config file generated as part of the build of DPDK should allow applications to be built with an installed DPDK. We can test this as part of the build by doing an install of DPDK to a temporary directory within the build folder, and by then compiling up a few sample apps using make working off that directory. Signed-off-by: Bruce Richardson --- devtools/test-meson-builds.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index 630a1a6fe..dfba2a782 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -90,3 +90,20 @@ if command -v $c >/dev/null 2>&1 ; then $use_shared --cross-file $f done fi + +############## +# Test installation of the x86-default target, to be used for checking +# the sample apps build using the pkg-config file for cflags and libs +############### +build_path=build-x86-default +DESTDIR=`pwd`/$build_path/install-root ; export DESTDIR +PKG_CONFIG_PATH=$DESTDIR/usr/local/lib64/pkgconfig ; export PKG_CONFIG_PATH +$ninja_cmd -C $build_path install + +# rather than hacking our environment, just edit the .pc file prefix value +sed -i "s|prefix=|prefix=$DESTDIR|" $PKG_CONFIG_PATH/libdpdk.pc + +for example in helloworld l2fwd l3fwd skeleton timer; do + echo "## Building $example" + make -C $DESTDIR/usr/local/share/dpdk/examples/$example +done From patchwork Tue Apr 23 22:06:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 53029 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 896F41B4F8; Wed, 24 Apr 2019 00:07:04 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CA9DB1B4DC for ; Wed, 24 Apr 2019 00:07:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 15:06:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,387,1549958400"; d="scan'208";a="133795863" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga007.jf.intel.com with ESMTP; 23 Apr 2019 15:06:59 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 23 Apr 2019 23:06:44 +0100 Message-Id: <20190423220644.54589-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190423220644.54589-1-bruce.richardson@intel.com> References: <20190423220644.54589-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/4] build: add libbsd to pkg-config file if enabled 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" If libbsd is enabled in DPDK, the strlcpy and strlcat functions in rte_string_fns.h redirect to the varients in libbsd, only using the fallbacks if it is not enabled. Therefore, if libbsd is enabled, it needs to be called out as a DPDK dependency in the pkgconfig file. To ensure that we don't have undefined variables on non-Linux platforms, we can remove the linux condition around the libbsd check - no harm comes in looking for it on other OS, since it's an optional dependency. To verify this builds correctly, the cmdline sample app is added to the list of examples compiled by test-meson-builds. Without this change compilation fails if libbsd is present on the system Signed-off-by: Bruce Richardson --- config/meson.build | 10 ++++------ devtools/test-meson-builds.sh | 2 +- meson.build | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/meson.build b/config/meson.build index f8aded6ed..64e2315dd 100644 --- a/config/meson.build +++ b/config/meson.build @@ -125,12 +125,10 @@ if numa_dep.found() and cc.has_header('numaif.h') dpdk_extra_ldflags += '-lnuma' endif -# check for strlcpy -if is_linux - libbsd = dependency('libbsd', required: false) - if libbsd.found() - dpdk_conf.set('RTE_USE_LIBBSD', 1) - endif +# check for libbsd +libbsd = dependency('libbsd', required: false) +if libbsd.found() + dpdk_conf.set('RTE_USE_LIBBSD', 1) endif # add -include rte_config to cflags diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index dfba2a782..41080353b 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -103,7 +103,7 @@ $ninja_cmd -C $build_path install # rather than hacking our environment, just edit the .pc file prefix value sed -i "s|prefix=|prefix=$DESTDIR|" $PKG_CONFIG_PATH/libdpdk.pc -for example in helloworld l2fwd l3fwd skeleton timer; do +for example in cmdline helloworld l2fwd l3fwd skeleton timer; do echo "## Building $example" make -C $DESTDIR/usr/local/share/dpdk/examples/$example done diff --git a/meson.build b/meson.build index a96486597..3c173a587 100644 --- a/meson.build +++ b/meson.build @@ -77,6 +77,8 @@ pkg.generate(name: meson.project_name(), libraries: dpdk_libraries, libraries_private: dpdk_drivers + dpdk_static_libraries + ['-Wl,-Bdynamic'] + dpdk_extra_ldflags, + requires: libbsd, # apps using rte_string_fns.h may need this if enabled + # if libbsd is not enabled, then this is blank description: '''The Data Plane Development Kit (DPDK). Note that CFLAGS might contain an -march flag higher than typical baseline. This is required for a number of static inline functions in the public headers.''',