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

Unified Diff: third_party/harfbuzz-ng/BUILD.gn

Issue 2872333002: Build FreeType with HarfBuzz support (Closed)
Patch Set: Always link harbuzz-ng-ft and fix mac component build 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 side-by-side diff with in-line comments
Download patch
Index: third_party/harfbuzz-ng/BUILD.gn
diff --git a/third_party/harfbuzz-ng/BUILD.gn b/third_party/harfbuzz-ng/BUILD.gn
index b3dcc3d46051c30a47855d0bc2279132f22349a1..efe066476a0bb365b85be00f90bac3108a219f79 100644
--- a/third_party/harfbuzz-ng/BUILD.gn
+++ b/third_party/harfbuzz-ng/BUILD.gn
@@ -5,17 +5,10 @@
import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//build/config/linux/pkg_config.gni")
+import("//build/config/freetype/freetype.gni")
import("//build/config/ui.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
-
-declare_args() {
- # Blink uses a cutting-edge version of Harfbuzz; most Linux distros do not
- # contain a new enough version of the code to work correctly. However,
- # ChromeOS chroots (i.e, real ChromeOS builds for devices) do contain a
- # new enough version of the library, and so this variable exists so that
- # ChromeOS can build against the system lib and keep binary sizes smaller.
- use_system_harfbuzz = false
-}
+import("//third_party/harfbuzz-ng/harfbuzz.gni")
if (use_system_harfbuzz) {
import("//build/config/linux/pkg_config.gni")
@@ -50,8 +43,7 @@ if (use_system_harfbuzz) {
# See also chrome/browser/ui/libgtkui/BUILD.gn which pulls this.
config("pangoft2_link_hack") {
- if (is_linux && use_pango && !is_chromeos && !is_official_build &&
- current_cpu != "arm" && current_cpu != "mipsel" && !is_component_build) {
+ if (is_linux && use_pango && !use_system_harfbuzz && !is_component_build) {
# These symbols are referenced from libpangoft2, which will be
# dynamically linked later.
ldflags = [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
@@ -198,20 +190,6 @@ if (use_system_harfbuzz) {
]
}
- # When without -fvisibility=hidden for pango to use the harfbuzz
- # in the tree, all symbols pango needs must be included, or
- # pango uses mixed versions of harfbuzz and leads to crash.
- # See crbug.com/462689.
- if (is_linux && use_pango && !is_chromeos && !is_official_build &&
- current_cpu != "arm" && current_cpu != "mipsel") {
- deps += [ "//build/config/freetype" ]
- configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
- configs += [ "//build/config/gcc:symbol_visibility_default" ]
- sources += [
- "src/hb-ft.cc",
- "src/hb-ft.h",
- ]
- }
if (use_glib) {
configs += [ "//build/config/linux:glib" ]
sources += [
@@ -220,6 +198,65 @@ if (use_system_harfbuzz) {
]
}
}
+
+ config("harfbuzz-ng-ft-deferred-linkage") {
+ # Use this in //third_party/freetype2 to link without the hb_ft* symbols
+ # existing yet.
+
+ # Use this in harbuzz-ng-ft to link without the regular hb_* symbols
+ # existing yet.
+
+ # The dependency circle is as follows: FreeType depends on HarfBuzz for the
+ # autofitter, HarfBuzz depends on FreeType for the hb_ft functions that
+ # pangocairo depends on. We can solve this by linking //third_party/freetype
+ # incompletely, with leaving the hb_ft_font_create function undefined. Then
+ # linking harfbuzz-ng-ft incompletely, with leaving the standard harfbuzz
+ # symbols undefined, then using the freetype group in
+ # //build/config/freetype which binds everything together: harfbuzz-ng,
+ # freetype-without-harfbuzz, and harfbuzz-ng-ft.
+ if (!is_clang) {
+ ldflags = [ "-Wl,--unresolved-symbols=ignore-all" ]
+ } else {
+ ldflags = [ "-Wl,-undefined,dynamic_lookup" ]
+ }
+ }
+
+ # if (is_linux && use_pango && !use_system_harfbuzz) {
+ static_library("harfbuzz-ng-ft") {
+ sources = [
+ "src/hb-ft.cc",
+ "src/hb-ft.h",
+ ]
+
+ if (is_component_build) {
+ configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
+ configs += [ "//build/config/gcc:symbol_visibility_default" ]
+ }
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+ ":harfbuzz-ng-ft-deferred-linkage",
+
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":harfbuzz_warnings",
+ ]
+ public_configs = [ ":harfbuzz-ng_config" ]
+
+ defines = [
+ "HAVE_OT",
+ "HAVE_ICU",
+ "HAVE_ICU_BUILTIN",
+ "HB_NO_MT",
+ ]
+
+ deps = [
+ "//build/config/freetype:freetype-without-harfbuzz",
+ ]
+ }
+
+ # }
}
fuzzer_test("harfbuzz_fuzzer") {
« no previous file with comments | « third_party/freetype/include/freetype-custom-config/ftoption.h ('k') | third_party/harfbuzz-ng/harfbuzz.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698