From patchwork Wed Feb 2 14:31:40 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: 15322 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 63427BDCBF for ; Wed, 2 Feb 2022 14:31:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B758D609C3; Wed, 2 Feb 2022 15:31:54 +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="dYNKxeq3"; 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 F3109609B5 for ; Wed, 2 Feb 2022 15:31:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643812311; 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=fffHxYRZExFOFHU4Rafy0AS5jhmcISfwSLYmzmwClz0=; b=dYNKxeq3+/OLWYFb3vRPC1H6Qiic78vEwuMppS0eEzG//7390xiB0JhOmVd52tClbpAsXI l+jqKWBZArq9W1uU/lbcYLC4XIYpPxlpX5n1eIeegeU/8xx11gAzwrIG9EpZD9H5UzWeJH JO0xqhNulbHYV/875jei5WS8zl89spo= 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-528-YzSc6SbQOTqjdDLRlB_-Zw-1; Wed, 02 Feb 2022 09:31:50 -0500 X-MC-Unique: YzSc6SbQOTqjdDLRlB_-Zw-1 Received: by mail-wm1-f70.google.com with SMTP id m189-20020a1c26c6000000b003508ba87dfbso4594525wmm.7 for ; Wed, 02 Feb 2022 06:31:50 -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=fffHxYRZExFOFHU4Rafy0AS5jhmcISfwSLYmzmwClz0=; b=lZc+X90eoCBCiv+S55dN7o0WsMlw5RnV3zcRdT6KChBdH2o3zEm3u+eo/xw5VpzBU0 s5lxlePWviQtsVSChBlnA5eN5aCA3qToh8jsTOeQqLz0RqZGaPJ82k9VWnpNY/5lRyZ7 EKlyT21fF+034fDWfXa5opMVJgez89dx1+/55Q13O1XkCCi1lxOZqChLTGli7U65OSon Wc3yzdOX2xXK4y+VAKoU5O1lxE7eEVz4BxGlNkGdKoo6jHWgv9kyAMCez/jeZKnW4NCZ SA+eHIRjit7RYlxOKfKFVbmVzmRD6EKA3F/DdP0X8ucOwynFwP/KtIsk/k1A3UPieMH0 aQ3g== X-Gm-Message-State: AOAM532Dg4XjuZOoJrUqdij2zGzXXurlYNC4fDKH6cgbqktPJeMAtoCd ni7J1ZkMFigpdGkth6Y9QXO9ysrWD8yBcknQoAD2/CtduOtH6cc0vwusfb+D+7vvS/Gz6UF7Iq1 oCwZhnMJijtTnPvulJ2b08wuLC3Gets53j7MKnk1TsCqxy9COhKCsD8HtAtulf5qYr1pUL9ls6K P3WHtJMX7V X-Received: by 2002:a05:600c:4f53:: with SMTP id m19mr6257043wmq.45.1643812309326; Wed, 02 Feb 2022 06:31:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJRDOI5uRUdGYN1pEavikLJ0UfvPSlnahWsxYWppI1iE7XgCfD/Q27IJ1L3JPR2trMxjKieA== X-Received: by 2002:a05:600c:4f53:: with SMTP id m19mr6257024wmq.45.1643812309008; Wed, 02 Feb 2022 06:31:49 -0800 (PST) Received: from minerva.home ([92.176.231.205]) by smtp.gmail.com with ESMTPSA id 21sm3840836wmv.11.2022.02.02.06.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Feb 2022 06:31:48 -0800 (PST) From: Javier Martinez Canillas To: libcamera-devel@lists.libcamera.org Date: Wed, 2 Feb 2022 15:31:40 +0100 Message-Id: <20220202143141.160660-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] lc-compliance: Only download a 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. 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 --- 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([