# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/config/chrome_build.gni") import("//build/config/features.gni") import("//build/config/freetype/freetype.gni") import("//build/config/ui.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//third_party/harfbuzz-ng/harfbuzz.gni") if (use_system_harfbuzz) { import("//build/config/linux/pkg_config.gni") pkg_config("harfbuzz_from_pkgconfig") { visibility = [ "//third_party:freetype_harfbuzz", "//third_party/freetype:freetype_source", ] packages = [ "harfbuzz" ] } } else { config("harfbuzz_config") { include_dirs = [ "src" ] } config("harfbuzz_warnings") { cflags = [] if (is_clang) { cflags += [ "-Wno-unused-value", # Harfbuzz uses unused typedefs for its static asserts (and its # static asserts are strange enough that they can't be replaced # by static_assert). "-Wno-unused-local-typedef", ] } if (is_win) { # Result of 32-bit shift implicitly converted to 64 bits. cflags += [ "/wd4334" ] } } source_set("harfbuzz_source") { visibility = [ "//third_party:freetype_harfbuzz" ] sources = [ "src/hb-atomic-private.hh", "src/hb-blob.cc", "src/hb-blob.h", "src/hb-buffer-deserialize-json.hh", "src/hb-buffer-deserialize-text.hh", "src/hb-buffer-private.hh", "src/hb-buffer-serialize.cc", "src/hb-buffer.cc", "src/hb-buffer.h", "src/hb-cache-private.hh", "src/hb-common.cc", "src/hb-common.h", "src/hb-deprecated.h", "src/hb-face-private.hh", "src/hb-face.cc", "src/hb-face.h", "src/hb-font-private.hh", "src/hb-font.cc", "src/hb-font.h", "src/hb-ft.cc", "src/hb-ft.h", "src/hb-icu.cc", "src/hb-icu.h", "src/hb-mutex-private.hh", "src/hb-object-private.hh", "src/hb-open-file-private.hh", "src/hb-open-type-private.hh", "src/hb-ot-font.cc", "src/hb-ot-font.h", "src/hb-ot-head-table.hh", "src/hb-ot-hhea-table.hh", "src/hb-ot-hmtx-table.hh", "src/hb-ot-layout-common-private.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-private.hh", "src/hb-ot-layout-private.hh", "src/hb-ot-layout.cc", "src/hb-ot-layout.h", "src/hb-ot-map-private.hh", "src/hb-ot-map.cc", "src/hb-ot-math-table.hh", "src/hb-ot-math.cc", "src/hb-ot-math.h", "src/hb-ot-maxp-table.hh", "src/hb-ot-name-table.hh", "src/hb-ot-shape-complex-arabic-fallback.hh", "src/hb-ot-shape-complex-arabic-private.hh", "src/hb-ot-shape-complex-arabic-table.hh", "src/hb-ot-shape-complex-arabic.cc", "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-private.hh", "src/hb-ot-shape-complex-indic-table.cc", "src/hb-ot-shape-complex-indic.cc", "src/hb-ot-shape-complex-myanmar-machine.hh", "src/hb-ot-shape-complex-myanmar.cc", "src/hb-ot-shape-complex-private.hh", "src/hb-ot-shape-complex-thai.cc", "src/hb-ot-shape-complex-tibetan.cc", "src/hb-ot-shape-complex-use-machine.hh", "src/hb-ot-shape-complex-use-private.hh", "src/hb-ot-shape-complex-use-table.cc", "src/hb-ot-shape-complex-use.cc", "src/hb-ot-shape-fallback-private.hh", "src/hb-ot-shape-fallback.cc", "src/hb-ot-shape-normalize-private.hh", "src/hb-ot-shape-normalize.cc", "src/hb-ot-shape-private.hh", "src/hb-ot-shape.cc", "src/hb-ot-shape.h", "src/hb-ot-tag.cc", "src/hb-ot-tag.h", "src/hb-ot-var-avar-table.hh", "src/hb-ot-var-fvar-table.hh", "src/hb-ot-var-hvar-table.hh", "src/hb-ot-var-mvar-table.hh", "src/hb-ot-var.cc", "src/hb-ot-var.h", "src/hb-ot.h", "src/hb-private.hh", "src/hb-set-digest-private.hh", "src/hb-set-private.hh", "src/hb-set.cc", "src/hb-set.h", "src/hb-shape-plan-private.hh", "src/hb-shape-plan.cc", "src/hb-shape-plan.h", "src/hb-shape.cc", "src/hb-shape.h", "src/hb-shaper-impl-private.hh", "src/hb-shaper-list.hh", "src/hb-shaper-private.hh", "src/hb-shaper.cc", "src/hb-unicode-private.hh", "src/hb-unicode.cc", "src/hb-unicode.h", "src/hb-utf-private.hh", "src/hb-version.h", "src/hb-warning.cc", "src/hb.h", ] defines = [ "HAVE_OT", "HAVE_ICU", "HAVE_ICU_BUILTIN", "HAVE_INTEL_ATOMIC_PRIMITIVES", ] if (is_component_build) { if (is_win) { defines += [ "HB_EXTERN=__declspec (dllexport) extern" ] } else { configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] configs += [ "//build/config/gcc:symbol_visibility_default" ] } } if (use_system_freetype) { configs += [ "//build/linux:freetype_from_pkgconfig" ] } else { configs += [ "//third_party/freetype:freetype_config" ] } configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", # Must be after no_chromium_code for warning flags to be ordered # correctly. ":harfbuzz_warnings", ] public_configs = [ ":harfbuzz_config" ] deps = [ "//third_party/icu:icuuc", ] if (is_mac) { sources += [ "src/hb-coretext.cc", "src/hb-coretext.h", ] defines += [ "HAVE_CORETEXT" ] libs = [ "CoreFoundation.framework", "CoreGraphics.framework", "CoreText.framework", ] } if (use_glib) { configs += [ "//build/config/linux:glib" ] sources += [ "src/hb-glib.cc", "src/hb-glib.h", ] } } } fuzzer_test("harfbuzz_fuzzer") { sources = [ "fuzz/harfbuzz_fuzzer.cc", ] deps = [ "//third_party:freetype_harfbuzz", ] libfuzzer_options = [ "max_len=16800" ] seed_corpus = "fuzz/seed_corpus" }