Ravenports generated: 28 Sep 2022 13:54
[ravenports.git] / bucket_AC / firefox
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               firefox
4 VERSION=                105.0.1
5 KEYWORDS=               www
6 VARIANTS=               standard
7 SDESC[standard]=        Mozilla web browser
8 HOMEPAGE=               https://www.mozilla.org/en-US/firefox/
9 CONTACT=                nobody
10
11 DOWNLOAD_GROUPS=        main
12 SITES[main]=            MOZILLA/firefox/releases/105.0.1/source
13 DISTFILE[1]=            firefox-105.0.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=          autoconf213:single:standard
21                         cbindgen:single:standard
22                         nodejs:primary:standard
23                         rust:single:standard
24                         yasm:single:standard
25                         nasm:primary:standard
26                         zip:single:standard
27                         python-sqlite3:single:python_used
28                         evdev-proto:single:standard
29 BUILDRUN_DEPENDS=       dbus-glib:primary:standard
30                         ffmpeg:primary:standard
31                         harfbuzz:primary:standard
32                         icu:single:standard
33                         libcanberra:primary:standard
34                         libevent:single:standard
35                         libffi:single:standard
36                         libnotify:primary:standard
37                         libproxy:single:standard
38                         libdrm:single:standard
39                         nss:primary:standard
40 RUN_DEPENDS=            pciutils:library:standard
41
42 USES=                   cpe desktop-utils:single gmake jpeg perl:build
43                         pkgconfig png python:build zlib clang:keepcc
44 GNOME_COMPONENTS=       gdkpixbuf gtk3
45 XORG_COMPONENTS=        pixman xcb
46
47 LICENSE=                MPL:single
48 LICENSE_TERMS=          single:{{WRKSRC}}/toolkit/content/license.html
49 LICENSE_FILE=           MPL:stock
50 LICENSE_SCHEME=         solo
51
52 CPE_VENDOR=             mozilla
53 FPC_EQUIVALENT=         www/firefox
54
55 MUST_CONFIGURE=         yes
56 CONFIGURE_OUTSOURCE=    yes
57 CONFIGURE_ENV=          PYTHON3={{PYTHON_CMD}}
58                         SETUPTOOLS_USE_DISTUTILS=stdlib
59                         BINDGEN_CFLAGS="-I{{LOCALBASE}}/include"
60
61 MAKE_ENV=               PYTHON3={{PYTHON_CMD}}
62                         CXXSTDLIB="stdc++"
63
64 QMAKE_ARGS=             --enable-application=browser
65                         --enable-chrome-format=omni
66                         --enable-default-toolkit=cairo-gtk3
67                         --enable-install-strip
68                         --enable-official-branding
69                         --enable-optimize
70                         --enable-release
71                         --enable-strip
72                         --enable-libproxy
73                         --enable-system-ffi
74                         --enable-system-pixman
75                         --disable-alsa
76                         --disable-debug
77                         --disable-debug-symbols
78                         --disable-dtrace
79                         --disable-jack
80                         --disable-profiling
81                         --disable-pulseaudio
82                         --disable-tests
83                         --disable-updater
84                         --disable-webrtc
85                         --disable-hardening
86                         --prefix="{{PREFIX}}"
87                         --with-intl-api
88                         --with-system-graphite2
89                         --with-system-harfbuzz
90                         --with-system-icu
91                         --with-system-jpeg
92                         --with-system-libevent
93                         --with-system-nspr
94                         --with-system-nss
95                         --with-system-png
96                         --with-system-zlib
97                         --without-wasm-sandboxed-libraries
98 VAR_OPSYS[linux]=       QMAKE_ARGS=--disable-elf-hack
99
100 post-patch:
101         ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
102                 ${WRKSRC}/browser/app/nsBrowserApp.cpp
103         ${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \
104                 -e '/^Icon/s/=.*/=firefox/' \
105                 ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop
106         (cd ${WRKSRC}/gfx/angle/checkout/src/compiler/translator && \
107                 ${REINPLACE_CMD} -e 's|<math.h>|<cmath>|' \
108                 InfoSink.h IntermNode.cpp)
109         # disable SCTP
110         ${REINPLACE_CMD} -e 's|MOZ_SCTP|MOZ_DISABLE_SCTP|' \
111                 ${WRKSRC}/netwerk/moz.build
112         # disable rust checksums
113         ${REINPLACE_CMD} -e 's/"files":{[^}]*}/"files":{}/' \
114                  ${WRKSRC}/third_party/rust/libc/.cargo-checksum.json
115         # Set mozilla options
116         @${ECHO_CMD} "--=> Setting configuration <=--"
117         @for arg in ${QMAKE_ARGS}; do \
118                 ${ECHO_CMD} ".mozconfig <<  $$arg" ;\
119                 ${ECHO_CMD} ac_add_options $$arg >> ${WRKSRC}/.mozconfig ;\
120         done
121         @${ECHO_CMD} LDFLAGS=\"-Wl,-rpath,${PREFIX}/lib/firefox\" \
122                 >> ${WRKSRC}/.mozconfig
123
124 post-install:
125         ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps \
126                 ${STAGEDIR}${PREFIX}/share/applications
127         ${INSTALL_DATA} ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop \
128                 ${STAGEDIR}${PREFIX}/share/applications/
129         ${LN} -sf ${PREFIX}/lib/firefox/browser/chrome/icons/default/default48.png \
130                 ${STAGEDIR}${PREFIX}/share/pixmaps/firefox.png
131
132 pre-configure:
133         (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
134         (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
135
136 [FILE:527:descriptions/desc.single]
137 Firefox is a full-featured standard-compliant web browser, built on the
138 Mozilla codebase by thousands of contributors around the world.
139 It is extensible through thousands of user-contributed extensions, and
140 features:
141  * Improved Security;
142  * Improved Tabbed Browsing, with tab grouping;
143  * Private Browsing;
144  * Spell Checking;
145  * Search Suggestions;
146  * Session Restore;
147  * Web Feeds (RSS);
148  * Live Titles;
149  * Integrated Search;
150  * Live Bookmarks;
151  * Pop-up Blocker;
152  * Phishing Protection;
153  * Themes;
154  * Search Engine Manager.
155
156
157 [FILE:108:distinfo]
158 70ecea0d26242d0c3613b9524405d72a22b52ae346072ac229a58c48634975cd    475536540 firefox-105.0.1.source.tar.xz
159
160
161 [FILE:981:manifests/plist.single]
162 %%ONLY-LINUX%%lib/firefox/
163  Throbber-small.gif
164  crashreporter
165  crashreporter.ini
166  libmozsandbox.so
167  minidump-analyzer
168 %%ONLY-LINUX%%lib/firefox/browser/crashreporter-override.ini
169 bin/firefox
170 lib/firefox/
171  application.ini
172  dependentlibs.list
173  firefox
174  firefox-bin
175  libipcclientcerts.so
176  liblgpllibs.so
177  libmozavcodec.so
178  libmozavutil.so
179  libmozgtk.so
180  libmozsqlite3.so
181  libxul.so
182  omni.ja
183  pingsender
184  platform.ini
185  plugin-container
186  removed-files
187 lib/firefox/browser/omni.ja
188 lib/firefox/browser/chrome/icons/default/
189  default128.png
190  default16.png
191  default32.png
192  default48.png
193  default64.png
194 lib/firefox/browser/features/
195  formautofill@mozilla.org.xpi
196  pictureinpicture@mozilla.org.xpi
197  screenshots@mozilla.org.xpi
198  webcompat-reporter@mozilla.org.xpi
199  webcompat@mozilla.org.xpi
200 lib/firefox/defaults/pref/channel-prefs.js
201 lib/firefox/fonts/TwemojiMozilla.ttf
202 lib/firefox/gmp-clearkey/0.1/
203  libclearkey.so
204  manifest.json
205 share/applications/firefox.desktop
206 share/pixmaps/firefox.png
207
208
209 [FILE:4568:patches/patch-addon-search]
210 https://github.com/mozilla/addons/issues/708
211 https://github.com/mozilla/addons-frontend/issues/4610
212
213 diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
214 index af08811..77a3b18 100644
215 --- browser/app/profile/firefox.js
216 +++ browser/app/profile/firefox.js
217 @@ -38,7 +38,7 @@ pref("extensions.postDownloadThirdPartyPrompt", true);
218  // Preferences for AMO integration
219  pref("extensions.getAddons.cache.enabled", true);
220  pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%");
221 -pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
222 +pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
223  pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
224  pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%");
225  pref("extensions.getAddons.discovery.api_url", "https://services.addons.mozilla.org/api/v4/discovery/?lang=%LOCALE%&edition=%DISTRIBUTION%");
226 @@ -193,8 +193,8 @@ pref("app.update.langpack.enabled", true);
227  //  .. etc ..
228  //
229  pref("extensions.update.enabled", true);
230 -pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/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%");
231 -pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/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%");
232 +pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/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%");
233 +pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/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  pref("extensions.update.interval", 86400);  // Check for updates to Extensions and
235                                              // Themes every day
236  
237 diff --git toolkit/mozapps/extensions/internal/AddonRepository.jsm toolkit/mozapps/extensions/internal/AddonRepository.jsm
238 index 661c902..a41b32f 100644
239 --- toolkit/mozapps/extensions/internal/AddonRepository.jsm
240 +++ toolkit/mozapps/extensions/internal/AddonRepository.jsm
241 @@ -592,7 +592,7 @@ var AddonRepository = {
242        addon.version = String(aEntry.current_version.version);
243        if (Array.isArray(aEntry.current_version.files)) {
244          for (let file of aEntry.current_version.files) {
245 -          if (file.platform == "all" || file.platform == lazy.PLATFORM) {
246 +          if (file.platform == "all" || file.platform == "linux" || file.platform == lazy.PLATFORM) {
247              if (file.url) {
248                addon.sourceURI = NetUtil.newURI(file.url);
249              }
250 diff --git toolkit/mozapps/extensions/internal/XPIDatabase.jsm toolkit/mozapps/extensions/internal/XPIDatabase.jsm
251 index f8c99c7..c6ba8a1 100644
252 --- toolkit/mozapps/extensions/internal/XPIDatabase.jsm
253 +++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm
254 @@ -520,7 +520,7 @@ class AddonInternal {
255      // Something is causing errors in here
256      try {
257        for (let platform of this.targetPlatforms) {
258 -        if (platform.os == Services.appinfo.OS) {
259 +        if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
260            if (platform.abi) {
261              needsABI = true;
262              if (platform.abi === abi) {
263
264
265 [FILE:501:patches/patch-browser_app_nsBrowserApp.cpp]
266 diff --git browser/app/nsBrowserApp.cpp browser/app/nsBrowserApp.cpp
267 index 87c2e16..a41f1d9 100644
268 --- browser/app/nsBrowserApp.cpp
269 +++ browser/app/nsBrowserApp.cpp
270 @@ -337,6 +337,9 @@ int main(int argc, char* argv[], char* envp[]) {
271    }
272  #endif
273  
274 +  setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
275 +  setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
276 +
277  #ifdef HAS_DLL_BLOCKLIST
278    DllBlocklist_Initialize(gBlocklistInitFlags);
279  #endif
280
281
282 [FILE:4140:patches/patch-bug1559213]
283 commit 717bba28411c
284 Author: Jory A. Pratt <anarchy@gentoo.org>
285 Date:   Thu Jun 13 11:53:00 2019 -0700
286
287     Bug 1559213 - Allow to use system av1 libs instead of bundled.
288 ---
289  config/external/moz.build      |  5 +++--
290  config/system-headers.mozbuild |  8 ++++++++
291  dom/media/platforms/moz.build  |  5 +++++
292  toolkit/moz.configure          | 19 ++++++++++++++++++-
293  4 files changed, 34 insertions(+), 3 deletions(-)
294
295 diff --git config/external/moz.build config/external/moz.build
296 index ab77121..75595d9 100644
297 --- config/external/moz.build
298 +++ config/external/moz.build
299 @@ -49,8 +49,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
300      external_dirs += ["media/libvpx"]
301  
302  if CONFIG["MOZ_AV1"]:
303 -    external_dirs += ["media/libaom"]
304 -    external_dirs += ["media/libdav1d"]
305 +    if not CONFIG["MOZ_SYSTEM_AV1"]:
306 +        external_dirs += ["media/libaom"]
307 +        external_dirs += ["media/libdav1d"]
308  
309  if not CONFIG["MOZ_SYSTEM_PNG"]:
310      external_dirs += ["media/libpng"]
311 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
312 index a1b58eb..65729f9 100644
313 --- config/system-headers.mozbuild
314 +++ config/system-headers.mozbuild
315 @@ -1289,6 +1289,14 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
316          'proxy.h',
317      ]
318  
319 +if CONFIG['MOZ_SYSTEM_AV1']:
320 +    system_headers += [
321 +        'aom/aom_decoder.h',
322 +        'aom/aomdx.h',
323 +        'aom/aom_image.h',
324 +        'dav1d/dav1d.h',
325 +    ]
326 +
327  if CONFIG['MOZ_SYSTEM_LIBVPX']:
328      system_headers += [
329          'vpx_mem/vpx_mem.h',
330 diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
331 index 8509aec..eb6f129 100644
332 --- dom/media/platforms/moz.build
333 +++ dom/media/platforms/moz.build
334 @@ -78,6 +78,11 @@ if CONFIG["MOZ_AV1"]:
335          "agnostic/AOMDecoder.cpp",
336          "agnostic/DAV1DDecoder.cpp",
337      ]
338 +    if CONFIG['MOZ_SYSTEM_AV1']:
339 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
340 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
341 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
342 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
343  
344  if CONFIG["MOZ_OMX"]:
345      EXPORTS += [
346 diff --git media/ffvpx/libavcodec/moz.build media/ffvpx/libavcodec/moz.build
347 index 0069865..e806fc8 100644
348 --- media/ffvpx/libavcodec/moz.build
349 +++ media/ffvpx/libavcodec/moz.build
350 @@ -112,9 +112,15 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
351              'vaapi_vp8.c',
352              'vaapi_vp9.c',
353          ]
354 +        if CONFIG["MOZ_SYSTEM_AV1"]:
355 +          CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
356 +          OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
357 +        else:
358 +          USE_LIBS += [
359 +            'dav1d',
360 +            'media_libdav1d_asm',
361 +          ]
362          USE_LIBS += [
363 -          'dav1d',
364 -          'media_libdav1d_asm',
365            'mozva'
366          ]
367  
368 diff --git toolkit/moz.configure toolkit/moz.configure
369 index 0069865..e806fc8 100644
370 --- toolkit/moz.configure
371 +++ toolkit/moz.configure
372 @@ -523,7 +523,23 @@ def av1(value):
373          return True
374  
375  
376 -@depends(target, when=av1 & compile_environment)
377 +option("--with-system-av1",
378 +       help="Use system av1 (located with pkgconfig)")
379 +
380 +system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
381 +                                       when="--with-system-av1")
382 +
383 +system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
384 +                                         when="--with-system-av1")
385 +
386 +@depends(system_libaom_info, system_libdav1d_info)
387 +def system_av1(system_libaom_info, system_libdav1d_info):
388 +    has_av1_libs = False
389 +    if system_libaom_info and system_libdav1d_info:
390 +        has_av1_libs = True
391 +    return has_av1_libs
392 +
393 +@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
394  def dav1d_asm(target):
395      if target.cpu in ("aarch64", "x86", "x86_64"):
396          return True
397 @@ -539,6 +555,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
398  set_define("MOZ_DAV1D_ASM", dav1d_asm)
399  set_config("MOZ_AV1", av1)
400  set_define("MOZ_AV1", av1)
401 +set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
402  
403  # JXL Image Codec Support
404  # ==============================================================
405
406
407 [FILE:2109:patches/patch-bug1659612]
408 media/libcubeb/src/cubeb_alsa.c:613:9: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned int, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
409     r = snprintf(node_name, sizeof(node_name), "pcm.%s", string);
410         ^
411 media/libcubeb/src/cubeb_alsa.c:613:9: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
412 media/libcubeb/src/cubeb_alsa.c:1168:3: error: implicitly declaring library function 'alloca' with type 'void *(unsigned int)' [-Werror,-Wimplicit-function-declaration]
413   snd_pcm_hw_params_alloca(&hw_params);
414   ^
415 /usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
416 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
417                                       ^
418 /usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
419 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
420                                                         ^
421 media/libcubeb/src/cubeb_alsa.c:1168:3: note: include the header <stdlib.h> or explicitly provide a declaration for 'alloca'
422 /usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
423 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
424                                       ^
425 /usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
426 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
427                                                         ^
428 2 errors generated.
429
430 --- media/libcubeb/src/cubeb_alsa.c.orig        2021-08-31 14:26:24.530548000 +0200
431 +++ media/libcubeb/src/cubeb_alsa.c     2021-08-31 14:26:43.081470000 +0200
432 @@ -5,9 +5,7 @@
433   * accompanying file LICENSE for details.
434   */
435  #undef NDEBUG
436 -#define _DEFAULT_SOURCE
437 -#define _BSD_SOURCE
438 -#define _XOPEN_SOURCE 500
439 +#define _GNU_SOURCE 1
440  #include "cubeb-internal.h"
441  #include "cubeb/cubeb.h"
442  #include <alsa/asoundlib.h>
443
444
445 [FILE:2800:patches/patch-bug1664115]
446 Revert bug 1647717 to workaround the issue of occational tab crashing when
447 using any cubeb backends other than pulse-rust to play media. The loss of
448 such change will be that users will not be able to do profiling on threads
449 created by libcubeb.
450
451 --- dom/media/AudioStream.cpp.orig      2022-09-08 21:05:37.835865000 +0200
452 +++ dom/media/AudioStream.cpp   2022-09-08 21:12:51.417935000 +0200
453 @@ -27,7 +27,6 @@
454  #endif
455  #include "Tracing.h"
456  #include "webaudio/blink/DenormalDisabler.h"
457 -#include "AudioThreadRegistry.h"
458  #include "mozilla/StaticPrefs_media.h"
459  
460  // Use abort() instead of exception in SoundTouch.
461 @@ -144,8 +143,6 @@
462        mOutChannels(aOutputChannels),
463        mState(INITIALIZED),
464        mDataSource(aSource),
465 -      mAudioThreadId(ProfilerThreadId{}),
466 -      mSandboxed(CubebUtils::SandboxEnabled()),
467        mPlaybackComplete(false),
468        mPlaybackRate(1.0f),
469        mPreservesPitch(true),
470 @@ -554,17 +551,6 @@
471        aWriter.Available());
472  }
473  
474 -bool AudioStream::CheckThreadIdChanged() {
475 -  ProfilerThreadId id = profiler_current_thread_id();
476 -  if (id != mAudioThreadId) {
477 -    mAudioThreadId = id;
478 -    mAudioThreadChanged = true;
479 -    return true;
480 -  }
481 -  mAudioThreadChanged = false;
482 -  return false;
483 -}
484 -
485  void AudioStream::AssertIsOnAudioThread() const {
486    // This can be called right after CheckThreadIdChanged, because the audio
487    // thread can change when not sandboxed.
488 @@ -593,9 +579,6 @@
489  }
490  
491  long AudioStream::DataCallback(void* aBuffer, long aFrames) {
492 -  if (CheckThreadIdChanged() && !mSandboxed) {
493 -    CubebUtils::GetAudioThreadRegistry()->Register(mAudioThreadId);
494 -  }
495    WebCore::DenormalDisabler disabler;
496    if (!mCallbacksStarted) {
497      mCallbacksStarted = true;
498 @@ -653,9 +636,6 @@
499    mDumpFile.Write(static_cast<const AudioDataValue*>(aBuffer),
500                    aFrames * mOutChannels);
501  
502 -  if (!mSandboxed && writer.Available() != 0) {
503 -    CubebUtils::GetAudioThreadRegistry()->Unregister(mAudioThreadId);
504 -  }
505    return aFrames - writer.Available();
506  }
507  
508 --- dom/media/AudioStream.h.orig        2022-09-08 21:13:08.562133000 +0200
509 +++ dom/media/AudioStream.h     2022-09-08 21:15:22.121196000 +0200
510 @@ -339,7 +339,6 @@
511  
512    template <typename Function, typename... Args>
513    int InvokeCubeb(Function aFunction, Args&&... aArgs) MOZ_REQUIRES(mMonitor);
514 -  bool CheckThreadIdChanged();
515    void AssertIsOnAudioThread() const;
516  
517    soundtouch::SoundTouch* mTimeStretcher;
518 @@ -378,9 +377,6 @@
519    // the default device is used. It is set
520    // during the Init() in decoder thread.
521    RefPtr<AudioDeviceInfo> mSinkInfo;
522 -  // Contains the id of the audio thread, from profiler_get_thread_id.
523 -  std::atomic<ProfilerThreadId> mAudioThreadId;
524 -  const bool mSandboxed = false;
525  
526    MozPromiseHolder<MediaSink::EndedPromise> mEndedPromise
527        MOZ_GUARDED_BY(mMonitor);
528
529
530 [FILE:14717:patches/patch-bug1680982]
531 commit 3204512f58a1
532 Author: Greg V <greg@unrelenting.technology>
533 Date:   Sun Dec 6 22:07:00 2020 +0000
534
535     Bug 1680982 - Use evdev instead of the Linux legacy joystick API for gamepads
536     
537     Using evdev is a prerequisite for adding rumble (haptic feedback) and LED support.
538     
539     - BTN_GAMEPAD semantic buttons are interpreted directly,
540     since all kernel drivers are supposed to use them correctly:
541     https://www.kernel.org/doc/html/latest/input/gamepad.html
542     - BTN_JOYSTICK legacy style numbered buttons use the model specific remappers
543     - we support even strange devices that combine both styles in one device
544     - the Linux gamepad module is enabled on FreeBSD and DragonFly, because
545     these kernels provide evdev, and libudev-devd provides enough of libudev
546     (evdev headers are provided by the devel/evdev-proto package)
547     
548     Differential Revision: https://phabricator.services.mozilla.com/D98868
549 ---
550  dom/gamepad/linux/LinuxGamepad.cpp | 262 ++++++++++++++++++++++++++++++++-----
551  dom/gamepad/moz.build              |   2 +-
552  2 files changed, 229 insertions(+), 35 deletions(-)
553
554 diff --git dom/gamepad/linux/LinuxGamepad.cpp dom/gamepad/linux/LinuxGamepad.cpp
555 index deee47b9d267..31f0aad7ae4a 100644
556 --- dom/gamepad/linux/LinuxGamepad.cpp
557 +++ dom/gamepad/linux/LinuxGamepad.cpp
558 @@ -5,15 +5,16 @@
559   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
560  
561  /*
562 - * LinuxGamepadService: A Linux backend for the GamepadService.
563 - * Derived from the kernel documentation at
564 - * http://www.kernel.org/doc/Documentation/input/joystick-api.txt
565 + * LinuxGamepadService: An evdev backend for the GamepadService.
566 + *
567 + * Ref: https://www.kernel.org/doc/html/latest/input/gamepad.html
568   */
569  #include <algorithm>
570 +#include <unordered_map>
571  #include <cstddef>
572  
573  #include <glib.h>
574 -#include <linux/joystick.h>
575 +#include <linux/input.h>
576  #include <stdio.h>
577  #include <stdint.h>
578  #include <sys/ioctl.h>
579 @@ -21,10 +22,14 @@
580  #include "nscore.h"
581  #include "mozilla/dom/GamepadHandle.h"
582  #include "mozilla/dom/GamepadPlatformService.h"
583 +#include "mozilla/dom/GamepadRemapping.h"
584  #include "mozilla/Tainting.h"
585  #include "mozilla/UniquePtr.h"
586  #include "udev.h"
587  
588 +#define LONG_BITS (sizeof(long) * 8)
589 +#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
590 +
591  namespace {
592  
593  using namespace mozilla::dom;
594 @@ -36,19 +41,29 @@ using mozilla::udev_list_entry;
595  using mozilla::udev_monitor;
596  using mozilla::UniquePtr;
597  
598 -static const float kMaxAxisValue = 32767.0;
599 -static const char kJoystickPath[] = "/dev/input/js";
600 +static const char kEvdevPath[] = "/dev/input/event";
601 +
602 +static inline bool TestBit(const unsigned long* arr, int bit) {
603 +  return !!(arr[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
604 +}
605 +
606 +static inline double ScaleAxis(const input_absinfo& info, int value) {
607 +  return 2.0 * (value - info.minimum) / (double)(info.maximum - info.minimum) -
608 +         1.0;
609 +}
610  
611  // TODO: should find a USB identifier for each device so we can
612  // provide something that persists across connect/disconnect cycles.
613 -typedef struct {
614 +struct Gamepad {
615    GamepadHandle handle;
616 -  guint source_id;
617 -  int numAxes;
618 -  int numButtons;
619 -  char idstring[256];
620 -  char devpath[PATH_MAX];
621 -} Gamepad;
622 +  RefPtr<GamepadRemapper> remapper = nullptr;
623 +  guint source_id = UINT_MAX;
624 +  char idstring[256] = {0};
625 +  char devpath[PATH_MAX] = {0};
626 +  uint8_t key_map[KEY_MAX] = {0};
627 +  uint8_t abs_map[ABS_MAX] = {0};
628 +  std::unordered_map<uint16_t, input_absinfo> abs_info;
629 +};
630  
631  class LinuxGamepadService {
632   public:
633 @@ -66,7 +81,7 @@ class LinuxGamepadService {
634    bool is_gamepad(struct udev_device* dev);
635    void ReadUdevChange();
636  
637 -  // handler for data from /dev/input/jsN
638 +  // handler for data from /dev/input/eventN
639    static gboolean OnGamepadData(GIOChannel* source, GIOCondition condition,
640                                  gpointer data);
641  
642 @@ -114,8 +129,14 @@ void LinuxGamepadService::AddDevice(struct udev_device* dev) {
643    g_io_channel_set_encoding(channel, nullptr, nullptr);
644    g_io_channel_set_buffered(channel, FALSE);
645    int fd = g_io_channel_unix_get_fd(channel);
646 +
647 +  struct input_id id {};
648 +  if (ioctl(fd, EVIOCGID, &id) == -1) {
649 +    return;
650 +  }
651 +
652    char name[128];
653 -  if (ioctl(fd, JSIOCGNAME(sizeof(name)), &name) == -1) {
654 +  if (ioctl(fd, EVIOCGNAME(sizeof(name)), &name) == -1) {
655      strcpy(name, "unknown");
656    }
657    const char* vendor_id =
658 @@ -131,20 +152,86 @@ void LinuxGamepadService::AddDevice(struct udev_device* dev) {
659        model_id = mUdev.udev_device_get_sysattr_value(parent, "id/product");
660      }
661    }
662 +  if (!vendor_id && id.vendor != 0) {
663 +    vendor_id = (const char*)alloca(5);
664 +    snprintf((char*)vendor_id, 5, "%04x", id.vendor);
665 +  }
666 +  if (!model_id && id.product != 0) {
667 +    model_id = (const char*)alloca(5);
668 +    snprintf((char*)model_id, 5, "%04x", id.product);
669 +  }
670    snprintf(gamepad->idstring, sizeof(gamepad->idstring), "%s-%s-%s",
671             vendor_id ? vendor_id : "unknown", model_id ? model_id : "unknown",
672             name);
673  
674    char numAxes = 0, numButtons = 0;
675 -  ioctl(fd, JSIOCGAXES, &numAxes);
676 -  gamepad->numAxes = numAxes;
677 -  ioctl(fd, JSIOCGBUTTONS, &numButtons);
678 -  gamepad->numButtons = numButtons;
679 +  unsigned long key_bits[NLONGS(KEY_CNT)] = {0};
680 +  unsigned long abs_bits[NLONGS(ABS_CNT)] = {0};
681 +  ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits);
682 +  ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
683 +
684 +  /* Here, we try to support even strange cases where proper semantic
685 +   * BTN_GAMEPAD button are combined with arbitrary extra buttons. */
686 +  for (uint16_t i = BTN_JOYSTICK; i < KEY_MAX; i++) {
687 +    /* Do not map semantic buttons, they are handled directly */
688 +    if (i == BTN_GAMEPAD) {
689 +      i = BTN_THUMBR + 1;
690 +      continue;
691 +    }
692 +    if (i == BTN_DPAD_UP) {
693 +      i = BTN_DPAD_RIGHT + 1;
694 +      continue;
695 +    }
696 +    if (TestBit(key_bits, i)) {
697 +      gamepad->key_map[i] = numButtons++;
698 +    }
699 +  }
700 +  for (uint16_t i = 0; i < BTN_JOYSTICK; i++) {
701 +    if (TestBit(key_bits, i)) {
702 +      gamepad->key_map[i] = numButtons++;
703 +    }
704 +  }
705 +  for (uint16_t i = BTN_GAMEPAD; i <= BTN_THUMBR; i++) {
706 +    /* But if any semantic event exists, count them all */
707 +    if (TestBit(key_bits, i)) {
708 +      numButtons += BUTTON_INDEX_COUNT;
709 +      break;
710 +    }
711 +  }
712 +  for (uint16_t i = 0; i < ABS_MAX; ++i) {
713 +    if (TestBit(abs_bits, i)) {
714 +      gamepad->abs_info.emplace(i, input_absinfo{});
715 +      if (ioctl(fd, EVIOCGABS(i), &gamepad->abs_info[i]) < 0) {
716 +        continue;
717 +      }
718 +      if (gamepad->abs_info[i].minimum == gamepad->abs_info[i].maximum) {
719 +        gamepad->abs_info.erase(i);
720 +        continue;
721 +      }
722 +      gamepad->abs_map[i] = numAxes++;
723 +    }
724 +  }
725 +
726 +  if (numAxes == 0) {
727 +    NS_WARNING("Gamepad with zero axes detected?");
728 +  }
729 +  if (numButtons == 0) {
730 +    NS_WARNING("Gamepad with zero buttons detected?");
731 +  }
732 +
733 +  bool defaultRemapper = false;
734 +  RefPtr<GamepadRemapper> remapper =
735 +      GetGamepadRemapper(id.vendor, id.product, defaultRemapper);
736 +  MOZ_ASSERT(remapper);
737 +  remapper->SetAxisCount(numAxes);
738 +  remapper->SetButtonCount(numButtons);
739  
740    gamepad->handle = service->AddGamepad(
741 -      gamepad->idstring, mozilla::dom::GamepadMappingType::_empty,
742 -      mozilla::dom::GamepadHand::_empty, gamepad->numButtons, gamepad->numAxes,
743 -      0, 0, 0);  // TODO: Bug 680289, implement gamepad haptics for Linux.
744 +      gamepad->idstring, remapper->GetMappingType(), GamepadHand::_empty,
745 +      remapper->GetButtonCount(), remapper->GetAxisCount(), 0,
746 +      remapper->GetLightIndicatorCount(), remapper->GetTouchEventCount());
747 +  gamepad->remapper = remapper.forget();
748 +  // TODO: Bug 680289, implement gamepad haptics for Linux.
749    // TODO: Bug 1523355, implement gamepad lighindicator and touch for Linux.
750  
751    gamepad->source_id =
752 @@ -257,7 +344,7 @@ bool LinuxGamepadService::is_gamepad(struct udev_device* dev) {
753    if (!devpath) {
754      return false;
755    }
756 -  if (strncmp(kJoystickPath, devpath, sizeof(kJoystickPath) - 1) != 0) {
757 +  if (strncmp(kEvdevPath, devpath, sizeof(kEvdevPath) - 1) != 0) {
758      return false;
759    }
760  
761 @@ -292,7 +379,7 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
762    if (condition & G_IO_ERR || condition & G_IO_HUP) return FALSE;
763  
764    while (true) {
765 -    struct js_event event;
766 +    struct input_event event {};
767      gsize count;
768      GError* err = nullptr;
769      if (g_io_channel_read_chars(source, (gchar*)&event, sizeof(event), &count,
770 @@ -301,18 +388,125 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
771        break;
772      }
773  
774 -    // TODO: store device state?
775 -    if (event.type & JS_EVENT_INIT) {
776 -      continue;
777 -    }
778 -
779      switch (event.type) {
780 -      case JS_EVENT_BUTTON:
781 -        service->NewButtonEvent(gamepad->handle, event.number, !!event.value);
782 +      case EV_KEY:
783 +        switch (event.code) {
784 +          /* The gamepad events are meaningful, and according to
785 +           * https://www.kernel.org/doc/html/latest/input/gamepad.html
786 +           * "No other devices, that do not look/feel like a gamepad, shall
787 +           * report these events" */
788 +          case BTN_SOUTH:
789 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_PRIMARY,
790 +                                    !!event.value);
791 +            break;
792 +          case BTN_EAST:
793 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_SECONDARY,
794 +                                    !!event.value);
795 +            break;
796 +          case BTN_NORTH:
797 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_QUATERNARY,
798 +                                    !!event.value);
799 +            break;
800 +          case BTN_WEST:
801 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_TERTIARY,
802 +                                    !!event.value);
803 +            break;
804 +          case BTN_TL:
805 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_SHOULDER,
806 +                                    !!event.value);
807 +            break;
808 +          case BTN_TR:
809 +            service->NewButtonEvent(gamepad->handle,
810 +                                    BUTTON_INDEX_RIGHT_SHOULDER, !!event.value);
811 +            break;
812 +          case BTN_TL2:
813 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_TRIGGER,
814 +                                    !!event.value);
815 +            break;
816 +          case BTN_TR2:
817 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_RIGHT_TRIGGER,
818 +                                    !!event.value);
819 +            break;
820 +          case BTN_SELECT:
821 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_BACK_SELECT,
822 +                                    !!event.value);
823 +            break;
824 +          case BTN_START:
825 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_START,
826 +                                    !!event.value);
827 +            break;
828 +          case BTN_MODE:
829 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_META,
830 +                                    !!event.value);
831 +            break;
832 +          case BTN_THUMBL:
833 +            service->NewButtonEvent(
834 +                gamepad->handle, BUTTON_INDEX_LEFT_THUMBSTICK, !!event.value);
835 +            break;
836 +          case BTN_THUMBR:
837 +            service->NewButtonEvent(
838 +                gamepad->handle, BUTTON_INDEX_RIGHT_THUMBSTICK, !!event.value);
839 +            break;
840 +          case BTN_DPAD_UP:
841 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_UP,
842 +                                    !!event.value);
843 +            break;
844 +          case BTN_DPAD_DOWN:
845 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
846 +                                    !!event.value);
847 +            break;
848 +          case BTN_DPAD_LEFT:
849 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
850 +                                    !!event.value);
851 +            break;
852 +          case BTN_DPAD_RIGHT:
853 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
854 +                                    !!event.value);
855 +            break;
856 +          default:
857 +            /* For non-gamepad events, this is the "anything goes" numbered
858 +             * handling that should be handled with remappers. */
859 +            gamepad->remapper->RemapButtonEvent(
860 +                gamepad->handle, gamepad->key_map[event.code], !!event.value);
861 +            break;
862 +        }
863          break;
864 -      case JS_EVENT_AXIS:
865 -        service->NewAxisMoveEvent(gamepad->handle, event.number,
866 -                                  ((float)event.value) / kMaxAxisValue);
867 +      case EV_ABS:
868 +        if (!gamepad->abs_info.count(event.code)) continue;
869 +        switch (event.code) {
870 +          case ABS_HAT0X:
871 +            service->NewButtonEvent(
872 +                gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
873 +                AxisNegativeAsButton(
874 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
875 +            service->NewButtonEvent(
876 +                gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
877 +                AxisPositiveAsButton(
878 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
879 +            break;
880 +          case ABS_HAT0Y:
881 +            service->NewButtonEvent(
882 +                gamepad->handle, BUTTON_INDEX_DPAD_UP,
883 +                AxisNegativeAsButton(
884 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
885 +            service->NewButtonEvent(
886 +                gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
887 +                AxisPositiveAsButton(
888 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
889 +            break;
890 +          case ABS_HAT1X:
891 +          case ABS_HAT1Y:
892 +          case ABS_HAT2X:
893 +          case ABS_HAT2Y:
894 +          case ABS_HAT3X:
895 +          case ABS_HAT3Y:
896 +            break;
897 +          default:
898 +            gamepad->remapper->RemapAxisMoveEvent(
899 +                gamepad->handle, gamepad->abs_map[event.code],
900 +                ScaleAxis(gamepad->abs_info[event.code], event.value));
901 +            break;
902 +        }
903          break;
904      }
905    }
906 diff --git dom/gamepad/moz.build dom/gamepad/moz.build
907 index 5f55d5a95e96..544b7f927736 100644
908 --- dom/gamepad/moz.build
909 +++ dom/gamepad/moz.build
910 @@ -59,7 +59,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
911      UNIFIED_SOURCES += ["windows/WindowsGamepad.cpp"]
912  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
913      UNIFIED_SOURCES += ["android/AndroidGamepad.cpp"]
914 -elif CONFIG["OS_ARCH"] == "Linux":
915 +elif CONFIG["OS_ARCH"] in ("Linux", "FreeBSD", "DragonFly"):
916      UNIFIED_SOURCES += ["linux/LinuxGamepad.cpp"]
917  else:
918      UNIFIED_SOURCES += ["fallback/FallbackGamepad.cpp"]
919
920
921 [FILE:9644:patches/patch-bug847568]
922 # Allow building against system-wide graphite2/harfbuzz.
923
924 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
925 index a1b58eb..a0a0943 100644
926 --- config/system-headers.mozbuild
927 +++ config/system-headers.mozbuild
928 @@ -1289,6 +1289,19 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
929          'proxy.h',
930      ]
931  
932 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
933 +    system_headers += [
934 +        'graphite2/Font.h',
935 +        'graphite2/Segment.h',
936 +    ]
937 +
938 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
939 +    system_headers += [
940 +        'harfbuzz/hb-glib.h',
941 +        'harfbuzz/hb-ot.h',
942 +        'harfbuzz/hb.h',
943 +    ]
944 +
945  if CONFIG['MOZ_SYSTEM_LIBVPX']:
946      system_headers += [
947          'vpx_mem/vpx_mem.h',
948 diff --git dom/base/moz.build dom/base/moz.build
949 index d390adf..4508f19 100644
950 --- dom/base/moz.build
951 +++ dom/base/moz.build
952 @@ -576,6 +576,9 @@ FINAL_LIBRARY = "xul"
953  if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
954      CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
955  
956 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
957 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
958 +
959  GeneratedFile(
960      "UseCounterList.h",
961      script="gen-usecounters.py",
962 diff --git gfx/graphite2/geckoextra/moz.build gfx/graphite2/geckoextra/moz.build
963 new file mode 100644
964 index 0000000..24e8d7a
965 --- /dev/null
966 +++ gfx/graphite2/geckoextra/moz.build
967 @@ -0,0 +1,21 @@
968 +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
969 +# vim: set filetype=python:
970 +# This Source Code Form is subject to the terms of the Mozilla Public
971 +# License, v. 2.0. If a copy of the MPL was not distributed with this
972 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
973 +
974 +EXPORTS.graphite2 += [
975 +    'include/GraphiteExtra.h',
976 +    'include/GraphiteStructsForRLBox.h',
977 +]
978 +
979 +UNIFIED_SOURCES += [
980 +    '../geckoextra/src/GraphiteExtra.cpp',
981 +]
982 +
983 +CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
984 +
985 +# Match bundled graphite2 configuration
986 +AllowCompilerWarnings()
987 +
988 +FINAL_LIBRARY = 'gkmedias'
989 diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
990 index b91d9c1..a97e6eb 100755
991 --- gfx/graphite2/moz-gr-update.sh
992 +++ gfx/graphite2/moz-gr-update.sh
993 @@ -1,6 +1,7 @@
994  #!/bin/bash
995  
996  # Script used to update the Graphite2 library in the mozilla source tree
997 +# and bump version for --with-system-graphite2
998  
999  # This script lives in gfx/graphite2, along with the library source,
1000  # but must be run from the top level of the mozilla-central tree.
1001 @@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
1002  #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
1003  #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
1004  
1005 +# chase version for --with-system-graphite2
1006 +perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
1007 +  if /GR2_VERSION_REQUIRE/" old-configure.in
1008 +
1009  # summarize what's been touched
1010  echo Updated to $RELEASE.
1011  echo Here is what changed in the gfx/graphite2 directory:
1012  echo
1013  
1014 -hg stat gfx/graphite2
1015 +hg stat old-configure.in gfx/graphite2
1016  
1017  echo
1018  echo If gfx/graphite2/src/files.mk has changed, please make corresponding
1019 diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
1020 index 3180257..4587a3b 100644
1021 --- gfx/harfbuzz/README-mozilla
1022 +++ gfx/harfbuzz/README-mozilla
1023 @@ -21,3 +21,8 @@ from within the gfx/harfbuzz directory.
1024  
1025  If the collection of source files changes, manual updates to moz.build may be
1026  needed as we don't use the upstream makefiles.
1027 +
1028 +The in-tree copy may be omitted during build by --with-system-harfbuzz.
1029 +Make sure to keep pkg-config version check within toolkit/moz.configure in sync
1030 +with checkout version or increment latest tag by one if it's not based
1031 +on upstream release.
1032 diff --git gfx/moz.build gfx/moz.build
1033 index 4d6d63d..cd57b0c 100644
1034 --- gfx/moz.build
1035 +++ gfx/moz.build
1036 @@ -10,6 +10,14 @@ with Files("**"):
1037  with Files("wr/**"):
1038      BUG_COMPONENT = ("Core", "Graphics: WebRender")
1039  
1040 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
1041 +    DIRS += ["graphite2/geckoextra"]
1042 +else:
1043 +    DIRS += ["graphite2/src" ]
1044 +
1045 +if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1046 +    DIRS += ["harfbuzz/src"]
1047 +
1048  DIRS += [
1049      "cairo",
1050      "2d",
1051 @@ -19,8 +27,6 @@ DIRS += [
1052      "qcms",
1053      "gl",
1054      "layers",
1055 -    "graphite2/src",
1056 -    "harfbuzz/src",
1057      "ots/src",
1058      "thebes",
1059      "ipc",
1060 diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
1061 index 5e0fd17..860b80a 100755
1062 --- gfx/skia/generate_mozbuild.py
1063 +++ gfx/skia/generate_mozbuild.py
1064 @@ -96,6 +96,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
1065          '-Wno-unused-private-field',
1066      ]
1067  
1068 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
1069 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
1070 +
1071  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
1072      LOCAL_INCLUDES += [
1073          "/gfx/cairo/cairo/src",
1074 diff --git gfx/skia/moz.build gfx/skia/moz.build
1075 index 524bd28..615c93b 100755
1076 --- gfx/skia/moz.build
1077 +++ gfx/skia/moz.build
1078 @@ -488,6 +488,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
1079          '-Wno-unused-private-field',
1080      ]
1081  
1082 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
1083 +    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
1084 +
1085  if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
1086      LOCAL_INCLUDES += [
1087          "/gfx/cairo/cairo/src",
1088 diff --git gfx/thebes/moz.build gfx/thebes/moz.build
1089 index baa6f09..4f02a9e 100644
1090 --- gfx/thebes/moz.build
1091 +++ gfx/thebes/moz.build
1092 @@ -286,7 +286,13 @@ if CONFIG["MOZ_WAYLAND"]:
1093  
1094  LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
1095  
1096 -DEFINES["GRAPHITE2_STATIC"] = True
1097 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
1098 +    CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
1099 +else:
1100 +    DEFINES["GRAPHITE2_STATIC"] = True
1101 +
1102 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1103 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
1104  
1105  if CONFIG["CC_TYPE"] == "clang":
1106      # Suppress warnings from Skia header files.
1107 diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
1108 index 301eb9a..7cece5e 100644
1109 --- intl/unicharutil/util/moz.build
1110 +++ intl/unicharutil/util/moz.build
1111 @@ -25,6 +25,9 @@ UNIFIED_SOURCES += [
1112      "nsUnicodeProperties.cpp",
1113  ]
1114  
1115 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1116 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
1117 +
1118  include("/ipc/chromium/chromium-config.mozbuild")
1119  
1120  GeneratedFile(
1121 diff --git netwerk/dns/moz.build netwerk/dns/moz.build
1122 index f769e27..315bdd4 100644
1123 --- netwerk/dns/moz.build
1124 +++ netwerk/dns/moz.build
1125 @@ -102,6 +102,9 @@ GeneratedFile(
1126      "etld_data.inc", script="prepare_tlds.py", inputs=["effective_tld_names.dat"]
1127  )
1128  
1129 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1130 +    CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
1131 +
1132  # need to include etld_data.inc
1133  LOCAL_INCLUDES += [
1134      "/netwerk/base",
1135 diff --git old-configure.in old-configure.in
1136 index d147957..d332b34 100644
1137 --- old-configure.in
1138 +++ old-configure.in
1139 @@ -1335,6 +1335,27 @@ fi
1140  AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1141  AC_SUBST(MOZ_MACBUNDLE_ID)
1142  
1143 +dnl ========================================================
1144 +dnl Check for graphite2
1145 +dnl ========================================================
1146 +if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
1147 +    dnl graphite2.pc has bogus version, check manually
1148 +    _SAVE_CFLAGS=$CFLAGS
1149 +    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
1150 +    AC_TRY_COMPILE([ #include <graphite2/Font.h>
1151 +                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
1152 +                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
1153 +                               * 100 + GR2_VERSION_BUGFIX >= \
1154 +                               (major) * 10000 + (minor) * 100 + (bugfix) )
1155 +                   ], [
1156 +                     #if !GR2_VERSION_REQUIRE(1,3,14)
1157 +                     #error "Insufficient graphite2 version."
1158 +                     #endif
1159 +                   ], [],
1160 +                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
1161 +    CFLAGS=$_SAVE_CFLAGS
1162 +fi
1163 +
1164  dnl ========================================================
1165  dnl = Child Process Name for IPC
1166  dnl ========================================================
1167 diff --git toolkit/library/moz.build toolkit/library/moz.build
1168 index 2c3f869..e8a9d23 100644
1169 --- toolkit/library/moz.build
1170 +++ toolkit/library/moz.build
1171 @@ -269,6 +269,12 @@ if CONFIG["MOZ_SYSTEM_PNG"]:
1172  if CONFIG["MOZ_SYSTEM_WEBP"]:
1173      OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
1174  
1175 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
1176 +    OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
1177 +
1178 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1179 +    OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
1180 +
1181  if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
1182      OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
1183  
1184 diff --git toolkit/moz.configure toolkit/moz.configure
1185 index 0069865..9bb1864 100644
1186 --- toolkit/moz.configure
1187 +++ toolkit/moz.configure
1188 @@ -1058,6 +1058,25 @@ def geckodriver_default(enable_tests, target, cross_compile, hazard, asan, autom
1189          return False
1190      return True
1191  
1192 +# Graphite2
1193 +# ==============================================================
1194 +option("--with-system-graphite2",
1195 +       help="Use system graphite2 (located with pkgconfig)")
1196 +
1197 +system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2",
1198 +                                     when="--with-system-graphite2")
1199 +
1200 +set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True))
1201 +
1202 +# HarfBuzz
1203 +# ==============================================================
1204 +option("--with-system-harfbuzz",
1205 +       help="Use system harfbuzz (located with pkgconfig)")
1206 +
1207 +system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 2.7.4",
1208 +                                    when="--with-system-harfbuzz")
1209 +
1210 +set_config("MOZ_SYSTEM_HARFBUZZ", depends_if(system_harfbuzz)(lambda _: True))
1211  
1212  option(
1213      "--enable-geckodriver",
1214
1215
1216 [FILE:704:patches/patch-dom_media_flac_FlacDecoder.cpp]
1217 Enable FLAC on platforms without ffvpx like powerpc*
1218
1219 --- dom/media/flac/FlacDecoder.cpp.orig 2021-04-15 19:44:28 UTC
1220 +++ dom/media/flac/FlacDecoder.cpp
1221 @@ -7,6 +7,7 @@
1222  #include "FlacDecoder.h"
1223  #include "MediaContainerType.h"
1224  #include "mozilla/StaticPrefs_media.h"
1225 +#include "PDMFactory.h"
1226  
1227  namespace mozilla {
1228  
1229 @@ -14,6 +15,10 @@ namespace mozilla {
1230  bool FlacDecoder::IsEnabled() {
1231  #ifdef MOZ_FFVPX
1232    return StaticPrefs::media_flac_enabled();
1233 +#elif defined(MOZ_FFMPEG)
1234 +  RefPtr<PDMFactory> platform = new PDMFactory();
1235 +  return StaticPrefs::media_flac_enabled() &&
1236 +         (platform->SupportsMimeType("audio/flac"_ns) != media::DecodeSupport::Unsupported);
1237  #else
1238    return false;
1239  #endif
1240
1241
1242 [FILE:914:patches/patch-env-api-keys]
1243 # Accept API keys from environment like before bug 1294585
1244
1245 --- build/moz.configure/keyfiles.configure
1246 +++ build/moz.configure/keyfiles.configure
1247 @@ -19,6 +19,7 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x):
1248      @checking("for the %s key" % desc, lambda x: x and x is not no_key)
1249      @imports(_from="__builtin__", _import="open")
1250      @imports(_from="__builtin__", _import="IOError")
1251 +    @imports(_from="os", _import="environ")
1252      def keyfile(value):
1253          if value:
1254              try:
1255 @@ -29,7 +30,7 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x):
1256                      raise FatalCheckError("'%s' is empty." % value[0])
1257              except IOError as e:
1258                  raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
1259 -        return no_key
1260 +        return environ.get("MOZ_%s_KEY" % desc.upper().replace(" ", "_")) or no_key
1261  
1262      return keyfile
1263  
1264
1265
1266 [FILE:997:patches/patch-gfx_skia_skia_src_core_SkCpu.cpp]
1267 Regressed by https://svnweb.freebsd.org/changeset/base/324815
1268
1269 gfx/skia/skia/src/core/SkCpu.cpp:81:27: error: use of undeclared identifier 'getauxval'
1270         uint32_t hwcaps = getauxval(AT_HWCAP);
1271                           ^
1272
1273 --- gfx/skia/skia/src/core/SkCpu.cpp.orig       2020-02-07 22:13:22 UTC
1274 +++ gfx/skia/skia/src/core/SkCpu.cpp
1275 @@ -72,6 +72,23 @@
1276          return features;
1277      }
1278  
1279 +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__)
1280 +    #include <machine/armreg.h>
1281 +    #ifndef ID_AA64ISAR0_CRC32_VAL
1282 +    #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
1283 +    #endif
1284 +
1285 +    static uint32_t read_cpu_features() {
1286 +        uint32_t features = 0;
1287 +        uint64_t id_aa64isar0;
1288 +
1289 +        id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
1290 +        if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
1291 +            features |= SkCpu::CRC32;
1292 +        }
1293 +        return features;
1294 +    }
1295 +
1296  #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
1297      #include <sys/auxv.h>
1298  
1299
1300
1301 [FILE:228:patches/patch-image_imgFrame.h]
1302 --- image/imgFrame.h.orig       2020-04-29 21:55:18 UTC
1303 +++ image/imgFrame.h
1304 @@ -8,6 +8,7 @@
1305  #define mozilla_image_imgFrame_h
1306  
1307  #include <utility>
1308 +#include <functional>
1309  
1310  #include "AnimationParams.h"
1311  #include "MainThreadUtils.h"
1312
1313
1314 [FILE:316:patches/patch-ipc_chromium_src_base_platform__thread__posix.cc]
1315 --- ipc/chromium/src/base/platform_thread_posix.cc.orig 2020-04-29 20:59:57 UTC
1316 +++ ipc/chromium/src/base/platform_thread_posix.cc
1317 @@ -16,6 +16,8 @@
1318  #elif defined(OS_LINUX)
1319  #  include <sys/syscall.h>
1320  #  include <sys/prctl.h>
1321 +#elif defined(OS_DRAGONFLY)
1322 +#  include <sys/lwp.h>
1323  #endif
1324  
1325  #if !defined(OS_MACOSX)
1326
1327
1328 [FILE:615:patches/patch-ipc_chromium_src_base_shared__memory__posix.cc]
1329 --- ipc/chromium/src/base/shared_memory_posix.cc.orig   2020-04-29 20:59:57 UTC
1330 +++ ipc/chromium/src/base/shared_memory_posix.cc
1331 @@ -182,6 +182,11 @@ bool SharedMemory::AppendPosixShmPrefix(
1332      StringAppendF(str, "snap.%s.", kSnap);
1333    }
1334  #  endif  // OS_LINUX
1335 +#  ifdef OS_DRAGONFLY
1336 +  // DragonFly BSD has a userland IPC implementation, we need to prefix the
1337 +  // path to shm_open(3), preferably with '/tmp'
1338 +  StringAppendF(str, "tmp/");
1339 +#  endif
1340    // Hopefully the "implementation defined" name length limit is long
1341    // enough for this.
1342    StringAppendF(str, "org.mozilla.ipc.%d.", static_cast<int>(pid));
1343
1344
1345 [FILE:318:patches/patch-js_src_old-configure.in]
1346 --- js/src/old-configure.in.orig        2021-09-04 13:25:05 UTC
1347 +++ js/src/old-configure.in
1348 @@ -858,7 +858,7 @@ then
1349      fi
1350  
1351         case "$target" in
1352 -           *-*-freebsd*)
1353 +           *-*-freebsd*|*-*-dragonfly*)
1354                         AC_DEFINE(_REENTRANT)
1355                         AC_DEFINE(_THREAD_SAFE)
1356                         dnl -pthread links in -lpthread, so don't specify it explicitly.
1357
1358
1359 [FILE:297:patches/patch-media_libcubeb_src_cubeb__jack.cpp]
1360 --- media/libcubeb/src/cubeb_jack.cpp.orig      2020-04-29 21:00:35 UTC
1361 +++ media/libcubeb/src/cubeb_jack.cpp
1362 @@ -8,7 +8,7 @@
1363   */
1364  #define _DEFAULT_SOURCE
1365  #define _BSD_SOURCE
1366 -#ifndef __FreeBSD__
1367 +#if !(defined __FreeBSD__ || defined __DragonFly__)
1368  #define _POSIX_SOURCE
1369  #endif
1370  #include <dlfcn.h>
1371
1372
1373 [FILE:3961:patches/patch-pipewire_init]
1374 Chase ABI from multimedia/pipewire/files/patch-src_pipewire_pipewire_init
1375
1376 https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1819
1377
1378 diff --git third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
1379 index 2fd3b1a575..79a14d7d7e 100644
1380 --- third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
1381 +++ third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
1382 @@ -279,7 +279,7 @@ void BaseCapturerPipeWire::InitPipeWire() {
1383    }
1384  #endif  // defined(WEBRTC_DLOPEN_PIPEWIRE)
1385  
1386 -  pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
1387 +  pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
1388  
1389    pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
1390    pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
1391 diff --git third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs
1392 index 3e21e9dc07..f561dcf619 100644
1393 --- third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs
1394 +++ third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs
1395 @@ -16,7 +16,7 @@ void pw_loop_destroy(pw_loop *loop);
1396  pw_loop * pw_loop_new(pw_properties *properties);
1397  
1398  // pipewire.h
1399 -void pw_init(int *argc, char **argv[]);
1400 +void pipewire_init(int *argc, char **argv[]);
1401  
1402  // properties.h
1403  pw_properties * pw_properties_new_string(const char *args);
1404 diff --git third_party/pipewire/libpipewire/mozpipewire.cpp third_party/pipewire/libpipewire/mozpipewire.cpp
1405 index 1ecfc3196a..6f44b35964 100644
1406 --- third_party/pipewire/libpipewire/mozpipewire.cpp
1407 +++ third_party/pipewire/libpipewire/mozpipewire.cpp
1408 @@ -58,7 +58,7 @@ struct pw_context * (*pw_context_new_fn)(struct pw_loop *main_loop,
1409                                        struct pw_properties *props,
1410                                        size_t user_data_size);
1411  static int (*pw_core_disconnect_fn)(struct pw_core *core);
1412 -static void (*pw_init_fn)(int *argc, char **argv[]);
1413 +static void (*pipewire_init_fn)(int *argc, char **argv[]);
1414  static void (*pw_stream_add_listener_fn)(struct pw_stream *stream,
1415                                        struct spa_hook *listener,
1416                                        const struct pw_stream_events *events,
1417 @@ -96,7 +96,7 @@ bool IsPwLibraryLoaded() {
1418            IS_FUNC_LOADED(pw_context_destroy_fn) &&
1419            IS_FUNC_LOADED(pw_context_new_fn) &&
1420            IS_FUNC_LOADED(pw_core_disconnect_fn) &&
1421 -          IS_FUNC_LOADED(pw_init_fn) &&
1422 +          IS_FUNC_LOADED(pipewire_init_fn) &&
1423            IS_FUNC_LOADED(pw_stream_add_listener_fn) &&
1424            IS_FUNC_LOADED(pw_stream_connect_fn) &&
1425            IS_FUNC_LOADED(pw_stream_dequeue_buffer_fn) &&
1426 @@ -133,7 +133,7 @@ bool LoadPWLibrary() {
1427      GET_FUNC(pw_context_destroy, pwLib);
1428      GET_FUNC(pw_context_new, pwLib);
1429      GET_FUNC(pw_core_disconnect, pwLib);
1430 -    GET_FUNC(pw_init, pwLib);
1431 +    GET_FUNC(pipewire_init, pwLib);
1432      GET_FUNC(pw_stream_add_listener, pwLib);
1433      GET_FUNC(pw_stream_connect, pwLib);
1434      GET_FUNC(pw_stream_dequeue_buffer, pwLib);
1435 @@ -207,12 +207,12 @@ pw_core_disconnect(struct pw_core *core)
1436  }
1437  
1438  void
1439 -pw_init(int *argc, char **argv[])
1440 +pipewire_init(int *argc, char **argv[])
1441  {
1442    if (!LoadPWLibrary()) {
1443      return;
1444    }
1445 -  return pw_init_fn(argc, argv);
1446 +  return pipewire_init_fn(argc, argv);
1447  }
1448  
1449  void
1450 diff --git third_party/pipewire/pipewire/pipewire.h third_party/pipewire/pipewire/pipewire.h
1451 index 69c523bd62..378502004c 100644
1452 --- third_party/pipewire/pipewire/pipewire.h
1453 +++ third_party/pipewire/pipewire/pipewire.h
1454 @@ -114,9 +114,9 @@ extern "C" {
1455   * \brief PipeWire initialization and infrastructure functions
1456   */
1457  void
1458 -pw_init(int *argc, char **argv[]);
1459 +pipewire_init(int *argc, char **argv[]);
1460  
1461 -void pw_deinit(void);
1462 +void pipewire_deinit(void);
1463  
1464  bool
1465  pw_debug_is_category_enabled(const char *name);
1466
1467
1468 [FILE:278:patches/patch-third__party_dav1d_src_mem.h]
1469 --- third_party/dav1d/src/mem.h.orig    2021-03-18 13:51:06 UTC
1470 +++ third_party/dav1d/src/mem.h
1471 @@ -31,7 +31,7 @@
1472  #include <stdlib.h>
1473  
1474  #if defined(HAVE_ALIGNED_MALLOC) || defined(HAVE_MEMALIGN)
1475 -#include <malloc.h>
1476 +#include <stdlib.h>
1477  #endif
1478  
1479  #include "common/attributes.h"
1480
1481
1482 [FILE:361:patches/patch-third__party_libwebrtc_build_build__config.h]
1483 --- third_party/libwebrtc/build/build_config.h.orig     2022-01-26 20:57:35 UTC
1484 +++ third_party/libwebrtc/build/build_config.h
1485 @@ -72,7 +72,7 @@
1486  #define OS_WIN 1
1487  #elif defined(__Fuchsia__)
1488  #define OS_FUCHSIA 1
1489 -#elif defined(__FreeBSD__)
1490 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1491  #define OS_FREEBSD 1
1492  #elif defined(__NetBSD__)
1493  #define OS_NETBSD 1
1494
1495
1496 [FILE:521:patches/patch-third__party_sqlite3_src_moz.build]
1497 --- third_party/sqlite3/src/moz.build.old       2021-08-09 16:08:59.381182000 -0500
1498 +++ third_party/sqlite3/src/moz.build   2021-08-09 16:10:25.370954000 -0500
1499 @@ -92,7 +92,8 @@
1500  
1501  # Enabling sqlite math functions
1502  DEFINES['SQLITE_ENABLE_MATH_FUNCTIONS'] = True
1503 -if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android":
1504 +if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android" or \
1505 +        CONFIG["OS_TARGET"] == "FreeBSD" or CONFIG["OS_TARGET"] == "DragonFly":
1506      OS_LIBS += [
1507          "m"
1508      ]
1509
1510
1511 [FILE:498:patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_port.h]
1512 --- toolkit/components/protobuf/src/google/protobuf/stubs/port.h.orig   2022-09-22 18:17:47 UTC
1513 +++ toolkit/components/protobuf/src/google/protobuf/stubs/port.h
1514 @@ -59,7 +59,7 @@
1515  #else
1516  #ifdef __APPLE__
1517  #include <machine/endian.h>  // __BYTE_ORDER
1518 -#elif defined(__FreeBSD__)
1519 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1520  #include <sys/endian.h>  // __BYTE_ORDER
1521  #elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
1522  #include <sys/isa_defs.h>  // __BYTE_ORDER
1523
1524
1525 [FILE:231:files/pkg-message-single]
1526 ==========================================================================
1527
1528   If Firefox segfaults, try setting MOZ_FORCE_DISABLE_E10S=1 in
1529   environment.
1530
1531 ==========================================================================
1532