From 2fdb14d28193e35353f5fc3cdfbd08fc44a1dc92 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Mon, 4 Mar 2024 09:14:19 -0600 Subject: [PATCH 01/13] pango: Fix some component requires --- recipes/pango/all/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 95d2994e0044e..26a42e3cb0793 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -196,6 +196,8 @@ def package_info(self): "pango_", "freetype::freetype", ] + if self.options.with_fontconfig: + self.cpp_info.components["pangoft2"].requires.append("fontconfig::fontconfig") self.cpp_info.components["pangoft2"].includedirs = [ os.path.join(self.package_folder, "include", "pango-1.0") ] @@ -203,7 +205,7 @@ def package_info(self): if self.options.with_fontconfig: self.cpp_info.components["pangofc"].set_property("pkg_config_name", "pangofc") if self.options.with_freetype: - self.cpp_info.components["pangofc"].requires = ["pangoft2"] + self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz" "pangoft2"] if self.settings.os != "Windows": self.cpp_info.components["pangoroot"].set_property("pkg_config_name", "pangoroot") @@ -229,7 +231,7 @@ def package_info(self): self.cpp_info.components["pangocairo"].set_property("pkg_config_name", "pangocairo") self.cpp_info.components["pangocairo"].requires = ["pango_"] if self.options.with_freetype: - self.cpp_info.components["pangocairo"].requires.append("pangoft2") + self.cpp_info.components["pangocairo"].requires.extend(["cairo::cairo_", "freetype::freetype", "pangoft2"]) if self.settings.os == "Windows": self.cpp_info.components["pangocairo"].requires.append("pangowin32") self.cpp_info.components["pangocairo"].system_libs.append("gdi32") From 56f69b8486806078c42ee3386d4806b47f195050 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Mon, 4 Mar 2024 10:53:28 -0600 Subject: [PATCH 02/13] Bump fontconfig to fix dependency conflict in libxft --- recipes/pango/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 26a42e3cb0793..00d667254f342 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -66,7 +66,7 @@ def requirements(self): self.requires("freetype/2.13.2") if self.options.with_fontconfig: - self.requires("fontconfig/2.14.2") + self.requires("fontconfig/2.15.0") if self.options.with_xft: self.requires("libxft/2.3.8") if ( From 5d3dfe28f8a7fea5541086603864feb5b896d6ee Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Thu, 11 Apr 2024 13:38:58 -0500 Subject: [PATCH 03/13] Add missing comma --- recipes/pango/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 00d667254f342..a8986014819db 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -205,7 +205,7 @@ def package_info(self): if self.options.with_fontconfig: self.cpp_info.components["pangofc"].set_property("pkg_config_name", "pangofc") if self.options.with_freetype: - self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz" "pangoft2"] + self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz", "pangoft2"] if self.settings.os != "Windows": self.cpp_info.components["pangoroot"].set_property("pkg_config_name", "pangoroot") From 31280ca75339356918858aff5e7045297b37b6a9 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 29 Aug 2024 11:21:12 +0300 Subject: [PATCH 04/13] pango: add v1.54.0 --- recipes/pango/all/conandata.yml | 3 +++ recipes/pango/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/pango/all/conandata.yml b/recipes/pango/all/conandata.yml index c28a2cc9181bb..c6a58de488d3e 100644 --- a/recipes/pango/all/conandata.yml +++ b/recipes/pango/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.54.0": + url: "https://download.gnome.org/sources/pango/1.54/pango-1.54.0.tar.xz" + sha256: "8a9eed75021ee734d7fc0fdf3a65c3bba51dfefe4ae51a9b414a60c70b2d1ed8" "1.51.0": url: "https://download.gnome.org/sources/pango/1.51/pango-1.51.0.tar.xz" sha256: "74efc109ae6f903bbe6af77eaa2ac6094b8ee245a2e23f132a7a8f0862d1a9f5" diff --git a/recipes/pango/config.yml b/recipes/pango/config.yml index 9086309110a6b..2d198a63c6b11 100644 --- a/recipes/pango/config.yml +++ b/recipes/pango/config.yml @@ -1,4 +1,6 @@ versions: + "1.54.0": + folder: all "1.51.0": folder: all "1.50.14": From 66773181192fe8faf3dbd2e319b90ae6400b770f Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 31 Aug 2024 22:31:18 +0300 Subject: [PATCH 05/13] pango: use version ranges for meson and pkgconf --- recipes/pango/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 927f6200bed62..0629388776478 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -118,9 +118,9 @@ def validate(self): def build_requirements(self): self.tool_requires("glib/") - self.tool_requires("meson/1.4.0") + self.tool_requires("meson/[>=1.2.3 <2]") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/2.1.0") + self.tool_requires("pkgconf/[>=2.2 <3]") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From efd04f82d097b6a2fe61648e36c8ace64c238667 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 29 Aug 2024 11:20:56 +0300 Subject: [PATCH 06/13] pango: improve with_xft handling --- recipes/pango/all/conanfile.py | 41 ++++++++++++++-------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 0629388776478..557693a2a4ee2 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -37,7 +37,7 @@ class PangoConan(ConanFile): "fPIC": True, "with_libthai": False, "with_cairo": True, - "with_xft": False, + "with_xft": True, "with_freetype": False, "with_fontconfig": False, } @@ -45,18 +45,19 @@ class PangoConan(ConanFile): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - - if self.settings.os in ["FreeBSD", "Linux"]: - self.options.with_xft = True - if not self.settings.os in ["Macos", "Windows"]: - self.options.with_freetype = True - self.options.with_fontconfig = True + if self.settings.os not in ["FreeBSD", "Linux"]: + del self.options.with_xft + if self.settings.os in ["Macos", "Windows"]: + self.options.with_freetype = False + self.options.with_fontconfig = False def configure(self): if self.options.shared: self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") + self.options["cairo"].with_freetype = self.options.with_freetype + self.options["cairo"].with_fontconfig = self.options.with_fontconfig def layout(self): basic_layout(self, src_folder="src") @@ -64,17 +65,12 @@ def layout(self): def requirements(self): if self.options.with_freetype: self.requires("freetype/2.13.2") - if self.options.with_fontconfig: self.requires("fontconfig/2.15.0") - if self.options.with_xft: + if self.options.get_safe("with_xft"): self.requires("libxft/2.3.8") - if ( - self.options.with_xft - and self.options.with_fontconfig - and self.options.with_freetype - ): - self.requires("xorg/system") # for xorg::xrender + if self.options.with_fontconfig and self.options.with_freetype: + self.requires("xorg/system") # for xorg::xrender if self.options.with_cairo: # "pango/pangocairo.h" includes "cairo.h" self.requires("cairo/1.18.0", transitive_headers=True) @@ -89,13 +85,10 @@ def validate(self): and Version(self.settings.compiler.version) < "5" ): raise ConanInvalidConfiguration(f"{self.name} does not support GCC before version 5. Contributions are welcome.") - if self.options.with_xft and not self.settings.os in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("Xft can only be used on Linux and FreeBSD") - if self.options.with_xft and ( - not self.options.with_freetype or not self.options.with_fontconfig - ): - raise ConanInvalidConfiguration("Xft requires freetype and fontconfig") + if self.options.get_safe("with_xft"): + if not self.options.with_freetype or not self.options.with_fontconfig: + raise ConanInvalidConfiguration("Xft requires freetype and fontconfig") if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( @@ -134,7 +127,7 @@ def generate(self): tc.project_options["introspection"] = "disabled" tc.project_options["libthai"] = "enabled" if self.options.with_libthai else "disabled" tc.project_options["cairo"] = "enabled" if self.options.with_cairo else "disabled" - tc.project_options["xft"] = "enabled" if self.options.with_xft else "disabled" + tc.project_options["xft"] = "enabled" if self.options.get_safe("with_xft") else "disabled" tc.project_options["fontconfig"] = "enabled" if self.options.with_fontconfig else "disabled" tc.project_options["freetype"] = "enabled" if self.options.with_freetype else "disabled" tc.generate() @@ -178,7 +171,7 @@ def package_info(self): if self.options.with_fontconfig: self.cpp_info.components["pango_"].requires.append("fontconfig::fontconfig") - if self.options.with_xft: + if self.options.get_safe("with_xft"): self.cpp_info.components["pango_"].requires.append("libxft::libxft") # Pango only uses xrender when Xft, fontconfig and freetype are enabled if self.options.with_fontconfig and self.options.with_freetype: @@ -210,7 +203,7 @@ def package_info(self): if self.options.with_freetype: self.cpp_info.components["pangoroot"].requires = ["pangoft2"] - if self.options.with_xft: + if self.options.get_safe("with_xft"): self.cpp_info.components["pangoxft"].libs = ["pangoxft-1.0"] self.cpp_info.components["pangoxft"].set_property("pkg_config_name", "pangoxft") self.cpp_info.components["pangoxft"].requires = ["pango_", "pangoft2"] From 4f4a79252311edaeee95b3b38b650e027a745abe Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 31 Aug 2024 22:36:50 +0300 Subject: [PATCH 07/13] pango: enable freetype and fontconfig by default --- recipes/pango/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 557693a2a4ee2..a43d8252ae583 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -38,8 +38,8 @@ class PangoConan(ConanFile): "with_libthai": False, "with_cairo": True, "with_xft": True, - "with_freetype": False, - "with_fontconfig": False, + "with_freetype": True, + "with_fontconfig": True, } def config_options(self): From f9f2c5a0ebb3618512525d565193ee81a9d25d5d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 30 Aug 2024 10:19:47 +0300 Subject: [PATCH 08/13] pango: add introspection support --- recipes/pango/all/conanfile.py | 39 +++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index a43d8252ae583..83c148aed5132 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -31,6 +31,7 @@ class PangoConan(ConanFile): "with_xft": [True, False], "with_freetype": [True, False], "with_fontconfig": [True, False], + "with_introspection": [True, False], } default_options = { "shared": False, @@ -40,6 +41,7 @@ class PangoConan(ConanFile): "with_xft": True, "with_freetype": True, "with_fontconfig": True, + "with_introspection": False, } def config_options(self): @@ -114,22 +116,29 @@ def build_requirements(self): self.tool_requires("meson/[>=1.2.3 <2]") if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/[>=2.2 <3]") + if self.options.with_introspection: + self.tool_requires("gobject-introspection/1.78.1") 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() - pkg_config_deps = PkgConfigDeps(self) - pkg_config_deps.generate() + VirtualBuildEnv(self).generate() + + deps = PkgConfigDeps(self) + if self.options.with_introspection: + # gnome.generate_gir() in Meson looks for gobject-introspection-1.0.pc + deps.build_context_activated = ["gobject-introspection"] + deps.generate() + + enabled_disabled = lambda opt: "enabled" if opt else "disabled" tc = MesonToolchain(self) - tc.project_options["introspection"] = "disabled" - tc.project_options["libthai"] = "enabled" if self.options.with_libthai else "disabled" - tc.project_options["cairo"] = "enabled" if self.options.with_cairo else "disabled" - tc.project_options["xft"] = "enabled" if self.options.get_safe("with_xft") else "disabled" - tc.project_options["fontconfig"] = "enabled" if self.options.with_fontconfig else "disabled" - tc.project_options["freetype"] = "enabled" if self.options.with_freetype else "disabled" + tc.project_options["introspection"] = enabled_disabled(self.options.with_introspection) + tc.project_options["libthai"] = enabled_disabled(self.options.with_libthai) + tc.project_options["cairo"] = enabled_disabled(self.options.with_cairo) + tc.project_options["xft"] = enabled_disabled(self.options.get_safe("with_xft")) + tc.project_options["fontconfig"] = enabled_disabled(self.options.with_fontconfig) + tc.project_options["freetype"] = enabled_disabled(self.options.with_freetype) tc.generate() def build(self): @@ -157,6 +166,9 @@ def package(self): self._fix_library_names(os.path.join(self.package_folder, "lib")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.pdb", self.package_folder, recursive=True) + if self.options.with_introspection: + os.rename(os.path.join(self.package_folder, "share"), + os.path.join(self.package_folder, "res")) def package_info(self): self.cpp_info.components["pango_"].libs = ["pango-1.0"] @@ -182,6 +194,13 @@ def package_info(self): os.path.join(self.package_folder, "include", "pango-1.0") ] + if self.options.with_introspection: + self.cpp_info.components["pango_"].resdirs = ["res"] + self.buildenv_info.append_path("GI_GIR_PATH", os.path.join(self.package_folder, "res", "gir-1.0")) + self.buildenv_info.append_path("GI_TYPELIB_PATH", os.path.join(self.package_folder, "lib", "girepository-1.0")) + self.env_info.GI_GIR_PATH.append(os.path.join(self.package_folder, "res", "gir-1.0")) + self.env_info.GI_TYPELIB_PATH.append(os.path.join(self.package_folder, "lib", "girepository-1.0")) + if self.options.with_freetype: self.cpp_info.components["pangoft2"].libs = ["pangoft2-1.0"] self.cpp_info.components["pangoft2"].set_property("pkg_config_name", "pangoft2") From 94316e2e80c03fc7cd15c346fbc705f284c500ed Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 4 Sep 2024 17:43:48 +0300 Subject: [PATCH 09/13] pango: revert propagation of option values to cairo --- recipes/pango/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index a73b391595bf8..3fc8b3552ef90 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -58,8 +58,6 @@ def configure(self): self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.libcxx") self.settings.rm_safe("compiler.cppstd") - self.options["cairo"].with_freetype = self.options.with_freetype - self.options["cairo"].with_fontconfig = self.options.with_fontconfig def layout(self): basic_layout(self, src_folder="src") From 095e8a850f0890832057dcc9fe988a21e8e1c915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Wed, 18 Sep 2024 13:16:07 +0200 Subject: [PATCH 10/13] Fix some issues in the recipe after inspecting meson.build --------- Co-authored-by: ErniGH --- recipes/pango/all/conanfile.py | 57 ++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 3fc8b3552ef90..5807ca6cfe3e2 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -3,6 +3,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os from conan.tools.env import VirtualBuildEnv from conan.tools.files import chdir, copy, get, rename, replace_in_file, rm, rmdir from conan.tools.gnu import PkgConfigDeps @@ -39,6 +40,8 @@ class PangoConan(ConanFile): "with_libthai": False, "with_cairo": True, "with_xft": True, + # TODO: Currently can't actually disable this in Macos at least, + # it always shows up as detected in meson "with_freetype": True, "with_fontconfig": True, "with_introspection": False, @@ -49,9 +52,12 @@ def config_options(self): del self.options.fPIC if self.settings.os not in ["FreeBSD", "Linux"]: del self.options.with_xft - if self.settings.os in ["Macos", "Windows"]: - self.options.with_freetype = False - self.options.with_fontconfig = False + if self.settings.os not in ["Macos", "Windows"]: + del self.options.with_fontconfig + + @property + def _has_fontconfig_requirement(self): + return self.options.get_safe("with_fontconfig") or self.settings.os not in ["Windows", "Macos"] def configure(self): if self.options.shared: @@ -65,12 +71,11 @@ def layout(self): def requirements(self): if self.options.with_freetype: self.requires("freetype/2.13.2") - if self.options.with_fontconfig: + if self._has_fontconfig_requirement: self.requires("fontconfig/2.15.0") if self.options.get_safe("with_xft"): self.requires("libxft/2.3.8") - if self.options.with_fontconfig and self.options.with_freetype: - self.requires("xorg/system") # for xorg::xrender + self.requires("xorg/system") # for xorg::xrender if self.options.with_cairo: # "pango/pangocairo.h" includes "cairo.h" self.requires("cairo/1.18.0", transitive_headers=True) @@ -87,14 +92,18 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.name} does not support GCC before version 5. Contributions are welcome.") if self.options.get_safe("with_xft"): - if not self.options.with_freetype or not self.options.with_fontconfig: - raise ConanInvalidConfiguration("Xft requires freetype and fontconfig") + if not self.options.with_freetype or not self._has_fontconfig_requirement: + raise ConanInvalidConfiguration(f"-o={self.ref}:with_xft=True requires -o={self.ref}:with_freetype=True and -o={self.ref}:with_fontconfig=True") if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Linking shared glib with the MSVC static runtime is not supported" ) + if (self._has_fontconfig_requirement and self.options.with_freetype + and not self.dependencies["cairo"].options.with_fontconfig): + raise ConanInvalidConfiguration(f"{self.ref} with -o=&:with_fontconfig=True and -o=&:with_freetype=True requires -o=cairo/*:with_fontconfig=True") + if self.options.shared: if not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( @@ -135,7 +144,7 @@ def generate(self): tc.project_options["libthai"] = enabled_disabled(self.options.with_libthai) tc.project_options["cairo"] = enabled_disabled(self.options.with_cairo) tc.project_options["xft"] = enabled_disabled(self.options.get_safe("with_xft")) - tc.project_options["fontconfig"] = enabled_disabled(self.options.with_fontconfig) + tc.project_options["fontconfig"] = enabled_disabled(self._has_fontconfig_requirement) tc.project_options["freetype"] = enabled_disabled(self.options.with_freetype) tc.generate() @@ -178,14 +187,13 @@ def package_info(self): self.cpp_info.components["pango_"].requires.append("glib::gio-2.0") self.cpp_info.components["pango_"].requires.append("fribidi::fribidi") self.cpp_info.components["pango_"].requires.append("harfbuzz::harfbuzz") - if self.options.with_fontconfig: + if self._has_fontconfig_requirement: self.cpp_info.components["pango_"].requires.append("fontconfig::fontconfig") if self.options.get_safe("with_xft"): - self.cpp_info.components["pango_"].requires.append("libxft::libxft") - # Pango only uses xrender when Xft, fontconfig and freetype are enabled - if self.options.with_fontconfig and self.options.with_freetype: - self.cpp_info.components["pango_"].requires.append("xorg::xrender") + # Pango only uses xrender when Xft, fontconfig and freetype are enabled, which if with_xft is true, + # means that the other options are true because they are checked in the validate() method + self.cpp_info.components["pango_"].requires.extend(["libxft::libxft", "xorg::xrender"]) if self.options.with_cairo: self.cpp_info.components["pango_"].requires.append("cairo::cairo_") self.cpp_info.components["pango_"].includedirs = [ @@ -199,22 +207,26 @@ def package_info(self): self.env_info.GI_GIR_PATH.append(os.path.join(self.package_folder, "res", "gir-1.0")) self.env_info.GI_TYPELIB_PATH.append(os.path.join(self.package_folder, "lib", "girepository-1.0")) - if self.options.with_freetype: + # From meson.build: To build pangoft2, we need HarfBuzz, FontConfig and FreeType + if self.options.with_freetype and self._has_fontconfig_requirement: self.cpp_info.components["pangoft2"].libs = ["pangoft2-1.0"] self.cpp_info.components["pangoft2"].set_property("pkg_config_name", "pangoft2") self.cpp_info.components["pangoft2"].requires = [ "pango_", "freetype::freetype", + "fontconfig::fontconfig", ] - if self.options.with_fontconfig: - self.cpp_info.components["pangoft2"].requires.append("fontconfig::fontconfig") self.cpp_info.components["pangoft2"].includedirs = [ os.path.join(self.package_folder, "include", "pango-1.0") ] - if self.options.with_fontconfig: + # meson.build#L320 + self.cpp_info.components["pango_"].requires.append("freetype::freetype") + + if self._has_fontconfig_requirement: self.cpp_info.components["pangofc"].set_property("pkg_config_name", "pangofc") if self.options.with_freetype: + # Pangoft2 is always built if pango has fontconfig and freetype support self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz", "pangoft2"] if self.settings.os != "Windows": @@ -225,6 +237,8 @@ def package_info(self): if self.options.get_safe("with_xft"): self.cpp_info.components["pangoxft"].libs = ["pangoxft-1.0"] self.cpp_info.components["pangoxft"].set_property("pkg_config_name", "pangoxft") + # Pangogft2 is always built if pango has fontconfig and freetype support, + # which is always true if pango has xft support enabled self.cpp_info.components["pangoxft"].requires = ["pango_", "pangoft2"] self.cpp_info.components["pangoxft"].includedirs = [ os.path.join(self.package_folder, "include", "pango-1.0") @@ -238,11 +252,16 @@ def package_info(self): if Version(self.version) >= "1.50.12": self.cpp_info.components["pangowin32"].system_libs.append("dwrite") + if is_apple_os(self): + self.cpp_info.components["pango_"].frameworks.extend(["CoreText", "CoreFoundation", "ApplicationServices"]) + if self.options.with_cairo: self.cpp_info.components["pangocairo"].libs = ["pangocairo-1.0"] self.cpp_info.components["pangocairo"].set_property("pkg_config_name", "pangocairo") self.cpp_info.components["pangocairo"].requires = ["pango_"] - if self.options.with_freetype: + # pangotf2 is only added if cairo has freetype support, and pango has fontconfig AND freetype support + if (self.options.with_freetype and self._has_fontconfig_requirement + and self.dependencies["cairo"].options.with_freetype): self.cpp_info.components["pangocairo"].requires.extend(["cairo::cairo_", "freetype::freetype", "pangoft2"]) if self.settings.os == "Windows": self.cpp_info.components["pangocairo"].requires.append("pangowin32") From 3a0c96dde65a1709fc7f5c23dd56e7629b817b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Rinc=C3=B3n=20Blanco?= Date: Fri, 20 Sep 2024 10:28:21 +0200 Subject: [PATCH 11/13] Try to solve Windows compilation issues --- recipes/pango/all/conanfile.py | 39 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 5807ca6cfe3e2..a90b7c6e7d261 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -52,12 +52,11 @@ def config_options(self): del self.options.fPIC if self.settings.os not in ["FreeBSD", "Linux"]: del self.options.with_xft - if self.settings.os not in ["Macos", "Windows"]: - del self.options.with_fontconfig - @property - def _has_fontconfig_requirement(self): - return self.options.get_safe("with_fontconfig") or self.settings.os not in ["Windows", "Macos"] + # meson.build#L242 - Optional in Windows/Macos but false by default + if self.settings.os in ["Macos", "Windows"]: + self.options.with_fontconfig = False + self.options.with_freetype = False def configure(self): if self.options.shared: @@ -71,7 +70,7 @@ def layout(self): def requirements(self): if self.options.with_freetype: self.requires("freetype/2.13.2") - if self._has_fontconfig_requirement: + if self.options.with_fontconfig: self.requires("fontconfig/2.15.0") if self.options.get_safe("with_xft"): self.requires("libxft/2.3.8") @@ -92,15 +91,19 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.name} does not support GCC before version 5. Contributions are welcome.") if self.options.get_safe("with_xft"): - if not self.options.with_freetype or not self._has_fontconfig_requirement: - raise ConanInvalidConfiguration(f"-o={self.ref}:with_xft=True requires -o={self.ref}:with_freetype=True and -o={self.ref}:with_fontconfig=True") + if not self.options.with_freetype or not self.options.with_fontconfig: + raise ConanInvalidConfiguration(f"-o=&:with_xft=True requires -o=&:with_freetype=True and -o=&:with_fontconfig=True") if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Linking shared glib with the MSVC static runtime is not supported" ) - if (self._has_fontconfig_requirement and self.options.with_freetype + # meson.build#L240 - Can't be turned off outside Macos/Windows + if self.settings.os not in ["Macos", "Windows"] and not self.options.with_fontconfig: + raise ConanInvalidConfiguration(f"{self.ref} requires -o=&:with_fontconfig=True for {self.settings.os}") + + if (self.options.with_fontconfig and self.options.with_freetype and not self.dependencies["cairo"].options.with_fontconfig): raise ConanInvalidConfiguration(f"{self.ref} with -o=&:with_fontconfig=True and -o=&:with_freetype=True requires -o=cairo/*:with_fontconfig=True") @@ -144,16 +147,19 @@ def generate(self): tc.project_options["libthai"] = enabled_disabled(self.options.with_libthai) tc.project_options["cairo"] = enabled_disabled(self.options.with_cairo) tc.project_options["xft"] = enabled_disabled(self.options.get_safe("with_xft")) - tc.project_options["fontconfig"] = enabled_disabled(self._has_fontconfig_requirement) + tc.project_options["fontconfig"] = enabled_disabled(self.options.with_fontconfig) tc.project_options["freetype"] = enabled_disabled(self.options.with_freetype) tc.generate() - def build(self): + def _patch_sources(self): meson_build = os.path.join(self.source_folder, "meson.build") replace_in_file(self, meson_build, "subdir('tests')", "") replace_in_file(self, meson_build, "subdir('tools')", "") replace_in_file(self, meson_build, "subdir('utils')", "") replace_in_file(self, meson_build, "subdir('examples')", "") + + def build(self): + self._patch_sources() meson = Meson(self) meson.configure() meson.build() @@ -187,7 +193,7 @@ def package_info(self): self.cpp_info.components["pango_"].requires.append("glib::gio-2.0") self.cpp_info.components["pango_"].requires.append("fribidi::fribidi") self.cpp_info.components["pango_"].requires.append("harfbuzz::harfbuzz") - if self._has_fontconfig_requirement: + if self.options.with_fontconfig: self.cpp_info.components["pango_"].requires.append("fontconfig::fontconfig") if self.options.get_safe("with_xft"): @@ -208,7 +214,7 @@ def package_info(self): self.env_info.GI_TYPELIB_PATH.append(os.path.join(self.package_folder, "lib", "girepository-1.0")) # From meson.build: To build pangoft2, we need HarfBuzz, FontConfig and FreeType - if self.options.with_freetype and self._has_fontconfig_requirement: + if self.options.with_freetype and self.options.with_fontconfig: self.cpp_info.components["pangoft2"].libs = ["pangoft2-1.0"] self.cpp_info.components["pangoft2"].set_property("pkg_config_name", "pangoft2") self.cpp_info.components["pangoft2"].requires = [ @@ -223,7 +229,7 @@ def package_info(self): # meson.build#L320 self.cpp_info.components["pango_"].requires.append("freetype::freetype") - if self._has_fontconfig_requirement: + if self.options.with_fontconfig: self.cpp_info.components["pangofc"].set_property("pkg_config_name", "pangofc") if self.options.with_freetype: # Pangoft2 is always built if pango has fontconfig and freetype support @@ -259,10 +265,11 @@ def package_info(self): self.cpp_info.components["pangocairo"].libs = ["pangocairo-1.0"] self.cpp_info.components["pangocairo"].set_property("pkg_config_name", "pangocairo") self.cpp_info.components["pangocairo"].requires = ["pango_"] + self.cpp_info.components["pangocairo"].requires.append("cairo::cairo_") # pangotf2 is only added if cairo has freetype support, and pango has fontconfig AND freetype support - if (self.options.with_freetype and self._has_fontconfig_requirement + if (self.options.with_freetype and self.options.with_fontconfig and self.dependencies["cairo"].options.with_freetype): - self.cpp_info.components["pangocairo"].requires.extend(["cairo::cairo_", "freetype::freetype", "pangoft2"]) + self.cpp_info.components["pangocairo"].requires.extend(["freetype::freetype", "pangoft2"]) if self.settings.os == "Windows": self.cpp_info.components["pangocairo"].requires.append("pangowin32") self.cpp_info.components["pangocairo"].system_libs.append("gdi32") From 3a44373fcd9913510d3e8716e0b6678bdd3d3704 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Fri, 20 Sep 2024 13:43:04 +0300 Subject: [PATCH 12/13] pango: add URLs to meson.build references in comments --- recipes/pango/all/conanfile.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index a90b7c6e7d261..444a2d0d9d75d 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -53,7 +53,8 @@ def config_options(self): if self.settings.os not in ["FreeBSD", "Linux"]: del self.options.with_xft - # meson.build#L242 - Optional in Windows/Macos but false by default + # Optional in Windows/Macos but false by default + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L242 if self.settings.os in ["Macos", "Windows"]: self.options.with_fontconfig = False self.options.with_freetype = False @@ -99,7 +100,8 @@ def validate(self): "Linking shared glib with the MSVC static runtime is not supported" ) - # meson.build#L240 - Can't be turned off outside Macos/Windows + # Can't be turned off outside Macos/Windows + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L240 if self.settings.os not in ["Macos", "Windows"] and not self.options.with_fontconfig: raise ConanInvalidConfiguration(f"{self.ref} requires -o=&:with_fontconfig=True for {self.settings.os}") @@ -213,7 +215,7 @@ def package_info(self): self.env_info.GI_GIR_PATH.append(os.path.join(self.package_folder, "res", "gir-1.0")) self.env_info.GI_TYPELIB_PATH.append(os.path.join(self.package_folder, "lib", "girepository-1.0")) - # From meson.build: To build pangoft2, we need HarfBuzz, FontConfig and FreeType + # From meson.build: "To build pangoft2, we need HarfBuzz, FontConfig and FreeType" if self.options.with_freetype and self.options.with_fontconfig: self.cpp_info.components["pangoft2"].libs = ["pangoft2-1.0"] self.cpp_info.components["pangoft2"].set_property("pkg_config_name", "pangoft2") @@ -226,13 +228,13 @@ def package_info(self): os.path.join(self.package_folder, "include", "pango-1.0") ] - # meson.build#L320 + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L320 self.cpp_info.components["pango_"].requires.append("freetype::freetype") if self.options.with_fontconfig: self.cpp_info.components["pangofc"].set_property("pkg_config_name", "pangofc") if self.options.with_freetype: - # Pangoft2 is always built if pango has fontconfig and freetype support + # pangoft2 is always built if pango has fontconfig and freetype support self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz", "pangoft2"] if self.settings.os != "Windows": @@ -243,7 +245,7 @@ def package_info(self): if self.options.get_safe("with_xft"): self.cpp_info.components["pangoxft"].libs = ["pangoxft-1.0"] self.cpp_info.components["pangoxft"].set_property("pkg_config_name", "pangoxft") - # Pangogft2 is always built if pango has fontconfig and freetype support, + # pangoft2 is always built if pango has fontconfig and freetype support, # which is always true if pango has xft support enabled self.cpp_info.components["pangoxft"].requires = ["pango_", "pangoft2"] self.cpp_info.components["pangoxft"].includedirs = [ @@ -259,17 +261,16 @@ def package_info(self): self.cpp_info.components["pangowin32"].system_libs.append("dwrite") if is_apple_os(self): + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L333-346 self.cpp_info.components["pango_"].frameworks.extend(["CoreText", "CoreFoundation", "ApplicationServices"]) if self.options.with_cairo: self.cpp_info.components["pangocairo"].libs = ["pangocairo-1.0"] self.cpp_info.components["pangocairo"].set_property("pkg_config_name", "pangocairo") - self.cpp_info.components["pangocairo"].requires = ["pango_"] - self.cpp_info.components["pangocairo"].requires.append("cairo::cairo_") - # pangotf2 is only added if cairo has freetype support, and pango has fontconfig AND freetype support - if (self.options.with_freetype and self.options.with_fontconfig - and self.dependencies["cairo"].options.with_freetype): - self.cpp_info.components["pangocairo"].requires.extend(["freetype::freetype", "pangoft2"]) + self.cpp_info.components["pangocairo"].requires = ["pango_", "cairo::cairo_"] + if self.options.with_freetype and self.options.with_fontconfig: + # https://gitlab.gnome.org/GNOME/pango/-/blob/1.54.0/meson.build#L506 + self.cpp_info.components["pangocairo"].requires.append("pangoft2") if self.settings.os == "Windows": self.cpp_info.components["pangocairo"].requires.append("pangowin32") self.cpp_info.components["pangocairo"].system_libs.append("gdi32") From 58cea0d29135013046c42d91cdd6af6a5c042815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Sat, 21 Sep 2024 00:32:47 +0200 Subject: [PATCH 13/13] Add missing freetype requirement on pango, this might be overlinking but ok --- recipes/pango/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 444a2d0d9d75d..b822fb21641da 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -236,6 +236,8 @@ def package_info(self): if self.options.with_freetype: # pangoft2 is always built if pango has fontconfig and freetype support self.cpp_info.components["pangofc"].requires = ["freetype::freetype", "harfbuzz::harfbuzz", "pangoft2"] + elif self.options.with_freetype: + self.cpp_info.components["pango_"].requires.append("freetype::freetype") if self.settings.os != "Windows": self.cpp_info.components["pangoroot"].set_property("pkg_config_name", "pangoroot")