Allow building against system-wide harfbuzz. Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=847568 --- config/system-headers.mozbuild | 7 +++++++ dom/base/moz.build | 3 +++ gfx/moz.build | 4 +++- gfx/skia/generate_mozbuild.py | 3 +++ gfx/skia/moz.build | 3 +++ gfx/thebes/moz.build | 3 +++ intl/unicharutil/util/moz.build | 3 +++ netwerk/dns/moz.build | 3 +++ toolkit/library/moz.build | 3 +++ toolkit/moz.configure | 9 +++++++++ 10 files changed, 40 insertions(+), 1 deletion(-) diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild index aa17660..7f416f9 100644 --- a/config/system-headers.mozbuild +++ b/config/system-headers.mozbuild @@ -1253,6 +1253,13 @@ if CONFIG["OS_TARGET"] == "Android": "vr/gvr/capi/include/gvr.h", ] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + system_headers += [ + "harfbuzz/hb-glib.h", + "harfbuzz/hb-ot.h", + "harfbuzz/hb.h", + ] + if CONFIG["MOZ_JACK"]: system_headers += [ "jack/jack.h", diff --git a/dom/base/moz.build b/dom/base/moz.build index fb7ed4b..ea65621 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -616,6 +616,9 @@ FINAL_LIBRARY = "xul" if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + GeneratedFile( "UseCounterList.h", script="gen-usecounters.py", diff --git a/gfx/moz.build b/gfx/moz.build index 56ea317..6cc19f8 100644 --- a/gfx/moz.build +++ b/gfx/moz.build @@ -10,6 +10,9 @@ with Files("**"): with Files("wr/**"): BUG_COMPONENT = ("Core", "Graphics: WebRender") +if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + DIRS += ["harfbuzz/src"] + DIRS += [ "cairo", "2d", @@ -20,7 +23,6 @@ DIRS += [ "gl", "layers", "graphite2/src", - "harfbuzz/src", "ots/src", "thebes", "ipc", diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py index b589efd..47f49e1 100755 --- a/gfx/skia/generate_mozbuild.py +++ b/gfx/skia/generate_mozbuild.py @@ -95,6 +95,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): '-Wno-unused-private-field', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'): LOCAL_INCLUDES += [ "/gfx/cairo/cairo/src", diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build index 7fee545..ba1a403 100644 --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -623,6 +623,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): '-Wno-unused-private-field', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'): LOCAL_INCLUDES += [ "/gfx/cairo/cairo/src", diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build index 48f2849..5e16334 100644 --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -297,6 +297,9 @@ LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"] DEFINES["GRAPHITE2_STATIC"] = True +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + CXXFLAGS += ["-Werror=switch"] include("/tools/fuzzing/libfuzzer-config.mozbuild") diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build index 2396210..092baac 100644 --- a/intl/unicharutil/util/moz.build +++ b/intl/unicharutil/util/moz.build @@ -24,6 +24,9 @@ UNIFIED_SOURCES += [ "nsUnicodeProperties.cpp", ] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + include("/ipc/chromium/chromium-config.mozbuild") GeneratedFile( diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build index c926d14..5082238 100644 --- a/netwerk/dns/moz.build +++ b/netwerk/dns/moz.build @@ -119,4 +119,7 @@ LOCAL_INCLUDES += [ "/netwerk/protocol/http", ] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + USE_LIBS += ["icu"] diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index a9feb0b..1d13418 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -288,6 +288,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]: "-lgvr", ] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"] + if CONFIG["MOZ_SYSTEM_JPEG"]: OS_LIBS += CONFIG["MOZ_JPEG_LIBS"] diff --git a/toolkit/moz.configure b/toolkit/moz.configure index c5dcc65..0c9e5fe 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -718,6 +718,22 @@ def freetype2_combined_info(fontconfig_info, freetype2_info): set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True)) +# HarfBuzz +# ============================================================== +option( + "--with-system-harfbuzz", + help="Use system harfbuzz (located with pkgconfig)", + when=use_pkg_config, +) +@depends("--with-system-harfbuzz", when=use_pkg_config) +def enable_system_harfbuzz_option(enable_system_harfbuzz): + return enable_system_harfbuzz + +system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 2.7.4', + when='--with-system-harfbuzz') + +set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True)) + # Apple platform decoder support # ============================================================== @depends(toolkit) -- 2.34.1 .