Enhance the material design ripple API so the ripple's state can be controlled by...
[chromium-blink-merge.git] / third_party / harfbuzz-ng / BUILD.gn
blob144130af1cab79d01df6bdfda2770fd898cc1c4a
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.
17 declare_args() {
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.
22   use_system_harfbuzz =
23       is_linux && is_chromeos && exec_script(pkg_config_script,
24                                              pkg_config_args + [
25                                                    "--atleast-version=1.31.0",
26                                                    "pangoft2",
27                                                  ],
28                                              "value")
31 if (use_system_harfbuzz) {
32   import("//build/config/linux/pkg_config.gni")
33   pkg_config("harfbuzz_pkgconfig") {
34     packages = [ "harfbuzz" ]
35   }
36   group("harfbuzz-ng") {
37     public_configs = [ ":harfbuzz_pkgconfig" ]
38   }
39 } else {
40   config("harfbuzz-ng_config") {
41     include_dirs = [ "src" ]
42   }
44   static_library("harfbuzz-ng") {
45     sources = [
46       "src/hb-atomic-private.hh",
47       "src/hb-blob.cc",
48       "src/hb-blob.h",
49       "src/hb-buffer-deserialize-json.hh",
50       "src/hb-buffer-deserialize-text.hh",
51       "src/hb-buffer-private.hh",
52       "src/hb-buffer-serialize.cc",
53       "src/hb-buffer.cc",
54       "src/hb-buffer.h",
55       "src/hb-cache-private.hh",
56       "src/hb-common.cc",
57       "src/hb-common.h",
58       "src/hb-deprecated.h",
59       "src/hb-face-private.hh",
60       "src/hb-face.cc",
61       "src/hb-face.h",
62       "src/hb-fallback-shape.cc",
63       "src/hb-font-private.hh",
64       "src/hb-font.cc",
65       "src/hb-font.h",
66       "src/hb-icu.cc",
67       "src/hb-icu.h",
68       "src/hb-mutex-private.hh",
69       "src/hb-object-private.hh",
70       "src/hb-open-file-private.hh",
71       "src/hb-open-type-private.hh",
72       "src/hb-ot-font.cc",
73       "src/hb-ot-font.h",
74       "src/hb-ot-head-table.hh",
75       "src/hb-ot-hhea-table.hh",
76       "src/hb-ot-hmtx-table.hh",
77       "src/hb-ot-layout-common-private.hh",
78       "src/hb-ot-layout-gdef-table.hh",
79       "src/hb-ot-layout-gpos-table.hh",
80       "src/hb-ot-layout-gsub-table.hh",
81       "src/hb-ot-layout-gsubgpos-private.hh",
82       "src/hb-ot-layout-private.hh",
83       "src/hb-ot-layout.cc",
84       "src/hb-ot-layout.h",
85       "src/hb-ot-map-private.hh",
86       "src/hb-ot-map.cc",
87       "src/hb-ot-maxp-table.hh",
88       "src/hb-ot-name-table.hh",
89       "src/hb-ot-shape-complex-arabic-fallback.hh",
90       "src/hb-ot-shape-complex-arabic-private.hh",
91       "src/hb-ot-shape-complex-arabic-table.hh",
92       "src/hb-ot-shape-complex-arabic.cc",
93       "src/hb-ot-shape-complex-default.cc",
94       "src/hb-ot-shape-complex-hangul.cc",
95       "src/hb-ot-shape-complex-hebrew.cc",
96       "src/hb-ot-shape-complex-indic-machine.hh",
97       "src/hb-ot-shape-complex-indic-private.hh",
98       "src/hb-ot-shape-complex-indic-table.cc",
99       "src/hb-ot-shape-complex-indic.cc",
100       "src/hb-ot-shape-complex-myanmar-machine.hh",
101       "src/hb-ot-shape-complex-myanmar.cc",
102       "src/hb-ot-shape-complex-private.hh",
103       "src/hb-ot-shape-complex-thai.cc",
104       "src/hb-ot-shape-complex-tibetan.cc",
105       "src/hb-ot-shape-complex-use-machine.hh",
106       "src/hb-ot-shape-complex-use-private.hh",
107       "src/hb-ot-shape-complex-use-table.cc",
108       "src/hb-ot-shape-complex-use.cc",
109       "src/hb-ot-shape-fallback-private.hh",
110       "src/hb-ot-shape-fallback.cc",
111       "src/hb-ot-shape-normalize-private.hh",
112       "src/hb-ot-shape-normalize.cc",
113       "src/hb-ot-shape-private.hh",
114       "src/hb-ot-shape.cc",
115       "src/hb-ot-shape.h",
116       "src/hb-ot-tag.cc",
117       "src/hb-ot-tag.h",
118       "src/hb-ot.h",
119       "src/hb-private.hh",
120       "src/hb-set-private.hh",
121       "src/hb-set.cc",
122       "src/hb-set.h",
123       "src/hb-shape-plan-private.hh",
124       "src/hb-shape-plan.cc",
125       "src/hb-shape-plan.h",
126       "src/hb-shape.cc",
127       "src/hb-shape.h",
128       "src/hb-shaper-impl-private.hh",
129       "src/hb-shaper-list.hh",
130       "src/hb-shaper-private.hh",
131       "src/hb-shaper.cc",
132       "src/hb-unicode-private.hh",
133       "src/hb-unicode.cc",
134       "src/hb-unicode.h",
135       "src/hb-utf-private.hh",
136       "src/hb-version.h",
137       "src/hb-warning.cc",
138       "src/hb.h",
139     ]
141     defines = [
142       "HAVE_OT",
143       "HAVE_ICU",
144       "HAVE_ICU_BUILTIN",
145       "HB_NO_MT",
146     ]
148     configs -= [ "//build/config/compiler:chromium_code" ]
149     configs += [ "//build/config/compiler:no_chromium_code" ]
151     config("harfbuzz_warnings") {
152       cflags = []
153       if (is_clang) {
154         cflags += [
155           "-Wno-unused-value",
157           # Harfbuzz uses unused typedefs for its static asserts (and its
158           # static asserts are strange enough that they can't be replaced
159           # by static_assert).
160           "-Wno-unused-local-typedef",
161         ]
162       }
163       if (is_win) {
164         cflags += [ "/wd4334" ]  # Result of 32-bit shift implicitly converted to 64 bits.
165       }
166     }
167     configs += [ ":harfbuzz_warnings" ]
169     public_configs = [ ":harfbuzz-ng_config" ]
171     deps = [
172       "//third_party/icu:icuuc",
173     ]
175     if (is_mac) {
176       sources += [
177         "src/hb-coretext.cc",
178         "src/hb-coretext.h",
179       ]
180       defines += [ "HAVE_CORETEXT" ]
181     }
183     # When without -fvisibility=hidden for pango to use the harfbuzz
184     # in the tree, all symbols pango needs must be included, or
185     # pango uses mixed versions of harfbuzz and leads to crash.
186     # See crbug.com/462689.
187     if (is_linux && use_pango && !is_chromeos && !is_official_build &&
188         current_cpu != "arm" && current_cpu != "mipsel") {
189       configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
190       configs += [
191         "//build/config/linux:freetype2",
192         "//build/config/linux:glib",
193       ]
194       sources += [
195         "src/hb-ft.cc",
196         "src/hb-ft.h",
197         "src/hb-glib.cc",
198         "src/hb-glib.h",
199       ]
200     }
202     # See also chrome/browser/ui/libgtk2ui/BUILD.gn which pulls this.
203     config("pangoft2_link_hack") {
204       if (is_linux && use_pango && !is_chromeos && !is_official_build &&
205           current_cpu != "arm" && current_cpu != "mipsel" &&
206           !is_component_build) {
207         # These symbols are referenced from libpangoft2, which will be
208         # dynamically linked later.
209         ldflags =
210             [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
211       }
212     }
213   }