Skip to content

Commit

Permalink
[bazel] Move harfbuzz out of third_party/BUILD.bazel
Browse files Browse the repository at this point in the history
Like Freetype and ICU, this creates a new Bazel workspace
to house the config-override.h file for inclusion.

Change-Id: I5acb45230acdce7dc17fbef02813a1f80175bda5
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/559516
Reviewed-by: Ben Wagner <[email protected]>
  • Loading branch information
kjlubick committed Jul 18, 2022
1 parent 87c0fe1 commit 0a5bcd1
Show file tree
Hide file tree
Showing 9 changed files with 312 additions and 272 deletions.
12 changes: 12 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ local_repository(
path = "bazel/external/freetype/config",
)

new_local_repository(
name = "harfbuzz",
build_file = "bazel/external/harfbuzz/BUILD.bazel",
path = "third_party/externals/harfbuzz",
workspace_file_content = "",
)

local_repository(
name = "harfbuzz_config",
path = "bazel/external/harfbuzz/config",
)

new_local_repository(
name = "icu",
build_file = "bazel/external/icu/BUILD.bazel",
Expand Down
285 changes: 285 additions & 0 deletions bazel/external/harfbuzz/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
# This file will be copied into //third_party/externals/harfbuzz via the new_local_repository
# rule in WORKSPACE.bazel, so all files should be relative to that path.

genrule(
name = "copy_config_override",
srcs = [
"@harfbuzz_config//:config-override.h",
],
outs = [
# Putting this in the root of the harfbuzz directory makes it easiest to include.
"config-override.h",
],
# $< is the one and only input file.
# $@ is the one and only output location.
cmd = "cp $< $@",
)

HARFBUZZ_HDRS = [
"src/hb-aat-layout.h",
"src/hb-blob.h",
"src/hb-buffer.h",
"src/hb-common.h",
"src/hb-deprecated.h",
"src/hb-face.h",
"src/hb-font.h",
"src/hb-map.h",
"src/hb-ot-font.h",
"src/hb-ot-layout.h",
"src/hb-ot-math.h",
"src/hb-ot-metrics.h",
"src/hb-ot-shape.h",
"src/hb-ot-var.h",
"src/hb-ot.h",
"src/hb-set.h",
"src/hb-shape-plan.h",
"src/hb-shape.h",
"src/hb-style.h",
"src/hb-subset.h",
"src/hb-unicode.h",
"src/hb-version.h",
"src/hb.h",
]

HARFBUZZ_SRCS = [
"src/OT/Layout/GSUB/AlternateSet.hh",
"src/OT/Layout/GSUB/AlternateSubst.hh",
"src/OT/Layout/GSUB/AlternateSubstFormat1.hh",
"src/OT/Layout/GSUB/ChainContextSubst.hh",
"src/OT/Layout/GSUB/Common.hh",
"src/OT/Layout/GSUB/ContextSubst.hh",
"src/OT/Layout/GSUB/ExtensionSubst.hh",
"src/OT/Layout/GSUB/GSUB.hh",
"src/OT/Layout/GSUB/Ligature.hh",
"src/OT/Layout/GSUB/LigatureSet.hh",
"src/OT/Layout/GSUB/LigatureSubst.hh",
"src/OT/Layout/GSUB/LigatureSubstFormat1.hh",
"src/OT/Layout/GSUB/MultipleSubst.hh",
"src/OT/Layout/GSUB/MultipleSubstFormat1.hh",
"src/OT/Layout/GSUB/ReverseChainSingleSubst.hh",
"src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh",
"src/OT/Layout/GSUB/Sequence.hh",
"src/OT/Layout/GSUB/SingleSubst.hh",
"src/OT/Layout/GSUB/SingleSubstFormat1.hh",
"src/OT/Layout/GSUB/SingleSubstFormat2.hh",
"src/OT/Layout/GSUB/SubstLookup.hh",
"src/OT/Layout/GSUB/SubstLookupSubTable.hh",
"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.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-bit-page.hh",
"src/hb-bit-set-invertible.hh",
"src/hb-bit-set.hh",
"src/hb-blob.cc",
"src/hb-blob.hh",
"src/hb-buffer-deserialize-json.hh",
"src/hb-buffer-deserialize-text.hh",
"src/hb-buffer-serialize.cc",
"src/hb-buffer-verify.cc",
"src/hb-buffer.cc",
"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-config.hh",
"src/hb-debug.hh",
"src/hb-dispatch.hh",
"src/hb-draw.cc",
"src/hb-draw.h",
"src/hb-draw.hh",
"src/hb-face.cc",
"src/hb-face.hh",
"src/hb-font.cc",
"src/hb-font.hh",
"src/hb-iter.hh",
"src/hb-kern.hh",
"src/hb-machinery.hh",
"src/hb-map.cc",
"src/hb-map.hh",
"src/hb-meta.hh",
"src/hb-ms-feature-ranges.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-colrv1-closure.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-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.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-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.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-v2subset.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.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-table.hh",
"src/hb-ot-shape-complex-use.cc",
"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.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-common.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-vorg-table.hh",
"src/hb-pool.hh",
"src/hb-priority-queue.hh",
"src/hb-repacker.hh",
"src/hb-sanitize.hh",
"src/hb-serialize.hh",
"src/hb-set-digest.hh",
"src/hb-set.cc",
"src/hb-set.hh",
"src/hb-shape-plan.cc",
"src/hb-shape-plan.hh",
"src/hb-shape.cc",
"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-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-repacker.cc",
"src/hb-subset-repacker.h",
"src/hb-subset.cc",
"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.hh",
"src/hb-utf.hh",
"src/hb-vector.hh",
"src/hb.hh",
"config-override.h",
]

cc_library(
name = "harfbuzz",
srcs = HARFBUZZ_SRCS,
hdrs = HARFBUZZ_HDRS,
defines = [
"HAVE_OT",
"HAVE_CONFIG_OVERRIDE_H",
"HB_NO_FALLBACK_SHAPE",
"HB_NO_WIN1256",
],
includes = [
"src",
],
visibility = ["//visibility:public"],
)
6 changes: 6 additions & 0 deletions bazel/external/harfbuzz/config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
exports_files(
[
"config-override.h",
],
visibility = ["//visibility:public"],
)
3 changes: 3 additions & 0 deletions bazel/external/harfbuzz/config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file represents the custom configuration of how we build Harfbuzz.

The files here are symlinked from //third_party/harfbuzz
3 changes: 3 additions & 0 deletions bazel/external/harfbuzz/config/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This blank WORKSPACE.bazel simply indicates that this folder is a distinct Bazel workspace
# from the main Skia one. This avoids a circular dependency by having Skia depend on harfbuzz
# and harfbuzz trying to use configuration files from Skia.
1 change: 1 addition & 0 deletions bazel/external/harfbuzz/config/config-override.h
2 changes: 1 addition & 1 deletion modules/skparagraph/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cc_library(
"//:skia_internal",
"//modules/skshaper",
"//modules/skunicode",
"//third_party:harfbuzz",
"@harfbuzz",
"@icu",
],
)
2 changes: 1 addition & 1 deletion modules/skshaper/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cc_library(
"//:skia_internal",
] + select({
"//bazel/common_config_settings:harfbuzz_shaper": [
"//third_party:harfbuzz",
"@harfbuzz",
"//modules/skunicode",
],
"//conditions:default": [],
Expand Down
Loading

0 comments on commit 0a5bcd1

Please sign in to comment.