libcamera/0001-lc-compliance-Only-download-a-gtest-subproject-as-a-.patch
Javier Martinez Canillas 3f28fcfa2a
Re-enable lc-compliance build
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2022-02-02 15:59:42 +01:00

73 lines
2.7 KiB
Diff

From 94f734cb11cb0e35c1201f44e8fbfa1892859dfb Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Wed, 2 Feb 2022 14:56:23 +0100
Subject: [PATCH] lc-compliance: Only download a gtest subproject as a fallback
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 <ecurtin@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
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([
--
2.34.1