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/Makefile.in b/config/Makefile.in --- a/config/Makefile.in +++ b/config/Makefile.in @@ -36,16 +36,17 @@ ifdef WRAP_SYSTEM_INCLUDES export-preqs = \ $(call mkdir_deps,system_wrappers) \ $(NULL) export:: $(export-preqs) $(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \ -DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \ -DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \ + -DMOZ_SYSTEM_HARFBUZZ=$(MOZ_SYSTEM_HARFBUZZ) \ -DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \ -DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \ -DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \ -DMOZ_SYSTEM_PNG=$(MOZ_SYSTEM_PNG) \ -DMOZ_SYSTEM_JPEG=$(MOZ_SYSTEM_JPEG) \ -DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \ -DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \ -DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \ diff --git a/config/system-headers b/config/system-headers --- a/config/system-headers +++ b/config/system-headers @@ -1262,16 +1262,21 @@ zlib.h #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION libsn/sn.h libsn/sn-common.h libsn/sn-launchee.h libsn/sn-launcher.h libsn/sn-monitor.h libsn/sn-util.h #endif +#if MOZ_SYSTEM_HARFBUZZ==1 +harfbuzz/hb-glib.h +harfbuzz/hb-ot.h +harfbuzz/hb.h +#endif #if MOZ_SYSTEM_HUNSPELL==1 hunspell.hxx #endif #if MOZ_SYSTEM_BZ2==1 bzlib.h #endif gio/gio.h #if MOZ_SYSTEM_LIBEVENT==1 diff --git a/dom/base/moz.build b/dom/base/moz.build --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -471,16 +471,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 @@ -14,8 +14,13 @@ this file when updating harfbuzz, and ch The normal approach to updating harfbuzz, therefore, is to pull the latest HB source into a scratch directory and do a local build; then copy the original sources AND the generated header mentioned above from the build directory into the mozilla tree. 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 @@ -128,16 +128,19 @@ if CONFIG['GNU_CXX'] and not CONFIG['CLA if CONFIG['CLANG_CXX'] or CONFIG['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 ('gtk2', 'gtk3', 'android'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', '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 @@ -770,16 +770,19 @@ if CONFIG['GNU_CXX'] and not CONFIG['CLA if CONFIG['CLANG_CXX'] or CONFIG['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 ('gtk2', 'gtk3', 'android'): CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS'] if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', '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 @@ -268,11 +268,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('and if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'): CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS'] LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES'] DEFINES['GRAPHITE2_STATIC'] = True +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + if CONFIG['CLANG_CXX']: # 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 @@ -24,9 +24,12 @@ UNIFIED_SOURCES += [ 'nsUnicodeProperties.cpp', ] if CONFIG['ENABLE_INTL_API']: UNIFIED_SOURCES += [ 'ICUUtils.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 @@ -64,16 +64,19 @@ 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'] + if CONFIG['ENABLE_INTL_API']: DEFINES['IDNA2008'] = True USE_LIBS += ['icu'] else: UNIFIED_SOURCES += [ 'nameprep.c', ] diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -207,16 +207,19 @@ if CONFIG['SERVO_TARGET_DIR']: OS_LIBS += ['-L%s' % CONFIG['SERVO_TARGET_DIR'], '-lgeckoservo'] if CONFIG['MOZ_SYSTEM_JPEG']: OS_LIBS += CONFIG['MOZ_JPEG_LIBS'] if CONFIG['MOZ_SYSTEM_PNG']: OS_LIBS += CONFIG['MOZ_PNG_LIBS'] +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS'] + if CONFIG['MOZ_SYSTEM_HUNSPELL']: OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS'] if CONFIG['MOZ_SYSTEM_LIBEVENT']: OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS'] if CONFIG['MOZ_SYSTEM_LIBVPX']: OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS'] diff --git a/toolkit/moz.configure b/toolkit/moz.configure --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -309,16 +309,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)