From patchwork Thu Feb 3 09:30:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 15323 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9DAF0BF415 for ; Thu, 3 Feb 2022 09:30:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1CE0B609E1; Thu, 3 Feb 2022 10:30:34 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="FbfSypzY"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6BEB06020B for ; Thu, 3 Feb 2022 10:30:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643880632; 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; bh=p8e+2bsA++clMbL8dEO79qU1me99vQ4CIenH06/9LYg=; b=FbfSypzYdQgV62zr55dMqpLczARl84KNNDz4DGnapsaLNGZ+YuEDPjVqSpT9YtVXfSMeUy z1DZt9gpAeQ4KQMOpY3NfDcfo1wbsMJttGg7S5Cl08y76+Loc96UERSOsN6PHFIeNZiZ6t EP4YUWixA9sY8yKlYm0grUo0z43QRuU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-P1Sf8ZU0NPOiwHpmiQUBJA-1; Thu, 03 Feb 2022 04:30:31 -0500 X-MC-Unique: P1Sf8ZU0NPOiwHpmiQUBJA-1 Received: by mail-wm1-f70.google.com with SMTP id i204-20020a1c3bd5000000b00352cf8b74dcso1359876wma.0 for ; Thu, 03 Feb 2022 01:30:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=p8e+2bsA++clMbL8dEO79qU1me99vQ4CIenH06/9LYg=; b=cjZlE+mLwGZl1YMA8qsauTvE3K3YsbvKHE9K2bTlGtaOi6IueMwJUPXrFPnXVOfVAA LhBZm/R830vxOfqSwcb+OHt6104KsUWwEIWcosfIWv4aDcrY5Va+3uY30qKd5gA/rLgK pA2pN2Z4ncU2CQq56avwuDeRYpjWnEtDRyWxzB/POXsBIyp2rNHpmfzQkt85EjRcy4rX CWoCwmcyeSacjlxhNi9Lybnix5Cd4kROPlQjwQEY8Ap2A2hT+gLB2NGkVCoqsU/p4EJY usNai/nMhwaF11n0F8piUgUKfRKOCTgRDmGa+RyOHC/isEHqd7zWtP44UOEndWyZpqf9 46pQ== X-Gm-Message-State: AOAM532LkTOO4TH4bushrKPtQigRpY70q/SGYszUm6YdebGXJyqH6/ye FM8oAB1hU0kU/UAea3uwgGttbzaJWpxo08tWucDIyQ3IfeXSb5y/Rl2copGKrWyRbNrgQK+gPIB W6n8TdRHMKm0cDVE5bi0azbtl5VpjpoCu2Ht3RvEauVFebrp86MC8lqUbXjGnzMAtYrgZ2PZRjJ SWxVOEUfXF X-Received: by 2002:a5d:590b:: with SMTP id v11mr27946903wrd.74.1643880630052; Thu, 03 Feb 2022 01:30:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuMCb+S0Wijv06WJTOk9daseMwsZ1cYIiAStepOhl0+n05/TDMZGsYSWbZMvW87/3iwerqjA== X-Received: by 2002:a5d:590b:: with SMTP id v11mr27946875wrd.74.1643880629746; Thu, 03 Feb 2022 01:30:29 -0800 (PST) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id j9sm5316560wro.8.2022.02.03.01.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Feb 2022 01:30:29 -0800 (PST) From: Javier Martinez Canillas To: libcamera-devel@lists.libcamera.org Date: Thu, 3 Feb 2022 10:30:22 +0100 Message-Id: <20220203093022.536031-1-javierm@redhat.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=javierm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [libcamera-devel] [PATCH v2] lc-compliance: Only download gtest subproject as a fallback X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Currently, a subproject is used to fetch gtest dependency unconditionally for any Linux distribution besides ChromeOS. But it leads to a regression in distros whose builders are not allowed to download files during build. This change was introduced by commit 0d50a04cc918 ("lc-compliance: Build with gtest in subprojects") and the rationale is that some distros, such as Debian ship libgtest-dev as a static library. And this could be built with a different toolchain than the one used to build libcamera itself. But this seems to be a corner case, usually users will either build both libcamera and all its dependencies using the same toolchain or build it using both the libgtest library and toolchain as provided by the distro. If someone doesn't want for meson to pick up the non-compatible static library provided by the distro, then instead should make sure that their build root does not have the package providing this installed. Let's simplify the logic to find the dependency and just use the built-in support in dependency() function to fallback to a subproject if not found. This covers to common case of attempting to use the gtest provided by the system or pulling from source if not found or is not preferred. To force meson to fallback to the wrap for gtest you can use this command: meson configure -Dforce_fallback_for=gtest and to force fallback for all the dependencies, you can use the following: meson build --wrap-mode=forcefallback Fixes: commit 0d50a04cc918 ("lc-compliance: Build with gtest in subprojects") Reported-by: Eric Curtin Signed-off-by: Javier Martinez Canillas Reviewed-by: Laurent Pinchart Reviewed-by: Hirokazu Honda --- Changes in v2: - Add collected Reviewed-by tags. - Mention in the commit message how to force messon to do fallbacks. src/lc-compliance/meson.build | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/lc-compliance/meson.build b/src/lc-compliance/meson.build index 130ddbb55916..8b57474be2b2 100644 --- a/src/lc-compliance/meson.build +++ b/src/lc-compliance/meson.build @@ -1,25 +1,14 @@ # SPDX-License-Identifier: CC0-1.0 libevent = dependency('libevent_pthreads', required : get_option('lc-compliance')) +libgtest = dependency('gtest', required : get_option('lc-compliance'), + fallback : ['gtest', 'gtest_dep']) -if not libevent.found() +if not (libevent.found() and libgtest.found()) lc_compliance_enabled = false subdir_done() endif -if get_option('android_platform') == 'cros' - libgtest = dependency('gtest', required : get_option('lc-compliance')) - - if not libgtest.found() - lc_compliance_enabled = false - subdir_done() - endif - -else - libgtest_sp = subproject('gtest') - libgtest = libgtest_sp.get_variable('gtest_dep') -endif - lc_compliance_enabled = true lc_compliance_sources = files([