From d05b789cd0ec20451364609c5372d53399b78738 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Fri, 11 Aug 2023 16:26:45 +0200 Subject: [PATCH] (#18611) at-spi2-core: conan V2 compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * at-spi2-core: conan V2 compatibility * bump deps * add glib as tool requirement * Use proper conan min version check * Option * Add package_type --------- Co-authored-by: Rubén Rincón Blanco --- recipes/at-spi2-core/new/conanfile.py | 22 ++++++------- .../new/test_package/CMakeLists.txt | 9 ----- .../new/test_package/conanfile.py | 33 ++++++++++++++----- .../at-spi2-core/new/test_package/meson.build | 5 +++ 4 files changed, 39 insertions(+), 30 deletions(-) delete mode 100644 recipes/at-spi2-core/new/test_package/CMakeLists.txt create mode 100644 recipes/at-spi2-core/new/test_package/meson.build diff --git a/recipes/at-spi2-core/new/conanfile.py b/recipes/at-spi2-core/new/conanfile.py index 85d759b7547fc..041ae5da456f1 100644 --- a/recipes/at-spi2-core/new/conanfile.py +++ b/recipes/at-spi2-core/new/conanfile.py @@ -9,7 +9,8 @@ import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.60.0 <2.0 || >=2.0.5" + class AtSpi2CoreConan(ConanFile): name = "at-spi2-core" description = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked" @@ -20,17 +21,18 @@ class AtSpi2CoreConan(ConanFile): provides = "at-spi2-atk", "atk" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_x11": [True, False], - } + } default_options = { "shared": False, "fPIC": True, "with_x11": False, - } + } def export_sources(self): export_conandata_patches(self) @@ -40,22 +42,21 @@ def configure(self): self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") - if self.options.shared: - self.options["glib"].shared = True def build_requirements(self): - self.tool_requires("meson/1.1.1") + self.tool_requires("meson/1.2.0") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/1.9.3") + self.tool_requires("pkgconf/1.9.5") + self.tool_requires("glib/") def requirements(self): - self.requires("glib/2.76.3") + self.requires("glib/2.77.0") if self.options.with_x11: self.requires("xorg/system") self.requires("dbus/1.15.6") def validate(self): - if self.options.shared and not self.options["glib"].shared: + if self.options.shared and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) @@ -123,6 +124,3 @@ def package_info(self): self.cpp_info.components["atk-bridge"].includedirs = [os.path.join('include', 'at-spi2-atk', '2.0')] self.cpp_info.components["atk-bridge"].requires = ["dbus::dbus", "atk", "glib::glib", "atspi"] self.cpp_info.components["atk-bridge"].set_property("pkg_config_name", 'atk-bridge-2.0') - - def package_id(self): - self.info.requires["glib"].full_package_mode() diff --git a/recipes/at-spi2-core/new/test_package/CMakeLists.txt b/recipes/at-spi2-core/new/test_package/CMakeLists.txt deleted file mode 100644 index afa2476357074..0000000000000 --- a/recipes/at-spi2-core/new/test_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/at-spi2-core/new/test_package/conanfile.py b/recipes/at-spi2-core/new/test_package/conanfile.py index d4128b0450777..74125d16c3d5f 100644 --- a/recipes/at-spi2-core/new/test_package/conanfile.py +++ b/recipes/at-spi2-core/new/test_package/conanfile.py @@ -1,17 +1,32 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + basic_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires("meson/1.2.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.5") def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + meson = Meson(self) + meson.configure() + meson.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/at-spi2-core/new/test_package/meson.build b/recipes/at-spi2-core/new/test_package/meson.build new file mode 100644 index 0000000000000..a6950ebe6d4ab --- /dev/null +++ b/recipes/at-spi2-core/new/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'c') +package_dep = dependency('atspi-2') +executable('test_package', + sources : ['test_package.c'], + dependencies : [package_dep])