| OLD | NEW |
| 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 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 43 ] | 35 ] |
| 44 } | 36 } |
| 45 if (is_win) { | 37 if (is_win) { |
| 46 # Result of 32-bit shift implicitly converted to 64 bits. | 38 # Result of 32-bit shift implicitly converted to 64 bits. |
| 47 cflags += [ "/wd4334" ] | 39 cflags += [ "/wd4334" ] |
| 48 } | 40 } |
| 49 } | 41 } |
| 50 | 42 |
| 51 # See also chrome/browser/ui/libgtkui/BUILD.gn which pulls this. | 43 # See also chrome/browser/ui/libgtkui/BUILD.gn which pulls this. |
| 52 config("pangoft2_link_hack") { | 44 config("pangoft2_link_hack") { |
| 53 if (is_linux && use_pango && !is_chromeos && !is_official_build && | 45 if (is_linux && use_pango && !use_system_harfbuzz && !is_component_build) { |
| 54 current_cpu != "arm" && current_cpu != "mipsel" && !is_component_build)
{ | |
| 55 # These symbols are referenced from libpangoft2, which will be | 46 # These symbols are referenced from libpangoft2, which will be |
| 56 # dynamically linked later. | 47 # dynamically linked later. |
| 57 ldflags = [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ] | 48 ldflags = [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ] |
| 58 } | 49 } |
| 59 } | 50 } |
| 60 | 51 |
| 61 static_library("harfbuzz-ng") { | 52 static_library("harfbuzz-ng") { |
| 62 sources = [ | 53 sources = [ |
| 63 "src/hb-atomic-private.hh", | 54 "src/hb-atomic-private.hh", |
| 64 "src/hb-blob.cc", | 55 "src/hb-blob.cc", |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 "src/hb-coretext.h", | 182 "src/hb-coretext.h", |
| 192 ] | 183 ] |
| 193 defines += [ "HAVE_CORETEXT" ] | 184 defines += [ "HAVE_CORETEXT" ] |
| 194 libs = [ | 185 libs = [ |
| 195 "CoreFoundation.framework", | 186 "CoreFoundation.framework", |
| 196 "CoreGraphics.framework", | 187 "CoreGraphics.framework", |
| 197 "CoreText.framework", | 188 "CoreText.framework", |
| 198 ] | 189 ] |
| 199 } | 190 } |
| 200 | 191 |
| 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) { | 192 if (use_glib) { |
| 216 configs += [ "//build/config/linux:glib" ] | 193 configs += [ "//build/config/linux:glib" ] |
| 217 sources += [ | 194 sources += [ |
| 218 "src/hb-glib.cc", | 195 "src/hb-glib.cc", |
| 219 "src/hb-glib.h", | 196 "src/hb-glib.h", |
| 220 ] | 197 ] |
| 221 } | 198 } |
| 222 } | 199 } |
| 200 |
| 201 static_library("harfbuzz-ng-ft") { |
| 202 sources = [ |
| 203 "src/hb-ft.cc", |
| 204 "src/hb-ft.h", |
| 205 ] |
| 206 |
| 207 if (is_component_build && !is_win) { |
| 208 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] |
| 209 configs += [ "//build/config/gcc:symbol_visibility_default" ] |
| 210 } |
| 211 |
| 212 configs -= [ "//build/config/compiler:chromium_code" ] |
| 213 configs += [ |
| 214 "//build/config/compiler:no_chromium_code", |
| 215 |
| 216 # Must be after no_chromium_code for warning flags to be ordered |
| 217 # correctly. |
| 218 ":harfbuzz_warnings", |
| 219 ] |
| 220 public_configs = [ ":harfbuzz-ng_config" ] |
| 221 |
| 222 defines = [ |
| 223 "HAVE_OT", |
| 224 "HAVE_ICU", |
| 225 "HAVE_ICU_BUILTIN", |
| 226 "HB_NO_MT", |
| 227 ] |
| 228 |
| 229 deps = [ |
| 230 "//third_party/freetype:bootstrap_freetype_for_harfbuzz", |
| 231 ] |
| 232 } |
| 223 } | 233 } |
| 224 | 234 |
| 225 fuzzer_test("harfbuzz_fuzzer") { | 235 fuzzer_test("harfbuzz_fuzzer") { |
| 226 sources = [ | 236 sources = [ |
| 227 "fuzz/harfbuzz_fuzzer.cc", | 237 "fuzz/harfbuzz_fuzzer.cc", |
| 228 ] | 238 ] |
| 229 deps = [ | 239 deps = [ |
| 230 ":harfbuzz-ng", | 240 ":harfbuzz-ng", |
| 231 ] | 241 ] |
| 232 libfuzzer_options = [ "max_len=16800" ] | 242 libfuzzer_options = [ "max_len=16800" ] |
| 233 seed_corpus = "fuzz/seed_corpus" | 243 seed_corpus = "fuzz/seed_corpus" |
| 234 } | 244 } |
| OLD | NEW |