From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9837FA09E0; Fri, 13 Nov 2020 13:28:27 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 60714C93E; Fri, 13 Nov 2020 13:25:29 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 1A4B0C8C6 for ; Fri, 13 Nov 2020 13:25:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605270326; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WJavvk9TrFn4rSxiBf/4kotLWd2VBiDeQSoY+k7/PR8=; b=fwI77ILwjTydaKrh1rEgIpW8oc4x+fnGfbItK2waX69Sjn6GX3fMUgFkz0EEUCtKlcJu9Z MQonWwLO4CXbiKCi+1mZdMM+uDnZA0LqNBKvgaLtGNT2i9vwpLDMYqX27etfAbPCG3tPzP j0eB/hT7++zDuYKRwRSSRHqJOxUym8A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-REdvN38BOK-Me_d4_GYDWw-1; Fri, 13 Nov 2020 07:25:25 -0500 X-MC-Unique: REdvN38BOK-Me_d4_GYDWw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2FBE6415F; Fri, 13 Nov 2020 12:25:23 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 834A15C1C2; Fri, 13 Nov 2020 12:25:22 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bruce.richardson@intel.com Date: Fri, 13 Nov 2020 13:24:30 +0100 Message-Id: <20201113122430.25354-12-david.marchand@redhat.com> In-Reply-To: <20201113122430.25354-1-david.marchand@redhat.com> References: <20201110151219.4893-1-david.marchand@redhat.com> <20201113122430.25354-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH v2 11/11] devtools: compile all buildable examples with pkg-config 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" Rather than just installing all examples, we can use the build checks to filter out any examples that are missing dependencies or are otherwise unbuildable on the current system. Introduce a new "buildable" special value for the -Dexamples= meson option, this way existing behavior on installing all examples is preserved. Select only buildable examples and test their compilation for the x86-default target. Note for maintainers/users of the script: for existing environments, the x86-default target might get broken by this patch since the script now tries to build all "installed" examples and dependencies for some might be unfulfilled. To fix this temporary situation, you can either delete the whole directory or reconfigure it: $ meson configure $DPDK_BUILD_TEST_DIR/build-x86-default \ -Dexamples=buildable Suggested-by: Bruce Richardson Signed-off-by: David Marchand --- Changelog since v1: - rebased on main, - introduced a new "buildable" special value for the -Dexamples option, - installation of the "multi-level" examples has been fixed, so corresponding exceptions have been removed, - a fix for the vhost is waiting in next-virtio, I assume it will get pulled before this series, - the only remaining exception is for vm_power_manager which is broken, --- devtools/test-meson-builds.sh | 11 +++++++++-- examples/meson.build | 24 ++++++++++++++++++++++-- meson.build | 2 ++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index 3ce49368cf..a04f3eb7ff 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -213,7 +213,8 @@ default_machine='nehalem' if ! check_cc_flags "-march=$default_machine" ; then default_machine='corei7' fi -build build-x86-default cc -Dlibdir=lib -Dmachine=$default_machine $use_shared +build build-x86-default cc -Dlibdir=lib -Dmachine=$default_machine \ + -Dexamples=buildable $use_shared # 32-bit with default compiler if check_cc_flags '-m32' ; then @@ -266,10 +267,16 @@ pc_file=$(find $DESTDIR -name libdpdk.pc) export PKG_CONFIG_PATH=$(dirname $pc_file):$PKG_CONFIG_PATH libdir=$(dirname $(find $DESTDIR -name librte_eal.so)) export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH -examples=${DPDK_BUILD_TEST_EXAMPLES:-"cmdline helloworld l2fwd l3fwd skeleton timer"} # if pkg-config defines the necessary flags, test building some examples if pkg-config --define-prefix libdpdk >/dev/null 2>&1; then export PKGCONF="pkg-config --define-prefix" + examples=${DPDK_BUILD_TEST_EXAMPLES:-} + if [ -z "$examples" ]; then + for mk in $DESTDIR/usr/local/share/dpdk/examples/*/Makefile; do + name=$(basename $(dirname $mk)) + examples="$examples $name" + done + fi for example in $examples; do echo "## Building $example" $MAKE -C $DESTDIR/usr/local/share/dpdk/examples/$example \ diff --git a/examples/meson.build b/examples/meson.build index 46ec80919e..a23ab79e8c 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -55,9 +55,18 @@ endif if get_option('examples').to_lower() == 'all' examples = all_examples allow_skips = true # don't flag an error if we can't build an app + install_buildable = false +elif get_option('examples').to_lower() == 'buildable' + examples = all_examples + allow_skips = true + install_buildable = true # only install examples that can be built + # FIXME: vm_power_manager relies on an internal header and can't build + # outside dpdk tree. + dpdk_examples_exclude += ['vm_power_manager'] else examples = get_option('examples').split(',') allow_skips = false # error out if we can't build a requested app + install_buildable = false endif default_cflags = machine_args if cc.has_argument('-Wno-format-truncation') @@ -81,10 +90,15 @@ foreach example: examples foreach d:deps var_name = get_option('default_library') + '_rte_' + d if not is_variable(var_name) - error('Missing dependency "@0@" for example "@1@"'.format(d, name)) + message('Missing dependency "@0@" for example "@1@"'.format(d, name)) + build = false + else + dep_objs += [get_variable(var_name)] endif - dep_objs += [get_variable(var_name)] endforeach + endif + + if build if allow_experimental_apis cflags += '-DALLOW_EXPERIMENTAL_API' endif @@ -98,5 +112,11 @@ foreach example: examples error('Cannot build requested example "' + name + '"') else message('Skipping example "' + name + '"') + if install_buildable + # exclude based on top-level directory only + dir = example.split('/')[0] + dpdk_examples_exclude += dir + message('Excluding example directory "@0@" from install'.format(dir)) + endif endif endforeach diff --git a/meson.build b/meson.build index 45d974cd2c..559a9d2f1b 100644 --- a/meson.build +++ b/meson.build @@ -58,9 +58,11 @@ subdir('doc') # build any examples explicitly requested - useful for developers - and # install any example code into the appropriate install path +dpdk_examples_exclude = [] subdir('examples') install_subdir('examples', install_dir: get_option('datadir') + '/dpdk', + exclude_directories: dpdk_examples_exclude, exclude_files: 'meson.build') # build kernel modules if enabled -- 2.23.0