From 036191f27b322e23f836a7a59f41598563d9208c Mon Sep 17 00:00:00 2001
From: Simon Hausmann <simon.hausmann@qt.io>
Date: Mon, 11 Nov 2019 10:37:29 +0100
Subject: [PATCH] Make it possible to find harfbuzz with cmake

Include commit 9e9a36ee651502b69717895385387951a2d0802a from upstream to
prevent an infinite loop when using find_package(harfbuzz).

Change-Id: I6a1d2a4ca677193dfa8eca6e2015888adc3a3012
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
---
 .../harfbuzz/harfbuzz_%.bbappend              |  4 +++
 ...p-when-walking-up-the-directory-hier.patch | 31 +++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 meta-boot2qt-distro/recipes-graphics/harfbuzz/harfbuzz_%.bbappend
 create mode 100644 meta-boot2qt-distro/recipes-graphics/harfbuzz/patches/0001-Fix-infinite-loop-when-walking-up-the-directory-hier.patch

diff --git a/meta-boot2qt-distro/recipes-graphics/harfbuzz/harfbuzz_%.bbappend b/meta-boot2qt-distro/recipes-graphics/harfbuzz/harfbuzz_%.bbappend
new file mode 100644
index 00000000..bbdd6b1f
--- /dev/null
+++ b/meta-boot2qt-distro/recipes-graphics/harfbuzz/harfbuzz_%.bbappend
@@ -0,0 +1,4 @@
+FILESEXTRAPATHS_append := ":${THISDIR}/patches"
+SRC_URI += "\
+    file://0001-Fix-infinite-loop-when-walking-up-the-directory-hier.patch \
+"
diff --git a/meta-boot2qt-distro/recipes-graphics/harfbuzz/patches/0001-Fix-infinite-loop-when-walking-up-the-directory-hier.patch b/meta-boot2qt-distro/recipes-graphics/harfbuzz/patches/0001-Fix-infinite-loop-when-walking-up-the-directory-hier.patch
new file mode 100644
index 00000000..4415eae0
--- /dev/null
+++ b/meta-boot2qt-distro/recipes-graphics/harfbuzz/patches/0001-Fix-infinite-loop-when-walking-up-the-directory-hier.patch
@@ -0,0 +1,31 @@
+From 9e9a36ee651502b69717895385387951a2d0802a Mon Sep 17 00:00:00 2001
+From: Volker Krause <vkrause@kde.org>
+Date: Thu, 27 Sep 2018 16:33:49 +0200
+Subject: [PATCH] Fix infinite loop when walking up the directory hierarchy
+ (#1183)
+
+A single find_package(harfbuzz) line in user code resulted in this loop
+getting stuck when _harfbuzz_libdir_iter became "/".
+---
+ src/harfbuzz-config.cmake.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/harfbuzz-config.cmake.in b/src/harfbuzz-config.cmake.in
+index 87b15721..304410d9 100644
+--- a/src/harfbuzz-config.cmake.in
++++ b/src/harfbuzz-config.cmake.in
+@@ -12,7 +12,11 @@ set(_harfbuzz_libdir "@libdir@")
+ string(REPLACE "${_harfbuzz_remove_string}/" "" _harfbuzz_libdir "${_harfbuzz_libdir}")
+ set(_harfbuzz_libdir_iter "${_harfbuzz_libdir}")
+ while (_harfbuzz_libdir_iter)
++  set(_harfbuzz_libdir_prev_iter "${_harfbuzz_libdir_iter}")
+   get_filename_component(_harfbuzz_libdir_iter "${_harfbuzz_libdir_iter}" DIRECTORY)
++  if (_harfbuzz_libdir_prev_iter STREQUAL _harfbuzz_libdir_iter)
++    break()
++  endif ()
+   get_filename_component(_harfbuzz_prefix "${_harfbuzz_prefix}" DIRECTORY)
+ endwhile ()
+ unset(_harfbuzz_libdir_iter)
+-- 
+2.20.1
+
-- 
GitLab