From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id D0BA343233;
	Sun, 29 Oct 2023 09:10:23 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 6A30D4027E;
	Sun, 29 Oct 2023 09:10:23 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 8AAEF4026B;
 Sun, 29 Oct 2023 09:10:21 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 39T4pi4S021685; Sun, 29 Oct 2023 01:10:20 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=vrqUZvY2iElqiJWIiMrIH4FbXpflNKlF7WN3kmnj4WY=;
 b=epx4Q5+FJMCJZEZRPiuiQoZWPj009jwc0W0UtgxJkwdXz7GkH43OKh+BwR/2UXmgHR+Z
 kFZHnYh70jydU2LeKUNHiFzCWRDw/rlIsCx9cLV/cgVhZEHDGYCOn6y7KcUBewWA/4xN
 Nkq087DbJXGvsO8FkcxCUL0sgshRKi9DV/vc74DrpYNxYcFQZ3oJe7gYx8ZzNSSu8Joe
 GdBy1rwMFGT/oiLYgrdFtF+oYwHJo+gU2/vzSmkiWUwozmvApncq9xZqMRJywRqe0cJg
 RBnuHH0/e2NcdMZwzUlXN2K5jlQCVgngsVSXcHenYtkPdHT/PUAZ9w90JdAKYEd2OUU5 Zw== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3u0ynqak3r-2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Sun, 29 Oct 2023 01:10:20 -0700
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;
 Sun, 29 Oct 2023 01:10:19 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend
 Transport; Sun, 29 Oct 2023 01:10:18 -0700
Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233])
 by maili.marvell.com (Postfix) with ESMTP id 7406B3F70B5;
 Sun, 29 Oct 2023 01:10:17 -0700 (PDT)
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Bruce Richardson <bruce.richardson@intel.com>, Srikanth Yalavarthi
 <syalavarthi@marvell.com>, Aaron Conole <aconole@redhat.com>, Igor Russkikh
 <irusskikh@marvell.com>, David Marchand <david.marchand@redhat.com>
CC: <dev@dpdk.org>, <sshankarnara@marvell.com>, <jerinj@marvell.com>,
 <stable@dpdk.org>
Subject: [PATCH v2 1/1] build: add libarchive to external deps
Date: Sun, 29 Oct 2023 01:10:13 -0700
Message-ID: <20231029081014.5397-1-syalavarthi@marvell.com>
X-Mailer: git-send-email 2.42.0
In-Reply-To: <20231020170135.18319-1-syalavarthi@marvell.com>
References: <20231020170135.18319-1-syalavarthi@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: CvidE04qJ2n2nFihMRawtaBHWiTzEWpa
X-Proofpoint-GUID: CvidE04qJ2n2nFihMRawtaBHWiTzEWpa
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26
 definitions=2023-10-28_24,2023-10-27_01,2023-05-22_02
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

In order to avoid linking with Libs.private, libarchive
is not added to ext_deps during the meson setup stage.

Since libarchive is not added to ext_deps, cross-compilation
or native compilation with libarchive installed in non-standard
location fails with errors related to "cannot find -larchive"
or "archive.h: No such file or directory". In order to fix the
build failures, user is required to define the 'c_args' and
'c_link_args' with '-I<includedir>' and '-L<libdir>'.

This patch adds libarchive to ext_deps and further would not
require setting c_args and c_link_args externally.

Fixes: 40edb9c0d36b ("eal: handle compressed firmware")
Cc: stable@dpdk.org

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 config/meson.build          | 5 -----
 drivers/ml/cnxk/meson.build | 1 +
 lib/eal/meson.build         | 3 +++
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index d56b0f9bce..4ff101767e 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -236,11 +236,6 @@ dpdk_conf.set('RTE_BACKTRACE', cc.has_header('execinfo.h') or is_windows)
 libarchive = dependency('libarchive', required: false, method: 'pkg-config')
 if libarchive.found()
     dpdk_conf.set('RTE_HAS_LIBARCHIVE', 1)
-    # Push libarchive link dependency at the project level to support
-    # statically linking dpdk apps. Details at:
-    # https://inbox.dpdk.org/dev/20210605004024.660267a1@sovereign/
-    add_project_link_arguments('-larchive', language: 'c')
-    dpdk_extra_ldflags += '-larchive'
 endif
 
 # check for libbsd
diff --git a/drivers/ml/cnxk/meson.build b/drivers/ml/cnxk/meson.build
index 0680a0faa5..921dc7e89b 100644
--- a/drivers/ml/cnxk/meson.build
+++ b/drivers/ml/cnxk/meson.build
@@ -67,6 +67,7 @@ sources += files(
         'mvtvm_ml_model.c',
 )
 
+ext_deps += libarchive
 ext_deps += jansson_dep
 ext_deps += dlpack_dep
 ext_deps += dmlc_dep
diff --git a/lib/eal/meson.build b/lib/eal/meson.build
index 9942104386..e1d6c4cf17 100644
--- a/lib/eal/meson.build
+++ b/lib/eal/meson.build
@@ -21,6 +21,9 @@ endif
 if dpdk_conf.has('RTE_USE_LIBBSD')
     ext_deps += libbsd
 endif
+if dpdk_conf.has('RTE_HAS_LIBARCHIVE')
+    ext_deps += libarchive
+endif
 if cc.has_function('getentropy', prefix : '#include <unistd.h>')
     cflags += '-DRTE_LIBEAL_USE_GETENTROPY'
 endif
-- 
2.42.0