summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-02-06 06:22:16 -0500
committerMark H Weaver <mhw@netris.org>2018-02-09 01:53:07 -0500
commit110afddee8dcf9fffc0d8044f3075b5f198b84c3 (patch)
tree0f5c08d3a06c59c8f811506cc0c4d911f0722573 /gnu
parentefe2a2833c6d306d0c60127fdfebaff6dc415b4c (diff)
gnu: icecat: Use system harfbuzz and graphite2 libraries.
* gnu/packages/patches/icecat-use-system-harfbuzz.patch, gnu/packages/patches/icecat-use-system-graphite2.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/gnuzilla.scm (icecat)[source]: Add patches. Delete "gfx/harfbuzz" and "gfx/graphite2" in the snippet. [inputs]: Add harfbuzz and graphite2. [arguments]: Add "--with-system-harfbuzz" and "--with-system-graphite2" to configure-flags.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk2
-rw-r--r--gnu/packages/gnuzilla.scm13
-rw-r--r--gnu/packages/patches/icecat-use-system-graphite2.patch248
-rw-r--r--gnu/packages/patches/icecat-use-system-harfbuzz.patch279
4 files changed, 537 insertions, 5 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index f20d1044da..9cf14c8b08 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -767,6 +767,8 @@ dist_patch_DATA = \
%D%/packages/patches/icecat-bug-1415133.patch \
%D%/packages/patches/icecat-bug-1414945.patch \
%D%/packages/patches/icecat-bug-1424373-pt2.patch \
+ %D%/packages/patches/icecat-use-system-graphite2.patch \
+ %D%/packages/patches/icecat-use-system-harfbuzz.patch \
%D%/packages/patches/id3lib-CVE-2007-4460.patch \
%D%/packages/patches/ilmbase-fix-tests.patch \
%D%/packages/patches/intltool-perl-compatibility.patch \
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ecb3abd5bd..3a3f5dceca 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -414,6 +414,8 @@ security standards.")
(patches
(list
(search-patch "icecat-avoid-bundled-libraries.patch")
+ (search-patch "icecat-use-system-harfbuzz.patch")
+ (search-patch "icecat-use-system-graphite2.patch")
(mozilla-patch "icecat-bug-546387.patch" "d13e3fefb76e" "1b760r0bg2ydbl585wlmajljh1nlisrwxvjws5b28a3sgjy01i6k")
(mozilla-patch "icecat-bug-1350152.patch" "f822bda79c28" "1wf56169ca874shr6r7qx40s17h2gwj7ngmpyylrpmd1c6hipvsj")
(mozilla-patch "icecat-bug-1388166.patch" "fbb0bdb191d5" "1y8wpj38vw1dd6f375s9i0mrk9bd8z8gz5g70p4qynfllpkn072d")
@@ -556,11 +558,6 @@ security standards.")
;; * speex
;; * soundtouch (not yet in guix)
;;
- ;; TODO: Use system harfbuzz. Waiting for:
- ;; <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
- ;;
- ;; TODO: Use system graphite2.
- ;;
"modules/freetype2"
"modules/zlib"
"modules/libbz2"
@@ -569,6 +566,8 @@ security standards.")
"media/libvpx"
"security/nss"
"gfx/cairo"
+ "gfx/harfbuzz"
+ "gfx/graphite2"
"js/src/ctypes/libffi"
"db/sqlite3"))
;; Delete .pyc files, typically present in icecat source tarballs
@@ -589,8 +588,10 @@ security standards.")
("glib" ,glib)
("gtk+" ,gtk+)
("gtk+-2" ,gtk+-2)
+ ("graphite2" ,graphite2)
("pango" ,pango)
("freetype" ,freetype)
+ ("harfbuzz" ,harfbuzz)
("hunspell" ,hunspell)
("libcanberra" ,libcanberra)
("libgnome" ,libgnome)
@@ -660,6 +661,8 @@ security standards.")
"--with-system-icu"
"--with-system-nspr"
"--with-system-nss"
+ "--with-system-harfbuzz"
+ "--with-system-graphite2"
"--enable-system-pixman"
"--enable-system-cairo"
"--enable-system-ffi"
diff --git a/gnu/packages/patches/icecat-use-system-graphite2.patch b/gnu/packages/patches/icecat-use-system-graphite2.patch
new file mode 100644
index 0000000000..188fba2bc9
--- /dev/null
+++ b/gnu/packages/patches/icecat-use-system-graphite2.patch
@@ -0,0 +1,248 @@
+Copied from <https://reviewboard.mozilla.org/r/90218/diff/4>
+See <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_GRAPHITE2=$(MOZ_SYSTEM_GRAPHITE2) \
+ -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) \
+diff --git a/config/system-headers b/config/system-headers
+--- a/config/system-headers
++++ b/config/system-headers
+@@ -1260,16 +1260,20 @@ 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_GRAPHITE2==1
++graphite2/Font.h
++graphite2/Segment.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
+diff --git a/gfx/graphite2/moz-gr-update.sh b/gfx/graphite2/moz-gr-update.sh
+--- a/gfx/graphite2/moz-gr-update.sh
++++ b/gfx/graphite2/moz-gr-update.sh
+@@ -1,11 +1,12 @@
+ #!/bin/bash
+
+ # Script used to update the Graphite2 library in the mozilla source tree
++# and bump version for --with-system-graphite2
+
+ # This script lives in gfx/graphite2, along with the library source,
+ # but must be run from the top level of the mozilla-central tree.
+
+ # Run as
+ #
+ # ./gfx/graphite2/moz-gr-update.sh RELEASE
+ #
+@@ -32,22 +33,26 @@ echo "This directory contains the Graphi
+ echo "$TARBALL" >> gfx/graphite2/README.mozilla
+ echo ""
+ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
+
+ # fix up includes because of bug 721839 (cstdio) and bug 803066 (Windows.h)
+ #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+ #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+
++# chase version for --with-system-graphite2
++perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
++ if /GR2_VERSION_REQUIRE/" old-configure.in
++
+ # summarize what's been touched
+ echo Updated to $RELEASE.
+ echo Here is what changed in the gfx/graphite2 directory:
+ echo
+
+-hg stat gfx/graphite2
++hg stat old-configure.in gfx/graphite2
+
+ echo
+ echo If gfx/graphite2/src/files.mk has changed, please make corresponding
+ echo changes to gfx/graphite2/src/moz.build
+ echo
+
+ echo
+ echo Now use hg commands to create a patch for the mozilla tree.
+diff --git a/gfx/moz.build b/gfx/moz.build
+--- a/gfx/moz.build
++++ b/gfx/moz.build
+@@ -2,28 +2,30 @@
+ # vim: set filetype=python:
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ if CONFIG['MOZ_TREE_CAIRO']:
+ DIRS += ['cairo']
+
++if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++ DIRS += ['graphite2/src' ]
++
+ if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ DIRS += ['harfbuzz/src']
+
+ DIRS += [
+ '2d',
+ 'ycbcr',
+ 'angle',
+ 'src',
+ 'qcms',
+ 'gl',
+ 'layers',
+- 'graphite2/src',
+ 'ots/src',
+ 'thebes',
+ 'ipc',
+ 'vr',
+ 'config',
+ ]
+
+ if CONFIG['MOZ_ENABLE_SKIA']:
+diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
+--- a/gfx/thebes/moz.build
++++ b/gfx/thebes/moz.build
+@@ -261,16 +261,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('and
+ CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
+
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
+ CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
+
+ LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
+ LOCAL_INCLUDES += ['/media/libyuv/include']
+
+-DEFINES['GRAPHITE2_STATIC'] = True
++if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++ CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
++else:
++ 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/moz.configure b/moz.configure
+--- a/moz.configure
++++ b/moz.configure
+@@ -260,16 +260,28 @@ def extra_programs(target):
+
+ check_prog('DSYMUTIL', delayed_getattr(extra_programs, 'DSYMUTIL'),
+ allow_missing=True)
+ check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'),
+ allow_missing=True)
+ check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),
+ allow_missing=True)
+
++option('--with-system-graphite2',
++ help="Use system graphite2 (located with pkgconfig)")
++
++@depends('--with-system-graphite2', compile_environment)
++def check_for_graphite2(value, compile_env):
++ return value and compile_env
++
++system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
++ check_for_graphite2)
++
++set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
++
+ option('--with-system-harfbuzz',
+ help="Use system harfbuzz (located with pkgconfig)")
+
+ @depends('--with-system-harfbuzz', compile_environment)
+ def check_for_harfbuzz(value, compile_env):
+ return value and compile_env
+
+ system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.3.3',
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -5060,16 +5060,37 @@ if test "$USE_FC_FREETYPE"; then
+ CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
+ MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
+ [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
+ CPPFLAGS="$_SAVE_CPPFLAGS"
+ fi
+ fi
+
+ dnl ========================================================
++dnl Check for graphite2
++dnl ========================================================
++if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
++ dnl graphite2.pc has bogus version, check manually
++ _SAVE_CFLAGS=$CFLAGS
++ CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
++ AC_TRY_COMPILE([ #include <graphite2/Font.h>
++ #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
++ ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
++ * 100 + GR2_VERSION_BUGFIX >= \
++ (major) * 10000 + (minor) * 100 + (bugfix) )
++ ], [
++ #if !GR2_VERSION_REQUIRE(1,3,8)
++ #error "Insufficient graphite2 version."
++ #endif
++ ], [],
++ [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
++ CFLAGS=$_SAVE_CFLAGS
++fi
++
++dnl ========================================================
+ dnl Check for pixman and cairo
+ dnl ========================================================
+
+ MOZ_TREE_CAIRO=1
+ MOZ_ARG_ENABLE_BOOL(system-cairo,
+ [ --enable-system-cairo Use system cairo (located with pkgconfig)],
+ MOZ_TREE_CAIRO=,
+ MOZ_TREE_CAIRO=1 )
+diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
+--- a/toolkit/library/moz.build
++++ b/toolkit/library/moz.build
+@@ -221,16 +221,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_GRAPHITE2']:
++ OS_LIBS += CONFIG['MOZ_GRAPHITE2_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']
+
diff --git a/gnu/packages/patches/icecat-use-system-harfbuzz.patch b/gnu/packages/patches/icecat-use-system-harfbuzz.patch
new file mode 100644
index 0000000000..083d404c13
--- /dev/null
+++ b/gnu/packages/patches/icecat-use-system-harfbuzz.patch
@@ -0,0 +1,279 @@
+Copied from <https://reviewboard.mozilla.org/r/35763/diff/9>
+See <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
+@@ -1260,16 +1260,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
+ #ifdef MOZ_ENABLE_GIO
+ gio/gio.h
+diff --git a/dom/base/moz.build b/dom/base/moz.build
+--- a/dom/base/moz.build
++++ b/dom/base/moz.build
+@@ -474,16 +474,19 @@ for var in ('MOZ_B2G_RIL'):
+ DEFINES[var] = True
+
+ 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 old-configure.in 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
+@@ -2,26 +2,28 @@
+ # vim: set filetype=python:
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+ 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',
+ ]
+
+ if CONFIG['MOZ_ENABLE_SKIA']:
+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
+@@ -138,16 +138,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']
+ """
+
+diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
+--- a/gfx/skia/moz.build
++++ b/gfx/skia/moz.build
+@@ -748,14 +748,17 @@ 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']
+diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
+--- a/gfx/thebes/moz.build
++++ b/gfx/thebes/moz.build
+@@ -263,11 +263,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']
+ LOCAL_INCLUDES += ['/media/libyuv/include']
+
+ 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
+@@ -37,9 +37,12 @@ if CONFIG['_MSC_VER']:
+ DEFINES['_USE_ANSI_CPP'] = True
+ # Don't include directives about which CRT to use
+ CFLAGS += ['-Zl']
+ CXXFLAGS += ['-Zl']
+
+ if CONFIG['ENABLE_INTL_API']:
+ USE_LIBS += ['icu']
+
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ DIST_INSTALL = True
+diff --git a/moz.configure b/moz.configure
+--- a/moz.configure
++++ b/moz.configure
+@@ -260,16 +260,28 @@ def extra_programs(target):
+
+ check_prog('DSYMUTIL', delayed_getattr(extra_programs, 'DSYMUTIL'),
+ allow_missing=True)
+ check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'),
+ allow_missing=True)
+ check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),
+ allow_missing=True)
+
++option('--with-system-harfbuzz',
++ help="Use system harfbuzz (located with pkgconfig)")
++
++@depends('--with-system-harfbuzz', compile_environment)
++def check_for_harfbuzz(value, compile_env):
++ return value and compile_env
++
++system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.3.3',
++ check_for_harfbuzz)
++
++set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
++
+ option('--enable-system-hunspell',
+ help="Use system hunspell (located with pkgconfig)")
+
+ @depends('--enable-system-hunspell', compile_environment)
+ def check_for_hunspell(value, compile_env):
+ return value and compile_env
+
+ system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
+diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build
+--- a/netwerk/dns/moz.build
++++ b/netwerk/dns/moz.build
+@@ -61,16 +61,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
+@@ -221,16 +221,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']
+