Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

harfbuzz: add v8.5.0, v9.0.0, define components, drop vulnerable versions, add introspection support #25093

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
18 changes: 6 additions & 12 deletions recipes/harfbuzz/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
sources:
"9.0.0":
url: "https://github.com/harfbuzz/harfbuzz/releases/download/9.0.0/harfbuzz-9.0.0.tar.xz"
sha256: "a41b272ceeb920c57263ec851604542d9ec85ee3030506d94662067c7b6ab89e"
"8.5.0":
url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.5.0/harfbuzz-8.5.0.tar.xz"
sha256: "77e4f7f98f3d86bf8788b53e6832fb96279956e1c3961988ea3d4b7ca41ddc27"
"8.3.0":
url: "https://github.com/harfbuzz/harfbuzz/releases/download/8.3.0/harfbuzz-8.3.0.tar.xz"
sha256: "109501eaeb8bde3eadb25fab4164e993fbace29c3d775bcaa1c1e58e2f15f847"
Expand All @@ -17,15 +23,3 @@ sources:
"7.3.0":
url: "https://github.com/harfbuzz/harfbuzz/releases/download/7.3.0/harfbuzz-7.3.0.tar.xz"
sha256: "20770789749ac9ba846df33983dbda22db836c70d9f5d050cb9aa5347094a8fb"
"6.0.0":
url: "https://github.com/harfbuzz/harfbuzz/releases/download/6.0.0/harfbuzz-6.0.0.tar.xz"
sha256: "1d1010a1751d076d5291e433c138502a794d679a7498d1268ee21e2d4a140eb4"
"5.1.0":
url: "https://github.com/harfbuzz/harfbuzz/releases/download/5.1.0/harfbuzz-5.1.0.tar.xz"
sha256: "2edb95db668781aaa8d60959d21be2ff80085f31b12053cdd660d9a50ce84f05"
patches:
"5.1.0":
- patch_file: "patches/0000-fix-freetype-lookup-5.1.0.patch"
patch_type: "portability"
patch_description: "fix fretype and icu dependency lookup"
patch_source: "https://github.com/harfbuzz/harfbuzz/pull/3811"
101 changes: 73 additions & 28 deletions recipes/harfbuzz/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from conan.tools.apple import is_apple_os, fix_apple_shared_install_name
from conan.tools.build import can_run, stdcpp_library
from conan.tools.env import Environment, VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, replace_in_file
from conan.tools.files import copy, get, rm, rmdir, replace_in_file
from conan.tools.gnu import PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.meson import Meson, MesonToolchain
Expand Down Expand Up @@ -33,8 +33,9 @@ class HarfbuzzConan(ConanFile):
"with_gdi": [True, False],
"with_uniscribe": [True, False],
"with_directwrite": [True, False],
"with_subset": [True, False],
"with_coretext": [True, False],
"with_introspection": [True, False],
"with_subset": ["deprecated", True, False],
}
default_options = {
"shared": False,
Expand All @@ -45,8 +46,9 @@ class HarfbuzzConan(ConanFile):
"with_gdi": True,
"with_uniscribe": True,
"with_directwrite": False,
"with_subset": False,
"with_coretext": True,
"with_introspection": False,
"with_subset": "deprecated",
}

short_paths = True
Expand All @@ -55,9 +57,6 @@ class HarfbuzzConan(ConanFile):
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -74,10 +73,15 @@ def configure(self):
if self.options.shared and self.options.with_glib:
wildcard = "" if Version(conan_version) < "2.0.0" else "/*"
self.options[f"glib{wildcard}"].shared = True
if not self.options.with_glib:
del self.options.with_introspection

def layout(self):
basic_layout(self, src_folder="src")

def package_id(self):
self.info.options.with_subset = True
valgur marked this conversation as resolved.
Show resolved Hide resolved

def requirements(self):
if self.options.with_freetype:
self.requires("freetype/2.13.2")
Expand All @@ -99,12 +103,20 @@ def validate(self):
"Linking shared glib with the MSVC static runtime is not supported"
)

if self.options.get_safe("with_introspection") and not self.options.shared:
raise ConanInvalidConfiguration("'with_introspection' option requires '-o harfbuzz/*:shared=True")

if self.options.with_subset != "deprecated":
self.output.warning("The 'with_subset' option is deprecated and will be removed in a future version. It never had any effect.")

def build_requirements(self):
self.tool_requires("meson/1.4.0")
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.1.0")
self.tool_requires("pkgconf/[>=2.2 <3]")
valgur marked this conversation as resolved.
Show resolved Hide resolved
if self.options.with_glib:
self.tool_requires("glib/<host_version>")
if self.options.get_safe("with_introspection"):
self.tool_requires("gobject-introspection/1.78.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on gettings this recently fixed @uilianries @valgur :)

if self.settings.os == "Macos":
# Ensure that the gettext we use at build time is compatible
# with the libiconv that is transitively exposed by glib
Expand Down Expand Up @@ -137,7 +149,11 @@ def is_vs_2017():
env.define_path("DYLD_LIBRARY_PATH", "")
env.vars(self, scope="build").save_script("conanbuild_macos_runtimepath")

PkgConfigDeps(self).generate()
deps = PkgConfigDeps(self)
if self.options.get_safe("with_introspection"):
# gnome.generate_gir() in Meson looks for gobject-introspection-1.0.pc
deps.build_context_activated = ["gobject-introspection"]
deps.generate()

backend, cxxflags = meson_backend_and_flags()
tc = MesonToolchain(self, backend=backend)
Expand All @@ -150,7 +166,7 @@ def is_vs_2017():
"coretext": is_enabled(self.options.get_safe("with_coretext")),
"directwrite": is_enabled(self.options.get_safe("with_directwrite")),
"gobject": is_enabled(can_run(self) and self.options.with_glib),
"introspection": is_enabled(False),
"introspection": is_enabled(self.options.get_safe("with_introspection")),
"tests": "disabled",
"docs": "disabled",
"benchmark": "disabled",
Expand All @@ -160,7 +176,6 @@ def is_vs_2017():
tc.generate()

def build(self):
apply_conandata_patches(self)
replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('util')", "")
meson = Meson(self)
meson.configure()
Expand All @@ -175,38 +190,68 @@ def package(self):
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
fix_apple_shared_install_name(self)
fix_msvc_libname(self)
if self.options.get_safe("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.set_property("cmake_file_name", "harfbuzz")
self.cpp_info.set_property("cmake_target_name", "harfbuzz::harfbuzz")
self.cpp_info.set_property("pkg_config_name", "harfbuzz")
if self.options.with_icu:
self.cpp_info.libs.append("harfbuzz-icu")
if self.options.with_subset:
self.cpp_info.libs.append("harfbuzz-subset")
self.cpp_info.libs.append("harfbuzz")
self.cpp_info.includedirs.append(os.path.join("include", "harfbuzz"))
self.cpp_info.set_property("pkg_config_name", "_harfbuzz-do-not-use")

self.cpp_info.components["harfbuzz_"].set_property("cmake_target_name", "harfbuzz::harfbuzz")
self.cpp_info.components["harfbuzz_"].set_property("pkg_config_name", "harfbuzz")
self.cpp_info.components["harfbuzz_"].libs = ["harfbuzz"]
self.cpp_info.components["harfbuzz_"].includedirs.append(os.path.join("include", "harfbuzz"))
if self.options.with_freetype:
self.cpp_info.components["harfbuzz_"].requires.append("freetype::freetype")
if self.options.with_glib:
self.cpp_info.components["harfbuzz_"].requires.append("glib::glib-2.0")

if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")
self.cpp_info.components["harfbuzz_"].system_libs.extend(["m", "pthread"])
if self.settings.os == "Windows" and not self.options.shared:
self.cpp_info.system_libs.append("user32")
self.cpp_info.components["harfbuzz_"].system_libs.append("user32")
if self.options.with_gdi or self.options.with_uniscribe:
self.cpp_info.system_libs.append("gdi32")
self.cpp_info.components["harfbuzz_"].system_libs.append("gdi32")
if self.options.with_uniscribe or self.options.with_directwrite:
self.cpp_info.system_libs.append("rpcrt4")
self.cpp_info.components["harfbuzz_"].system_libs.append("rpcrt4")
if self.options.with_uniscribe:
self.cpp_info.system_libs.append("usp10")
self.cpp_info.components["harfbuzz_"].system_libs.append("usp10")
if self.options.with_directwrite:
self.cpp_info.system_libs.append("dwrite")
self.cpp_info.components["harfbuzz_"].system_libs.append("dwrite")
if is_apple_os(self) and self.options.get_safe("with_coretext", False):
if self.settings.os == "Macos":
self.cpp_info.frameworks.append("ApplicationServices")
self.cpp_info.components["harfbuzz_"].frameworks.append("ApplicationServices")
else:
self.cpp_info.frameworks.extend(["CoreFoundation", "CoreGraphics", "CoreText"])
self.cpp_info.components["harfbuzz_"].frameworks.extend(["CoreFoundation", "CoreGraphics", "CoreText"])
if not self.options.shared:
libcxx = stdcpp_library(self)
if libcxx:
self.cpp_info.system_libs.append(libcxx)
self.cpp_info.components["harfbuzz_"].system_libs.append(libcxx)

self.cpp_info.components["subset"].set_property("cmake_target_name", "harfbuzz::subset")
self.cpp_info.components["subset"].set_property("pkg_config_name", "harfbuzz-subset")
self.cpp_info.components["subset"].libs = ["harfbuzz-subset"]
self.cpp_info.components["subset"].requires = ["harfbuzz_"]

if self.options.with_icu:
self.cpp_info.components["icu"].set_property("cmake_target_name", "harfbuzz::icu")
self.cpp_info.components["icu"].set_property("pkg_config_name", "harfbuzz-icu")
self.cpp_info.components["icu"].libs = ["harfbuzz-icu"]
self.cpp_info.components["icu"].requires = ["harfbuzz_", "icu::icu-uc"]

if self.options.with_glib and can_run(self):
self.cpp_info.components["gobject"].set_property("cmake_target_name", "harfbuzz::gobject")
self.cpp_info.components["gobject"].set_property("pkg_config_name", "harfbuzz-gobject")
self.cpp_info.components["gobject"].libs = ["harfbuzz-gobject"]
self.cpp_info.components["gobject"].requires = ["harfbuzz_", "glib::glib-2.0", "glib::gobject-2.0"]

if self.options.get_safe("with_introspection"):
self.cpp_info.components["harfbuzz_"].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"))


def fix_msvc_libname(conanfile, remove_lib_prefix=True):
Expand Down
72 changes: 0 additions & 72 deletions recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-5.1.0.patch

This file was deleted.

8 changes: 4 additions & 4 deletions recipes/harfbuzz/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
versions:
"9.0.0":
folder: all
"8.5.0":
folder: all
"8.3.0":
folder: all
"8.2.2":
Expand All @@ -11,7 +15,3 @@ versions:
folder: all
"7.3.0":
folder: all
"6.0.0":
folder: all
"5.1.0":
folder: all
Loading