diff --git a/recipes/at-spi2-core/config.yml b/recipes/at-spi2-core/config.yml index 3a9a2fb50465f..f0d6f514974e4 100644 --- a/recipes/at-spi2-core/config.yml +++ b/recipes/at-spi2-core/config.yml @@ -21,3 +21,5 @@ versions: folder: new "2.49.1": folder: new + "2.50.0": + folder: new diff --git a/recipes/at-spi2-core/new/conandata.yml b/recipes/at-spi2-core/new/conandata.yml index 14543d255e3d0..b27bb3ef5a258 100644 --- a/recipes/at-spi2-core/new/conandata.yml +++ b/recipes/at-spi2-core/new/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.50.0": + sha256: e9f5a8c8235c9dd963b2171de9120301129c677dde933955e1df618b949c4adc + url: https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.50/at-spi2-core-2.50.0.tar.xz "2.49.1": sha256: 53ed9eb77e4c48b3bf6ac4afb5689391e0d7d0f44f7ca4443d8b13c7dd26119c url: https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.49/at-spi2-core-2.49.1.tar.xz diff --git a/recipes/at-spi2-core/new/conanfile.py b/recipes/at-spi2-core/new/conanfile.py index 041ae5da456f1..02a871957ee4f 100644 --- a/recipes/at-spi2-core/new/conanfile.py +++ b/recipes/at-spi2-core/new/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain @@ -37,6 +38,10 @@ class AtSpi2CoreConan(ConanFile): def export_sources(self): export_conandata_patches(self) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + def configure(self): if self.options.shared: self.options.rm_safe("fPIC") @@ -44,24 +49,29 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") def build_requirements(self): - self.tool_requires("meson/1.2.0") + self.tool_requires("meson/1.2.2") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/1.9.5") + self.tool_requires("pkgconf/2.0.3") self.tool_requires("glib/") def requirements(self): - self.requires("glib/2.77.0") + self.requires("glib/2.78.0") if self.options.with_x11: self.requires("xorg/system") - self.requires("dbus/1.15.6") + if self.settings.os == "Linux": + self.requires("dbus/1.15.8") def validate(self): if self.options.shared and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("only linux is supported by this recipe") + if Version(self.version) < "2.49.1": + if self.settings.os == "Windows": + raise ConanInvalidConfiguration("Windows is not supported before version 2.49.1") + if Version(self.version) < "2.50.0": + if self.settings.os == "Macos": + raise ConanInvalidConfiguration("macos is not supported before version 2.50.0") def layout(self): basic_layout(self, src_folder="src") @@ -80,6 +90,9 @@ def generate(self): else: tc.project_options["introspection"] = "no" tc.project_options["x11"] = "yes" if self.options.with_x11 else "no" + if self.settings.os != "Linux": + tc.project_options["atk_only"] = "true" + tc.project_options["docs"] = "false" tc.generate() tc = PkgConfigDeps(self) @@ -107,20 +120,42 @@ def package(self): meson.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "etc")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): - self.cpp_info.components["atspi"].libs = ['atspi'] - self.cpp_info.components["atspi"].includedirs = ["include/at-spi-2.0"] - self.cpp_info.components["atspi"].requires = ["dbus::dbus", "glib::glib"] - self.cpp_info.components["atspi"].set_property("pkg_config_name", "atspi-2") + if self.settings.os == "Linux": + self.cpp_info.components["atspi"].libs = ['atspi'] + self.cpp_info.components["atspi"].includedirs = ["include/at-spi-2.0"] + self.cpp_info.components["atspi"].requires = ["dbus::dbus", "glib::glib"] + self.cpp_info.components["atspi"].set_property("pkg_config_name", "atspi-2") self.cpp_info.components["atk"].libs = ["atk-1.0"] self.cpp_info.components["atk"].includedirs = ['include/atk-1.0'] self.cpp_info.components["atk"].requires = ["glib::glib"] self.cpp_info.components["atk"].set_property("pkg_config_name", 'atk') - self.cpp_info.components["atk-bridge"].libs = ['atk-bridge-2.0'] - 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') + if self.settings.os == "Linux": + self.cpp_info.components["atk-bridge"].libs = ['atk-bridge-2.0'] + 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 fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib in case of cl like compiler""" + if not conanfile.settings.get_safe("compiler.runtime"): + return + from conan.tools.files import rename + import glob + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/at-spi2-core/new/test_package/conanfile.py b/recipes/at-spi2-core/new/test_package/conanfile.py index 74125d16c3d5f..5aab0703e7a4e 100644 --- a/recipes/at-spi2-core/new/test_package/conanfile.py +++ b/recipes/at-spi2-core/new/test_package/conanfile.py @@ -17,9 +17,9 @@ def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.tool_requires("meson/1.2.0") + self.tool_requires("meson/1.2.2") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/1.9.5") + self.tool_requires("pkgconf/2.0.3") def build(self): meson = Meson(self) diff --git a/recipes/at-spi2-core/new/test_package/meson.build b/recipes/at-spi2-core/new/test_package/meson.build index a6950ebe6d4ab..896df27207865 100644 --- a/recipes/at-spi2-core/new/test_package/meson.build +++ b/recipes/at-spi2-core/new/test_package/meson.build @@ -1,5 +1,5 @@ project('test_package', 'c') -package_dep = dependency('atspi-2') +package_dep = dependency('atk') executable('test_package', sources : ['test_package.c'], dependencies : [package_dep]) diff --git a/recipes/at-spi2-core/new/test_package/test_package.c b/recipes/at-spi2-core/new/test_package/test_package.c index c155308c155ba..284086622ab26 100644 --- a/recipes/at-spi2-core/new/test_package/test_package.c +++ b/recipes/at-spi2-core/new/test_package/test_package.c @@ -1,9 +1,10 @@ -#include "atspi/atspi.h" -#include "assert.h" +#include +#include int main() { - atspi_init (); - assert(atspi_get_desktop_count() > 0); - return atspi_exit(); + printf("ATK version %d.%d.%d\n",atk_get_major_version(), atk_get_minor_version(), atk_get_micro_version()); + printf("binary age %d\n", atk_get_binary_age()); + printf("interface age %d\n", atk_get_interface_age()); + return 0; }