1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/chrome_build.gni")
6 import("//build/config/linux/pkg_config.gni")
7 import("//build/config/ui.gni")
9 # The GYP build supports system harfbuzz for non-official builds when using
10 # pangoft2 1.31.0 or greater (which pulls it in).
11 # TODO(brettw) we can consider doing this as well, although the benefit is
12 # unclear and requires shelling out to a script to check the version.
14 # ChromeOS uses an up-to-date system one that we have control over, so we
15 # don't want to bloat the binary more by including another copy.
18 # Since version 1.31.0, pangoft2 which we depend on pulls in harfbuzz
19 # anyways. However, we want to have control of the version of harfbuzz
20 # we use, so don't use system harfbuzz unless we are building for
21 # chrome os, where we have the system harfbuzz under control.
23 is_linux && is_chromeos && exec_script(pkg_config_script,
25 "--atleast-version=1.31.0",
31 if (use_system_harfbuzz) {
32 import("//build/config/linux/pkg_config.gni")
33 pkg_config("harfbuzz_pkgconfig") {
34 packages = [ "harfbuzz" ]
36 group("harfbuzz-ng") {
37 public_configs = [ ":harfbuzz_pkgconfig" ]
40 config("harfbuzz-ng_config") {
41 include_dirs = [ "src" ]
44 config("harfbuzz_warnings") {
50 # Harfbuzz uses unused typedefs for its static asserts (and its
51 # static asserts are strange enough that they can't be replaced
53 "-Wno-unused-local-typedef",
57 # Result of 32-bit shift implicitly converted to 64 bits.
58 cflags += [ "/wd4334" ]
62 # See also chrome/browser/ui/libgtk2ui/BUILD.gn which pulls this.
63 config("pangoft2_link_hack") {
64 if (is_linux && use_pango && !is_chromeos && !is_official_build &&
65 current_cpu != "arm" && current_cpu != "mipsel" &&
66 !is_component_build) {
67 # These symbols are referenced from libpangoft2, which will be
68 # dynamically linked later.
70 [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
74 static_library("harfbuzz-ng") {
76 "src/hb-atomic-private.hh",
79 "src/hb-buffer-deserialize-json.hh",
80 "src/hb-buffer-deserialize-text.hh",
81 "src/hb-buffer-private.hh",
82 "src/hb-buffer-serialize.cc",
85 "src/hb-cache-private.hh",
88 "src/hb-deprecated.h",
89 "src/hb-face-private.hh",
92 "src/hb-fallback-shape.cc",
93 "src/hb-font-private.hh",
98 "src/hb-mutex-private.hh",
99 "src/hb-object-private.hh",
100 "src/hb-open-file-private.hh",
101 "src/hb-open-type-private.hh",
104 "src/hb-ot-head-table.hh",
105 "src/hb-ot-hhea-table.hh",
106 "src/hb-ot-hmtx-table.hh",
107 "src/hb-ot-layout-common-private.hh",
108 "src/hb-ot-layout-gdef-table.hh",
109 "src/hb-ot-layout-gpos-table.hh",
110 "src/hb-ot-layout-gsub-table.hh",
111 "src/hb-ot-layout-gsubgpos-private.hh",
112 "src/hb-ot-layout-private.hh",
113 "src/hb-ot-layout.cc",
114 "src/hb-ot-layout.h",
115 "src/hb-ot-map-private.hh",
117 "src/hb-ot-maxp-table.hh",
118 "src/hb-ot-name-table.hh",
119 "src/hb-ot-shape-complex-arabic-fallback.hh",
120 "src/hb-ot-shape-complex-arabic-private.hh",
121 "src/hb-ot-shape-complex-arabic-table.hh",
122 "src/hb-ot-shape-complex-arabic.cc",
123 "src/hb-ot-shape-complex-default.cc",
124 "src/hb-ot-shape-complex-hangul.cc",
125 "src/hb-ot-shape-complex-hebrew.cc",
126 "src/hb-ot-shape-complex-indic-machine.hh",
127 "src/hb-ot-shape-complex-indic-private.hh",
128 "src/hb-ot-shape-complex-indic-table.cc",
129 "src/hb-ot-shape-complex-indic.cc",
130 "src/hb-ot-shape-complex-myanmar-machine.hh",
131 "src/hb-ot-shape-complex-myanmar.cc",
132 "src/hb-ot-shape-complex-private.hh",
133 "src/hb-ot-shape-complex-thai.cc",
134 "src/hb-ot-shape-complex-tibetan.cc",
135 "src/hb-ot-shape-complex-use-machine.hh",
136 "src/hb-ot-shape-complex-use-private.hh",
137 "src/hb-ot-shape-complex-use-table.cc",
138 "src/hb-ot-shape-complex-use.cc",
139 "src/hb-ot-shape-fallback-private.hh",
140 "src/hb-ot-shape-fallback.cc",
141 "src/hb-ot-shape-normalize-private.hh",
142 "src/hb-ot-shape-normalize.cc",
143 "src/hb-ot-shape-private.hh",
144 "src/hb-ot-shape.cc",
150 "src/hb-set-private.hh",
153 "src/hb-shape-plan-private.hh",
154 "src/hb-shape-plan.cc",
155 "src/hb-shape-plan.h",
158 "src/hb-shaper-impl-private.hh",
159 "src/hb-shaper-list.hh",
160 "src/hb-shaper-private.hh",
162 "src/hb-unicode-private.hh",
165 "src/hb-utf-private.hh",
178 configs -= [ "//build/config/compiler:chromium_code" ]
180 "//build/config/compiler:no_chromium_code",
182 # Must be after no_chromium_code for warning flags to be ordered
184 ":harfbuzz_warnings",
186 public_configs = [ ":harfbuzz-ng_config" ]
189 "//third_party/icu:icuuc",
194 "src/hb-coretext.cc",
197 defines += [ "HAVE_CORETEXT" ]
200 # When without -fvisibility=hidden for pango to use the harfbuzz
201 # in the tree, all symbols pango needs must be included, or
202 # pango uses mixed versions of harfbuzz and leads to crash.
203 # See crbug.com/462689.
204 if (is_linux && use_pango && !is_chromeos && !is_official_build &&
205 current_cpu != "arm" && current_cpu != "mipsel") {
206 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
208 "//build/config/linux:freetype2",
209 "//build/config/linux:glib",