From patchwork Tue Apr 20 10:22:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 91858 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4B86A0548; Tue, 20 Apr 2021 12:24:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C006B41729; Tue, 20 Apr 2021 12:24:00 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id F0DA941702 for ; Tue, 20 Apr 2021 12:23:55 +0200 (CEST) IronPort-SDR: 34KTecD9p6ApjxQCi1oSIh0PTke6Km0BP9HdEt72iu4f4rVPiR9Pq575nVE5bVGBdYOPVrnS39 KYwC7zLZoO2A== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="195509116" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="195509116" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 03:23:45 -0700 IronPort-SDR: wC+F6yjdNPgMAf8nvgrqhb+K5Kk3IwrKimS4CgtfVGLUsCEYBpR7vfCmtM9lMR11vnRiMq7uFN zVVqT8Do+bRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="616862800" Received: from silpixa00399126.ir.intel.com ([10.237.223.116]) by fmsmga005.fm.intel.com with ESMTP; 20 Apr 2021 03:23:44 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Tue, 20 Apr 2021 11:22:32 +0100 Message-Id: <20210420102232.314452-17-bruce.richardson@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210420102232.314452-1-bruce.richardson@intel.com> References: <20210401115009.1063844-1-bruce.richardson@intel.com> <20210420102232.314452-1-bruce.richardson@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 16/16] lib: allow disabling optional libraries 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 Sender: "dev" Add support for the disable_libs option, to allow disabling the build of particular libraries. As part of this, maintain a list of what libraries can safely be disabled, without breaking the build - for now this list is solely those libraries which are not built on FreeBSD, kni, power and vhost. This list can be expanded by future patches. Signed-off-by: Bruce Richardson --- lib/meson.build | 24 +++++++++++++++++++++++- meson_options.txt | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/meson.build b/lib/meson.build index 3a9a6c3be4..c9a20f65b7 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -81,6 +81,23 @@ if is_windows ] # only supported libraries for windows endif +optional_libs = [ + 'kni', + 'power', + 'vhost', +] + +disabled_libs = [] +opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs')).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 + + default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] default_cflags += ['-DALLOW_INTERNAL_API'] @@ -114,7 +131,12 @@ foreach l:libraries deps += ['eal'] endif - subdir(l) + if disabled_libs.contains(l) + build = false + reason = 'explicitly disabled via build config' + else + subdir(l) + endif if name != l warning('Library name, "@0@", and directory name, "@1@", do not match'.format(name, l)) endif diff --git a/meson_options.txt b/meson_options.txt index 530fcddfa1..9d73fd5419 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,6 +6,8 @@ option('developer_mode', type: 'feature', description: 'turn on additional build checks relevant for DPDK developers') 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]') 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: