commit:     5a5248cde63dd7a115c2ae9598d8081da18562d1
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Apr  8 17:37:38 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Apr  8 17:41:27 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a5248cd

media-libs/harfbuzz: Fix freetype dependency logic

Bug: https://bugs.gentoo.org/953435
Closes: https://bugs.gentoo.org/950274
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/harfbuzz-10.4.0-meson-freetype.patch     | 87 +++++++++++++++++++++
 media-libs/harfbuzz/harfbuzz-10.4.0-r1.ebuild      | 91 ++++++++++++++++++++++
 2 files changed, 178 insertions(+)

diff --git a/media-libs/harfbuzz/files/harfbuzz-10.4.0-meson-freetype.patch 
b/media-libs/harfbuzz/files/harfbuzz-10.4.0-meson-freetype.patch
new file mode 100644
index 000000000000..fea5b1e99411
--- /dev/null
+++ b/media-libs/harfbuzz/files/harfbuzz-10.4.0-meson-freetype.patch
@@ -0,0 +1,87 @@
+From 5809f47dea83644ed78c2c7884bfea94932e4c94 Mon Sep 17 00:00:00 2001
+From: Alfred Wingate <[email protected]>
+Date: Tue, 25 Feb 2025 17:43:41 +0200
+Subject: [PATCH] meson: refactor freetype dependency logic
+
+Simplify and respect -Dfreetype=disabled again.
+
+Bug: https://bugs.gentoo.org/950274
+Fixes: 1ad48fddd08654052da4f8a93609e7f4380d5c42
+See-Also: 604fe807078ce41d0ac7742547e90b17c066709f
+Signed-off-by: Alfred Wingate <[email protected]>
+(cherry picked from commit 628b868f44acce749adc08ff61f2d9c19c9e2bbe)
+---
+ meson.build | 46 +++++++++++++++++++---------------------------
+ 1 file changed, 19 insertions(+), 27 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 1460c2a9d..ab46197f2 100644
+--- a/meson.build
++++ b/meson.build
+@@ -102,44 +102,36 @@ check_funcs = [
+ 
+ m_dep = cpp.find_library('m', required: false)
+ 
+-if meson.version().version_compare('>=0.60.0')
++# Painful hack to handle multiple dependencies but also respect options
++if get_option('freetype').disabled()
++  freetype_dep = dependency('', required: false)
++else
+   # Sadly, FreeType's versioning schemes are different between pkg-config and 
CMake
+-  # pkg-config: freetype2, cmake: Freetype
++
++  # Try pkg-config name
+   freetype_dep = dependency('freetype2',
+                             version: freetype_min_version,
+                             method: 'pkg-config',
+                             required: false,
+                             allow_fallback: false)
+   if not freetype_dep.found()
+-    freetype_dep = dependency('FreeType',
++    # Try cmake name
++    freetype_dep = dependency('Freetype',
+                               version: freetype_min_version_actual,
+                               method: 'cmake',
+-                              required: get_option('freetype'),
+-                              default_options: ['harfbuzz=disabled'],
+-                              allow_fallback: true)
+-  endif
+-else
+-  # painful hack to handle multiple dependencies but also respect options
+-  freetype_opt = get_option('freetype')
+-  # we want to handle enabled manually after fallbacks, but also handle 
disabled normally
+-  if freetype_opt.enabled()
+-    freetype_opt = false
+-  endif
+-  # try pkg-config name
+-  freetype_dep = dependency('freetype2', version: freetype_min_version, 
method: 'pkg-config', required: freetype_opt)
+-  # when disabled, leave it not-found
+-  if not freetype_dep.found() and not get_option('freetype').disabled()
+-    # Try cmake name
+-    freetype_dep = dependency('Freetype', version: 
freetype_min_version_actual, method: 'cmake', required: false)
+-    # Subproject fallback, `allow_fallback: true` means the fallback will be
+-    # tried even if the freetype option is set to `auto`.
++                              required: false,
++                              allow_fallback: false)
++    # Subproject fallback
+     if not freetype_dep.found()
+-      freetype_dep = dependency('freetype2',
+-                                version: freetype_min_version,
+-                                method: 'pkg-config',
++      freetype_proj = subproject('freetype2',
++                                version: freetype_min_version_actual,
+                                 required: get_option('freetype'),
+-                                default_options: ['harfbuzz=disabled'],
+-                                allow_fallback: true)
++                                default_options: ['harfbuzz=disabled'])
++      if freetype_proj.found()
++        freetype_dep = freetype_proj.get_variable('freetype_dep')
++      else
++        freetype_dep = dependency('', required: false)
++      endif
+     endif
+   endif
+ endif
+-- 
+2.49.0
+

diff --git a/media-libs/harfbuzz/harfbuzz-10.4.0-r1.ebuild 
b/media-libs/harfbuzz/harfbuzz-10.4.0-r1.ebuild
new file mode 100644
index 000000000000..bb97d9a80568
--- /dev/null
+++ b/media-libs/harfbuzz/harfbuzz-10.4.0-r1.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit flag-o-matic meson-multilib python-any-r1 xdg-utils
+
+DESCRIPTION="An OpenType text shaping engine"
+HOMEPAGE="https://harfbuzz.github.io/";
+
+if [[ ${PV} == 9999 ]] ; then
+       EGIT_REPO_URI="https://github.com/harfbuzz/harfbuzz.git";
+       inherit git-r3
+else
+       
SRC_URI="https://github.com/harfbuzz/harfbuzz/releases/download/${PV}/${P}.tar.xz";
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc 
~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~x64-solaris"
+fi
+
+LICENSE="Old-MIT ISC icu"
+# 0.9.18 introduced the harfbuzz-icu split; bug #472416
+# 3.0.0 dropped some unstable APIs; bug #813705
+# 6.0.0 changed libharfbuzz-subset.so ABI
+SLOT="0/6.0.0"
+
+IUSE="+cairo debug doc experimental +glib +graphite icu +introspection test 
+truetype"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="introspection? ( glib )"
+
+RDEPEND="
+       cairo? ( x11-libs/cairo:=[${MULTILIB_USEDEP}] )
+       glib? ( >=dev-libs/glib-2.38:2[${MULTILIB_USEDEP}] )
+       graphite? ( >=media-gfx/graphite2-1.2.1:=[${MULTILIB_USEDEP}] )
+       icu? ( >=dev-libs/icu-51.2-r1:=[${MULTILIB_USEDEP}] )
+       introspection? ( >=dev-libs/gobject-introspection-1.34:= )
+       truetype? ( >=media-libs/freetype-2.5.0.1:2=[${MULTILIB_USEDEP}] )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       ${PYTHON_DEPS}
+       virtual/pkgconfig
+       doc? ( dev-util/gtk-doc )
+       introspection? ( dev-util/glib-utils )
+"
+
+FILES=( "${FILESDIR}/${P}-meson-harfbuzz.patch" ) # bug 950274
+
+src_prepare() {
+       default
+
+       xdg_environment_reset
+
+       # bug #790359
+       filter-flags -fexceptions -fthreadsafe-statics
+
+       if ! use debug ; then
+               append-cppflags -DHB_NDEBUG
+       fi
+}
+
+multilib_src_configure() {
+       # harfbuzz-gobject only used for introspection, bug #535852
+       local emesonargs=(
+               -Dcoretext=disabled
+               -Dchafa=disabled
+               -Dwasm=disabled
+
+               $(meson_feature cairo)
+               $(meson_feature glib)
+               $(meson_feature graphite graphite2)
+               $(meson_feature icu)
+               $(meson_feature introspection gobject)
+               $(meson_feature test tests)
+               $(meson_feature truetype freetype)
+
+               $(meson_native_use_feature doc docs)
+               $(meson_native_use_feature introspection)
+               # Breaks building tests..
+               #$(meson_native_use_feature utilities)
+
+               $(meson_use experimental experimental_api)
+       )
+
+       meson_src_configure
+}
+
+multilib_src_test() {
+       # harfbuzz:src / check-static-inits times out on hppa
+       meson_src_test --timeout-multiplier 5
+}

Reply via email to