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