From 0d71120fc2babf2e357321b871c7d3e6aa195cc7 Mon Sep 17 00:00:00 2001 From: Benjamin Oldenburg Date: Thu, 28 Apr 2022 15:32:04 -0700 Subject: [PATCH] [harfbuzz] Update to 4.2.0 (#24144) * updated harfbuzz from 3.2.0 to 4.2.0 * updated version * Update ports/harfbuzz/vcpkg.json Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> * updated version * Removed paths from library definitions in *.pc files in case of windows static build\nRemoved patches * version-semver -> version * Delete no longer applied patches. Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Billy Robert O'Neal III --- .../0001-circumvent-samefile-error.patch | 42 ------------------ ports/harfbuzz/0002-fix-uwp-build.patch | 15 ------- ports/harfbuzz/fix-macos-build.diff | 43 ------------------- ports/harfbuzz/fix-mingw-build.patch | 17 -------- ports/harfbuzz/portfile.cmake | 28 +++++++----- ports/harfbuzz/vcpkg.json | 3 +- versions/baseline.json | 4 +- versions/h-/harfbuzz.json | 5 +++ 8 files changed, 25 insertions(+), 132 deletions(-) delete mode 100755 ports/harfbuzz/0001-circumvent-samefile-error.patch delete mode 100644 ports/harfbuzz/0002-fix-uwp-build.patch delete mode 100644 ports/harfbuzz/fix-macos-build.diff delete mode 100644 ports/harfbuzz/fix-mingw-build.patch diff --git a/ports/harfbuzz/0001-circumvent-samefile-error.patch b/ports/harfbuzz/0001-circumvent-samefile-error.patch deleted file mode 100755 index 40aaac0b4d..0000000000 --- a/ports/harfbuzz/0001-circumvent-samefile-error.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/src/gen-harfbuzzcc.py b/src/gen-harfbuzzcc.py -index b25bcc7..f3bc87a 100644 ---- a/src/gen-harfbuzzcc.py -+++ b/src/gen-harfbuzzcc.py -@@ -15,4 +15,8 @@ with open (OUTPUT, "wb") as f: - f.write ("".join ('#include "{}"\n'.format (os.path.basename (x)) for x in sources if x.endswith (".cc")).encode ()) - - # copy it also to src/ --shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))) -+src = OUTPUT -+dst = os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT)) -+# Avoid SameFileError -+if not os.path.samefile(src, dst): -+ shutil.copyfile (src, dst) -diff --git a/src/gen-hb-version.py b/src/gen-hb-version.py -index 879811f..c376721 100644 ---- a/src/gen-hb-version.py -+++ b/src/gen-hb-version.py -@@ -33,4 +33,8 @@ with open (INPUT, "r", encoding='utf-8') as template: - .encode ()) - - # copy it also to src/ --shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))) -+src = OUTPUT -+dst = os.path.join(CURRENT_SOURCE_DIR, os.path.basename (OUTPUT)) -+# Avoid SameFileError if src and dst is the same -+if not os.path.samefile(src, dst): -+ shutil.copyfile (src, dst) -diff --git a/src/gen-ragel-artifacts.py b/src/gen-ragel-artifacts.py -index d22e03a..2b1e819 100644 ---- a/src/gen-ragel-artifacts.py -+++ b/src/gen-ragel-artifacts.py -@@ -22,4 +22,8 @@ hh = rl.replace ('.rl', '.hh') - subprocess.Popen (ragel.split() + ['-e', '-F1', '-o', hh, rl], cwd=outdir).wait () - - # copy it also to src/ --shutil.copyfile (os.path.join (outdir, hh), os.path.join (CURRENT_SOURCE_DIR, hh)) -+src = os.path.join (outdir, hh) -+dst = os.path.join (CURRENT_SOURCE_DIR, hh) -+# Avoid SameFileError -+if not os.path.samefile(src, dst): -+ shutil.copyfile (src, dst) diff --git a/ports/harfbuzz/0002-fix-uwp-build.patch b/ports/harfbuzz/0002-fix-uwp-build.patch deleted file mode 100644 index beb5ce750e..0000000000 --- a/ports/harfbuzz/0002-fix-uwp-build.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/src/hb-ft.cc b/src/hb-ft.cc -index 1900f30..add9917 100644 ---- a/src/hb-ft.cc -+++ b/src/hb-ft.cc -@@ -31,6 +31,10 @@ - - #include "hb-ft.h" - -+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) -+#define generic GenericFromFreeTypeLibrary -+#endif -+ - #include "hb-font.hh" - #include "hb-machinery.hh" - #include "hb-cache.hh" diff --git a/ports/harfbuzz/fix-macos-build.diff b/ports/harfbuzz/fix-macos-build.diff deleted file mode 100644 index 3d0f8b5ceb..0000000000 --- a/ports/harfbuzz/fix-macos-build.diff +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc -index 5f383064c4..6ccc1b0a2b 100644 ---- a/src/hb-coretext.cc -+++ b/src/hb-coretext.cc -@@ -897,7 +897,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, - DEBUG_MSG (CORETEXT, nullptr, "Num runs: %d", num_runs); - - buffer->len = 0; -- uint32_t status_and = ~0, status_or = 0; -+ uint32_t status_or = 0; - CGFloat advances_so_far = 0; - /* For right-to-left runs, CoreText returns the glyphs positioned such that - * any trailing whitespace is to the left of (0,0). Adjust coordinate system -@@ -918,7 +918,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, - CTRunRef run = static_cast(CFArrayGetValueAtIndex (glyph_runs, i)); - CTRunStatus run_status = CTRunGetStatus (run); - status_or |= run_status; -- status_and &= run_status; - DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status); - CGFloat run_advance = CTRunGetTypographicBounds (run, range_all, nullptr, nullptr, nullptr); - if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction)) -@@ -1140,21 +1139,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, - buffer->len += num_glyphs; - } - -- /* Mac OS 10.6 doesn't have kCTTypesetterOptionForcedEmbeddingLevel, -- * or if it does, it doesn't respect it. So we get runs with wrong -- * directions. As such, disable the assert... It wouldn't crash, but -- * cursoring will be off... -- * -- * https://crbug.com/419769 -- */ -- if (false) -- { -- /* Make sure all runs had the expected direction. */ -- HB_UNUSED bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction); -- assert (bool (status_and & kCTRunStatusRightToLeft) == backward); -- assert (bool (status_or & kCTRunStatusRightToLeft) == backward); -- } -- - buffer->clear_positions (); - - unsigned int count = buffer->len; diff --git a/ports/harfbuzz/fix-mingw-build.patch b/ports/harfbuzz/fix-mingw-build.patch deleted file mode 100644 index 25fa366223..0000000000 --- a/ports/harfbuzz/fix-mingw-build.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/meson.build b/meson.build -index 41344b3a33..8fb68f296a 100644 ---- a/meson.build -+++ b/meson.build -@@ -57,6 +57,12 @@ if host_machine.cpu_family() == 'arm' and cpp.alignment('struct { char c; }') != - endif - endif - -+if host_machine.system() == 'windows' -+ add_project_arguments(cpp.get_supported_arguments([ -+ '-Wa,-mbig-obj' -+ ]), language : 'cpp') -+endif -+ - check_headers = [ - ['unistd.h'], - ['sys/mman.h'], diff --git a/ports/harfbuzz/portfile.cmake b/ports/harfbuzz/portfile.cmake index a597b5f1f3..426150b7c9 100644 --- a/ports/harfbuzz/portfile.cmake +++ b/ports/harfbuzz/portfile.cmake @@ -1,18 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO harfbuzz/harfbuzz - REF 3.2.0 - SHA512 5d8c629416c0bc557b83e8d9d731d41b9e8ee3abc74590e65ed6ca67d74d3a440d038134313f17a7b1b14ef0fc1ecf8bb87113fdcf5f0c8d3dc3d2eeb9b08c18 + REF 4.2.0 + SHA512 2aff1e6a41d6186b71f2915296c46c0b2ffc67371e1f05c13a62c237ff7a84d7d78d414d7a395e1616a2861c83c4792ef5936a492713780564b994d18e2d3e38 HEAD_REF master - PATCHES - # This patch is a workaround that is needed until the following issues are resolved upstream: - # - https://github.com/mesonbuild/meson/issues/8375 - # - https://github.com/harfbuzz/harfbuzz/issues/2870 - # Details: https://github.com/microsoft/vcpkg/issues/16262 - 0001-circumvent-samefile-error.patch - 0002-fix-uwp-build.patch - fix-macos-build.diff # fixes https://github.com/harfbuzz/harfbuzz/issues/3484 - fix-mingw-build.patch # https://github.com/harfbuzz/harfbuzz/pull/3385 ) if("icu" IN_LIST FEATURES) @@ -65,6 +56,21 @@ vcpkg_install_meson() vcpkg_copy_pdbs() vcpkg_fixup_pkgconfig() +if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(GLOB PC_FILES + "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/*.pc" + "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/*.pc") + + foreach(PC_FILE IN LISTS PC_FILES) + file(READ "${PC_FILE}" PC_FILE_CONTENT) + string(REGEX REPLACE + "\\$\\{prefix\}\\/lib\\/([a-zA-Z0-9\-]*)\\.lib" + "-l\\1" PC_FILE_CONTENT + "${PC_FILE_CONTENT}") + file(WRITE "${PC_FILE}" ${PC_FILE_CONTENT}) + endforeach() +endif() + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake") configure_file("${CMAKE_CURRENT_LIST_DIR}/harfbuzzConfig.cmake.in" diff --git a/ports/harfbuzz/vcpkg.json b/ports/harfbuzz/vcpkg.json index 701d00f86f..9d86ed458a 100644 --- a/ports/harfbuzz/vcpkg.json +++ b/ports/harfbuzz/vcpkg.json @@ -1,7 +1,6 @@ { "name": "harfbuzz", - "version-semver": "3.2.0", - "port-version": 3, + "version": "4.2.0", "description": "HarfBuzz OpenType text shaping engine", "homepage": "https://github.com/harfbuzz/harfbuzz", "license": "MIT-Modern-Variant", diff --git a/versions/baseline.json b/versions/baseline.json index ba1df1b576..13ce44f1cf 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2721,8 +2721,8 @@ "port-version": 0 }, "harfbuzz": { - "baseline": "3.2.0", - "port-version": 3 + "baseline": "4.2.0", + "port-version": 0 }, "hash-library": { "baseline": "8", diff --git a/versions/h-/harfbuzz.json b/versions/h-/harfbuzz.json index f6416d8e1d..32ecc780ae 100644 --- a/versions/h-/harfbuzz.json +++ b/versions/h-/harfbuzz.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "02ad2865be7815604bb2c0e6cbc368f3d23d93d6", + "version": "4.2.0", + "port-version": 0 + }, { "git-tree": "1c4a2589742ad6156667771b0cf38ecb46e8c797", "version-semver": "3.2.0",