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

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

Issue 2872333002: Build FreeType with HarfBuzz support (Closed)
Patch Set: Move back to if statement for harfbuzz-ng-ft target 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/freetype/freetype.gni")
8 import("//build/config/ui.gni") 9 import("//build/config/ui.gni")
9 import("//testing/libfuzzer/fuzzer_test.gni") 10 import("//testing/libfuzzer/fuzzer_test.gni")
10 11 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 12
20 if (use_system_harfbuzz) { 13 if (use_system_harfbuzz) {
21 import("//build/config/linux/pkg_config.gni") 14 import("//build/config/linux/pkg_config.gni")
22 pkg_config("harfbuzz_pkgconfig") { 15 pkg_config("harfbuzz_pkgconfig") {
23 packages = [ "harfbuzz" ] 16 packages = [ "harfbuzz" ]
24 } 17 }
25 group("harfbuzz-ng") { 18 group("harfbuzz-ng") {
26 public_configs = [ ":harfbuzz_pkgconfig" ] 19 public_configs = [ ":harfbuzz_pkgconfig" ]
27 } 20 }
28 } else { 21 } else {
(...skipping 14 matching lines...) Expand all
43 ] 36 ]
44 } 37 }
45 if (is_win) { 38 if (is_win) {
46 # Result of 32-bit shift implicitly converted to 64 bits. 39 # Result of 32-bit shift implicitly converted to 64 bits.
47 cflags += [ "/wd4334" ] 40 cflags += [ "/wd4334" ]
48 } 41 }
49 } 42 }
50 43
51 # See also chrome/browser/ui/libgtkui/BUILD.gn which pulls this. 44 # See also chrome/browser/ui/libgtkui/BUILD.gn which pulls this.
52 config("pangoft2_link_hack") { 45 config("pangoft2_link_hack") {
53 if (is_linux && use_pango && !is_chromeos && !is_official_build && 46 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 47 # These symbols are referenced from libpangoft2, which will be
56 # dynamically linked later. 48 # dynamically linked later.
57 ldflags = [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ] 49 ldflags = [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
58 } 50 }
59 } 51 }
60 52
61 static_library("harfbuzz-ng") { 53 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",
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 "src/hb.h", 156 "src/hb.h",
165 ] 157 ]
166 158
167 defines = [ 159 defines = [
168 "HAVE_OT", 160 "HAVE_OT",
169 "HAVE_ICU", 161 "HAVE_ICU",
170 "HAVE_ICU_BUILTIN", 162 "HAVE_ICU_BUILTIN",
171 "HB_NO_MT", 163 "HB_NO_MT",
172 ] 164 ]
173 165
166 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
167 configs += [ "//build/config/gcc:symbol_visibility_default" ]
168
174 configs -= [ "//build/config/compiler:chromium_code" ] 169 configs -= [ "//build/config/compiler:chromium_code" ]
175 configs += [ 170 configs += [
176 "//build/config/compiler:no_chromium_code", 171 "//build/config/compiler:no_chromium_code",
177 172
178 # Must be after no_chromium_code for warning flags to be ordered 173 # Must be after no_chromium_code for warning flags to be ordered
179 # correctly. 174 # correctly.
180 ":harfbuzz_warnings", 175 ":harfbuzz_warnings",
181 ] 176 ]
182 public_configs = [ ":harfbuzz-ng_config" ] 177 public_configs = [ ":harfbuzz-ng_config" ]
183 178
184 deps = [ 179 deps = [
185 "//third_party/icu:icuuc", 180 "//third_party/icu:icuuc",
186 ] 181 ]
187 182
188 if (is_mac) { 183 if (is_mac) {
189 sources += [ 184 sources += [
190 "src/hb-coretext.cc", 185 "src/hb-coretext.cc",
191 "src/hb-coretext.h", 186 "src/hb-coretext.h",
192 ] 187 ]
193 defines += [ "HAVE_CORETEXT" ] 188 defines += [ "HAVE_CORETEXT" ]
194 libs = [ 189 libs = [
195 "CoreFoundation.framework", 190 "CoreFoundation.framework",
196 "CoreGraphics.framework", 191 "CoreGraphics.framework",
197 "CoreText.framework", 192 "CoreText.framework",
198 ] 193 ]
199 } 194 }
200 195
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) { 196 if (use_glib) {
216 configs += [ "//build/config/linux:glib" ] 197 configs += [ "//build/config/linux:glib" ]
217 sources += [ 198 sources += [
218 "src/hb-glib.cc", 199 "src/hb-glib.cc",
219 "src/hb-glib.h", 200 "src/hb-glib.h",
220 ] 201 ]
221 } 202 }
222 } 203 }
204
205 config("harfbuzz-ng-ft-deferred-linkage") {
206 # Use this in //third_party/freetype2 to link without the hb_ft* symbols
207 # existing yet.
208
209 # Use this in harbuzz-ng-ft to link without the regular hb_* symbols
210 # existing yet.
211
212 # The dependency circle is as follows: FreeType depends on HarfBuzz for the
213 # autofitter, HarfBuzz depends on FreeType for the hb_ft functions that
214 # pangocairo depends on. We can solve this by linking //third_party/freetype
215 # incompletely, with leaving the hb_ft_font_create function undefined. Then
216 # linking harfbuzz-ng-ft incompletely, with leaving the standard harfbuzz
217 # symbols undefined, then using the freetype group in
218 # //build/config/freetype which binds everything together: harfbuzz-ng,
219 # freetype-without-harfbuzz, and harfbuzz-ng-ft.
220 ldflags = [ "-Wl,--unresolved-symbols=ignore-all" ]
221 }
222
223 if (is_linux && use_pango && !use_system_harfbuzz) {
224 static_library("harfbuzz-ng-ft") {
225 sources = [
226 "src/hb-ft.cc",
227 "src/hb-ft.h",
228 ]
229
230 configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
231 configs += [ "//build/config/gcc:symbol_visibility_default" ]
232
233 configs -= [ "//build/config/compiler:chromium_code" ]
234 configs += [
235 "//build/config/compiler:no_chromium_code",
236 ":harfbuzz-ng-ft-deferred-linkage",
237
238 # Must be after no_chromium_code for warning flags to be ordered
239 # correctly.
240 ":harfbuzz_warnings",
241 ]
242 public_configs = [ ":harfbuzz-ng_config" ]
243
244 defines = [
245 "HAVE_OT",
246 "HAVE_ICU",
247 "HAVE_ICU_BUILTIN",
248 "HB_NO_MT",
249 ]
250
251 deps = [
252 "//build/config/freetype:freetype-without-harfbuzz",
253 ]
254 }
255 }
223 } 256 }
224 257
225 fuzzer_test("harfbuzz_fuzzer") { 258 fuzzer_test("harfbuzz_fuzzer") {
226 sources = [ 259 sources = [
227 "fuzz/harfbuzz_fuzzer.cc", 260 "fuzz/harfbuzz_fuzzer.cc",
228 ] 261 ]
229 deps = [ 262 deps = [
230 ":harfbuzz-ng", 263 ":harfbuzz-ng",
231 ] 264 ]
232 libfuzzer_options = [ "max_len=16800" ] 265 libfuzzer_options = [ "max_len=16800" ]
233 seed_corpus = "fuzz/seed_corpus" 266 seed_corpus = "fuzz/seed_corpus"
234 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698