From: Jan Beich Add ability to use system-harfbuzz instead of bundled. https://bugzilla.mozilla.org/show_bug.cgi?id=847568 diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild --- a/config/system-headers.mozbuild +++ b/config/system-headers.mozbuild @@ -1228,16 +1228,23 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr 'utils/TypeHelpers.h', 'utils/Unicode.h', 'utils/Vector.h', 'utils/VectorImpl.h', 'vr/gvr/capi/include/gvr_controller.h', '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', 'jack/statistics.h', ] if CONFIG['MOZ_SYSTEM_JPEG']: system_headers += [ diff --git a/dom/base/moz.build b/dom/base/moz.build --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -477,16 +477,19 @@ include('/ipc/chromium/chromium-config.m FINAL_LIBRARY = 'xul' if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']: DEFINES['HAVE_SIDEBAR'] = True if CONFIG['MOZ_X11']: CXXFLAGS += CONFIG['TK_CFLAGS'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + GENERATED_FILES += [ 'PropertyUseCounterMap.inc', 'UseCounterList.h', ] countermap = GENERATED_FILES['PropertyUseCounterMap.inc'] countermap.script = 'gen-usecounters.py:property_map' countermap.inputs = ['UseCounters.conf'] diff --git a/gfx/harfbuzz/README-mozilla b/gfx/harfbuzz/README-mozilla --- a/gfx/harfbuzz/README-mozilla +++ b/gfx/harfbuzz/README-mozilla @@ -15,3 +15,8 @@ If the collection of source files changes, manual updates to moz.build may be needed as we don't use the upstream makefiles. + +The in-tree copy may be omitted during build by --with-system-harfbuzz. +Make sure to keep pkg-config version check within toolkit/moz.configure in sync +with checkout version or increment latest tag by one if it's not based +on upstream release. diff --git a/gfx/moz.build b/gfx/moz.build --- a/gfx/moz.build +++ b/gfx/moz.build @@ -5,26 +5,28 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. with Files('**'): BUG_COMPONENT = ('Core', 'Graphics') if CONFIG['MOZ_TREE_CAIRO']: DIRS += ['cairo'] +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']: + DIRS += ['harfbuzz/src'] + DIRS += [ '2d', 'ycbcr', 'angle', 'src', 'qcms', 'gl', 'layers', 'graphite2/src', - 'harfbuzz/src', 'ots/src', 'thebes', 'ipc', 'vr', 'config', 'webrender_bindings', ] diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py --- a/gfx/skia/generate_mozbuild.py +++ b/gfx/skia/generate_mozbuild.py @@ -143,16 +143,19 @@ if CONFIG['CC_TYPE'] == 'gcc': if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): CXXFLAGS += [ '-Wno-implicit-fallthrough', '-Wno-inconsistent-missing-override', '-Wno-macro-redefined', '-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'] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3': CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS'] if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']: diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -817,16 +817,19 @@ if CONFIG['CC_TYPE'] == 'gcc': if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): CXXFLAGS += [ '-Wno-implicit-fallthrough', '-Wno-inconsistent-missing-override', '-Wno-macro-redefined', '-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'] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3': CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS'] if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']: diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -290,6 +290,9 @@ 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'] diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build --- a/intl/unicharutil/util/moz.build +++ b/intl/unicharutil/util/moz.build @@ -20,9 +20,12 @@ UNIFIED_SOURCES += [ 'ICUUtils.cpp', 'IrishCasing.cpp', 'nsBidiUtils.cpp', 'nsSpecialCasingData.cpp', 'nsUnicharUtils.cpp', 'nsUnicodeProperties.cpp', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + FINAL_LIBRARY = 'xul' diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build --- a/netwerk/dns/moz.build +++ b/netwerk/dns/moz.build @@ -67,12 +67,15 @@ etld_data = GENERATED_FILES['etld_data.i etld_data.script = 'prepare_tlds.py' etld_data.inputs = ['effective_tld_names.dat'] # need to include etld_data.inc LOCAL_INCLUDES += [ '/netwerk/base', ] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + USE_LIBS += ['icu'] if CONFIG['CC_TYPE'] in ('clang', 'gcc'): CXXFLAGS += ['-Wno-error=shadow'] diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -226,6 +226,9 @@ if CONFIG['MOZ_SYSTEM_WEBP']: OS_LIBS += CONFIG['MOZ_WEBP_LIBS'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS'] + if CONFIG['MOZ_SYSTEM_LIBEVENT']: OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS'] diff --git a/toolkit/moz.configure b/toolkit/moz.configure --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -331,16 +331,26 @@ def freetype2_combined_info(fontconfig_i return namespace( cflags=freetype2_info.cflags + fontconfig_info.cflags, libs=freetype2_info.libs + fontconfig_info.libs, ) 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) def applemedia(toolkit): if toolkit in ('cocoa', 'uikit'): return True set_config('MOZ_APPLEMEDIA', applemedia)