diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild index b8c14159a7c5..b428d98af9a0 100644 --- a/config/system-headers.mozbuild +++ b/config/system-headers.mozbuild @@ -1331,6 +1331,22 @@ if CONFIG["MOZ_SYSTEM_AV1"]: "dav1d/dav1d.h", ] +if CONFIG['MOZ_SYSTEM_GRAPHITE2']: + system_headers += [ + 'graphite2/Font.h', + 'graphite2/Segment.h', + ] + +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + system_headers += [ + 'harfbuzz/hb-blob.h', + 'harfbuzz/hb-face.h', + 'harfbuzz/hb-glib.h', + 'harfbuzz/hb-ot.h', + 'harfbuzz/hb.h', + 'harfbuzz/hb-subset.h', + ] + if CONFIG["MOZ_SYSTEM_ICU"]: system_headers += [ "unicode/calendar.h", diff --git a/dom/base/moz.build b/dom/base/moz.build index 30060e9347db..04c4aeabfdb3 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -638,6 +638,10 @@ FINAL_LIBRARY = "xul" if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + DEFINES["HB_EXTERN"] = 'extern __attribute__((visibility("default")))' + GeneratedFile( "UseCounterList.h", script="gen-usecounters.py", diff --git a/gfx/graphite2/geckoextra/moz.build b/gfx/graphite2/geckoextra/moz.build new file mode 100644 index 000000000000..c8e6698eb99d --- /dev/null +++ b/gfx/graphite2/geckoextra/moz.build @@ -0,0 +1,19 @@ +EXPORTS.graphite2 += [ + 'include/GraphiteExtra.h', + 'include/GraphiteStructsForRLBox.h', +] + +UNIFIED_SOURCES += [ + '../geckoextra/src/GraphiteExtra.cpp', +] + +CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS'] + +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]: + OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"] + + +# Match bundled graphite2 configuration +AllowCompilerWarnings() + +FINAL_LIBRARY = 'xul' diff --git a/gfx/moz.build b/gfx/moz.build index 4eb206169e79..ea9df2bb6c04 100644 --- a/gfx/moz.build +++ b/gfx/moz.build @@ -14,6 +14,14 @@ with Files("skia/**"): with Files("angle/**"): BUG_COMPONENT = ("Core", "Graphics: ANGLE") +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]: + DIRS += ["graphite2/geckoextra"] +else: + DIRS += ["graphite2/src" ] + +if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + DIRS += ["harfbuzz/src"] + DIRS += [ "cairo", "2d", @@ -23,8 +31,6 @@ DIRS += [ "qcms", "gl", "layers", - "graphite2/src", - "harfbuzz/src", "ots/src", "thebes", "ipc", diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py index 4e92906988c2..a1baa3f82baf 100755 --- a/gfx/skia/generate_mozbuild.py +++ b/gfx/skia/generate_mozbuild.py @@ -97,9 +97,14 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): '-Wno-unused-private-field', ] -LOCAL_INCLUDES += [ - "/gfx/harfbuzz/src", -] +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']: + LOCAL_INCLUDES += [ + "/gfx/harfbuzz/src", + ] + +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + DEFINES['HB_EXTERN'] = 'extern __attribute__((visibility("default")))' if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'): LOCAL_INCLUDES += [ diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build index 5dacf12c5778..f6f346462462 100644 --- a/gfx/skia/moz.build +++ b/gfx/skia/moz.build @@ -649,9 +649,14 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'): '-Wno-unused-private-field', ] -LOCAL_INCLUDES += [ - "/gfx/harfbuzz/src", -] +if not CONFIG['MOZ_SYSTEM_HARFBUZZ']: + LOCAL_INCLUDES += [ + "/gfx/harfbuzz/src", + ] + +if CONFIG['MOZ_SYSTEM_HARFBUZZ']: + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS'] + DEFINES['HB_EXTERN'] = 'extern __attribute__((visibility("default")))' if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'): LOCAL_INCLUDES += [ diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build index fdc0eefd507d..49c805441d23 100644 --- a/gfx/thebes/moz.build +++ b/gfx/thebes/moz.build @@ -287,7 +287,14 @@ if CONFIG["MOZ_WAYLAND"]: LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"] -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"] + DEFINES["HB_EXTERN"] = 'extern __attribute__((visibility("default")))' COMPILE_FLAGS["WARNINGS_CXXFLAGS"] += ["-Werror=switch"] diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build index c93613429c91..d5d34daf5bf3 100644 --- a/intl/unicharutil/util/moz.build +++ b/intl/unicharutil/util/moz.build @@ -22,6 +22,10 @@ UNIFIED_SOURCES += [ "nsUnicodeProperties.cpp", ] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + DEFINES["HB_EXTERN"] = 'extern __attribute__((visibility("default")))' + include("/ipc/chromium/chromium-config.mozbuild") GeneratedFile( diff --git a/layout/inspector/moz.build b/layout/inspector/moz.build index f9381a939d9f..a8fbac30956c 100644 --- a/layout/inspector/moz.build +++ b/layout/inspector/moz.build @@ -6,6 +6,10 @@ if CONFIG["ENABLE_TESTS"]: MOCHITEST_CHROME_MANIFESTS += ["tests/chrome/chrome.toml"] MOCHITEST_MANIFESTS += ["tests/mochitest.toml"] +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + DEFINES["HB_EXTERN"] = 'extern __attribute__((visibility("default")))' + XPIDL_SOURCES += [ "inIDeepTreeWalker.idl", ] diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build index 5d862cf8c71f..732382f61ebd 100644 --- a/netwerk/dns/moz.build +++ b/netwerk/dns/moz.build @@ -107,6 +107,10 @@ GeneratedFile( "etld_data.inc", script="prepare_tlds.py", inputs=["effective_tld_names.dat"] ) +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"] + DEFINES["HB_EXTERN"] = 'extern __attribute__((visibility("default")))' + # need to include etld_data.inc LOCAL_INCLUDES += [ "/netwerk/base", diff --git a/security/rlbox/moz.build b/security/rlbox/moz.build index 64545f550773..a8f9235ac83f 100644 --- a/security/rlbox/moz.build +++ b/security/rlbox/moz.build @@ -45,6 +45,9 @@ if CONFIG["MOZ_WASM_SANDBOXING_GRAPHITE"]: for k, v in graphite_defines: WASM_DEFINES[k] = v LOCAL_INCLUDES += ["/gfx/graphite2/src"] + if CONFIG["MOZ_SYSTEM_GRAPHITE2"]: + OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"] + WASM_CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"] if CONFIG["MOZ_WASM_SANDBOXING_OGG"]: include("/media/libogg/sources.mozbuild") diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build index 671c32b2d8e2..bbe60d7b30fd 100644 --- a/toolkit/library/moz.build +++ b/toolkit/library/moz.build @@ -294,6 +294,13 @@ if CONFIG["MOZ_SYSTEM_PNG"]: if CONFIG["MOZ_SYSTEM_WEBP"]: OS_LIBS += CONFIG["MOZ_WEBP_LIBS"] +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]: + OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"] + +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]: + OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"] + OS_LIBS += CONFIG["MOZ_HARFBUZZ_SUBSET_LIBS"] + if CONFIG["MOZ_SYSTEM_LIBEVENT"]: OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"] diff --git a/toolkit/moz.configure b/toolkit/moz.configure index bc3cdce65cd5..c9bfed1f7c0e 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -1403,6 +1403,30 @@ def enable_cairo_ft(target, tree_freetype, freetype2_info): set_config("MOZ_ENABLE_CAIRO_FT", True, when=enable_cairo_ft) set_config("CAIRO_FT_CFLAGS", ft2_info.cflags, when=enable_cairo_ft) +# Graphite2 +# ============================================================== +option("--with-system-graphite2", + help="Use system graphite2 (located with pkgconfig)") + +system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2", + when="--with-system-graphite2") + +set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True)) + +# HarfBuzz +# ============================================================== +option("--with-system-harfbuzz", + help="Use system harfbuzz (located with pkgconfig)") + +system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 10.0.0", + when="--with-system-harfbuzz") + +system_harfbuzz_subset = pkg_check_modules("MOZ_HARFBUZZ_SUBSET", "harfbuzz-subset >= 10.0.0", + when="--with-system-harfbuzz") + +set_config("MOZ_SYSTEM_HARFBUZZ", + depends_if(system_harfbuzz)(lambda _: True)) + # WebDriver (HTTP / BiDi) # ============================================================== .