Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: third_party/harfbuzz-ng/BUILD.gn

Issue 2880223002: Reland: Compile FreeType with HarfBuzz support (Closed)
Patch Set: Fix Android build, and update TestExpectations for linux rebaselines Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/chrome_build.gni") 5 import("//build/config/chrome_build.gni")
6 import("//build/config/features.gni") 6 import("//build/config/features.gni")
7 import("//build/config/linux/pkg_config.gni") 7 import("//build/config/linux/pkg_config.gni")
8 import("//build/config/ui.gni") 8 import("//build/config/ui.gni")
9 import("//testing/libfuzzer/fuzzer_test.gni") 9 import("//testing/libfuzzer/fuzzer_test.gni")
10 10 import("//third_party/harfbuzz-ng/harfbuzz.gni")
11 declare_args() {
12 # Blink uses a cutting-edge version of Harfbuzz; most Linux distros do not
13 # contain a new enough version of the code to work correctly. However,
14 # ChromeOS chroots (i.e, real ChromeOS builds for devices) do contain a
15 # new enough version of the library, and so this variable exists so that
16 # ChromeOS can build against the system lib and keep binary sizes smaller.
17 use_system_harfbuzz = false
18 }
19 11
20 if (use_system_harfbuzz) { 12 if (use_system_harfbuzz) {
21 import("//build/config/linux/pkg_config.gni") 13 import("//build/config/linux/pkg_config.gni")
22 pkg_config("harfbuzz_pkgconfig") { 14 pkg_config("harfbuzz_pkgconfig") {
23 packages = [ "harfbuzz" ] 15 packages = [ "harfbuzz" ]
24 } 16 }
25 group("harfbuzz-ng") { 17 group("harfbuzz-ng") {
26 public_configs = [ ":harfbuzz_pkgconfig" ] 18 public_configs = [ ":harfbuzz_pkgconfig" ]
27 } 19 }
28 } else { 20 } else {
21 # The :harfbuzz-ng target combines the staged build steps required to resolve
22 # the cyclic dependency between parts of FreeType and HarfBuzz.
23 group("harfbuzz-ng") {
24 public_deps = [
25 ":harfbuzz-ng-ft",
26 ":harfbuzz-ng-without-freetype",
27 "//build/config/freetype",
28 ]
29 }
30
29 config("harfbuzz-ng_config") { 31 config("harfbuzz-ng_config") {
30 include_dirs = [ "src" ] 32 include_dirs = [ "src" ]
31 } 33 }
32 34
33 config("harfbuzz_warnings") { 35 config("harfbuzz_warnings") {
34 cflags = [] 36 cflags = []
35 if (is_clang) { 37 if (is_clang) {
36 cflags += [ 38 cflags += [
37 "-Wno-unused-value", 39 "-Wno-unused-value",
38 40
39 # Harfbuzz uses unused typedefs for its static asserts (and its 41 # Harfbuzz uses unused typedefs for its static asserts (and its
40 # static asserts are strange enough that they can't be replaced 42 # static asserts are strange enough that they can't be replaced
41 # by static_assert). 43 # by static_assert).
42 "-Wno-unused-local-typedef", 44 "-Wno-unused-local-typedef",
43 ] 45 ]
44 } 46 }
45 if (is_win) { 47 if (is_win) {
46 # Result of 32-bit shift implicitly converted to 64 bits. 48 # Result of 32-bit shift implicitly converted to 64 bits.
47 cflags += [ "/wd4334" ] 49 cflags += [ "/wd4334" ]
48 } 50 }
49 } 51 }
50 52
51 # See also chrome/browser/ui/libgtkui/BUILD.gn which pulls this. 53 static_library("harfbuzz-ng-without-freetype") {
52 config("pangoft2_link_hack") {
53 if (is_linux && use_pango && !is_chromeos && !is_official_build &&
54 current_cpu != "arm" && current_cpu != "mipsel" && !is_component_build) {
55 # These symbols are referenced from libpangoft2, which will be
56 # dynamically linked later.
57 ldflags = [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
58 }
59 }
60
61 static_library("harfbuzz-ng") {
62 sources = [ 54 sources = [
63 "src/hb-atomic-private.hh", 55 "src/hb-atomic-private.hh",
64 "src/hb-blob.cc", 56 "src/hb-blob.cc",
65 "src/hb-blob.h", 57 "src/hb-blob.h",
66 "src/hb-buffer-deserialize-json.hh", 58 "src/hb-buffer-deserialize-json.hh",
67 "src/hb-buffer-deserialize-text.hh", 59 "src/hb-buffer-deserialize-text.hh",
68 "src/hb-buffer-private.hh", 60 "src/hb-buffer-private.hh",
69 "src/hb-buffer-serialize.cc", 61 "src/hb-buffer-serialize.cc",
70 "src/hb-buffer.cc", 62 "src/hb-buffer.cc",
71 "src/hb-buffer.h", 63 "src/hb-buffer.h",
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 "src/hb-shaper.cc", 149 "src/hb-shaper.cc",
158 "src/hb-unicode-private.hh", 150 "src/hb-unicode-private.hh",
159 "src/hb-unicode.cc", 151 "src/hb-unicode.cc",
160 "src/hb-unicode.h", 152 "src/hb-unicode.h",
161 "src/hb-utf-private.hh", 153 "src/hb-utf-private.hh",
162 "src/hb-version.h", 154 "src/hb-version.h",
163 "src/hb-warning.cc", 155 "src/hb-warning.cc",
164 "src/hb.h", 156 "src/hb.h",
165 ] 157 ]
166 158
159 if (is_component_build && !is_win) {
160 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
161 configs += [ "//build/config/gcc:symbol_visibility_default" ]
162 }
163
167 defines = [ 164 defines = [
168 "HAVE_OT", 165 "HAVE_OT",
169 "HAVE_ICU", 166 "HAVE_ICU",
170 "HAVE_ICU_BUILTIN", 167 "HAVE_ICU_BUILTIN",
171 "HB_NO_MT", 168 "HB_NO_MT",
172 ] 169 ]
173 170
174 configs -= [ "//build/config/compiler:chromium_code" ] 171 configs -= [ "//build/config/compiler:chromium_code" ]
175 configs += [ 172 configs += [
176 "//build/config/compiler:no_chromium_code", 173 "//build/config/compiler:no_chromium_code",
(...skipping 14 matching lines...) Expand all
191 "src/hb-coretext.h", 188 "src/hb-coretext.h",
192 ] 189 ]
193 defines += [ "HAVE_CORETEXT" ] 190 defines += [ "HAVE_CORETEXT" ]
194 libs = [ 191 libs = [
195 "CoreFoundation.framework", 192 "CoreFoundation.framework",
196 "CoreGraphics.framework", 193 "CoreGraphics.framework",
197 "CoreText.framework", 194 "CoreText.framework",
198 ] 195 ]
199 } 196 }
200 197
201 # When without -fvisibility=hidden for pango to use the harfbuzz
202 # in the tree, all symbols pango needs must be included, or
203 # pango uses mixed versions of harfbuzz and leads to crash.
204 # See crbug.com/462689.
205 if (is_linux && use_pango && !is_chromeos && !is_official_build &&
206 current_cpu != "arm" && current_cpu != "mipsel") {
207 deps += [ "//build/config/freetype" ]
208 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
209 configs += [ "//build/config/gcc:symbol_visibility_default" ]
210 sources += [
211 "src/hb-ft.cc",
212 "src/hb-ft.h",
213 ]
214 }
215 if (use_glib) { 198 if (use_glib) {
216 configs += [ "//build/config/linux:glib" ] 199 configs += [ "//build/config/linux:glib" ]
217 sources += [ 200 sources += [
218 "src/hb-glib.cc", 201 "src/hb-glib.cc",
219 "src/hb-glib.h", 202 "src/hb-glib.h",
220 ] 203 ]
221 } 204 }
222 } 205 }
206
207 static_library("harfbuzz-ng-ft") {
208 sources = [
209 "src/hb-ft.cc",
210 "src/hb-ft.h",
211 ]
212
213 if (is_component_build && !is_win) {
214 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
215 configs += [ "//build/config/gcc:symbol_visibility_default" ]
216 }
217
218 configs -= [ "//build/config/compiler:chromium_code" ]
219 configs += [
220 "//build/config/compiler:no_chromium_code",
221
222 # Must be after no_chromium_code for warning flags to be ordered
223 # correctly.
224 ":harfbuzz_warnings",
225 ]
226 public_configs = [ ":harfbuzz-ng_config" ]
227
228 defines = [
229 "HAVE_OT",
230 "HAVE_ICU",
231 "HAVE_ICU_BUILTIN",
232 "HB_NO_MT",
233 ]
234
235 deps = [
236 "//third_party/freetype:bootstrap_freetype_for_harfbuzz",
237 ]
238 }
223 } 239 }
224 240
225 fuzzer_test("harfbuzz_fuzzer") { 241 fuzzer_test("harfbuzz_fuzzer") {
226 sources = [ 242 sources = [
227 "fuzz/harfbuzz_fuzzer.cc", 243 "fuzz/harfbuzz_fuzzer.cc",
228 ] 244 ]
229 deps = [ 245 deps = [
230 ":harfbuzz-ng", 246 ":harfbuzz-ng",
231 ] 247 ]
232 libfuzzer_options = [ "max_len=16800" ] 248 libfuzzer_options = [ "max_len=16800" ]
233 seed_corpus = "fuzz/seed_corpus" 249 seed_corpus = "fuzz/seed_corpus"
234 } 250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698