From: Jan Beich Add ability to use system-harfbuzz instead of bundled. https://bugzilla.mozilla.org/show_bug.cgi?id=847568 --- a/config/system-headers.mozbuild +++ b/config/system-headers.mozbuild @@ -1234,6 +1234,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == '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', --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -506,6 +506,9 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']: if CONFIG['MOZ_X11']: CXXFLAGS += CONFIG['TK_CFLAGS'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + GENERATED_FILES += [ 'PropertyUseCounterMap.inc', 'UseCounterList.h', --- a/gfx/moz.build +++ b/gfx/moz.build @@ -10,6 +10,9 @@ with Files('**'): if CONFIG['MOZ_TREE_CAIRO']: DIRS += ['cairo'] +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']: + DIRS += ['harfbuzz/src'] + DIRS += [ '2d', 'ycbcr', @@ -19,7 +22,6 @@ DIRS += [ 'gl', 'layers', 'graphite2/src', - 'harfbuzz/src', 'ots/src', 'thebes', 'ipc', --- a/gfx/skia/generate_mozbuild.py +++ b/gfx/skia/generate_mozbuild.py @@ -138,6 +138,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 ('gtk3', 'android'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -818,6 +818,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 ('gtk3', 'android'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -278,6 +278,9 @@ LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES'] DEFINES['GRAPHITE2_STATIC'] = True +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['CC_TYPE'] == 'clang': # Suppress warnings from Skia header files. SOURCES['gfxPlatform.cpp'].flags += ['-Wno-implicit-fallthrough'] --- a/intl/unicharutil/util/moz.build +++ b/intl/unicharutil/util/moz.build @@ -25,4 +25,7 @@ UNIFIED_SOURCES += [ 'nsUnicodeProperties.cpp', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + FINAL_LIBRARY = 'xul' --- a/netwerk/dns/moz.build +++ b/netwerk/dns/moz.build @@ -75,6 +75,9 @@ LOCAL_INCLUDES += [ '/netwerk/base', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + USE_LIBS += ['icu'] if CONFIG['CC_TYPE'] in ('clang', 'gcc'): --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -217,6 +217,9 @@ OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] if CONFIG['MOZ_LIB_SECRET']: OS_LIBS += CONFIG['MOZ_LIB_SECRET_LIBS'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS'] + if CONFIG['MOZ_SYSTEM_JPEG']: OS_LIBS += CONFIG['MOZ_JPEG_LIBS'] --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -340,6 +340,16 @@ def freetype2_combined_info(fontconfig_info, freetype2_info): add_old_configure_assignment('_HAVE_FREETYPE2', depends_if(freetype2_info)(lambda _: True)) +# HarfBuzz +# ============================================================== +option('--with-system-harfbuzz', + help="Use system harfbuzz (located with pkgconfig)") + +system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.4.2', + when='--with-system-harfbuzz') + +set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True)) + # Apple platform decoder support # ============================================================== @depends(toolkit)