From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9A70642D80; Wed, 28 Jun 2023 15:21:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8426F406B3; Wed, 28 Jun 2023 15:21:33 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 6328140151 for ; Wed, 28 Jun 2023 15:21:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687958491; 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=adLSWOwgPMBKuv89jlsM+C18pOslAOL0/3d+Xjxv0YM=; b=LgQbn2WnDrwwXobmdGci3bgRjGqJhverpXAQDd0ZQMQaa/j1OqDpDnKtLf6vGYOj5BR7KS bg+eQ0WP3D3+hVmat/WUeOpa9ETFohoWhhFCGtisIuq0ENY3X9GbuYNO3yO8dXo1aMtPXX lAapKh6RQvXfNdan6fTsydkzvT/E47w= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-UWAZcttfNYSg0pvLQ1T6ug-1; Wed, 28 Jun 2023 09:21:21 -0400 X-MC-Unique: UWAZcttfNYSg0pvLQ1T6ug-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B21B78ED62A; Wed, 28 Jun 2023 13:20:16 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.210]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22433111F3B0; Wed, 28 Jun 2023 13:20:14 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr, Bruce Richardson Subject: [PATCH v5 2/2] build: select optional libraries Date: Wed, 28 Jun 2023 15:20:04 +0200 Message-Id: <20230628132004.340074-3-david.marchand@redhat.com> In-Reply-To: <20230628132004.340074-1-david.marchand@redhat.com> References: <20211117112847.7362-6-david.marchand@redhat.com> <20230628132004.340074-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org There is currently no way to know which libraries are optional. Introduce a enable_libs option (close to what we have for drivers) so that packagers or projects consuming DPDK can more easily select the optional libraries that matter to them and disable other optional libraries. Signed-off-by: David Marchand --- Changes since v4: - moved always_enable earlier for readability, Changes since v3: - split non related cleanup changes, - fixed false positive complaints about disabling mandatory libs by building the list of always enabled libs, appending this list to enable_list and checking the disable side, - updated enable/disable_libs descriptions, Changes since v2: - moved the IOVA check for kni build in lib/kni/meson.build, - reworked deprecated libraries handling by only considering them when no enable_libs option is set. With this, no need for a default value in meson_options.txt, yet configurations in the CI must be adjusted, - moved mandatory libraries check after enable/disable_libs evaluation, --- lib/meson.build | 34 ++++++++++++++++++++++------------ meson_options.txt | 4 +++- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/meson.build b/lib/meson.build index 73afd90b38..b8834fc277 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -88,6 +88,13 @@ optional_libs = [ 'vhost', ] +always_enable = [] +foreach l:libraries + if not optional_libs.contains(l) + always_enable += l + endif +endforeach + dpdk_libs_deprecated += [ 'flow_classify', 'kni', @@ -102,17 +109,13 @@ foreach l:run_command(list_dir_globs, get_option('enable_deprecated_libs'), enable_deprecated_libs += l endforeach -disabled_libs = [] -opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'), - check: true).stdout().split() -foreach l:opt_disabled_libs - if not optional_libs.contains(l) - warning('Cannot disable mandatory library "@0@"'.format(l)) - continue - endif - disabled_libs += l -endforeach +disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split() +enable_libs = run_command(list_dir_globs, get_option('enable_libs'), check: true).stdout().split() +if enable_libs.length() == 0 + enable_libs += optional_libs +endif +enable_libs += always_enable default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] @@ -153,9 +156,16 @@ foreach l:libraries else warning('Enabling deprecated library, "@0@"'.format(l)) endif - elif disabled_libs.contains(l) + elif not enable_libs.contains(l) build = false - reason = 'explicitly disabled via build config' + reason = 'not in enabled libraries build config' + elif disable_libs.contains(l) + if always_enable.contains(l) + warning('Cannot disable mandatory library "@0@"'.format(l)) + else + build = false + reason = 'explicitly disabled via build config' + endif endif if build diff --git a/meson_options.txt b/meson_options.txt index 839d4266c6..7312da3640 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,7 +11,7 @@ option('disable_apps', type: 'string', value: '', description: option('disable_drivers', type: 'string', value: '', description: 'Comma-separated list of drivers to explicitly disable.') option('disable_libs', type: 'string', value: '', description: - 'Comma-separated list of libraries to explicitly disable. [NOTE: not all libs can be disabled]') + 'Comma-separated list of optional libraries to explicitly disable. [NOTE: mandatory libs cannot be disabled]') option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-', description: 'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.') option('enable_docs', type: 'boolean', value: false, description: @@ -26,6 +26,8 @@ option('enable_driver_sdk', type: 'boolean', value: false, description: 'Install headers to build drivers.') option('enable_kmods', type: 'boolean', value: false, description: 'build kernel modules') +option('enable_libs', type: 'string', value: '', description: + 'Comma-separated list of optional libraries to explicitly enable. [NOTE: mandatory libs are always enabled]') option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', description: -- 2.40.1