From 5a4dcfd768984aaab0cf3e2caa2bfb593d59bce769091d5715717b001b8f010c Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Wed, 22 Sep 2021 17:19:46 +0000 Subject: [PATCH] Accepting request 920659 from home:Vogtinator:qt5.15 Third try: - Add patches from Arch to fix build with HarfBuzz 3.0.0: * chromium-harfbuzz-3.0.0.patch * skia-harfbuzz-3.0.0.patch - ... but don't break with < 2.9.0: * chromium-older-harfbuzz.patch OBS-URL: https://build.opensuse.org/request/show/920659 OBS-URL: https://build.opensuse.org/package/show/KDE:Qt:5.15/libqt5-qtwebengine?expand=0&rev=33 --- chromium-harfbuzz-3.0.0.patch | 24 ++++++++ chromium-older-harfbuzz.patch | 26 +++++++++ libqt5-qtwebengine.changes | 9 +++ libqt5-qtwebengine.spec | 4 ++ skia-harfbuzz-3.0.0.patch | 104 ++++++++++++++++++++++++++++++++++ 5 files changed, 167 insertions(+) create mode 100644 chromium-harfbuzz-3.0.0.patch create mode 100644 chromium-older-harfbuzz.patch create mode 100644 skia-harfbuzz-3.0.0.patch diff --git a/chromium-harfbuzz-3.0.0.patch b/chromium-harfbuzz-3.0.0.patch new file mode 100644 index 0000000..1cc2093 --- /dev/null +++ b/chromium-harfbuzz-3.0.0.patch @@ -0,0 +1,24 @@ +Subject: Fix build with harfbuzz 3.0.0 + +Upstream backport copied from Arch and rebased. + +# https://github.com/chromium/chromium/commit/b289f6f3fcbc + +diff --git a/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc b/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc +index 8ff0540d9a..20a7d37474 100644 +--- a/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc ++++ b/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc +@@ -72,9 +72,11 @@ sk_sp SubsetFont(SkTypeface* typeface, const GlyphUsage& usage) { + hb_set_t* glyphs = + hb_subset_input_glyph_set(input.get()); // Owned by |input|. + usage.ForEach(base::BindRepeating(&AddGlyphs, base::Unretained(glyphs))); +- hb_subset_input_set_retain_gids(input.get(), true); ++ hb_subset_input_set_flags(input.get(), HB_SUBSET_FLAGS_RETAIN_GIDS); + +- HbScoped subset_face(hb_subset(face.get(), input.get())); ++ HbScoped subset_face(hb_subset_or_fail(face.get(), input.get())); ++ if (!subset_face) ++ return nullptr; + HbScoped subset_blob(hb_face_reference_blob(subset_face.get())); + if (!subset_blob) + return nullptr; diff --git a/chromium-older-harfbuzz.patch b/chromium-older-harfbuzz.patch new file mode 100644 index 0000000..694cd95 --- /dev/null +++ b/chromium-older-harfbuzz.patch @@ -0,0 +1,26 @@ +From: Fabian Vogt +Subject: Fix build with harfbuzz < 2.9.0 + +Index: qtwebengine-everywhere-src-5.15.6/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc +=================================================================== +--- qtwebengine-everywhere-src-5.15.6.orig/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc ++++ qtwebengine-everywhere-src-5.15.6/src/3rdparty/chromium/components/paint_preview/common/subset_font.cc +@@ -71,11 +71,18 @@ sk_sp SubsetFont(SkTypeface* typ + hb_set_t* glyphs = + hb_subset_input_glyph_set(input.get()); // Owned by |input|. + usage.ForEach(base::BindRepeating(&AddGlyphs, base::Unretained(glyphs))); ++#if HB_VERSION_ATLEAST(2,9,0) + hb_subset_input_set_flags(input.get(), HB_SUBSET_FLAGS_RETAIN_GIDS); + + HbScoped subset_face(hb_subset_or_fail(face.get(), input.get())); + if (!subset_face) + return nullptr; ++#else ++ hb_subset_input_set_retain_gids(input.get(), true); ++ ++ HbScoped subset_face(hb_subset(face.get(), input.get())); ++#endif ++ + HbScoped subset_blob(hb_face_reference_blob(subset_face.get())); + if (!subset_blob) + return nullptr; diff --git a/libqt5-qtwebengine.changes b/libqt5-qtwebengine.changes index 99ee79e..a9f6c87 100644 --- a/libqt5-qtwebengine.changes +++ b/libqt5-qtwebengine.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Sep 21 11:34:41 UTC 2021 - Fabian Vogt + +- Add patches from Arch to fix build with HarfBuzz 3.0.0: + * chromium-harfbuzz-3.0.0.patch + * skia-harfbuzz-3.0.0.patch +- ... but don't break with < 2.9.0: + * chromium-older-harfbuzz.patch + ------------------------------------------------------------------- Thu Sep 09 07:19:58 UTC 2021 - christophe@krop.fr diff --git a/libqt5-qtwebengine.spec b/libqt5-qtwebengine.spec index 3f67d63..4661e51 100644 --- a/libqt5-qtwebengine.spec +++ b/libqt5-qtwebengine.spec @@ -54,6 +54,10 @@ Patch5: chromium-glibc-2.33.patch Patch6: 0001-Fix-build-with-glibc-2.34.patch # PATCH-FIX-UPSTREAM Patch7: 0001-return-ENOSYS-for-clone3.patch +Patch8: chromium-harfbuzz-3.0.0.patch +Patch9: skia-harfbuzz-3.0.0.patch +# PATCH-FIX-OPENSUSE +Patch10: chromium-older-harfbuzz.patch # http://www.chromium.org/blink is not ported to PowerPC & s390 ExcludeArch: ppc ppc64 ppc64le s390 s390x # Try to fix i586 MemoryErrors with rpmlint diff --git a/skia-harfbuzz-3.0.0.patch b/skia-harfbuzz-3.0.0.patch new file mode 100644 index 0000000..bac60fa --- /dev/null +++ b/skia-harfbuzz-3.0.0.patch @@ -0,0 +1,104 @@ +Subject: Fix build with harfbuzz 3.0.0 + +Upstream backport copied from Arch and rebased. + +# Minimal diff for harfbuzz 3.0.0 support; based on: +# https://github.com/google/skia/commit/66684b17b382 +# https://github.com/google/skia/commit/51d83abcd24a + +diff --git a/src/3rdparty/chromium/third_party/skia/gn/skia.gni b/src/3rdparty/chromium/third_party/skia/gn/skia.gni +index d98fdc19ee..199335d5c4 100644 +--- a/src/3rdparty/chromium/third_party/skia/gn/skia.gni ++++ b/src/3rdparty/chromium/third_party/skia/gn/skia.gni +@@ -34,8 +34,6 @@ declare_args() { + skia_include_multiframe_procs = false + skia_lex = false + skia_libgifcodec_path = "third_party/externals/libgifcodec" +- skia_pdf_subset_harfbuzz = +- false # TODO: set skia_pdf_subset_harfbuzz to skia_use_harfbuzz. + skia_qt_path = getenv("QT_PATH") + skia_skqp_global_error_tolerance = 0 + skia_tools_require_resources = false +@@ -99,6 +97,10 @@ declare_args() { + skia_use_libfuzzer_defaults = true + } + ++declare_args() { ++ skia_pdf_subset_harfbuzz = skia_use_harfbuzz ++} ++ + declare_args() { + skia_compile_sksl_tests = skia_compile_processors + skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype +diff --git a/src/3rdparty/chromium/third_party/skia/src/pdf/SkPDFSubsetFont.cpp b/src/3rdparty/chromium/third_party/skia/src/pdf/SkPDFSubsetFont.cpp +index 81c37eef3a..2340a7937b 100644 +--- a/src/3rdparty/chromium/third_party/skia/src/pdf/SkPDFSubsetFont.cpp ++++ b/src/3rdparty/chromium/third_party/skia/src/pdf/SkPDFSubsetFont.cpp +@@ -49,6 +49,37 @@ static sk_sp to_data(HBBlob blob) { + blob.release()); + } + ++template using void_t = void; ++template ++struct SkPDFHarfBuzzSubset { ++ // This is the HarfBuzz 3.0 interface. ++ // hb_subset_flags_t does not exist in 2.0. It isn't dependent on T, so inline the value of ++ // HB_SUBSET_FLAGS_RETAIN_GIDS until 2.0 is no longer supported. ++ static HBFace Make(T input, hb_face_t* face) { ++ // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY. ++ // If it isn't known if a font is 'tricky', retain the hints. ++ hb_subset_input_set_flags(input, 2/*HB_SUBSET_FLAGS_RETAIN_GIDS*/); ++ return HBFace(hb_subset_or_fail(face, input)); ++ } ++}; ++template ++struct SkPDFHarfBuzzSubset(), std::declval())), ++ decltype(hb_subset_input_set_drop_hints(std::declval(), std::declval())), ++ decltype(hb_subset(std::declval(), std::declval())) ++ >> ++{ ++ // This is the HarfBuzz 2.0 (non-public) interface, used if it exists. ++ // This code should be removed as soon as all users are migrated to the newer API. ++ static HBFace Make(T input, hb_face_t* face) { ++ hb_subset_input_set_retain_gids(input, true); ++ // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY. ++ // If it isn't known if a font is 'tricky', retain the hints. ++ hb_subset_input_set_drop_hints(input, false); ++ return HBFace(hb_subset(face, input)); ++ } ++}; ++ + static sk_sp subset_harfbuzz(sk_sp fontData, + const SkPDFGlyphUse& glyphUsage, + int ttcIndex) { +@@ -71,11 +102,10 @@ static sk_sp subset_harfbuzz(sk_sp fontData, + hb_set_t* glyphs = hb_subset_input_glyph_set(input.get()); + glyphUsage.getSetValues([&glyphs](unsigned gid) { hb_set_add(glyphs, gid);}); + +- hb_subset_input_set_retain_gids(input.get(), true); +- // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY. +- // If it isn't known if a font is 'tricky', retain the hints. +- hb_subset_input_set_drop_hints(input.get(), false); +- HBFace subset(hb_subset(face.get(), input.get())); ++ HBFace subset = SkPDFHarfBuzzSubset::Make(input.get(), face.get()); ++ if (!subset) { ++ return nullptr; ++ } + HBBlob result(hb_face_reference_blob(subset.get())); + return to_data(std::move(result)); + } +diff --git a/src/3rdparty/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn b/src/3rdparty/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn +index 173830de62..4156607ef9 100644 +--- a/src/3rdparty/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn ++++ b/src/3rdparty/chromium/third_party/skia/third_party/harfbuzz/BUILD.gn +@@ -14,6 +14,9 @@ if (skia_use_system_harfbuzz) { + system("harfbuzz") { + include_dirs = [ "/usr/include/harfbuzz" ] + libs = [ "harfbuzz" ] ++ if (skia_pdf_subset_harfbuzz) { ++ libs += [ "harfbuzz-subset" ] ++ } + } + } else { + third_party("harfbuzz") {