1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Mon, 6 Apr 2020 19:34:44 +0200
Subject: [PATCH] Bug 847568 - Support system graphite2
Allow building against system-wide graphite2.
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=847568
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
config/system-headers.mozbuild | 6 ++++++
gfx/graphite2/geckoextra/moz.build | 21 +++++++++++++++++++++
gfx/moz.build | 6 +++++-
gfx/thebes/moz.build | 5 ++++-
old-configure.in | 21 +++++++++++++++++++++
toolkit/library/moz.build | 3 +++
toolkit/moz.configure | 13 +++++++++++++
7 files changed, 73 insertions(+), 2 deletions(-)
create mode 100644 gfx/graphite2/geckoextra/moz.build
diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
index 03d1ffb0ec63d3db00e2d76ea20d4ebc0f18acd4..61fae227b39534380507939e0f9711a66f17b2f6 100644
--- a/config/system-headers.mozbuild
+++ b/config/system-headers.mozbuild
@@ -1262,6 +1262,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 0000000000000000000000000000000000000000..ed0323eba9d5b2b4afa24d0cccd9138fe5d25b62
--- /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 6cc19f84709bbe3be4ff830e3a6dd29189048c6f..14b08dbac3e3f5d3df421d5dd6840673046d0486 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 13886d3babf52cbd6ecd88f3a4c388d2aa298475..4219986abdb513b522c4c01d9a9ce03ba8535106 100644
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -298,7 +298,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 036734708f20d658248a8b5b3a6d8adc2530a878..123c294a53113ccdcf0b147db87daa9096b08c45 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -97,6 +97,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 cfbf6e599e88c0e296438335743bf64f2818389d..16fd8e8b5808da8f63b0d49baf63bb5b10f04e4d 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -289,6 +289,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 21af90b9163ff74738e21331f47b2f3d1d0ff335..036cdd2730d8137d2ff06c9dc6921c4094103222 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -775,6 +775,19 @@ 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)")
+
+@depends('--with-system-graphite2')
+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('--with-system-harfbuzz', help="Use system harfbuzz (located with pkgconfig)")
|