From a29c53f6a646ed9644a94b2face62d078d8290be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 22 Jan 2025 13:09:11 +0100 Subject: [PATCH] meson: Use libyaml wrap file from wrapdb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the libyaml wrap file from the meson wrapdb instead of creating the wrap file manually and using the cmake module. This provides better integration with meson, such as the `force_fallback_for` built-in option. This is also needed because the upstream CMakeLists.txt is out of date, failing with a sufficiently new cmake version: CMake Error at CMakeLists.txt:2 (cmake_minimum_required): Compatibility with CMake < 3.5 has been removed from CMake. The above is nonetheless addressed by https://github.com/yaml/libyaml/pull/314, but the project seems a bit inactive at the moment. The wrap file was added using `meson wrap install libyaml`, and it can be updated using `meson wrap update libyaml`. `default_library=static` is used to match the behaviour of the previously used cmake build. `werror=false` needs to be set because libyaml does not compile without warnings, and that would abort the build process otherwise. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/meson.build | 16 ++++------------ subprojects/libyaml.wrap | 16 +++++++++++----- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 28a3b0f36..de1eb99b2 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -84,7 +84,10 @@ if not cc.has_function('dlopen') libdl = cc.find_library('dl') endif libudev = dependency('libudev', required : get_option('udev')) -libyaml = dependency('yaml-0.1', required : false) +libyaml = dependency('yaml-0.1', default_options : [ + 'default_library=static', + 'werror=false', +]) # Use one of gnutls or libcrypto (provided by OpenSSL), trying gnutls first. libcrypto = dependency('gnutls', required : false) @@ -120,17 +123,6 @@ if libudev.found() ]) endif -# Fallback to a subproject if libyaml isn't found, as it's not packaged in AOSP. -if not libyaml.found() - cmake = import('cmake') - - libyaml_vars = cmake.subproject_options() - libyaml_vars.add_cmake_defines({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'}) - libyaml_vars.append_compile_args('c', '-Wno-unused-value') - libyaml_wrap = cmake.subproject('libyaml', options : libyaml_vars) - libyaml = libyaml_wrap.dependency('yaml') -endif - control_sources = [] controls_mode_files = { diff --git a/subprojects/libyaml.wrap b/subprojects/libyaml.wrap index 392416c61..44ac0ff8e 100644 --- a/subprojects/libyaml.wrap +++ b/subprojects/libyaml.wrap @@ -1,7 +1,13 @@ # SPDX-License-Identifier: CC0-1.0 -[wrap-git] -directory = libyaml -url = https://github.com/yaml/libyaml -# tags/0.2.5 -revision = 2c891fc7a770e8ba2fec34fc6b545c672beb37e6 +[wrap-file] +directory = yaml-0.2.5 +source_url = https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz +source_filename = yaml-0.2.5.tar.gz +source_hash = c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4 +patch_filename = libyaml_0.2.5-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/libyaml_0.2.5-1/get_patch +patch_hash = bf2e9b922be00b6b00c5fce29d9fb8dc83f0431c77239f3b73e8b254d3f3f5b5 + +[provide] +yaml-0.1 = yaml_dep