Build scripts for HarfBuzz 3.1.1

Change-Id: I30f1fdcca02f20e6f8da01f7f93494511e3af505
Reviewed-on: https://flutter-review.googlesource.com/c/third_party/harfbuzz/+/24380
Reviewed-by: Dan Field <dnfield@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..b2ae138
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,295 @@
+# Copyright 2016 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+config("harfbuzz_config") {
+  include_dirs = [ "src" ]
+}
+
+config("harfbuzz_warnings") {
+  cflags = []
+  if (is_clang) {
+    cflags += [
+      "-Wno-missing-field-initializers",
+      "-Wno-unused-variable",
+      "-Wno-sign-compare",
+    ]
+  }
+}
+
+source_set("harfbuzz_sources") {
+  sources = [
+    "src/hb-aat-layout-ankr-table.hh",
+    "src/hb-aat-layout-bsln-table.hh",
+    "src/hb-aat-layout-common.hh",
+    "src/hb-aat-layout-feat-table.hh",
+    "src/hb-aat-layout-just-table.hh",
+    "src/hb-aat-layout-kerx-table.hh",
+    "src/hb-aat-layout-morx-table.hh",
+    "src/hb-aat-layout-opbd-table.hh",
+    "src/hb-aat-layout-trak-table.hh",
+    "src/hb-aat-layout.cc",
+    "src/hb-aat-layout.h",
+    "src/hb-aat-layout.hh",
+    "src/hb-aat-ltag-table.hh",
+    "src/hb-aat-map.cc",
+    "src/hb-aat-map.hh",
+    "src/hb-aat.h",
+    "src/hb-algs.hh",
+    "src/hb-array.hh",
+    "src/hb-atomic.hh",
+    "src/hb-bimap.hh",
+    "src/hb-blob.cc",
+    "src/hb-blob.h",
+    "src/hb-blob.hh",
+    "src/hb-buffer-deserialize-json.hh",
+    "src/hb-buffer-deserialize-text.hh",
+    "src/hb-buffer-serialize.cc",
+    "src/hb-buffer.cc",
+    "src/hb-buffer.h",
+    "src/hb-buffer.hh",
+    "src/hb-cache.hh",
+    "src/hb-cff-interp-common.hh",
+    "src/hb-cff-interp-cs-common.hh",
+    "src/hb-cff-interp-dict-common.hh",
+    "src/hb-cff1-interp-cs.hh",
+    "src/hb-cff2-interp-cs.hh",
+    "src/hb-common.cc",
+    "src/hb-common.h",
+    "src/hb-config.hh",
+    "src/hb-debug.hh",
+    "src/hb-deprecated.h",
+    "src/hb-directwrite.cc",
+    "src/hb-directwrite.h",
+    "src/hb-dispatch.hh",
+    "src/hb-draw.cc",
+    "src/hb-draw.h",
+    "src/hb-draw.hh",
+    "src/hb-face.cc",
+    "src/hb-face.h",
+    "src/hb-face.hh",
+    "src/hb-fallback-shape.cc",
+    "src/hb-font.cc",
+    "src/hb-font.h",
+    "src/hb-font.hh",
+    "src/hb-ft.cc",
+    "src/hb-ft.h",
+    "src/hb-gdi.cc",
+    "src/hb-gdi.h",
+    "src/hb-graphite2.cc",
+    "src/hb-graphite2.h",
+    "src/hb-icu.cc",
+    "src/hb-icu.h",
+    "src/hb-iter.hh",
+    "src/hb-kern.hh",
+    "src/hb-machinery.hh",
+    "src/hb-map.cc",
+    "src/hb-map.h",
+    "src/hb-map.hh",
+    "src/hb-meta.hh",
+    "src/hb-mutex.hh",
+    "src/hb-null.hh",
+    "src/hb-number-parser.hh",
+    "src/hb-number.cc",
+    "src/hb-number.hh",
+    "src/hb-object.hh",
+    "src/hb-open-file.hh",
+    "src/hb-open-type.hh",
+    "src/hb-ot-cff-common.hh",
+    "src/hb-ot-cff1-std-str.hh",
+    "src/hb-ot-cff1-table.cc",
+    "src/hb-ot-cff1-table.hh",
+    "src/hb-ot-cff2-table.cc",
+    "src/hb-ot-cff2-table.hh",
+    "src/hb-ot-cmap-table.hh",
+    "src/hb-ot-color-cbdt-table.hh",
+    "src/hb-ot-color-colr-table.hh",
+    "src/hb-ot-color-cpal-table.hh",
+    "src/hb-ot-color-sbix-table.hh",
+    "src/hb-ot-color-svg-table.hh",
+    "src/hb-ot-color.cc",
+    "src/hb-ot-color.h",
+    "src/hb-ot-deprecated.h",
+    "src/hb-ot-face-table-list.hh",
+    "src/hb-ot-face.cc",
+    "src/hb-ot-face.hh",
+    "src/hb-ot-font.cc",
+    "src/hb-ot-font.h",
+    "src/hb-ot-gasp-table.hh",
+    "src/hb-ot-glyf-table.hh",
+    "src/hb-ot-hdmx-table.hh",
+    "src/hb-ot-head-table.hh",
+    "src/hb-ot-hhea-table.hh",
+    "src/hb-ot-hmtx-table.hh",
+    "src/hb-ot-kern-table.hh",
+    "src/hb-ot-layout-base-table.hh",
+    "src/hb-ot-layout-common.hh",
+    "src/hb-ot-layout-gdef-table.hh",
+    "src/hb-ot-layout-gpos-table.hh",
+    "src/hb-ot-layout-gsub-table.hh",
+    "src/hb-ot-layout-gsubgpos.hh",
+    "src/hb-ot-layout-jstf-table.hh",
+    "src/hb-ot-layout.cc",
+    "src/hb-ot-layout.h",
+    "src/hb-ot-layout.hh",
+    "src/hb-ot-map.cc",
+    "src/hb-ot-map.hh",
+    "src/hb-ot-math-table.hh",
+    "src/hb-ot-math.cc",
+    "src/hb-ot-math.h",
+    "src/hb-ot-maxp-table.hh",
+    "src/hb-ot-meta-table.hh",
+    "src/hb-ot-meta.cc",
+    "src/hb-ot-meta.h",
+    "src/hb-ot-metrics.cc",
+    "src/hb-ot-metrics.h",
+    "src/hb-ot-metrics.hh",
+    "src/hb-ot-name-language-static.hh",
+    "src/hb-ot-name-language.hh",
+    "src/hb-ot-name-table.hh",
+    "src/hb-ot-name.cc",
+    "src/hb-ot-name.h",
+    "src/hb-ot-os2-table.hh",
+    "src/hb-ot-os2-unicode-ranges.hh",
+    "src/hb-ot-post-macroman.hh",
+    "src/hb-ot-post-table.hh",
+    "src/hb-ot-shape-complex-arabic-fallback.hh",
+    "src/hb-ot-shape-complex-arabic-joining-list.hh",
+    "src/hb-ot-shape-complex-arabic-table.hh",
+    "src/hb-ot-shape-complex-arabic-win1256.hh",
+    "src/hb-ot-shape-complex-arabic.cc",
+    "src/hb-ot-shape-complex-arabic.hh",
+    "src/hb-ot-shape-complex-default.cc",
+    "src/hb-ot-shape-complex-hangul.cc",
+    "src/hb-ot-shape-complex-hebrew.cc",
+    "src/hb-ot-shape-complex-indic-machine.hh",
+    "src/hb-ot-shape-complex-indic-table.cc",
+    "src/hb-ot-shape-complex-indic.cc",
+    "src/hb-ot-shape-complex-indic.hh",
+    "src/hb-ot-shape-complex-khmer-machine.hh",
+    "src/hb-ot-shape-complex-khmer.cc",
+    "src/hb-ot-shape-complex-khmer.hh",
+    "src/hb-ot-shape-complex-myanmar-machine.hh",
+    "src/hb-ot-shape-complex-myanmar.cc",
+    "src/hb-ot-shape-complex-myanmar.hh",
+    "src/hb-ot-shape-complex-syllabic.cc",
+    "src/hb-ot-shape-complex-syllabic.hh",
+    "src/hb-ot-shape-complex-thai.cc",
+    "src/hb-ot-shape-complex-use-machine.hh",
+    "src/hb-ot-shape-complex-use.cc",
+    "src/hb-ot-shape-complex-use.hh",
+    "src/hb-ot-shape-complex-vowel-constraints.cc",
+    "src/hb-ot-shape-complex-vowel-constraints.hh",
+    "src/hb-ot-shape-complex.hh",
+    "src/hb-ot-shape-fallback.cc",
+    "src/hb-ot-shape-fallback.hh",
+    "src/hb-ot-shape-normalize.cc",
+    "src/hb-ot-shape-normalize.hh",
+    "src/hb-ot-shape.cc",
+    "src/hb-ot-shape.h",
+    "src/hb-ot-shape.hh",
+    "src/hb-ot-stat-table.hh",
+    "src/hb-ot-tag-table.hh",
+    "src/hb-ot-tag.cc",
+    "src/hb-ot-var-avar-table.hh",
+    "src/hb-ot-var-fvar-table.hh",
+    "src/hb-ot-var-gvar-table.hh",
+    "src/hb-ot-var-hvar-table.hh",
+    "src/hb-ot-var-mvar-table.hh",
+    "src/hb-ot-var.cc",
+    "src/hb-ot-var.h",
+    "src/hb-ot-vorg-table.hh",
+    "src/hb-ot.h",
+    "src/hb-pool.hh",
+    "src/hb-sanitize.hh",
+    "src/hb-serialize.hh",
+    "src/hb-set-digest.hh",
+    "src/hb-set.cc",
+    "src/hb-set.h",
+    "src/hb-set.hh",
+    "src/hb-shape-plan.cc",
+    "src/hb-shape-plan.h",
+    "src/hb-shape-plan.hh",
+    "src/hb-shape.cc",
+    "src/hb-shape.h",
+    "src/hb-shaper-impl.hh",
+    "src/hb-shaper-list.hh",
+    "src/hb-shaper.cc",
+    "src/hb-shaper.hh",
+    "src/hb-static.cc",
+    "src/hb-string-array.hh",
+    "src/hb-style.cc",
+    "src/hb-style.h",
+    "src/hb-subset-cff-common.cc",
+    "src/hb-subset-cff-common.hh",
+    "src/hb-subset-cff1.cc",
+    "src/hb-subset-cff1.hh",
+    "src/hb-subset-cff2.cc",
+    "src/hb-subset-cff2.hh",
+    "src/hb-subset-input.cc",
+    "src/hb-subset-input.hh",
+    "src/hb-subset-plan.cc",
+    "src/hb-subset-plan.hh",
+    "src/hb-subset.cc",
+    "src/hb-subset.h",
+    "src/hb-subset.hh",
+    "src/hb-ucd-table.hh",
+    "src/hb-ucd.cc",
+    "src/hb-unicode-emoji-table.hh",
+    "src/hb-unicode.cc",
+    "src/hb-unicode.h",
+    "src/hb-unicode.hh",
+    "src/hb-uniscribe.cc",
+    "src/hb-uniscribe.h",
+    "src/hb-utf.hh",
+    "src/hb-vector.hh",
+    "src/hb-version.h",
+    "src/hb.h",
+    "src/hb.hh",
+  ]
+
+  defines = [
+    "HAVE_OT",
+    "HAVE_ICU",
+    "HAVE_ICU_BUILTIN",
+  ]
+
+  if (is_mac) {
+    sources += [
+      "src/hb-coretext.cc",
+      "src/hb-coretext.h",
+    ]
+    defines += [ "HAVE_CORETEXT" ]
+  }
+
+  if (is_linux || is_android || is_fuchsia) {
+    defines += [ "HAVE_PTHREAD" ]
+  }
+
+  configs += [ ":harfbuzz_warnings" ]
+
+  # Without this modification, almost everything ends up hidden in the shared library, making it
+  # useless for linking.
+  if (current_toolchain == shlib_toolchain) {
+    # Avoid failure when subtracting if not already present.
+    configs += [ "//build/config:symbol_visibility_hidden" ]
+    configs -= [ "//build/config:symbol_visibility_hidden" ]
+  }
+
+  public_configs = [ ":harfbuzz_config" ]
+
+  deps = [
+    "//third_party/freetype2",
+    "//third_party/icu:icuuc",
+  ]
+}
+
+source_set("harfbuzz") {
+  output_name = "harfbuzz"
+  public_deps = [ ":harfbuzz_sources" ]
+}
+
+shared_library("harfbuzz_shared") {
+  output_name = "harfbuzz"
+  public_deps = [ ":harfbuzz_sources" ]
+}
diff --git a/README.fuchsia b/README.fuchsia
new file mode 100644
index 0000000..55baee0
--- /dev/null
+++ b/README.fuchsia
@@ -0,0 +1,19 @@
+Name: harfbuzz
+Short Name: harfbuzz
+URL: http://harfbuzz.org
+Version: 3.1.1
+Upstream git: https://github.com/harfbuzz/harfbuzz
+Date: 20211108
+Security Critical: yes
+License: MIT
+License File: COPYING
+
+Description:
+This is harfbuzz, a text shaping engine.
+
+To upgrade this repo:
+* Pull in the latest updates from https://github.com/harfbuzz/harfbuzz.
+  If merging is not possible, remove all files except for BUILD.gn and
+  README.fuchsia and replace them with the upstream version.
+* Modify the BUILD.gn file to update the harfbuzz target for new sources.
+* Update version numbers and date in this document.