Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2019-12-06
Initial Package Version: 72.0b2
Upstream Status: Waiting for review (mozilla bug 847568)
Origin: Jan Beich at FreeBSD
Description: Allows system version of harfbuzz to be used.

Changes since 71.0 :
 harfbuzz now >= 2.6.4
 system graphite2 removed, mozilla added a geckoextra directory with their
 local changes, which is referenced from thebes and does not build if system
 graphite2 is used.

Please read the wiki page for firefox if building this version.

diff -Naur a/config/system-headers.mozbuild b/config/system-headers.mozbuild
--- a/config/system-headers.mozbuild	2019-12-03 16:16:16.000000000 +0000
+++ b/config/system-headers.mozbuild	2019-12-06 04:35:24.282639080 +0000
@@ -1294,6 +1294,13 @@
         'proxy.h',
     ]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    system_headers += [
+        'harfbuzz/hb-glib.h',
+        'harfbuzz/hb-ot.h',
+        'harfbuzz/hb.h',
+    ]
+
 if CONFIG['MOZ_SYSTEM_LIBVPX']:
     system_headers += [
         'vpx_mem/vpx_mem.h',
diff -Naur a/dom/base/moz.build b/dom/base/moz.build
--- a/dom/base/moz.build	2019-12-03 16:16:17.000000000 +0000
+++ b/dom/base/moz.build	2019-12-06 04:35:24.282639080 +0000
@@ -540,6 +540,9 @@
 if CONFIG['MOZ_X11']:
     CXXFLAGS += CONFIG['TK_CFLAGS']
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 GeneratedFile('UseCounterList.h', script='gen-usecounters.py',
               entry_point='use_counter_list', inputs=['UseCounters.conf'])
 
diff -Naur a/gfx/harfbuzz/README-mozilla b/gfx/harfbuzz/README-mozilla
--- a/gfx/harfbuzz/README-mozilla	2019-12-03 16:16:18.000000000 +0000
+++ b/gfx/harfbuzz/README-mozilla	2019-12-06 04:35:24.282639080 +0000
@@ -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 -Naur a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
--- a/gfx/skia/generate_mozbuild.py	2019-12-03 16:16:18.000000000 +0000
+++ b/gfx/skia/generate_mozbuild.py	2019-12-06 04:35:24.282639080 +0000
@@ -94,6 +94,9 @@
         '-Wno-unused-private-field',
     ]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
diff -Naur a/gfx/skia/moz.build b/gfx/skia/moz.build
--- a/gfx/skia/moz.build	2019-12-03 16:16:18.000000000 +0000
+++ b/gfx/skia/moz.build	2019-12-06 04:35:24.282639080 +0000
@@ -490,6 +490,9 @@
         '-Wno-unused-private-field',
     ]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
diff -Naur a/gfx/thebes/moz.build b/gfx/thebes/moz.build
--- a/gfx/thebes/moz.build	2019-12-03 16:16:18.000000000 +0000
+++ b/gfx/thebes/moz.build	2019-12-06 04:35:24.282639080 +0000
@@ -284,7 +284,8 @@
 
 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.
diff -Naur a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build
--- a/intl/unicharutil/util/moz.build	2019-12-03 16:16:18.000000000 +0000
+++ b/intl/unicharutil/util/moz.build	2019-12-06 04:35:24.282639080 +0000
@@ -25,4 +25,7 @@
     'nsUnicodeProperties.cpp',
 ]
 
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
 FINAL_LIBRARY = 'xul'
diff -Naur a/netwerk/dns/moz.build b/netwerk/dns/moz.build
--- a/netwerk/dns/moz.build	2019-12-03 16:16:22.000000000 +0000
+++ b/netwerk/dns/moz.build	2019-12-06 04:35:24.282639080 +0000
@@ -86,3 +86,6 @@
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
diff -Naur a/toolkit/library/moz.build b/toolkit/library/moz.build
--- a/toolkit/library/moz.build	2019-12-03 16:16:27.000000000 +0000
+++ b/toolkit/library/moz.build	2019-12-06 04:35:24.283639088 +0000
@@ -248,6 +248,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 -Naur a/toolkit/moz.configure b/toolkit/moz.configure
--- a/toolkit/moz.configure	2019-12-03 16:16:27.000000000 +0000
+++ b/toolkit/moz.configure	2019-12-06 04:35:24.283639088 +0000
@@ -958,6 +958,16 @@
 set_define('ENABLE_REMOTE_AGENT', remote)
 
 
+# HarfBuzz
+# ==============================================================
+option('--with-system-harfbuzz',
+       help="Use system harfbuzz (located with pkgconfig)")
+
+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 2.6.4',
+                                    when='--with-system-harfbuzz')
+
+set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
+
 # Marionette remote protocol
 # ==============================================================
 #
