Fix content_browsertests on Linux GN build.
[chromium-blink-merge.git] / third_party / harfbuzz-ng / BUILD.gn
blob71213fd42945432143bb50f7b79cda3747f49b23
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/linux/pkg_config.gni")
7 # The GYP build supports system harfbuzz for non-official builds when using
8 # pangoft2 1.31.0 or greater (which pulls it in).
9 # TODO(brettw) we can consider doing this as well, although the benefit is
10 # unclear and requires shelling out to a script to check the version.
12 # ChromeOS uses an up-to-date system one that we have control over, so we
13 # don't want to bloat the binary more by including another copy.
15 declare_args() {
16   if (is_linux && (!is_official_build || is_chromeos)) {
17     # Since version 1.31.0, pangoft2 which we depend on pulls in harfbuzz
18     # anyways. However, we want to have control of the version of harfbuzz
19     # we use, so don't use system harfbuzz for official builds, unless we
20     # are building for chrome os, where we have the system harfbuzz under
21     # control as well.
22     use_system_harfbuzz = exec_script(pkg_config_script,
23                                       pkg_config_args + [
24                                             "--atleast-version=1.31.0",
25                                             "pangoft2",
26                                           ],
27                                       "value")
28   } else {
29     use_system_harfbuzz = false
30   }
31   if (is_linux && current_cpu == "arm" && !is_chromeos) {
32     # Override use_system_harfbuzz for ARM cross compiling so system
33     # harfbuzz is not used because the corresponding package is not
34     # available.
35     use_system_harfbuzz = false
36   }
39 if (use_system_harfbuzz) {
40   import("//build/config/linux/pkg_config.gni")
41   pkg_config("harfbuzz_pkgconfig") {
42     packages = [ "harfbuzz" ]
43   }
44   group("harfbuzz-ng") {
45     public_configs = [ ":harfbuzz_pkgconfig" ]
46   }
47 } else {
48   config("harfbuzz-ng_config") {
49     include_dirs = [ "src" ]
50   }
52   static_library("harfbuzz-ng") {
53     sources = [
54       "src/hb-atomic-private.hh",
55       "src/hb-blob.cc",
56       "src/hb-blob.h",
57       "src/hb-buffer.cc",
58       "src/hb-buffer-deserialize-json.hh",
59       "src/hb-buffer-deserialize-text.hh",
60       "src/hb-buffer.h",
61       "src/hb-buffer-private.hh",
62       "src/hb-buffer-serialize.cc",
63       "src/hb-cache-private.hh",
64       "src/hb-common.cc",
65       "src/hb-common.h",
66       "src/hb-deprecated.h",
67       "src/hb-face.cc",
68       "src/hb-face.h",
69       "src/hb-face-private.hh",
70       "src/hb-fallback-shape.cc",
71       "src/hb-font.cc",
72       "src/hb-font.h",
73       "src/hb-font-private.hh",
74       "src/hb.h",
75       "src/hb-icu.cc",
76       "src/hb-icu.h",
77       "src/hb-mutex-private.hh",
78       "src/hb-object-private.hh",
79       "src/hb-open-file-private.hh",
80       "src/hb-open-type-private.hh",
81       "src/hb-ot.h",
82       "src/hb-ot-head-table.hh",
83       "src/hb-ot-hhea-table.hh",
84       "src/hb-ot-hmtx-table.hh",
85       "src/hb-ot-layout.cc",
86       "src/hb-ot-layout-common-private.hh",
87       "src/hb-ot-layout-gdef-table.hh",
88       "src/hb-ot-layout-gpos-table.hh",
89       "src/hb-ot-layout-gsubgpos-private.hh",
90       "src/hb-ot-layout-gsub-table.hh",
91       "src/hb-ot-layout.h",
92       "src/hb-ot-layout-private.hh",
93       "src/hb-ot-map.cc",
94       "src/hb-ot-map-private.hh",
95       "src/hb-ot-maxp-table.hh",
96       "src/hb-ot-name-table.hh",
97       "src/hb-ot-shape.cc",
98       "src/hb-ot-shape-complex-arabic.cc",
99       "src/hb-ot-shape-complex-arabic-fallback.hh",
100       "src/hb-ot-shape-complex-arabic-table.hh",
101       "src/hb-ot-shape-complex-default.cc",
102       "src/hb-ot-shape-complex-hangul.cc",
103       "src/hb-ot-shape-complex-hebrew.cc",
104       "src/hb-ot-shape-complex-indic.cc",
105       "src/hb-ot-shape-complex-indic-machine.hh",
106       "src/hb-ot-shape-complex-indic-private.hh",
107       "src/hb-ot-shape-complex-indic-table.cc",
108       "src/hb-ot-shape-complex-myanmar.cc",
109       "src/hb-ot-shape-complex-myanmar-machine.hh",
110       "src/hb-ot-shape-complex-private.hh",
111       "src/hb-ot-shape-complex-sea.cc",
112       "src/hb-ot-shape-complex-sea-machine.hh",
113       "src/hb-ot-shape-complex-thai.cc",
114       "src/hb-ot-shape-complex-tibetan.cc",
115       "src/hb-ot-shape-fallback.cc",
116       "src/hb-ot-shape-fallback-private.hh",
117       "src/hb-ot-shape.h",
118       "src/hb-ot-shape-normalize.cc",
119       "src/hb-ot-shape-normalize-private.hh",
120       "src/hb-ot-shape-private.hh",
121       "src/hb-ot-tag.cc",
122       "src/hb-ot-tag.h",
123       "src/hb-private.hh",
124       "src/hb-set.cc",
125       "src/hb-set.h",
126       "src/hb-set-private.hh",
127       "src/hb-shape.cc",
128       "src/hb-shape.h",
129       "src/hb-shape-plan.cc",
130       "src/hb-shape-plan.h",
131       "src/hb-shape-plan-private.hh",
132       "src/hb-shaper.cc",
133       "src/hb-shaper-impl-private.hh",
134       "src/hb-shaper-list.hh",
135       "src/hb-shaper-private.hh",
136       "src/hb-unicode.cc",
137       "src/hb-unicode.h",
138       "src/hb-unicode-private.hh",
139       "src/hb-utf-private.hh",
140       "src/hb-version.h",
141       "src/hb-warning.cc",
142     ]
144     defines = [
145       "HAVE_OT",
146       "HAVE_ICU",
147       "HAVE_ICU_BUILTIN",
148       "HB_NO_MT",
149     ]
151     configs -= [ "//build/config/compiler:chromium_code" ]
152     configs += [ "//build/config/compiler:no_chromium_code" ]
153     public_configs = [ ":harfbuzz-ng_config" ]
155     deps = [
156       "//third_party/icu:icuuc",
157     ]
159     cflags = []
160     if (is_clang) {
161       cflags += [ "-Wno-unused-value" ]
162     }
163     if (is_win) {
164       cflags += [ "/wd4334" ]  # Result of 32-bit shift implicitly converted to 64 bits.
165     }
166     if (is_mac) {
167       sources += [
168         "src/hb-coretext.cc",
169         "src/hb-coretext.h",
170       ]
171       defines += [ "HAVE_CORETEXT" ]
172     }
173   }