Ravenports generated: 22 Dec 2021 04:02
[ravenports.git] / bucket_67 / thunderbird
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               thunderbird
4 VERSION=                91.4.1
5 KEYWORDS=               mail net_im news
6 VARIANTS=               standard
7 SDESC[standard]=        Mozilla Thunderbird mail/newsgroup client
8 HOMEPAGE=               https://www.thunderbird.net/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            MOZILLA/thunderbird/releases/91.4.1/source
13 DISTFILE[1]=            thunderbird-91.4.1.source.tar.xz:main
14 DF_INDEX=               1
15 SPKGS[standard]=        single
16
17 OPTIONS_AVAILABLE=      none
18 OPTIONS_STANDARD=       none
19
20 BUILD_DEPENDS=          rust:single:standard
21                         cbindgen:single:standard
22                         autoconf213:single:standard
23                         yasm:single:standard
24                         nasm:primary:standard
25                         zip:single:standard
26                         nodejs:primary:standard
27                         libvpx:single:standard
28                         evdev-proto:single:standard
29                         python-sqlite3:single:python_used
30 BUILDRUN_DEPENDS=       nss:primary:standard
31                         icu:single:standard
32                         libffi:single:standard
33                         libproxy:single:standard
34                         libevent:single:standard
35                         libcanberra:primary:standard
36                         libnotify:primary:standard
37                         harfbuzz:primary:standard
38                         aom:single:standard
39                         WebP:single:standard
40                         dav1d:single:standard
41                         ffmpeg:primary:standard
42                         dbus-glib:primary:standard
43                         startup-notification:single:standard
44
45 USES=                   cpe desktop-utils:single gmake jpeg png zlib
46                         perl:build pkgconfig iconv bz2 python:build
47                         gettext-runtime clang:keepcc
48 GNOME_COMPONENTS=       gconf gtk2 gtk3 gdkpixbuf pango
49 XORG_COMPONENTS=        x11 xcb xcomposite xdamage xext xfixes xrender xt
50                         pixman
51
52 LICENSE=                MPL:single
53 LICENSE_TERMS=          single:{{WRKSRC}}/toolkit/content/license.html
54 LICENSE_FILE=           MPL:stock
55 LICENSE_SCHEME=         solo
56
57 CPE_VENDOR=             mozilla
58 FPC_EQUIVALENT=         mail/thunderbird
59
60 MUST_CONFIGURE=         yes
61 CONFIGURE_OUTSOURCE=    yes
62 CONFIGURE_ENV=          PYTHON3={{PYTHON_CMD}}
63                         SETUPTOOLS_USE_DISTUTILS=stdlib
64
65 MAKE_ENV=               PYTHON3={{PYTHON_CMD}}
66                         CXXSTDLIB="stdc++"
67
68 QMAKE_ARGS=             --prefix="{{PREFIX}}"
69                         --with-system-nss
70                         --with-system-nspr
71                         --with-system-zlib
72                         --with-system-icu
73                         --with-system-png="{{LOCALBASE}}"
74                         --with-system-jpeg="{{LOCALBASE}}"
75                         --with-system-libevent
76                         --with-system-harfbuzz
77                         --with-system-graphite2
78                         --with-system-av1
79                         --with-system-webp
80                         --enable-system-ffi
81                         --enable-system-pixman
82                         --enable-install-strip
83                         --enable-strip
84                         --enable-libproxy
85                         --enable-release
86                         --enable-optimize
87                         --enable-official-branding
88                         --enable-application=comm/mail
89                         --enable-update-channel=release
90                         --enable-rust-simd
91                         --with-intl-api
92                         --disable-alsa
93                         --disable-debug
94                         --disable-debug-symbols
95                         --disable-dtrace
96                         --disable-jack
97                         --disable-webrtc
98                         --disable-profiling
99                         --disable-pulseaudio
100                         --disable-tests
101                         --disable-updater
102                         --disable-hardening
103 VAR_OPSYS[linux]=       QMAKE_ARGS=--disable-elf-hack
104
105 post-patch:
106         ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
107                 ${WRKSRC}/comm/mail/app/nsMailApp.cpp \
108                 ${WRKSRC}/browser/app/nsBrowserApp.cpp
109         (cd ${WRKSRC}/gfx/angle/checkout/src/compiler/translator && \
110                 ${REINPLACE_CMD} -e 's|<math.h>|<cmath>|' \
111                 InfoSink.h IntermNode.cpp)
112         # disable SCTP
113         ${REINPLACE_CMD} -e 's|MOZ_SCTP|MOZ_DISABLE_SCTP|' \
114                 ${WRKSRC}/netwerk/moz.build
115         # alsa headers use 'u_int32_t' and other BerkeleyDB/nvi
116         # fixed types (_XOPEN_SOURCE)
117         ${REINPLACE_CMD} -e 's@_XOPEN_SOURCE@&___@g' \
118                 ${WRKSRC}/media/libcubeb/src/cubeb_alsa.c
119         ${REINPLACE_CMD} -e 's@_POSIX_SOURCE@&___@g' \
120                 ${WRKSRC}/media/libcubeb/src/cubeb_jack.cpp
121         # Set mozilla options
122         @${ECHO_CMD} "--=> Setting configuration <=--"
123         @for arg in ${QMAKE_ARGS}; do \
124                 ${ECHO_CMD} ".mozconfig <<  $$arg" ;\
125                 ${ECHO_CMD} ac_add_options $$arg >> ${WRKSRC}/.mozconfig ;\
126         done
127         @${ECHO_CMD} LDFLAGS=\"-Wl,-rpath,${PREFIX}/lib/thunderbird\" \
128                 >> ${WRKSRC}/.mozconfig
129         # disable rust checksums
130         ${REINPLACE_CMD} -e 's/"files":{[^}]*}/"files":{}/' \
131                  ${WRKSRC}/third_party/rust/packed_simd/.cargo-checksum.json
132
133 post-patch-dragonfly:
134         ${REINPLACE_CMD} -e '/<malloc.h>/d' \
135                 ${WRKSRC}/comm/ldap/c-sdk/libraries/liblber/lber-int.h
136
137 post-install:
138         ${MKDIR} ${STAGEDIR}${PREFIX}/share/applications
139         ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps
140         ${INSTALL_DATA} ${FILESDIR}/thunderbird.desktop \
141                 ${STAGEDIR}${PREFIX}/share/applications
142         (cd ${STAGEDIR}${PREFIX}/share/pixmaps && ${LN} -sf \
143                 ../../lib/thunderbird/chrome/icons/default/default48.png \
144                 thunderbird.png)
145         # regenerate symlink to avoid absolute paths
146         ${RM} ${STAGEDIR}${PREFIX}/bin/thunderbird
147         (cd ${STAGEDIR}${PREFIX}/bin && \
148                 ${LN} -sf ../lib/thunderbird/thunderbird thunderbird)
149
150 pre-configure:
151         (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
152         (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
153
154 [FILE:391:descriptions/desc.single]
155 Thunderbird is a free and open source email, newsfeed, chat, and
156 calendaring client, that's easy to set up and customize. One of the core
157 principles of Thunderbird is the use and promotion of open standards -
158 this focus is a rejection of our world of closed platforms and services
159 that can't communicate with each other. We want our users to have
160 freedom and choice in how they communicate.
161
162
163 [FILE:111:distinfo]
164 f1079ed2cbd335a417b18929c5018d8ade9fb1d0c8cba9fdb2b6d672f14074f1    408805472 thunderbird-91.4.1.source.tar.xz
165
166
167 [FILE:699:manifests/plist.single]
168 bin/thunderbird
169 lib/thunderbird/
170  application.ini
171  dependentlibs.list
172  libldap60.so
173  libldif60.so
174  liblgpllibs.so
175  libmozgtk.so
176  libmozsqlite3.so
177  libprldap60.so
178  librnp.so
179  libxul.so
180  omni.ja
181  pingsender
182  platform.ini
183  plugin-container
184  removed-files
185  thunderbird
186  thunderbird-bin
187 lib/thunderbird/chrome/icons/default/
188  default128.png
189  default16.png
190  default22.png
191  default24.png
192  default256.png
193  default32.png
194  default48.png
195  default64.png
196 lib/thunderbird/defaults/messenger/mailViews.dat
197 lib/thunderbird/defaults/pref/channel-prefs.js
198 lib/thunderbird/isp/
199  Bogofilter.sfd
200  DSPAM.sfd
201  POPFile.sfd
202  SpamAssassin.sfd
203  SpamPal.sfd
204 share/applications/thunderbird.desktop
205 share/pixmaps/thunderbird.png
206
207
208 [FILE:5247:patches/patch-addon-search]
209 https://github.com/mozilla/addons/issues/708
210 https://github.com/mozilla/addons-frontend/issues/4610
211
212 --- comm/mail/app/profile/all-thunderbird.js.orig       2021-08-11 18:47:33.538900000 +0200
213 +++ comm/mail/app/profile/all-thunderbird.js    2021-08-11 18:51:30.055570000 +0200
214 @@ -159,10 +159,10 @@
215  pref("extensions.getAddons.get.url", "https://services.addons.thunderbird.net/api/v3/addons/search/?guid=%IDS%&lang=%LOCALE%");
216  pref("extensions.getAddons.compatOverides.url", "https://services.addons.thunderbird.net/api/v3/addons/compat-override/?guid=%IDS%&lang=%LOCALE%");
217  pref("extensions.getAddons.link.url", "https://addons.thunderbird.net/%LOCALE%/%APP%/");
218 -pref("extensions.getAddons.recommended.url", "https://services.addons.thunderbird.net/%LOCALE%/%APP%/api/%API_VERSION%/list/recommended/all/%MAX_RESULTS%/%OS%/%VERSION%?src=thunderbird");
219 +pref("extensions.getAddons.recommended.url", "https://services.addons.thunderbird.net/%LOCALE%/%APP%/api/%API_VERSION%/list/recommended/all/%MAX_RESULTS%/Linux/%VERSION%?src=thunderbird");
220  pref("extensions.getAddons.search.browseURL", "https://addons.thunderbird.net/%LOCALE%/%APP%/search/?q=%TERMS%");
221 -pref("extensions.getAddons.search.url", "https://services.addons.thunderbird.net/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/%OS%/%VERSION%/%COMPATIBILITY_MODE%?src=thunderbird");
222 -pref("extensions.webservice.discoverURL", "https://services.addons.thunderbird.net/%LOCALE%/%APP%/discovery/pane/%VERSION%/%OS%");
223 +pref("extensions.getAddons.search.url", "https://services.addons.thunderbird.net/%LOCALE%/%APP%/api/%API_VERSION%/search/%TERMS%/all/%MAX_RESULTS%/Linux/%VERSION%/%COMPATIBILITY_MODE%?src=thunderbird");
224 +pref("extensions.webservice.discoverURL", "https://services.addons.thunderbird.net/%LOCALE%/%APP%/discovery/pane/%VERSION%/Linux");
225  pref("extensions.getAddons.langpacks.url", "https://services.addons.thunderbird.net/api/v3/addons/language-tools/?app=thunderbird&type=language&appversion=%VERSION%");
226  pref("extensions.getAddons.discovery.api_url", "https://services.addons.thunderbird.net/api/v4/discovery/?lang=%LOCALE%&edition=%DISTRIBUTION%");
227  
228 @@ -191,9 +191,9 @@
229  //  .. etc ..
230  //
231  pref("extensions.update.enabled", true);
232 -pref("extensions.update.url", "https://versioncheck.addons.thunderbird.net/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
233 +pref("extensions.update.url", "https://versioncheck.addons.thunderbird.net/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
234  
235 -pref("extensions.update.background.url", "https://versioncheck-bg.addons.thunderbird.net/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
236 +pref("extensions.update.background.url", "https://versioncheck-bg.addons.thunderbird.net/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
237  
238  pref("extensions.update.interval", 86400);  // Check for updates to Extensions and
239                                              // Themes every day
240 --- toolkit/mozapps/extensions/internal/AddonRepository.jsm.orig        2021-08-11 18:52:27.424729000 +0200
241 +++ toolkit/mozapps/extensions/internal/AddonRepository.jsm     2021-08-11 18:54:16.222790000 +0200
242 @@ -584,7 +584,7 @@
243        addon.version = String(aEntry.current_version.version);
244        if (Array.isArray(aEntry.current_version.files)) {
245          for (let file of aEntry.current_version.files) {
246 -          if (file.platform == "all" || file.platform == PLATFORM) {
247 +          if (file.platform == "all" || file.platform == "linux" || file.platform == PLATFORM) {
248              if (file.url) {
249                addon.sourceURI = NetUtil.newURI(file.url);
250              }
251 --- toolkit/mozapps/extensions/internal/XPIDatabase.jsm.orig    2021-08-11 18:55:01.952372000 +0200
252 +++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm 2021-08-11 18:55:57.455245000 +0200
253 @@ -483,7 +483,7 @@
254      // Something is causing errors in here
255      try {
256        for (let platform of this.targetPlatforms) {
257 -        if (platform.os == Services.appinfo.OS) {
258 +        if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
259            if (platform.abi) {
260              needsABI = true;
261              if (platform.abi === abi) {
262
263
264 [FILE:445:patches/patch-browser-app-nsBrowserApp.cpp]
265 --- browser/app/nsBrowserApp.cpp.orig   2016-09-19 16:19:28 UTC
266 +++ browser/app/nsBrowserApp.cpp
267 @@ -324,6 +324,9 @@ int main(int argc, char* argv[], char* e
268  {
269    mozilla::TimeStamp start = mozilla::TimeStamp::Now();
270  
271 +  setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
272 +  setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
273 +
274  #ifdef HAS_DLL_BLOCKLIST
275    DllBlocklist_Initialize();
276  
277
278
279 [FILE:1672:patches/patch-bug1288587]
280 diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
281 index 855214a..1e91d51 100644
282 --- build/moz.configure/init.configure
283 +++ build/moz.configure/init.configure
284 @@ -238,6 +238,7 @@ option(
285  @imports(_from="mozbuild.pythonutil", _import="find_python3_executable")
286  @imports(_from="mozbuild.pythonutil", _import="python_executable_version")
287  @imports(_from="six", _import="ensure_text")
288 +@imports(_from="__builtin__", _import="KeyError")
289  def virtualenv_python3(env_python, build_env, mozconfig, help):
290      # Avoid re-executing python when running configure --help.
291      if help:
292 @@ -271,6 +272,12 @@ def virtualenv_python3(env_python, virtualenv_name, bu
293              python = mozconfig["vars"]["added"]["PYTHON3"]
294          elif "PYTHON3" in mozconfig["vars"]["modified"]:
295              python = mozconfig["vars"]["modified"]["PYTHON3"][1]
296 +        for i in ("env", "vars"):
297 +            for j in ("added", "modified"):
298 +                try:
299 +                    del mozconfig[i][j]["PYTHON3"]
300 +                except KeyError:
301 +                    pass
302  
303      log.debug("python3: executable from configuration: %r" % python)
304  
305 @@ -364,7 +371,10 @@ def virtualenv_python3(env_python, virtualenv_name, bu
306          )
307          log.info("Re-executing in the virtualenv")
308          if env_python:
309 -            del os.environ["PYTHON3"]
310 +                try:
311 +                    del os.environ["PYTHON3"]
312 +                except KeyError:
313 +                    pass
314          # Another quirk on macOS, with the system python, the virtualenv is
315          # not fully operational (missing entries in sys.path) if
316          # __PYVENV_LAUNCHER__ is set.
317
318
319 [FILE:3539:patches/patch-bug1559213]
320 commit 717bba28411c
321 Author: Jory A. Pratt <anarchy@gentoo.org>
322 Date:   Thu Jun 13 11:53:00 2019 -0700
323
324     Bug 1559213 - Allow to use system av1 libs instead of bundled.
325 ---
326  config/external/moz.build      |  5 +++--
327  config/system-headers.mozbuild |  8 ++++++++
328  dom/media/platforms/moz.build  |  5 +++++
329  toolkit/moz.configure          | 19 ++++++++++++++++++-
330  4 files changed, 34 insertions(+), 3 deletions(-)
331
332 diff --git config/external/moz.build config/external/moz.build
333 index 03e4fa143bd1..a67d10b11fe6 100644
334 --- config/external/moz.build
335 +++ config/external/moz.build
336 @@ -40,8 +40,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
337      external_dirs += ["media/libvpx"]
338  
339  if CONFIG["MOZ_AV1"]:
340 -    external_dirs += ["media/libaom"]
341 -    external_dirs += ["media/libdav1d"]
342 +    if not CONFIG["MOZ_SYSTEM_AV1"]:
343 +        external_dirs += ["media/libaom"]
344 +        external_dirs += ["media/libdav1d"]
345  
346  if not CONFIG["MOZ_SYSTEM_PNG"]:
347      external_dirs += ["media/libpng"]
348 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
349 index bcf5c4925564..48964a999a9b 100644
350 --- config/system-headers.mozbuild
351 +++ config/system-headers.mozbuild
352 @@ -1305,6 +1305,14 @@ if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
353          'harfbuzz/hb.h',
354      ]
355  
356 +if CONFIG['MOZ_SYSTEM_AV1']:
357 +    system_headers += [
358 +        'aom/aom_decoder.h',
359 +        'aom/aomdx.h',
360 +        'aom/aom_image.h',
361 +        'dav1d/dav1d.h',
362 +    ]
363 +
364  if CONFIG['MOZ_SYSTEM_LIBVPX']:
365      system_headers += [
366          'vpx_mem/vpx_mem.h',
367 diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
368 index 092cee0c9b66..38e45de5b5f0 100644
369 --- dom/media/platforms/moz.build
370 +++ dom/media/platforms/moz.build
371 @@ -78,6 +78,11 @@ if CONFIG["MOZ_AV1"]:
372          "agnostic/AOMDecoder.cpp",
373          "agnostic/DAV1DDecoder.cpp",
374      ]
375 +    if CONFIG['MOZ_SYSTEM_AV1']:
376 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
377 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
378 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
379 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
380  
381  if CONFIG["MOZ_OMX"]:
382      EXPORTS += [
383 diff --git toolkit/moz.configure toolkit/moz.configure
384 index 82b5a59acf42..e2329560b42b 100644
385 --- toolkit/moz.configure.orig  2021-04-13 16:12:34.770032000 +0200
386 +++ toolkit/moz.configure       2021-04-18 00:03:41.432698000 +0200
387 @@ -538,7 +538,23 @@
388          return True
389  
390  
391 -@depends(target, when=av1 & compile_environment)
392 +option("--with-system-av1",
393 +       help="Use system av1 (located with pkgconfig)")
394 +
395 +system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
396 +                                       when="--with-system-av1")
397 +
398 +system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
399 +                                         when="--with-system-av1")
400 +
401 +@depends(system_libaom_info, system_libdav1d_info)
402 +def system_av1(system_libaom_info, system_libdav1d_info):
403 +    has_av1_libs = False
404 +    if system_libaom_info and system_libdav1d_info:
405 +        has_av1_libs = True
406 +    return has_av1_libs
407 +
408 +@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
409  def dav1d_asm(target):
410      if target.cpu in ("aarch64", "x86", "x86_64"):
411          return True
412 @@ -554,6 +570,7 @@
413  set_define("MOZ_DAV1D_ASM", dav1d_asm)
414  set_config("MOZ_AV1", av1)
415  set_define("MOZ_AV1", av1)
416 +set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
417  
418  # Built-in fragmented MP4 support.
419  # ==============================================================
420
421
422 [FILE:1500:patches/patch-bug1618914]
423 From cea8e6a01bb03bbe565c9bf5dd4f439f30ca953f Mon Sep 17 00:00:00 2001
424 From: Jan Beich <jbeich@FreeBSD.org>
425 Date: Fri, 28 Feb 2020 16:49:38 +0000
426 Subject: Bug 1618914 - [Wayland] Fall back to ftruncate if posix_fallocate isn't supported by filesystem.
427
428 diff --git widget/gtk/WaylandShmBuffer.cpp widget/gtk/WaylandShmBuffer.cpp
429 index 42eeedd3429ac..2a5c23d287413 100644
430 --- widget/gtk/WaylandShmBuffer.cpp
431 +++ widget/gtk/WaylandShmBuffer.cpp
432 @@ -67,36 +67,37 @@ static int WaylandAllocateShmMemory(int aSize) {
433      return -1;
434    }
435  
436    int ret = 0;
437  #ifdef HAVE_POSIX_FALLOCATE
438    do {
439      ret = posix_fallocate(fd, 0, aSize);
440    } while (ret == EINTR);
441 -  if (ret != 0) {
442 +  if (ret == 0) {
443 +    return fd;
444 +  } else if (ret != ENODEV && ret != EINVAL && ret != EOPNOTSUPP) {
445      NS_WARNING(
446          nsPrintfCString("posix_fallocate() fails to allocate shm memory: %s",
447                          strerror(ret))
448              .get());
449      close(fd);
450      return -1;
451    }
452 -#else
453 +#endif
454    do {
455      ret = ftruncate(fd, aSize);
456    } while (ret < 0 && errno == EINTR);
457    if (ret < 0) {
458      NS_WARNING(nsPrintfCString("ftruncate() fails to allocate shm memory: %s",
459                                 strerror(ret))
460                     .get());
461      close(fd);
462      fd = -1;
463    }
464 -#endif
465  
466    return fd;
467  }
468  
469  /* static */
470  RefPtr<WaylandShmPool> WaylandShmPool::Create(
471      const RefPtr<nsWaylandDisplay>& aWaylandDisplay, int aSize) {
472    RefPtr<WaylandShmPool> shmPool = new WaylandShmPool(aSize);
473
474
475 [FILE:11510:patches/patch-bug292127]
476 --- comm/ldap/c-sdk/include/ldap.h~
477 +++ comm/ldap/c-sdk/include/ldap.h
478 @@ -40,6 +40,229 @@
479  #ifndef _LDAP_H
480  #define _LDAP_H
481  
482 +/* rename symbols to not clash with openldap (bug 292127) */
483 +#define ldap_abandon moz_ldap_abandon
484 +#define ldap_abandon_ext moz_ldap_abandon_ext
485 +#define ldap_abandoned moz_ldap_abandoned
486 +#define ldap_add moz_ldap_add
487 +#define ldap_add_ext moz_ldap_add_ext
488 +#define ldap_add_ext_s moz_ldap_add_ext_s
489 +#define ldap_add_result_entry moz_ldap_add_result_entry
490 +#define ldap_add_s moz_ldap_add_s
491 +#define ldap_ber_free moz_ldap_ber_free
492 +#define ldap_bind moz_ldap_bind
493 +#define ldap_bind_s moz_ldap_bind_s
494 +#define ldap_build_filter moz_ldap_build_filter
495 +#define ldap_cache_flush moz_ldap_cache_flush
496 +#define ldap_charray_add moz_ldap_charray_add
497 +#define ldap_charray_dup moz_ldap_charray_dup
498 +#define ldap_charray_free moz_ldap_charray_free
499 +#define ldap_charray_inlist moz_ldap_charray_inlist
500 +#define ldap_charray_merge moz_ldap_charray_merge
501 +#define ldap_charray_position moz_ldap_charray_position
502 +#define ldap_compare moz_ldap_compare
503 +#define ldap_compare_ext moz_ldap_compare_ext
504 +#define ldap_compare_ext_s moz_ldap_compare_ext_s
505 +#define ldap_compare_s moz_ldap_compare_s
506 +#define ldap_control_free moz_ldap_control_free
507 +#define ldap_controls_free moz_ldap_controls_free
508 +#define ldap_count_entries moz_ldap_count_entries
509 +#define ldap_count_messages moz_ldap_count_messages
510 +#define ldap_count_references moz_ldap_count_references
511 +#define ldap_count_values moz_ldap_count_values
512 +#define ldap_count_values_len moz_ldap_count_values_len
513 +#define ldap_create_authzid_control moz_ldap_create_authzid_control
514 +#define ldap_create_filter moz_ldap_create_filter
515 +#define ldap_create_geteffectiveRights_control moz_ldap_create_geteffectiveRights_control
516 +#define ldap_create_passwordpolicy_control moz_ldap_create_passwordpolicy_control
517 +#define ldap_create_passwordpolicy_control_ext moz_ldap_create_passwordpolicy_control_ext
518 +#define ldap_create_persistentsearch_control moz_ldap_create_persistentsearch_control
519 +#define ldap_create_proxiedauth_control moz_ldap_create_proxiedauth_control
520 +#define ldap_create_proxyauth_control moz_ldap_create_proxyauth_control
521 +#define ldap_create_sort_control moz_ldap_create_sort_control
522 +#define ldap_create_sort_keylist moz_ldap_create_sort_keylist
523 +#define ldap_create_userstatus_control moz_ldap_create_userstatus_control
524 +#define ldap_create_virtuallist_control moz_ldap_create_virtuallist_control
525 +#define ldap_delete moz_ldap_delete
526 +#define ldap_delete_ext moz_ldap_delete_ext
527 +#define ldap_delete_ext_s moz_ldap_delete_ext_s
528 +#define ldap_delete_result_entry moz_ldap_delete_result_entry
529 +#define ldap_delete_s moz_ldap_delete_s
530 +#define ldap_dn2ufn moz_ldap_dn2ufn
531 +#define ldap_entry2html moz_ldap_entry2html
532 +#define ldap_entry2html_search moz_ldap_entry2html_search
533 +#define ldap_entry2text moz_ldap_entry2text
534 +#define ldap_entry2text_search moz_ldap_entry2text_search
535 +#define ldap_err2string moz_ldap_err2string
536 +#define ldap_errlist moz_ldap_errlist
537 +#define ldap_explode moz_ldap_explode
538 +#define ldap_explode_dn moz_ldap_explode_dn
539 +#define ldap_explode_dns moz_ldap_explode_dns
540 +#define ldap_explode_rdn moz_ldap_explode_rdn
541 +#define ldap_extended_operation moz_ldap_extended_operation
542 +#define ldap_extended_operation_s moz_ldap_extended_operation_s
543 +#define ldap_find_control moz_ldap_find_control
544 +#define ldap_first_attribute moz_ldap_first_attribute
545 +#define ldap_first_disptmpl moz_ldap_first_disptmpl
546 +#define ldap_first_entry moz_ldap_first_entry
547 +#define ldap_first_message moz_ldap_first_message
548 +#define ldap_first_reference moz_ldap_first_reference
549 +#define ldap_first_searchobj moz_ldap_first_searchobj
550 +#define ldap_first_tmplcol moz_ldap_first_tmplcol
551 +#define ldap_first_tmplrow moz_ldap_first_tmplrow
552 +#define ldap_free_friendlymap moz_ldap_free_friendlymap
553 +#define ldap_free_searchprefs moz_ldap_free_searchprefs
554 +#define ldap_free_sort_keylist moz_ldap_free_sort_keylist
555 +#define ldap_free_templates moz_ldap_free_templates
556 +#define ldap_free_urldesc moz_ldap_free_urldesc
557 +#define ldap_friendly_name moz_ldap_friendly_name
558 +#define ldap_get_dn moz_ldap_get_dn
559 +#define ldap_get_entry_controls moz_ldap_get_entry_controls
560 +#define ldap_get_lang_values moz_ldap_get_lang_values
561 +#define ldap_get_lang_values_len moz_ldap_get_lang_values_len
562 +#define ldap_get_lderrno moz_ldap_get_lderrno
563 +#define ldap_get_option moz_ldap_get_option
564 +#define ldap_get_values moz_ldap_get_values
565 +#define ldap_get_values_len moz_ldap_get_values_len
566 +#define ldap_getfilter_free moz_ldap_getfilter_free
567 +#define ldap_getfirstfilter moz_ldap_getfirstfilter
568 +#define ldap_getnextfilter moz_ldap_getnextfilter
569 +#define ldap_init moz_ldap_init
570 +#define ldap_init_getfilter moz_ldap_init_getfilter
571 +#define ldap_init_getfilter_buf moz_ldap_init_getfilter_buf
572 +#define ldap_init_searchprefs moz_ldap_init_searchprefs
573 +#define ldap_init_searchprefs_buf moz_ldap_init_searchprefs_buf
574 +#define ldap_init_templates moz_ldap_init_templates
575 +#define ldap_init_templates_buf moz_ldap_init_templates_buf
576 +#define ldap_is_dns_dn moz_ldap_is_dns_dn
577 +#define ldap_is_ldap_url moz_ldap_is_ldap_url
578 +#define ldap_keysort_entries moz_ldap_keysort_entries
579 +#define ldap_ld_free moz_ldap_ld_free
580 +#define ldap_memcache_abandon moz_ldap_memcache_abandon
581 +#define ldap_memcache_append moz_ldap_memcache_append
582 +#define ldap_memcache_createkey moz_ldap_memcache_createkey
583 +#define ldap_memcache_destroy moz_ldap_memcache_destroy
584 +#define ldap_memcache_flush moz_ldap_memcache_flush
585 +#define ldap_memcache_flush_results moz_ldap_memcache_flush_results
586 +#define ldap_memcache_get moz_ldap_memcache_get
587 +#define ldap_memcache_init moz_ldap_memcache_init
588 +#define ldap_memcache_new moz_ldap_memcache_new
589 +#define ldap_memcache_result moz_ldap_memcache_result
590 +#define ldap_memcache_set moz_ldap_memcache_set
591 +#define ldap_memcache_update moz_ldap_memcache_update
592 +#define ldap_memfree moz_ldap_memfree
593 +#define ldap_modify moz_ldap_modify
594 +#define ldap_modify_ext moz_ldap_modify_ext
595 +#define ldap_modify_ext_s moz_ldap_modify_ext_s
596 +#define ldap_modify_s moz_ldap_modify_s
597 +#define ldap_modrdn moz_ldap_modrdn
598 +#define ldap_modrdn2 moz_ldap_modrdn2
599 +#define ldap_modrdn2_s moz_ldap_modrdn2_s
600 +#define ldap_modrdn_s moz_ldap_modrdn_s
601 +#define ldap_mods_free moz_ldap_mods_free
602 +#define ldap_msgdelete moz_ldap_msgdelete
603 +#define ldap_msgfree moz_ldap_msgfree
604 +#define ldap_msgid moz_ldap_msgid
605 +#define ldap_msgtype moz_ldap_msgtype
606 +#define ldap_multisort_entries moz_ldap_multisort_entries
607 +#define ldap_name2template moz_ldap_name2template
608 +#define ldap_next_attribute moz_ldap_next_attribute
609 +#define ldap_next_disptmpl moz_ldap_next_disptmpl
610 +#define ldap_next_entry moz_ldap_next_entry
611 +#define ldap_next_message moz_ldap_next_message
612 +#define ldap_next_reference moz_ldap_next_reference
613 +#define ldap_next_searchobj moz_ldap_next_searchobj
614 +#define ldap_next_tmplcol moz_ldap_next_tmplcol
615 +#define ldap_next_tmplrow moz_ldap_next_tmplrow
616 +#define ldap_oc2template moz_ldap_oc2template
617 +#define ldap_open moz_ldap_open
618 +#define ldap_parse_authzid_control moz_ldap_parse_authzid_control
619 +#define ldap_parse_entrychange_control moz_ldap_parse_entrychange_control
620 +#define ldap_parse_extended_result moz_ldap_parse_extended_result
621 +#define ldap_parse_passwd moz_ldap_parse_passwd
622 +#define ldap_parse_passwordpolicy_control moz_ldap_parse_passwordpolicy_control
623 +#define ldap_parse_passwordpolicy_control_ext moz_ldap_parse_passwordpolicy_control_ext
624 +#define ldap_parse_reference moz_ldap_parse_reference
625 +#define ldap_parse_result moz_ldap_parse_result
626 +#define ldap_parse_sasl_bind_result moz_ldap_parse_sasl_bind_result
627 +#define ldap_parse_sort_control moz_ldap_parse_sort_control
628 +#define ldap_parse_userstatus_control moz_ldap_parse_userstatus_control
629 +#define ldap_parse_virtuallist_control moz_ldap_parse_virtuallist_control
630 +#define ldap_parse_whoami moz_ldap_parse_whoami
631 +#define ldap_passwd moz_ldap_passwd
632 +#define ldap_passwd_s moz_ldap_passwd_s
633 +#define ldap_passwordpolicy_err2txt moz_ldap_passwordpolicy_err2txt
634 +#define ldap_perror moz_ldap_perror
635 +#define ldap_rename moz_ldap_rename
636 +#define ldap_rename_s moz_ldap_rename_s
637 +#define ldap_result moz_ldap_result
638 +#define ldap_result2error moz_ldap_result2error
639 +#define ldap_sasl_bind moz_ldap_sasl_bind
640 +#define ldap_sasl_bind_s moz_ldap_sasl_bind_s
641 +#define ldap_sasl_interactive_bind_ext_s moz_ldap_sasl_interactive_bind_ext_s
642 +#define ldap_sasl_interactive_bind_s moz_ldap_sasl_interactive_bind_s
643 +#define ldap_search moz_ldap_search
644 +#define ldap_search_ext moz_ldap_search_ext
645 +#define ldap_search_ext_s moz_ldap_search_ext_s
646 +#define ldap_search_s moz_ldap_search_s
647 +#define ldap_search_st moz_ldap_search_st
648 +#define ldap_set_filter_additions moz_ldap_set_filter_additions
649 +#define ldap_set_lderrno moz_ldap_set_lderrno
650 +#define ldap_set_option moz_ldap_set_option
651 +#define ldap_set_rebind_proc moz_ldap_set_rebind_proc
652 +#define ldap_setfilteraffixes moz_ldap_setfilteraffixes
653 +#define ldap_simple_bind moz_ldap_simple_bind
654 +#define ldap_simple_bind_s moz_ldap_simple_bind_s
655 +#define ldap_sort_entries moz_ldap_sort_entries
656 +#define ldap_sort_strcasecmp moz_ldap_sort_strcasecmp
657 +#define ldap_sort_values moz_ldap_sort_values
658 +#define ldap_start_tls_s moz_ldap_start_tls_s
659 +#define ldap_str2charray moz_ldap_str2charray
660 +#define ldap_tmplattrs moz_ldap_tmplattrs
661 +#define ldap_tmplerr2string moz_ldap_tmplerr2string
662 +#define ldap_tmplerrlist moz_ldap_tmplerrlist
663 +#define ldap_ufn_search_c moz_ldap_ufn_search_c
664 +#define ldap_ufn_search_ct moz_ldap_ufn_search_ct
665 +#define ldap_ufn_search_ctx moz_ldap_ufn_search_ctx
666 +#define ldap_ufn_search_s moz_ldap_ufn_search_s
667 +#define ldap_ufn_setfilter moz_ldap_ufn_setfilter
668 +#define ldap_ufn_setprefix moz_ldap_ufn_setprefix
669 +#define ldap_ufn_timeout moz_ldap_ufn_timeout
670 +#define ldap_unbind moz_ldap_unbind
671 +#define ldap_unbind_ext moz_ldap_unbind_ext
672 +#define ldap_unbind_s moz_ldap_unbind_s
673 +#define ldap_url_parse moz_ldap_url_parse
674 +#define ldap_url_parse_no_defaults moz_ldap_url_parse_no_defaults
675 +#define ldap_url_search moz_ldap_url_search
676 +#define ldap_url_search_s moz_ldap_url_search_s
677 +#define ldap_url_search_st moz_ldap_url_search_st
678 +#define ldap_utf8characters moz_ldap_utf8characters
679 +#define ldap_utf8copy moz_ldap_utf8copy
680 +#define ldap_utf8getcc moz_ldap_utf8getcc
681 +#define ldap_utf8isalnum moz_ldap_utf8isalnum
682 +#define ldap_utf8isalpha moz_ldap_utf8isalpha
683 +#define ldap_utf8isdigit moz_ldap_utf8isdigit
684 +#define ldap_utf8isspace moz_ldap_utf8isspace
685 +#define ldap_utf8isxdigit moz_ldap_utf8isxdigit
686 +#define ldap_utf8len moz_ldap_utf8len
687 +#define ldap_utf8next moz_ldap_utf8next
688 +#define ldap_utf8prev moz_ldap_utf8prev
689 +#define ldap_utf8strtok_r moz_ldap_utf8strtok_r
690 +#define ldap_vals2html moz_ldap_vals2html
691 +#define ldap_vals2text moz_ldap_vals2text
692 +#define ldap_value_free moz_ldap_value_free
693 +#define ldap_value_free_len moz_ldap_value_free_len
694 +#define ldap_version moz_ldap_version
695 +#define ldap_whoami moz_ldap_whoami
696 +#define ldap_whoami_s moz_ldap_whoami_s
697 +#define ldap_x_calloc moz_ldap_x_calloc
698 +#define ldap_x_free moz_ldap_x_free
699 +#define ldap_x_hostlist_first moz_ldap_x_hostlist_first
700 +#define ldap_x_hostlist_next moz_ldap_x_hostlist_next
701 +#define ldap_x_hostlist_statusfree moz_ldap_x_hostlist_statusfree
702 +#define ldap_x_malloc moz_ldap_x_malloc
703 +#define ldap_x_realloc moz_ldap_x_realloc
704 +
705  /* Standard LDAP API functions and declarations */
706  #include "ldap-standard.h"
707  
708
709
710 [FILE:9827:patches/patch-bug847568]
711 # Allow building against system-wide graphite2/harfbuzz.
712
713 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
714 index 7620b4d00623..09d3db5ca8c0 100644
715 --- config/system-headers.mozbuild
716 +++ config/system-headers.mozbuild
717 @@ -1292,6 +1292,19 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
718          'proxy.h',
719      ]
720  
721 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
722 +    system_headers += [
723 +        'graphite2/Font.h',
724 +        'graphite2/Segment.h',
725 +    ]
726 +
727 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
728 +    system_headers += [
729 +        'harfbuzz/hb-glib.h',
730 +        'harfbuzz/hb-ot.h',
731 +        'harfbuzz/hb.h',
732 +    ]
733 +
734  if CONFIG['MOZ_SYSTEM_LIBVPX']:
735      system_headers += [
736          'vpx_mem/vpx_mem.h',
737 diff --git dom/base/moz.build dom/base/moz.build
738 index 8e19020315ae..2fcdbb6f7b42 100644
739 --- dom/base/moz.build
740 +++ dom/base/moz.build
741 @@ -546,6 +546,9 @@ if CONFIG["MOZ_BUILD_APP"] in ["browser", "mobile/android", "xulrunner"]:
742  if CONFIG["MOZ_X11"]:
743      CXXFLAGS += CONFIG["TK_CFLAGS"]
744  
745 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
746 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
747 +
748  GeneratedFile(
749      "UseCounterList.h",
750      script="gen-usecounters.py",
751 diff --git gfx/graphite2/geckoextra/moz.build gfx/graphite2/geckoextra/moz.build
752 new file mode 100644
753 index 0000000000000..24e8d7a03274a
754 --- /dev/null
755 +++ gfx/graphite2/geckoextra/moz.build
756 @@ -0,0 +1,21 @@
757 +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
758 +# vim: set filetype=python:
759 +# This Source Code Form is subject to the terms of the Mozilla Public
760 +# License, v. 2.0. If a copy of the MPL was not distributed with this
761 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
762 +
763 +EXPORTS.graphite2 += [
764 +    'include/GraphiteExtra.h',
765 +    'include/GraphiteStructsForRLBox.h',
766 +]
767 +
768 +UNIFIED_SOURCES += [
769 +    '../geckoextra/src/GraphiteExtra.cpp',
770 +]
771 +
772 +CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
773 +
774 +# Match bundled graphite2 configuration
775 +AllowCompilerWarnings()
776 +
777 +FINAL_LIBRARY = 'gkmedias'
778 diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
779 index faaab1b17971..04eff5f09882 100644
780 --- gfx/graphite2/moz-gr-update.sh
781 +++ gfx/graphite2/moz-gr-update.sh
782 @@ -1,6 +1,7 @@
783  #!/bin/bash
784  
785  # Script used to update the Graphite2 library in the mozilla source tree
786 +# and bump version for --with-system-graphite2
787  
788  # This script lives in gfx/graphite2, along with the library source,
789  # but must be run from the top level of the mozilla-central tree.
790 @@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
791  #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
792  #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
793  
794 +# chase version for --with-system-graphite2
795 +perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
796 +  if /GR2_VERSION_REQUIRE/" old-configure.in
797 +
798  # summarize what's been touched
799  echo Updated to $RELEASE.
800  echo Here is what changed in the gfx/graphite2 directory:
801  echo
802  
803 -hg stat gfx/graphite2
804 +hg stat old-configure.in gfx/graphite2
805  
806  echo
807  echo If gfx/graphite2/src/files.mk has changed, please make corresponding
808 diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
809 index 22c76a7df020..a01490bd49ee 100644
810 --- gfx/harfbuzz/README-mozilla
811 +++ gfx/harfbuzz/README-mozilla
812 @@ -15,3 +15,8 @@ from within the gfx/harfbuzz directory.
813  
814  If the collection of source files changes, manual updates to moz.build may be
815  needed as we don't use the upstream makefiles.
816 +
817 +The in-tree copy may be omitted during build by --with-system-harfbuzz.
818 +Make sure to keep pkg-config version check within toolkit/moz.configure in sync
819 +with checkout version or increment latest tag by one if it's not based
820 +on upstream release.
821 diff --git gfx/moz.build gfx/moz.build
822 index 771f652e837a..3b358d84e384 100644
823 --- gfx/moz.build
824 +++ gfx/moz.build
825 @@ -13,6 +13,14 @@ with Files("wr/**"):
826  if CONFIG["MOZ_TREE_CAIRO"]:
827      DIRS += ["cairo"]
828  
829 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
830 +    DIRS += ["graphite2/geckoextra"]
831 +else:
832 +    DIRS += ["graphite2/src" ]
833 +
834 +if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
835 +    DIRS += ["harfbuzz/src"]
836 +
837  DIRS += [
838      "2d",
839      "ycbcr",
840 @@ -21,8 +29,6 @@ DIRS += [
841      "qcms",
842      "gl",
843      "layers",
844 -    "graphite2/src",
845 -    "harfbuzz/src",
846      "ots/src",
847      "thebes",
848      "ipc",
849 diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
850 index e06ae3457a47..93faa61594a3 100755
851 --- gfx/skia/generate_mozbuild.py
852 +++ gfx/skia/generate_mozbuild.py
853 @@ -98,6 +98,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
854          '-Wno-unused-private-field',
855      ]
856  
857 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
858 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
859 +
860  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
861      CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
862      CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
863 diff --git gfx/skia/moz.build gfx/skia/moz.build
864 index 2118677ca3a8..e4978b413784 100644
865 --- gfx/skia/moz.build
866 +++ gfx/skia/moz.build
867 @@ -490,6 +490,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
868          '-Wno-unused-private-field',
869      ]
870  
871 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
872 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
873 +
874  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
875      CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
876      CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
877 diff --git gfx/thebes/moz.build gfx/thebes/moz.build
878 index 56f1b9fe3f4b..0ac1100b0df3 100644
879 --- gfx/thebes/moz.build
880 +++ gfx/thebes/moz.build
881 @@ -287,7 +287,13 @@ if CONFIG["MOZ_WAYLAND"]:
882  
883  LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
884  
885 -DEFINES["GRAPHITE2_STATIC"] = True
886 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
887 +    CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
888 +else:
889 +    DEFINES["GRAPHITE2_STATIC"] = True
890 +
891 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
892 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
893  
894  if CONFIG["CC_TYPE"] == "clang":
895      # Suppress warnings from Skia header files.
896 diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
897 index cb1233c56d7e..06fb1f9f174b 100644
898 --- intl/unicharutil/util/moz.build
899 +++ intl/unicharutil/util/moz.build
900 @@ -25,4 +25,7 @@ UNIFIED_SOURCES += [
901      "nsUnicodeProperties.cpp",
902  ]
903  
904 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
905 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
906 +
907  FINAL_LIBRARY = "xul"
908 diff --git netwerk/dns/moz.build netwerk/dns/moz.build
909 index 79c26e3e7001..c4d93bc5f7dc 100644
910 --- netwerk/dns/moz.build
911 +++ netwerk/dns/moz.build
912 @@ -105,3 +105,6 @@ USE_LIBS += ["icu"]
913  
914  if CONFIG["CC_TYPE"] in ("clang", "gcc"):
915      CXXFLAGS += ["-Wno-error=shadow"]
916 +
917 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
918 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
919 diff --git old-configure.in old-configure.in
920 index 95a58b634593..b614eef85c89 100644
921 --- old-configure.in
922 +++ old-configure.in
923 @@ -2303,6 +2303,27 @@ dnl ========================================================
924  
925  AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
926  
927 +dnl ========================================================
928 +dnl Check for graphite2
929 +dnl ========================================================
930 +if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
931 +    dnl graphite2.pc has bogus version, check manually
932 +    _SAVE_CFLAGS=$CFLAGS
933 +    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
934 +    AC_TRY_COMPILE([ #include <graphite2/Font.h>
935 +                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
936 +                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
937 +                               * 100 + GR2_VERSION_BUGFIX >= \
938 +                               (major) * 10000 + (minor) * 100 + (bugfix) )
939 +                   ], [
940 +                     #if !GR2_VERSION_REQUIRE(1,3,14)
941 +                     #error "Insufficient graphite2 version."
942 +                     #endif
943 +                   ], [],
944 +                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
945 +    CFLAGS=$_SAVE_CFLAGS
946 +fi
947 +
948  dnl ========================================================
949  dnl Check for pixman and cairo
950  dnl ========================================================
951 diff --git toolkit/library/moz.build toolkit/library/moz.build
952 index 24f940e1ed7e..079a575adec3 100644
953 --- toolkit/library/moz.build
954 +++ toolkit/library/moz.build
955 @@ -247,6 +247,12 @@ if CONFIG["MOZ_SYSTEM_PNG"]:
956  if CONFIG["MOZ_SYSTEM_WEBP"]:
957      OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
958  
959 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
960 +    OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
961 +
962 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
963 +    OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
964 +
965  if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
966      OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
967  
968 diff --git toolkit/moz.configure toolkit/moz.configure
969 index 9297e4d6f501..d8e273887e4b 100644
970 --- toolkit/moz.configure
971 +++ toolkit/moz.configure
972 @@ -1055,6 +1055,25 @@ set_config("FT2_LIBS", ft2_info.libs)
973  add_old_configure_assignment("FT2_LIBS", ft2_info.libs)
974  add_old_configure_assignment("FT2_CFLAGS", ft2_info.cflags)
975  
976 +# Graphite2
977 +# ==============================================================
978 +option("--with-system-graphite2",
979 +       help="Use system graphite2 (located with pkgconfig)")
980 +
981 +system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2",
982 +                                     when="--with-system-graphite2")
983 +
984 +set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True))
985 +
986 +# HarfBuzz
987 +# ==============================================================
988 +option("--with-system-harfbuzz",
989 +       help="Use system harfbuzz (located with pkgconfig)")
990 +
991 +system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 2.7.4",
992 +                                    when="--with-system-harfbuzz")
993 +
994 +set_config("MOZ_SYSTEM_HARFBUZZ", depends_if(system_harfbuzz)(lambda _: True))
995  
996  # Remote agent
997  # (partial implementation of Chromium Remote Debugging Protocol)
998
999
1000 [FILE:406:patches/patch-comm__third_party__rnpdefs.mozbuild]
1001 --- comm/third_party/rnpdefs.mozbuild.orig      2021-08-11 20:13:25.176921000 +0200
1002 +++ comm/third_party/rnpdefs.mozbuild   2021-08-11 20:14:08.855374000 +0200
1003 @@ -43,6 +43,6 @@
1004      OS_LIBS += [static_libdir, "-l:libc++.a", "-l:libc++abi.a"]
1005  
1006  
1007 -if CONFIG["OS_ARCH"] in ("Linux", "SunOS"):
1008 +if CONFIG["OS_ARCH"] in ("Linux", "FreeBSD", "DragonFly", "SunOS"):
1009      CFLAGS += ["-fPIC"]
1010      CXXFLAGS += ["-fPIC"]
1011
1012
1013 [FILE:1292:patches/patch-comm_ldap_c-sdk_include_portable.h]
1014 --- comm/ldap/c-sdk/include/portable.h.orig     2020-05-21 20:31:05 UTC
1015 +++ comm/ldap/c-sdk/include/portable.h
1016 @@ -119,11 +119,15 @@
1017  #  define OPENLOG_OPTIONS (LOG_PID | LOG_NOWAIT)
1018  #endif
1019  
1020 +#ifdef __DragonFly__
1021 +#define DRAGONFLY
1022 +#endif
1023 +
1024  /*
1025   * some systems don't have the BSD re_comp and re_exec routines
1026   */
1027  #ifndef NEED_BSDREGEX
1028 -#  if (defined(SYSV) || defined(NETBSD) || defined(FREEBSD) ||       \
1029 +#  if (defined(SYSV) || defined(NETBSD) || defined(FREEBSD) || defined(DRAGONFLY) || \
1030         defined(__OpenBSD__) || defined(linux) || defined(DARWIN)) && \
1031        !defined(sgi)
1032  #    define NEED_BSDREGEX
1033 @@ -274,7 +278,7 @@ int strncasecmp(const char *, const char
1034        defined(SUNOS4) || defined(SNI) || defined(BSDI) || defined(NCR) ||      \
1035        defined(OSF1) || defined(NEC) || defined(VMS) ||                         \
1036        (defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) ||          \
1037 -      defined(UnixWare) || defined(NETBSD) || defined(FREEBSD) ||              \
1038 +      defined(UnixWare) || defined(NETBSD) || defined(FREEBSD) || defined(DRAGONFLY) || \
1039        defined(OPENBSD) || (defined(LINUX) && __GLIBC__ < 2) ||                 \
1040        (defined(AIX) && !defined(USE_REENTRANT_LIBC))
1041  #    define GETHOSTBYNAME(n, r, b, l, e) gethostbyname(n)
1042
1043
1044 [FILE:421:patches/patch-comm_mail_app_nsMailApp.cpp]
1045 --- comm/mail/app/nsMailApp.cpp.orig    2020-07-13 18:10:03 UTC
1046 +++ comm/mail/app/nsMailApp.cpp
1047 @@ -306,6 +306,9 @@ int main(int argc, char* argv[], char* e
1048    }
1049  #endif
1050  
1051 +  setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
1052 +  setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
1053 +
1054  #ifdef HAS_DLL_BLOCKLIST
1055    DllBlocklist_Initialize(gBlocklistInitFlags);
1056  #endif
1057
1058
1059 [FILE:679:patches/patch-comm_third__party_botan_configure.py]
1060 --- comm/third_party/botan/configure.py.orig    2020-07-13 18:10:04 UTC
1061 +++ comm/third_party/botan/configure.py
1062 @@ -2936,11 +2936,7 @@ def set_defaults_for_unset_options(optio
1063          options.os = find_canonical_os_name(options.os)
1064  
1065      def deduce_compiler_type_from_cc_bin(cc_bin):
1066 -        if cc_bin.find('clang') != -1 or cc_bin in ['emcc', 'em++']:
1067 -            return 'clang'
1068 -        if cc_bin.find('-g++') != -1 or cc_bin.find('g++') != -1:
1069 -            return 'gcc'
1070 -        return None
1071 +        return 'gcc'
1072  
1073      if options.compiler is None and options.compiler_binary is not None:
1074          options.compiler = deduce_compiler_type_from_cc_bin(options.compiler_binary)
1075
1076
1077 [FILE:286:patches/patch-comm_third__party_botan_src_build-data_os_freebsd.txt]
1078 FreeBSD 11.3 doesn't have sys/auxv.h
1079
1080 --- comm/third_party/botan/src/build-data/os/freebsd.txt.orig   2020-09-08 23:21:51 UTC
1081 +++ comm/third_party/botan/src/build-data/os/freebsd.txt
1082 @@ -11,7 +11,6 @@ dev_random
1083  arc4random
1084  explicit_bzero
1085  cap_enter
1086 -elf_aux_info
1087  getentropy
1088  
1089  atomics
1090
1091
1092 [FILE:914:patches/patch-env-api-keys]
1093 # Accept API keys from environment like before bug 1294585
1094
1095 --- build/moz.configure/keyfiles.configure
1096 +++ build/moz.configure/keyfiles.configure
1097 @@ -19,6 +19,7 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x):
1098      @checking("for the %s key" % desc, lambda x: x and x is not no_key)
1099      @imports(_from="__builtin__", _import="open")
1100      @imports(_from="__builtin__", _import="IOError")
1101 +    @imports(_from="os", _import="environ")
1102      def keyfile(value):
1103          if value:
1104              try:
1105 @@ -29,7 +30,7 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x):
1106                      raise FatalCheckError("'%s' is empty." % value[0])
1107              except IOError as e:
1108                  raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
1109 -        return no_key
1110 +        return environ.get("MOZ_%s_KEY" % desc.upper().replace(" ", "_")) or no_key
1111  
1112      return keyfile
1113  
1114
1115
1116 [FILE:2142:patches/patch-freebsd11.3]
1117 Drop after FreeBSD 11.3 EOL around 2020-09-20.
1118 https://svnweb.freebsd.org/changeset/base/351766
1119
1120 mozglue/baseprofiler/core/shared-libraries-linux.cc:374:34: error: use of undeclared
1121       identifier 'NT_GNU_BUILD_ID'
1122       if (note_header->n_type == NT_GNU_BUILD_ID) break;
1123                                  ^
1124 In file included from Unified_cpp_mozglue_baseprofiler0.cpp:137:
1125 mozglue/baseprofiler/lul/LulElf.cpp:762:32: error: use of undeclared identifier
1126       'NT_GNU_BUILD_ID'
1127     if (note_header->n_type == NT_GNU_BUILD_ID) break;
1128                                ^
1129 In file included from Unified_cpp_tools_profiler1.cpp:38:
1130 tools/profiler/lul/LulElf.cpp:776:32: error: use of undeclared identifier
1131       'NT_GNU_BUILD_ID'
1132     if (note_header->n_type == NT_GNU_BUILD_ID) break;
1133                                ^
1134
1135 --- mozglue/baseprofiler/core/shared-libraries-linux.cc.orig    2020-06-25 17:04:48 UTC
1136 +++ mozglue/baseprofiler/core/shared-libraries-linux.cc
1137 @@ -50,6 +50,11 @@ extern "C" MOZ_EXPORT __attribute__((weak)) int dl_ite
1138  #  define ElfW(type) Elf_##type
1139  #endif
1140  
1141 +#if defined(GP_OS_freebsd) && !defined(NT_GNU_BUILD_ID)
1142 +// FreeBSD < 11.4 doesn't define NT_GNU_BUILD_ID
1143 +#  define NT_GNU_BUILD_ID 3
1144 +#endif
1145 +
1146  // ----------------------------------------------------------------------------
1147  // Starting imports from toolkit/crashreporter/google-breakpad/, as needed by
1148  // this file when moved to mozglue.
1149 --- mozglue/baseprofiler/lul/LulElf.cpp.orig    2020-06-25 17:04:48 UTC
1150 +++ mozglue/baseprofiler/lul/LulElf.cpp
1151 @@ -79,6 +79,11 @@
1152  #  define EM_AARCH64 183
1153  #endif
1154  
1155 +#if defined(GP_OS_freebsd) && !defined(NT_GNU_BUILD_ID)
1156 +// FreeBSD < 11.4 doesn't define NT_GNU_BUILD_ID
1157 +#  define NT_GNU_BUILD_ID 3
1158 +#endif
1159 +
1160  // This namespace contains helper functions.
1161  namespace {
1162  
1163 --- tools/profiler/lul/LulElf.cpp.orig  2020-06-25 17:05:05 UTC
1164 +++ tools/profiler/lul/LulElf.cpp
1165 @@ -84,6 +84,11 @@
1166  #  define EM_AARCH64 183
1167  #endif
1168  
1169 +#if defined(GP_OS_freebsd) && !defined(NT_GNU_BUILD_ID)
1170 +// FreeBSD < 11.4 doesn't define NT_GNU_BUILD_ID
1171 +#  define NT_GNU_BUILD_ID 3
1172 +#endif
1173 +
1174  // This namespace contains helper functions.
1175  namespace {
1176  
1177
1178
1179 [FILE:890:patches/patch-gfx_skia_skia_src_core_SkCpu.cpp]
1180 Regressed by https://svnweb.freebsd.org/changeset/base/324815
1181
1182 gfx/skia/skia/src/core/SkCpu.cpp:81:27: error: use of undeclared identifier 'getauxval'
1183         uint32_t hwcaps = getauxval(AT_HWCAP);
1184                           ^
1185
1186 --- gfx/skia/skia/src/core/SkCpu.cpp.orig       2020-07-13 18:06:57 UTC
1187 +++ gfx/skia/skia/src/core/SkCpu.cpp
1188 @@ -72,6 +72,20 @@
1189          return features;
1190      }
1191  
1192 +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__)
1193 +    #include <machine/armreg.h>
1194 +
1195 +    static uint32_t read_cpu_features() {
1196 +        uint32_t features = 0;
1197 +        uint64_t id_aa64isar0;
1198 +
1199 +        id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1);
1200 +        if (ID_AA64ISAR0_CRC32(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
1201 +            features |= SkCpu::CRC32;
1202 +        }
1203 +        return features;
1204 +    }
1205 +
1206  #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
1207      #include <sys/auxv.h>
1208  
1209
1210
1211 [FILE:290:files/thunderbird.desktop]
1212 [Desktop Entry]
1213 Encoding=UTF-8
1214 Name=Thunderbird
1215 GenericName=Mail Client
1216 Comment=Mail client and News Reader
1217 Exec=thunderbird %u
1218 Icon=thunderbird.png
1219 StartupNotify=true
1220 Terminal=false
1221 Type=Application
1222 Categories=Network;Email;News;InstantMessaging;
1223 MimeType=application/mbox;message/rfc822;
1224