Bug 847568 - Allow building against system-wide harfbuzz. r=jfkthame r?glandium
MozReview-Commit-ID: 9JWIgcAwQnM
--- 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) \
--- a/config/system-headers
+++ b/config/system-headers
@@ -1263,16 +1263,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
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -476,16 +476,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']
--- 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.
--- 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',
]
--- 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']
if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']:
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -748,16 +748,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']:
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -270,11 +270,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']
--- 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'
--- 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',
]
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -223,16 +223,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']
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -338,16 +338,26 @@ def ft2_info(freetype2_combined_info, tr
return freetype2_combined_info
set_config('FT2_LIBS', delayed_getattr(ft2_info, 'libs'))
add_old_configure_assignment('FT2_LIBS',
delayed_getattr(ft2_info, 'libs'))
add_old_configure_assignment('FT2_CFLAGS',
delayed_getattr(ft2_info, 'cflags'))
+# 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)