packages/firefox/0013-bmo-847568-Support-system-graphite2.patch

162 lines
4.9 KiB
Diff

diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
index 7f416f9..1193883 100644
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1260,6 +1260,12 @@ if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
"harfbuzz/hb.h",
]
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ system_headers += [
+ "graphite2/Font.h",
+ "graphite2/Segment.h",
+ ]
+
if CONFIG["MOZ_JACK"]:
system_headers += [
"jack/jack.h",
diff --git a/gfx/graphite2/geckoextra/moz.build b/gfx/graphite2/geckoextra/moz.build
new file mode 100644
index 0000000..24e8d7a
--- /dev/null
+++ b/gfx/graphite2/geckoextra/moz.build
@@ -0,0 +1,21 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# 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/.
+
+EXPORTS.graphite2 += [
+ 'include/GraphiteExtra.h',
+ 'include/GraphiteStructsForRLBox.h',
+]
+
+UNIFIED_SOURCES += [
+ '../geckoextra/src/GraphiteExtra.cpp',
+]
+
+CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
+
+# Match bundled graphite2 configuration
+AllowCompilerWarnings()
+
+FINAL_LIBRARY = 'xul'
diff --git a/gfx/moz.build b/gfx/moz.build
index 6cc19f8..14b08db 100644
--- a/gfx/moz.build
+++ b/gfx/moz.build
@@ -10,6 +10,11 @@ with Files("**"):
with Files("wr/**"):
BUG_COMPONENT = ("Core", "Graphics: WebRender")
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ DIRS += ["graphite2/geckoextra"]
+else:
+ DIRS += ["graphite2/src"]
+
if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
DIRS += ["harfbuzz/src"]
@@ -22,7 +27,6 @@ DIRS += [
"qcms",
"gl",
"layers",
- "graphite2/src",
"ots/src",
"thebes",
"ipc",
diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
index 5e16334..7d0a161 100644
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -295,7 +295,10 @@ 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"]
diff --git a/old-configure.in b/old-configure.in
index 2d2ad0b..f97051a 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -703,6 +703,27 @@ fi
AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
AC_SUBST(MOZ_MACBUNDLE_ID)
+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 = Child Process Name for IPC
dnl ========================================================
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index 1d13418..31c8158 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -288,6 +288,9 @@ if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
"-lgvr",
]
+if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
+ OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
+
if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 0c9e5fe..0c62ade 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -718,6 +718,23 @@ def freetype2_combined_info(fontconfig_info, freetype2_info):
set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True))
+# Graphite2
+# ==============================================================
+option(
+ "--with-system-graphite2",
+ help="Use system graphite2 (located with pkgconfig)",
+ when=use_pkg_config,
+)
+
+@depends("--with-system-graphite2", when=use_pkg_config)
+def check_for_graphite2(value):
+ return bool(value)
+
+system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
+ when=check_for_graphite2)
+
+set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
+
# HarfBuzz
# ==============================================================
option(
--
2.34.1