[DO-973] harfbuzz package (!10)

Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/10
This commit is contained in:
Aleksandr Vodyanov
2024-12-26 12:02:17 +03:00
parent 39afe6a1dd
commit c807f2514e
126 changed files with 6604 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
sources:
"2.81.0":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_gnome_org/sources/glib/2.81/glib-2.81.0.tar.xz"
sha256: "1665188ed9cc941c0a189dc6295e6859872523d1bfc84a5a84732a7ae87b02e4"
"2.78.3":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_gnome_org/sources/glib/2.78/glib-2.78.3.tar.xz"
sha256: "609801dd373796e515972bf95fc0b2daa44545481ee2f465c4f204d224b2bc21"
"2.77.3":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_gnome_org/sources/glib/2.77/glib-2.77.3.tar.xz"
sha256: "1753f963bb680b28a83d6e2095f63d0d4b94244675bcd2603850b2ebc1ac6a61"
"2.76.3":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-download_gnome_org/sources/glib/2.76/glib-2.76.3.tar.xz"
sha256: "c0be444e403d7c3184d1f394f89f0b644710b5e9331b54fa4e8b5037813ad32a"
patches:
"2.81.0":
- patch_file: "patches/dont-use-python-packaging-2.81.0.patch"
patch_type: bugfix
patch_description: replace package.version.Version by internal code
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3352
"2.78.3":
- patch_file: "patches/remove-distutils-2.77.0.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133
"2.76.3":
- patch_file: "patches/libintl-discovery.patch"
patch_type: bugfix
patch_description: fix libintl discovery
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3352
- patch_file: "patches/remove-distutils.patch"
patch_type: bugfix
patch_description: remove distutils
patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4133

View File

@@ -0,0 +1,299 @@
from conan import ConanFile
from conan.tools.apple import fix_apple_shared_install_name, is_apple_os
from conan.tools.env import VirtualBuildEnv
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
from conan.tools.microsoft import is_msvc
import os
import shutil
required_conan_version = ">=2.0"
class GLibConan(ConanFile):
name = "glib"
description = (
"Low-level core library that forms the basis for projects such as GTK+ and GNOME. "
"It provides data structure handling for C, portability wrappers, and interfaces "
"for such runtime functionality as an event loop, threads, dynamic loading, and an object system."
)
topics = "gio", "gmodule", "gnome", "gobject", "gtk"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://gitlab.gnome.org/GNOME/glib"
license = "LGPL-2.1-or-later"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_elf": [True, False],
"with_selinux": [True, False],
"with_mount": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_elf": True,
"with_mount": True,
"with_selinux": True,
}
short_paths = True
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.settings.os != "Linux":
del self.options.with_mount
del self.options.with_selinux
if is_msvc(self):
del self.options.with_elf
if self.settings.os == "Neutrino":
del self.options.with_elf
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")
def layout(self):
basic_layout(self, src_folder="src")
def requirements(self):
self.requires("zlib/[>=1.2.11 <2]")
self.requires("libffi/3.4.4")
self.requires("pcre2/[>=10.42]")
if self.options.get_safe("with_elf"):
self.requires("libelf/0.8.13")
if self.options.get_safe("with_mount"):
self.requires("libmount/2.39.2")
if self.options.get_safe("with_selinux"):
self.requires("libselinux/3.6")
if self.settings.os != "Linux":
# for Linux, gettext is provided by libc
self.requires("libgettext/0.22", transitive_headers=True, transitive_libs=True)
if is_apple_os(self):
self.requires("libiconv/1.17")
def build_requirements(self):
# self.tool_requires("meson/[>=1.2.3 <2]")
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/[>=2.2 <3]")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
virtual_build_env = VirtualBuildEnv(self)
virtual_build_env.generate()
tc = PkgConfigDeps(self)
tc.generate()
tc = MesonToolchain(self)
tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled"
tc.project_options["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled"
if self.settings.os == "FreeBSD" or self.settings.os == "Neutrino":
tc.project_options["xattr"] = "false"
tc.project_options["tests"] = "false"
tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled"
if self.settings.os == "Neutrino":
tc.cross_build["host"]["system"] = "qnx"
tc.c_link_args.append("-lm")
tc.c_link_args.append("-lsocket")
tc.generate()
def _patch_sources(self):
apply_conandata_patches(self)
replace_in_file(self,
os.path.join(self.source_folder, "meson.build"),
"subdir('fuzzing')",
"#subdir('fuzzing')",
) # https://gitlab.gnome.org/GNOME/glib/-/issues/2152
if self.settings.os != "Linux" and self.settings.os != "Neutrino":
# allow to find gettext
replace_in_file(self,
os.path.join(self.source_folder, "meson.build"),
"libintl = dependency('intl', required: false",
"libintl = dependency('libgettext', method : 'pkg-config', required : false",
)
replace_in_file(self,
os.path.join(
self.source_folder,
"gio",
"gdbus-2.0",
"codegen",
"gdbus-codegen.in",
),
"'share'",
"'res'",
)
def build(self):
self._patch_sources()
meson = Meson(self)
meson.configure()
meson.build()
def package(self):
copy(self, pattern="LGPL-2.1-or-later.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "LICENSES"))
meson = Meson(self)
meson.install()
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "libexec"))
shutil.move(
os.path.join(self.package_folder, "share"),
os.path.join(self.package_folder, "res"),
)
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["glib-2.0"].set_property("pkg_config_name", "glib-2.0")
self.cpp_info.components["glib-2.0"].libs = ["glib-2.0"]
self.cpp_info.components["glib-2.0"].includedirs += [
os.path.join("include", "glib-2.0"),
os.path.join("lib", "glib-2.0", "include")
]
self.cpp_info.components["glib-2.0"].resdirs = ["res"]
self.cpp_info.components["gmodule-no-export-2.0"].set_property("pkg_config_name", "gmodule-no-export-2.0")
self.cpp_info.components["gmodule-no-export-2.0"].libs = ["gmodule-2.0"]
self.cpp_info.components["gmodule-no-export-2.0"].resdirs = ["res"]
self.cpp_info.components["gmodule-no-export-2.0"].requires.append("glib-2.0")
self.cpp_info.components["gmodule-export-2.0"].set_property("pkg_config_name", "gmodule-export-2.0")
self.cpp_info.components["gmodule-export-2.0"].requires += ["gmodule-no-export-2.0", "glib-2.0"]
self.cpp_info.components["gmodule-2.0"].set_property("pkg_config_name", "gmodule-2.0")
self.cpp_info.components["gmodule-2.0"].requires += ["gmodule-no-export-2.0", "glib-2.0"]
self.cpp_info.components["gobject-2.0"].set_property("pkg_config_name", "gobject-2.0")
self.cpp_info.components["gobject-2.0"].libs = ["gobject-2.0"]
self.cpp_info.components["gobject-2.0"].resdirs = ["res"]
self.cpp_info.components["gobject-2.0"].requires += ["glib-2.0", "libffi::libffi"]
self.cpp_info.components["gthread-2.0"].set_property("pkg_config_name", "gthread-2.0")
self.cpp_info.components["gthread-2.0"].libs = ["gthread-2.0"]
self.cpp_info.components["gthread-2.0"].resdirs = ["res"]
self.cpp_info.components["gthread-2.0"].requires.append("glib-2.0")
self.cpp_info.components["gio-2.0"].set_property("pkg_config_name", "gio-2.0")
self.cpp_info.components["gio-2.0"].libs = ["gio-2.0"]
self.cpp_info.components["gio-2.0"].resdirs = ["res"]
self.cpp_info.components["gio-2.0"].requires += ["glib-2.0", "gobject-2.0", "gmodule-2.0", "zlib::zlib"]
self.cpp_info.components["gresource"].set_property("pkg_config_name", "gresource")
self.cpp_info.components["gresource"].libs = [] # this is actually an executable
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["glib-2.0"].system_libs.append("pthread")
self.cpp_info.components["gmodule-no-export-2.0"].system_libs.append("pthread")
self.cpp_info.components["gmodule-no-export-2.0"].system_libs.append("dl")
self.cpp_info.components["gmodule-export-2.0"].sharedlinkflags.append("-Wl,--export-dynamic")
self.cpp_info.components["gmodule-2.0"].sharedlinkflags.append("-Wl,--export-dynamic")
self.cpp_info.components["gthread-2.0"].system_libs.append("pthread")
self.cpp_info.components["gio-2.0"].system_libs.append("dl")
if self.settings.os == "Neutrino":
self.cpp_info.components["gmodule-export-2.0"].sharedlinkflags.append("-Wl,--export-dynamic")
self.cpp_info.components["gmodule-2.0"].sharedlinkflags.append("-Wl,--export-dynamic")
self.cpp_info.components["glib-2.0"].system_libs.append("m")
self.cpp_info.components["glib-2.0"].system_libs.append("socket")
self.cpp_info.components["gmodule-no-export-2.0"].system_libs.append("c")
self.cpp_info.components["gio-2.0"].system_libs.append("c")
self.cpp_info.components["gio-2.0"].system_libs.append("socket")
if self.settings.os == "Windows":
self.cpp_info.components["glib-2.0"].system_libs += ["ws2_32", "ole32", "shell32", "user32", "advapi32"]
self.cpp_info.components["gio-2.0"].system_libs.extend(["iphlpapi", "dnsapi", "shlwapi"])
self.cpp_info.components["gio-windows-2.0"].set_property("pkg_config_name", "gio-windows-2.0")
self.cpp_info.components["gio-windows-2.0"].requires = ["gobject-2.0", "gmodule-no-export-2.0", "gio-2.0"]
self.cpp_info.components["gio-windows-2.0"].includedirs = [os.path.join("include", "gio-win32-2.0")]
else:
self.cpp_info.components["gio-unix-2.0"].set_property("pkg_config_name", "gio-unix-2.0")
self.cpp_info.components["gio-unix-2.0"].requires += ["gobject-2.0", "gio-2.0"]
self.cpp_info.components["gio-unix-2.0"].includedirs = [os.path.join("include", "gio-unix-2.0")]
if self.settings.os == "Macos":
self.cpp_info.components["glib-2.0"].system_libs.append("resolv")
self.cpp_info.components["glib-2.0"].frameworks += ["Foundation", "CoreServices", "CoreFoundation"]
self.cpp_info.components["gio-2.0"].frameworks.append("AppKit")
if is_apple_os(self):
self.cpp_info.components["glib-2.0"].requires.append("libiconv::libiconv")
self.cpp_info.components["glib-2.0"].requires.append("pcre2::pcre2")
if self.settings.os == "Linux":
self.cpp_info.components["gio-2.0"].system_libs.append("resolv")
else:
self.cpp_info.components["glib-2.0"].requires.append("libgettext::libgettext")
if self.options.get_safe("with_mount"):
self.cpp_info.components["gio-2.0"].requires.append("libmount::libmount")
if self.options.get_safe("with_selinux"):
self.cpp_info.components["gio-2.0"].requires.append("libselinux::libselinux")
if self.options.get_safe("with_elf"):
self.cpp_info.components["gresource"].requires.append("libelf::libelf") # this is actually an executable
self.env_info.GLIB_COMPILE_SCHEMAS = os.path.join(self.package_folder, "bin", "glib-compile-schemas")
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
pkgconfig_variables = {
'datadir': '${prefix}/res',
'schemasdir': '${datadir}/glib-2.0/schemas',
'bindir': '${prefix}/bin',
# Can't use libdir here as it is libdir1 when using the PkgConfigDeps generator.
'giomoduledir': '${prefix}/lib/gio/modules',
'gio': '${bindir}/gio',
'gio_querymodules': '${bindir}/gio-querymodules',
'glib_compile_schemas': '${bindir}/glib-compile-schemas',
'glib_compile_resources': '${bindir}/glib-compile-resources',
'gdbus': '${bindir}/gdbus',
'gdbus_codegen': '${bindir}/gdbus-codegen',
'gresource': '${bindir}/gresource',
'gsettings': '${bindir}/gsettings'
}
self.cpp_info.components["gio-2.0"].set_property(
"pkg_config_custom_content",
"\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items()))
pkgconfig_variables = {
'bindir': '${prefix}/bin',
'glib_genmarshal': '${bindir}/glib-genmarshal',
'gobject_query': '${bindir}/gobject-query',
'glib_mkenums': '${bindir}/glib-mkenums'
}
self.cpp_info.components["glib-2.0"].set_property(
"pkg_config_custom_content",
"\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items()))
def fix_msvc_libname(conanfile, remove_lib_prefix=True):
"""remove lib prefix & change extension to .lib in case of cl like compiler"""
from conan.tools.files import rename
import glob
if not conanfile.settings.get_safe("compiler.runtime"):
return
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"))

View File

@@ -0,0 +1,148 @@
diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in
index 9c409e6..1913b6d 100755
--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in
+++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env @PYTHON@
# GDBus - GLib D-Bus Library
#
diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build
index 67ea9f2..2ee1fc8 100644
--- a/gio/gdbus-2.0/codegen/meson.build
+++ b/gio/gdbus-2.0/codegen/meson.build
@@ -31,7 +31,7 @@ gdbus_codegen_conf = configuration_data()
gdbus_codegen_conf.set('VERSION', glib_version)
gdbus_codegen_conf.set('MAJOR_VERSION', major_version)
gdbus_codegen_conf.set('MINOR_VERSION', minor_version)
-gdbus_codegen_conf.set('PYTHON', python.full_path())
+gdbus_codegen_conf.set('PYTHON', python_name)
gdbus_codegen_conf.set('DATADIR', glib_datadir)
# Install gdbus-codegen executable
diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py
index 6399945..86024d7 100644
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -21,10 +21,9 @@
#
# Author: David Zeuthen <davidz@redhat.com>
-import packaging.version
import os
import sys
-
+import re
# pylint: disable=too-few-public-methods
class Color:
@@ -161,11 +160,35 @@ def lookup_brief_docs(annotations):
def version_cmp_key(key):
# If the 'since' version is 'UNRELEASED', compare higher than anything else
# If it is empty put a 0 in its place as this will
- # allow LooseVersion to work and will always compare lower.
+ # allow _parse_version() to work and will always compare lower.
if key[0] == "UNRELEASED":
v = "9999"
elif key[0]:
v = str(key[0])
else:
v = "0"
- return (packaging.version.Version(v), key[1])
+ return (_parse_version(v), key[1])
+
+
+def _parse_version(version):
+ """
+ Parse a version string into a list of integers and strings.
+
+ This function takes a version string and breaks it down into its component parts.
+ It separates numeric and non-numeric segments, converting numeric segments to integers.
+
+ Args:
+ version (str): The version string to parse.
+
+ Returns:
+ list: A list where each element is either an integer (for numeric parts)
+ or a string (for non-numeric parts).
+
+ Example:
+ >>> parseversion("1.2.3a")
+ [1, 2, 3, 'a']
+ >>> parseversion("2.0.0-rc1")
+ [2, 0, 0, 'rc1']
+ """
+ blocks = re.findall(r"(\d+|\w+)", version)
+ return [int(b) if b.isdigit() else b for b in blocks]
diff --git a/glib/gtester-report.in b/glib/gtester-report.in
index 0745d53..b8291d2 100644
--- a/glib/gtester-report.in
+++ b/glib/gtester-report.in
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#! /usr/bin/env @PYTHON@
# GLib Testing Framework Utility -*- Mode: python; -*-
# Copyright (C) 2007 Imendio AB
# Authors: Tim Janik
diff --git a/glib/meson.build b/glib/meson.build
index b2dd569..5c29bb7 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -502,7 +502,7 @@ endif
report_conf = configuration_data()
report_conf.set('GLIB_VERSION', glib_version)
-report_conf.set('PYTHON', python.full_path())
+report_conf.set('PYTHON', python_name)
configure_file(
input: 'gtester-report.in',
output: 'gtester-report',
diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in
index 0578b74..aa5af43 100755
--- a/gobject/glib-genmarshal.in
+++ b/gobject/glib-genmarshal.in
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env @PYTHON@
# pylint: disable=too-many-lines, missing-docstring, invalid-name
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index 7e794e9..e10b910 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -1,4 +1,4 @@
-#!@PYTHON@
+#!/usr/bin/env @PYTHON@
# If the code below looks horrible and unpythonic, do not panic.
#
diff --git a/gobject/meson.build b/gobject/meson.build
index 78b732b..2129aaf 100644
--- a/gobject/meson.build
+++ b/gobject/meson.build
@@ -87,7 +87,7 @@ python_tools = [
python_tools_conf = configuration_data()
python_tools_conf.set('VERSION', glib_version)
-python_tools_conf.set('PYTHON', python.full_path())
+python_tools_conf.set('PYTHON', python_name)
foreach tool: python_tools
tool_bin = configure_file(
diff --git a/meson.build b/meson.build
index bcc2887..6cca73d 100644
--- a/meson.build
+++ b/meson.build
@@ -2457,7 +2457,9 @@ endif
glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline)
-python = import('python').find_installation(modules: ['packaging'])
+python = import('python').find_installation()
+# used for '#!/usr/bin/env <name>'
+python_name = 'python3'
python_version = python.language_version()
python_version_req = '>=3.7'

View File

@@ -0,0 +1,49 @@
From 32249a22fc39319651e7c23442d37ec837f05764 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Thu, 8 Sep 2022 02:36:33 +0530
Subject: [PATCH] meson: Fix detection of a system-provided proxy-libintl
proxy-libintl defines ngettext() as a define in the header that points
to the actual symbol in the library which is g_libintl_ngettext().
Same with bind_textdomain_codeset().
---
meson.build | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/meson.build b/meson.build
index 0cbc9689f5..de0bee5a39 100644
--- a/meson.build
+++ b/meson.build
@@ -2089,6 +2089,7 @@ libz_dep = dependency('zlib')
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
# implementations. This could be extended if issues are found in some platforms.
libintl_deps = []
+libintl_prefix = '#include <libintl.h>'
libintl = dependency('intl', required: false, allow_fallback: false)
if libintl.found()
# libintl supports different threading APIs, which may not
@@ -2100,11 +2101,11 @@ if libintl.found()
#
# Meson's builtin dependency lookup as of 0.60.0 doesn't check for
# pthread, so we do this manually here.
- if cc.has_function('ngettext', dependencies : libintl)
+ if cc.has_function('ngettext', dependencies : libintl, prefix: libintl_prefix)
libintl_deps += [libintl]
else
libintl_pthread = cc.find_library('pthread', required : false)
- if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread])
+ if libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_pthread], prefix: libintl_prefix)
libintl_deps += [libintl, libintl_pthread]
else
libintl = disabler()
@@ -2113,7 +2114,7 @@ if libintl.found()
endif
if libintl.found()
- have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', dependencies: libintl_deps)
+ have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', dependencies: libintl_deps, prefix: libintl_prefix)
else
libintl = dependency('intl', allow_fallback: true)
assert(libintl.type_name() == 'internal')
--
GitLab

View File

@@ -0,0 +1,51 @@
diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py
index 0204610..f8d758c 100644
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -19,7 +19,7 @@
#
# Author: David Zeuthen <davidz@redhat.com>
-import distutils.version
+import re
import os
import sys
@@ -159,11 +159,35 @@ def lookup_brief_docs(annotations):
def version_cmp_key(key):
# If the 'since' version is 'UNRELEASED', compare higher than anything else
# If it is empty put a 0 in its place as this will
- # allow LooseVersion to work and will always compare lower.
+ # allow _parse_version() to work and will always compare lower.
if key[0] == "UNRELEASED":
v = "9999"
elif key[0]:
v = str(key[0])
else:
v = "0"
- return (distutils.version.LooseVersion(v), key[1])
+ return (_parse_version(v), key[1])
+
+
+def _parse_version(version):
+ """
+ Parse a version string into a list of integers and strings.
+
+ This function takes a version string and breaks it down into its component parts.
+ It separates numeric and non-numeric segments, converting numeric segments to integers.
+
+ Args:
+ version (str): The version string to parse.
+
+ Returns:
+ list: A list where each element is either an integer (for numeric parts)
+ or a string (for non-numeric parts).
+
+ Example:
+ >>> parseversion("1.2.3a")
+ [1, 2, 3, 'a']
+ >>> parseversion("2.0.0-rc1")
+ [2, 0, 0, 'rc1']
+ """
+ blocks = re.findall(r"(\d+|\w+)", version)
+ return [int(b) if b.isdigit() else b for b in blocks]

View File

@@ -0,0 +1,51 @@
diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py
index 95559d3..2b7a176 100644
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -19,7 +19,7 @@
#
# Author: David Zeuthen <davidz@redhat.com>
-import distutils.version
+import re
import os
import sys
@@ -155,11 +155,35 @@ def lookup_brief_docs(annotations):
def version_cmp_key(key):
# If the 'since' version is 'UNRELEASED', compare higher than anything else
# If it is empty put a 0 in its place as this will
- # allow LooseVersion to work and will always compare lower.
+ # allow _parse_version() to work and will always compare lower.
if key[0] == "UNRELEASED":
v = "9999"
elif key[0]:
v = str(key[0])
else:
v = "0"
- return (distutils.version.LooseVersion(v), key[1])
+ return (_parse_version(v), key[1])
+
+
+def _parse_version(version):
+ """
+ Parse a version string into a list of integers and strings.
+
+ This function takes a version string and breaks it down into its component parts.
+ It separates numeric and non-numeric segments, converting numeric segments to integers.
+
+ Args:
+ version (str): The version string to parse.
+
+ Returns:
+ list: A list where each element is either an integer (for numeric parts)
+ or a string (for non-numeric parts).
+
+ Example:
+ >>> parseversion("1.2.3a")
+ [1, 2, 3, 'a']
+ >>> parseversion("2.0.0-rc1")
+ [2, 0, 0, 'rc1']
+ """
+ blocks = re.findall(r"(\d+|\w+)", version)
+ return [int(b) if b.isdigit() else b for b in blocks]

View File

@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES C)
find_package(glib CONFIG REQUIRED)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0)

View File

@@ -0,0 +1,10 @@
{
"version": 4,
"vendor": {
"conan": {}
},
"include": [
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json",
"build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json"
]
}

View File

@@ -0,0 +1,28 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str, run=True)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
if self.settings.os != "Windows":
self.run("gdbus-codegen -h", env="conanrun")

View File

@@ -0,0 +1,26 @@
#include <stdlib.h>
#include <stdio.h>
#include "glib.h"
#include "gmodule.h"
#include "gio/gio.h"
int main() {
printf("glib %d.%d.%d\n", glib_major_version, glib_minor_version, glib_micro_version);
printf("glib interface age: %d\n", glib_interface_age);
printf("glib binary age: %d\n", glib_binary_age);
GQueue *queue = g_queue_new();
g_queue_free(queue);
printf("glib module supported: %s\n", g_module_supported() ? "true" : "false");
GMutex m;
g_mutex_init(&m);
g_mutex_clear(&m);
printf("type name for char: %s\n", g_type_name(G_TYPE_CHAR));
return EXIT_SUCCESS;
}

9
recipes/glib/config.yml Normal file
View File

@@ -0,0 +1,9 @@
versions:
"2.81.0":
folder: all
"2.78.3":
folder: all
"2.77.3":
folder: all
"2.76.3":
folder: all