Ravenports generated: 03 Aug 2023 23:53
[ravenports.git] / bucket_AC / firefox
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               firefox
4 VERSION=                115.0.3
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/115.0.3esr/source
13 DISTFILE[1]=            firefox-115.0.3esr.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                         dav1d:dev:standard
23                         evdev-proto:single:standard
24                         harfbuzz:dev:standard
25                         libdrm:dev:standard
26                         libnotify:dev:standard
27                         nasm:primary:standard
28                         nodejs:primary:standard
29                         nss:dev:standard
30                         rust:single:standard
31                         yasm:single:standard
32                         zip:single:standard
33                         python-sqlite3:single:python_used
34                         ffmpeg:dev:standard
35                         icu:dev:standard
36                         pciutils:dev:standard
37                         libproxy:dev:standard
38                         libevent:dev:standard
39                         clang15:complete:standard
40                         llvm15:tools:standard
41 BUILDRUN_DEPENDS=       dbus-glib:primary:standard
42                         ffmpeg:primary:standard
43                         harfbuzz:primary:standard
44                         icu:primary:standard
45                         libcanberra:primary:standard
46                         libevent:primary:standard
47                         libffi:single:standard
48                         libnotify:primary:standard
49                         libproxy:primary:standard
50                         libdrm:primary:standard
51                         nss:primary:standard
52                         dav1d:primary:standard
53                         pciutils:primary:standard
54 B_DEPS[linux]=          alsa-lib:dev:standard
55 BR_DEPS[linux]=         sndio:single:standard alsa-lib:primary:standard
56 BR_DEPS[netbsd]=        sndio:single:standard
57
58 USES=                   cpe desktop-utils:single gmake jpeg perl:build
59                         pkgconfig png python:build zlib
60 GNOME_COMPONENTS=       gdkpixbuf gtk3
61 XORG_COMPONENTS=        pixman xcb ice sm
62
63 LICENSE=                MPL:single
64 LICENSE_TERMS=          single:{{WRKSRC}}/toolkit/content/license.html
65 LICENSE_FILE=           MPL:stock
66 LICENSE_SCHEME=         solo
67
68 CPE_VENDOR=             mozilla
69 FPC_EQUIVALENT=         www/firefox
70
71 MUST_CONFIGURE=         yes
72 CONFIGURE_OUTSOURCE=    yes
73 CONFIGURE_ENV=          PYTHON3={{PYTHON_CMD}}
74                         SETUPTOOLS_USE_DISTUTILS=stdlib
75                         BINDGEN_CFLAGS="-I{{LOCALBASE}}/include"
76
77 MAKE_ENV=               PYTHON3={{PYTHON_CMD}}
78                         CXXSTDLIB="stdc++"
79
80 QMAKE_ARGS=             --enable-application=browser
81                         --enable-chrome-format=omni
82                         --enable-default-toolkit=cairo-gtk3
83                         --enable-install-strip
84                         --enable-official-branding
85                         --enable-optimize
86                         --enable-release
87                         --enable-strip
88                         --enable-libproxy
89                         --enable-system-ffi
90                         --enable-system-pixman
91                         --disable-alsa
92                         --disable-debug
93                         --disable-debug-symbols
94                         --disable-dtrace
95                         --disable-jack
96                         --disable-profiling
97                         --disable-pulseaudio
98                         --disable-tests
99                         --disable-updater
100                         --disable-webrtc
101                         --disable-hardening
102                         --prefix="{{PREFIX}}"
103                         --with-intl-api
104                         --with-system-graphite2
105                         --with-system-harfbuzz
106                         --with-system-icu
107                         --with-system-jpeg
108                         --with-system-libevent
109                         --with-system-nspr
110                         --with-system-nss
111                         --with-system-png
112                         --with-system-zlib
113                         --without-wasm-sandboxed-libraries
114 VAR_OPSYS[linux]=       QMAKE_ARGS=--disable-elf-hack
115                         QMAKE_ARGS=--enable-audio-backends=sndio
116 VAR_OPSYS[netbsd]=      QMAKE_ARGS=--enable-audio-backends=sndio
117 VAR_OPSYS[midnightbsd]= MAKEFILE_LINE=CONFIGURE_TARGET=x86_64-raven-freebsd12.3
118
119 post-patch:
120         ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
121                 ${WRKSRC}/browser/app/nsBrowserApp.cpp
122         ${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \
123                 -e '/^Icon/s/=.*/=firefox/' \
124                 ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop
125         (cd ${WRKSRC}/gfx/angle/checkout/src/compiler/translator && \
126                 ${REINPLACE_CMD} -e 's|<math.h>|<cmath>|' \
127                 InfoSink.h IntermNode.cpp)
128         # disable SCTP
129         ${REINPLACE_CMD} -e 's|MOZ_SCTP|MOZ_DISABLE_SCTP|' \
130                 ${WRKSRC}/netwerk/moz.build
131         # disable rust checksums
132         ${REINPLACE_CMD} -e 's/"files":{[^}]*}/"files":{}/' \
133                  ${WRKSRC}/third_party/rust/libc/.cargo-checksum.json
134         # Fix midnight
135         ${REINPLACE_CMD} -e "s|%%MBSD64_TGT%%|x86_64-raven-freebsd12.3|" \
136                 ${WRKSRC}/build/autoconf/config.guess
137         # Set mozilla options
138         @${ECHO_CMD} "--=> Setting configuration <=--"
139         @for arg in ${QMAKE_ARGS}; do \
140                 ${ECHO_CMD} ".mozconfig <<  $$arg" ;\
141                 ${ECHO_CMD} ac_add_options $$arg >> ${WRKSRC}/.mozconfig ;\
142         done
143         @${ECHO_CMD} LDFLAGS=\"-Wl,-rpath,${PREFIX}/lib/firefox\" \
144                 >> ${WRKSRC}/.mozconfig
145
146 post-install:
147         ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps \
148                 ${STAGEDIR}${PREFIX}/share/applications
149         ${INSTALL_DATA} ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop \
150                 ${STAGEDIR}${PREFIX}/share/applications/
151         (cd ${STAGEDIR}${PREFIX}/share/pixmaps &&\
152         ${LN} -s ../../lib/firefox/browser/chrome/icons/default/default48.png firefox.png)
153         # Rewrite symlink to make it relative instead of absolute
154         (cd ${STAGEDIR}${PREFIX}/bin &&\
155         ${RM} firefox &&\
156         ${LN} -s ../lib/firefox/firefox firefox)
157
158 post-install-netbsd:
159         ${PAXCTL} +m ${STAGEDIR}${PREFIX}/lib/firefox/plugin-container
160
161 [FILE:527:descriptions/desc.single]
162 Firefox is a full-featured standard-compliant web browser, built on the
163 Mozilla codebase by thousands of contributors around the world.
164 It is extensible through thousands of user-contributed extensions, and
165 features:
166  * Improved Security;
167  * Improved Tabbed Browsing, with tab grouping;
168  * Private Browsing;
169  * Spell Checking;
170  * Search Suggestions;
171  * Session Restore;
172  * Web Feeds (RSS);
173  * Live Titles;
174  * Integrated Search;
175  * Live Bookmarks;
176  * Pop-up Blocker;
177  * Phishing Protection;
178  * Themes;
179  * Search Engine Manager.
180
181
182 [FILE:111:distinfo]
183 0bcc571c44f94ac6b8c26e896fd771eb7bd41b2a8ec35598bced0102c1b855fa    516725896 firefox-115.0.3esr.source.tar.xz
184
185
186 [FILE:990:manifests/plist.single]
187 %%ONLY-LINUX%%lib/firefox/
188  Throbber-small.gif
189  crashreporter
190  crashreporter.ini
191  libmozsandbox.so
192  minidump-analyzer
193 %%ONLY-LINUX%%lib/firefox/browser/crashreporter-override.ini
194 bin/firefox
195 lib/firefox/
196  application.ini
197  dependentlibs.list
198  firefox
199  firefox-bin
200  glxtest
201  libipcclientcerts.so
202  liblgpllibs.so
203  libmozavcodec.so
204  libmozavutil.so
205  libmozgtk.so
206  libmozsqlite3.so
207  libxul.so
208  omni.ja
209  pingsender
210  platform.ini
211  plugin-container
212  removed-files
213 lib/firefox/browser/omni.ja
214 lib/firefox/browser/chrome/icons/default/
215  default128.png
216  default16.png
217  default32.png
218  default48.png
219  default64.png
220 lib/firefox/browser/features/
221  formautofill@mozilla.org.xpi
222  pictureinpicture@mozilla.org.xpi
223  screenshots@mozilla.org.xpi
224  webcompat-reporter@mozilla.org.xpi
225  webcompat@mozilla.org.xpi
226 lib/firefox/defaults/pref/channel-prefs.js
227 lib/firefox/fonts/TwemojiMozilla.ttf
228 lib/firefox/gmp-clearkey/0.1/
229  libclearkey.so
230  manifest.json
231 share/applications/firefox.desktop
232 share/pixmaps/firefox.png
233
234
235 [FILE:4626:patches/patch-addon-search]
236 https://github.com/mozilla/addons/issues/708
237 https://github.com/mozilla/addons-frontend/issues/4610
238
239 diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
240 index 621900f90fc1..401ef9074bd0 100644
241 --- browser/app/profile/firefox.js
242 +++ browser/app/profile/firefox.js
243 @@ -38,7 +38,7 @@ pref("extensions.postDownloadThirdPartyPrompt", true);
244  // Preferences for AMO integration
245  pref("extensions.getAddons.cache.enabled", true);
246  pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%");
247 -pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
248 +pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
249  pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
250  pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%");
251  pref("extensions.getAddons.discovery.api_url", "https://services.addons.mozilla.org/api/v4/discovery/?lang=%LOCALE%&edition=%DISTRIBUTION%");
252 @@ -204,8 +204,8 @@ pref("app.update.langpack.enabled", true);
253  //  .. etc ..
254  //
255  pref("extensions.update.enabled", true);
256 -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%");
257 -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%");
258 +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%");
259 +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%");
260  pref("extensions.update.interval", 86400);  // Check for updates to Extensions and
261                                              // Themes every day
262  
263 diff --git toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs
264 index f906f244b658..7bb2eb6697c6 100644
265 --- toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs
266 +++ toolkit/mozapps/extensions/internal/AddonRepository.sys.mjs
267 @@ -596,7 +596,7 @@ export var AddonRepository = {
268        addon.version = String(aEntry.current_version.version);
269        if (Array.isArray(aEntry.current_version.files)) {
270          for (let file of aEntry.current_version.files) {
271 -          if (file.platform == "all" || file.platform == lazy.PLATFORM) {
272 +          if (file.platform == "all" || file.platform == "linux" || file.platform == lazy.PLATFORM) {
273              if (file.url) {
274                addon.sourceURI = lazy.NetUtil.newURI(file.url);
275              }
276 diff --git toolkit/mozapps/extensions/internal/XPIDatabase.jsm toolkit/mozapps/extensions/internal/XPIDatabase.jsm
277 index 03186dad43a4..4053fc6f2702 100644
278 --- toolkit/mozapps/extensions/internal/XPIDatabase.jsm
279 +++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm
280 @@ -634,7 +634,7 @@ class AddonInternal {
281      // Something is causing errors in here
282      try {
283        for (let platform of this.targetPlatforms) {
284 -        if (platform.os == Services.appinfo.OS) {
285 +        if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
286            if (platform.abi) {
287              needsABI = true;
288              if (platform.abi === abi) {
289
290
291 [FILE:642:patches/patch-browser_app_nsBrowserApp.cpp]
292 diff --git browser/app/nsBrowserApp.cpp browser/app/nsBrowserApp.cpp
293 index 87c2e16..a41f1d9 100644
294 --- browser/app/nsBrowserApp.cpp.orig   2023-06-08 22:09:31 UTC
295 +++ browser/app/nsBrowserApp.cpp
296 @@ -388,6 +388,9 @@ int main(int argc, char* argv[], char* e
297    // Register an external module to report on otherwise uncatchable exceptions.
298    CrashReporter::RegisterRuntimeExceptionModule();
299  
300 +  setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
301 +  setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
302 +
303  #ifdef HAS_DLL_BLOCKLIST
304    DllBlocklist_Initialize(gBlocklistInitFlags);
305  #endif
306
307
308 [FILE:513:patches/patch-bug1427152]
309 --- modules/libpref/Preferences.cpp.orig        2023-06-08 22:35:48 UTC
310 +++ modules/libpref/Preferences.cpp
311 @@ -6126,6 +6126,7 @@ static const PrefListEntry sDynamicPrefO
312      PREF_LIST_ENTRY("logging.config.LOG_FILE"),
313      PREF_LIST_ENTRY("media.audio_loopback_dev"),
314      PREF_LIST_ENTRY("media.decoder-doctor."),
315 +    PREF_LIST_ENTRY("media.cubeb.backend"),
316      PREF_LIST_ENTRY("media.cubeb.output_device"),
317      PREF_LIST_ENTRY("media.getusermedia.fake-camera-name"),
318      PREF_LIST_ENTRY("media.hls.server.url"),
319
320
321 [FILE:2405:patches/patch-bug1504834_comment5]
322 https://bugzilla.mozilla.org/show_bug.cgi?id=1504834#c5
323 https://bugzilla.mozilla.org/attachment.cgi?id=9028600
324 Rough progress patch
325
326
327 diff --git gfx/2d/DrawTargetSkia.cpp gfx/2d/DrawTargetSkia.cpp
328 index 6bbef8d..82b04ba 100644
329 --- gfx/2d/DrawTargetSkia.cpp.orig      2023-06-08 22:09:35 UTC
330 +++ gfx/2d/DrawTargetSkia.cpp
331 @@ -155,8 +155,7 @@ static IntRect CalculateSurfaceBounds(co
332    return surfaceBounds.Intersect(bounds);
333  }
334  
335 -static const int kARGBAlphaOffset =
336 -    SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
337 +static const int kARGBAlphaOffset = 0;
338  
339  static bool VerifyRGBXFormat(uint8_t* aData, const IntSize& aSize,
340                               const int32_t aStride, SurfaceFormat aFormat) {
341 --- gfx/2d/Types.h.orig 2023-06-08 22:09:33 UTC
342 +++ gfx/2d/Types.h
343 @@ -92,15 +92,8 @@ enum class SurfaceFormat : int8_t {
344  // The following values are endian-independent synonyms. The _UINT32 suffix
345  // indicates that the name reflects the layout when viewed as a uint32_t
346  // value.
347 -#if MOZ_LITTLE_ENDIAN()
348    A8R8G8B8_UINT32 = B8G8R8A8,  // 0xAARRGGBB
349    X8R8G8B8_UINT32 = B8G8R8X8,  // 0x00RRGGBB
350 -#elif MOZ_BIG_ENDIAN()
351 -  A8R8G8B8_UINT32 = A8R8G8B8,  // 0xAARRGGBB
352 -  X8R8G8B8_UINT32 = X8R8G8B8,  // 0x00RRGGBB
353 -#else
354 -#  error "bad endianness"
355 -#endif
356  
357    // The following values are OS and endian-independent synonyms.
358    //
359 --- gfx/skia/skia/modules/skcms/skcms.cc.orig   2023-06-08 22:09:35 UTC
360 +++ gfx/skia/skia/modules/skcms/skcms.cc
361 @@ -30,6 +30,8 @@
362          #include <avx512fintrin.h>
363          #include <avx512dqintrin.h>
364      #endif
365 +#else
366 +    #define SKCMS_PORTABLE
367  #endif
368  
369  static bool runtime_cpu_detection = true;
370 @@ -324,20 +326,28 @@ enum {
371  static uint16_t read_big_u16(const uint8_t* ptr) {
372      uint16_t be;
373      memcpy(&be, ptr, sizeof(be));
374 -#if defined(_MSC_VER)
375 -    return _byteswap_ushort(be);
376 +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
377 +    return be;
378  #else
379 +    #if defined(_MSC_VER)
380 +    return _byteswap_ushort(be);
381 +    #else
382      return __builtin_bswap16(be);
383 +    #endif
384  #endif
385  }
386  
387  static uint32_t read_big_u32(const uint8_t* ptr) {
388      uint32_t be;
389      memcpy(&be, ptr, sizeof(be));
390 -#if defined(_MSC_VER)
391 -    return _byteswap_ulong(be);
392 +#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
393 +    return be;
394  #else
395 +    #if defined(_MSC_VER)
396 +    return _byteswap_ulong(be);
397 +    #else
398      return __builtin_bswap32(be);
399 +    #endif
400  #endif
401  }
402  
403
404
405 [FILE:3723:patches/patch-bug1559213]
406 commit 717bba28411c
407 Author: Jory A. Pratt <anarchy@gentoo.org>
408 Date:   Thu Jun 13 11:53:00 2019 -0700
409
410     Bug 1559213 - Allow to use system av1 libs instead of bundled.
411 ---
412  config/external/moz.build      |  5 +++--
413  config/system-headers.mozbuild |  8 ++++++++
414  dom/media/platforms/moz.build  |  5 +++++
415  toolkit/moz.configure          | 19 ++++++++++++++++++-
416  4 files changed, 34 insertions(+), 3 deletions(-)
417
418 diff --git config/external/moz.build config/external/moz.build
419 index ab77121..75595d9 100644
420 --- config/external/moz.build.orig      2023-06-08 22:09:32 UTC
421 +++ config/external/moz.build
422 @@ -45,8 +45,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
423      external_dirs += ["media/libvpx"]
424  
425  if CONFIG["MOZ_AV1"]:
426 -    external_dirs += ["media/libaom"]
427 -    external_dirs += ["media/libdav1d"]
428 +    if not CONFIG["MOZ_SYSTEM_AV1"]:
429 +        external_dirs += ["media/libaom"]
430 +        external_dirs += ["media/libdav1d"]
431  
432  if not CONFIG["MOZ_SYSTEM_PNG"]:
433      external_dirs += ["media/libpng"]
434 --- config/system-headers.mozbuild.orig 2023-06-28 17:49:53 UTC
435 +++ config/system-headers.mozbuild
436 @@ -1299,6 +1299,19 @@ if CONFIG['MOZ_SYSTEM_AV1']:
437          'dav1d/dav1d.h',
438      ]
439  
440 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
441 +    system_headers += [
442 +        'graphite2/Font.h',
443 +        'graphite2/Segment.h',
444 +    ]
445 +
446 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
447 +    system_headers += [
448 +        'harfbuzz/hb-glib.h',
449 +        'harfbuzz/hb-ot.h',
450 +        'harfbuzz/hb.h',
451 +    ]
452 +
453  if CONFIG['MOZ_SYSTEM_LIBVPX']:
454      system_headers += [
455          'vpx_mem/vpx_mem.h',
456 --- dom/media/platforms/moz.build.orig  2023-06-08 22:09:33 UTC
457 +++ dom/media/platforms/moz.build
458 @@ -80,6 +80,11 @@ if CONFIG["MOZ_AV1"]:
459          "agnostic/AOMDecoder.cpp",
460          "agnostic/DAV1DDecoder.cpp",
461      ]
462 +    if CONFIG['MOZ_SYSTEM_AV1']:
463 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
464 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
465 +        CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
466 +        OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
467  
468  if CONFIG["MOZ_OMX"]:
469      EXPORTS += [
470 --- media/ffvpx/libavcodec/moz.build.orig       2023-06-08 22:09:41 UTC
471 +++ media/ffvpx/libavcodec/moz.build
472 @@ -109,10 +109,14 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
473          'vp9recon.c',
474          'vpx_rac.c',
475      ]
476 -    USE_LIBS += [
477 -        'dav1d',
478 -        'media_libdav1d_asm',
479 -    ]
480 +    if CONFIG["MOZ_SYSTEM_AV1"]:
481 +      CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
482 +      OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
483 +    else:
484 +      USE_LIBS += [
485 +          'dav1d',
486 +          'media_libdav1d_asm',
487 +      ]
488      if CONFIG['MOZ_WAYLAND']:
489          LOCAL_INCLUDES += ['/media/mozva']
490          SOURCES += [
491 --- toolkit/moz.configure.orig  2023-06-28 17:49:53 UTC
492 +++ toolkit/moz.configure
493 @@ -1308,6 +1308,25 @@ def geckodriver_default(enable_tests, ta
494          return False
495      return True
496  
497 +# Graphite2
498 +# ==============================================================
499 +option("--with-system-graphite2",
500 +       help="Use system graphite2 (located with pkgconfig)")
501 +
502 +system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2",
503 +                                     when="--with-system-graphite2")
504 +
505 +set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True))
506 +
507 +# HarfBuzz
508 +# ==============================================================
509 +option("--with-system-harfbuzz",
510 +       help="Use system harfbuzz (located with pkgconfig)")
511 +
512 +system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 2.7.4",
513 +                                    when="--with-system-harfbuzz")
514 +
515 +set_config("MOZ_SYSTEM_HARFBUZZ", depends_if(system_harfbuzz)(lambda _: True))
516  
517  option(
518      "--enable-geckodriver",
519
520
521 [FILE:2175:patches/patch-bug1659612]
522 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]
523     r = snprintf(node_name, sizeof(node_name), "pcm.%s", string);
524         ^
525 media/libcubeb/src/cubeb_alsa.c:613:9: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
526 media/libcubeb/src/cubeb_alsa.c:1168:3: error: implicitly declaring library function 'alloca' with type 'void *(unsigned int)' [-Werror,-Wimplicit-function-declaration]
527   snd_pcm_hw_params_alloca(&hw_params);
528   ^
529 /usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
530 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
531                                       ^
532 /usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
533 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
534                                                         ^
535 media/libcubeb/src/cubeb_alsa.c:1168:3: note: include the header <stdlib.h> or explicitly provide a declaration for 'alloca'
536 /usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
537 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
538                                       ^
539 /usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
540 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
541                                                         ^
542 2 errors generated.
543
544 --- media/libcubeb/src/cubeb_alsa.c.orig        2023-06-08 22:09:41 UTC
545 +++ media/libcubeb/src/cubeb_alsa.c
546 @@ -5,12 +5,16 @@
547   * accompanying file LICENSE for details.
548   */
549  #undef NDEBUG
550 +#if defined(__FreeBSD__)
551 +#define _GNU_SOURCE
552 +#else
553  #define _DEFAULT_SOURCE
554  #define _BSD_SOURCE
555  #if defined(__NetBSD__)
556  #define _NETBSD_SOURCE /* timersub() */
557  #endif
558  #define _XOPEN_SOURCE 500
559 +#endif
560  #include "cubeb-internal.h"
561  #include "cubeb/cubeb.h"
562  #include "cubeb_tracing.h"
563
564
565 [FILE:14560:patches/patch-bug1680982]
566 commit 3204512f58a1
567 Author: Greg V <greg@unrelenting.technology>
568 Date:   Sun Dec 6 22:07:00 2020 +0000
569
570     Bug 1680982 - Use evdev instead of the Linux legacy joystick API for gamepads
571     
572     Using evdev is a prerequisite for adding rumble (haptic feedback) and LED support.
573     
574     - BTN_GAMEPAD semantic buttons are interpreted directly,
575     since all kernel drivers are supposed to use them correctly:
576     https://www.kernel.org/doc/html/latest/input/gamepad.html
577     - BTN_JOYSTICK legacy style numbered buttons use the model specific remappers
578     - we support even strange devices that combine both styles in one device
579     - the Linux gamepad module is enabled on FreeBSD and DragonFly, because
580     these kernels provide evdev, and libudev-devd provides enough of libudev
581     (evdev headers are provided by the devel/evdev-proto package)
582     
583     Differential Revision: https://phabricator.services.mozilla.com/D98868
584 ---
585  dom/gamepad/linux/LinuxGamepad.cpp | 262 ++++++++++++++++++++++++++++++++-----
586  dom/gamepad/moz.build              |   2 +-
587  2 files changed, 229 insertions(+), 35 deletions(-)
588
589 diff --git dom/gamepad/linux/LinuxGamepad.cpp dom/gamepad/linux/LinuxGamepad.cpp
590 index deee47b9d267..31f0aad7ae4a 100644
591 --- dom/gamepad/linux/LinuxGamepad.cpp.orig     2023-06-08 22:09:33 UTC
592 +++ dom/gamepad/linux/LinuxGamepad.cpp
593 @@ -5,15 +5,16 @@
594   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
595  
596  /*
597 - * LinuxGamepadService: A Linux backend for the GamepadService.
598 - * Derived from the kernel documentation at
599 - * http://www.kernel.org/doc/Documentation/input/joystick-api.txt
600 + * LinuxGamepadService: An evdev backend for the GamepadService.
601 + *
602 + * Ref: https://www.kernel.org/doc/html/latest/input/gamepad.html
603   */
604  #include <algorithm>
605 +#include <unordered_map>
606  #include <cstddef>
607  
608  #include <glib.h>
609 -#include <linux/joystick.h>
610 +#include <linux/input.h>
611  #include <stdio.h>
612  #include <stdint.h>
613  #include <sys/ioctl.h>
614 @@ -21,10 +22,14 @@
615  #include "nscore.h"
616  #include "mozilla/dom/GamepadHandle.h"
617  #include "mozilla/dom/GamepadPlatformService.h"
618 +#include "mozilla/dom/GamepadRemapping.h"
619  #include "mozilla/Tainting.h"
620  #include "mozilla/UniquePtr.h"
621  #include "udev.h"
622  
623 +#define LONG_BITS (sizeof(long) * 8)
624 +#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
625 +
626  namespace {
627  
628  using namespace mozilla::dom;
629 @@ -36,19 +41,29 @@ using mozilla::udev_list_entry;
630  using mozilla::udev_monitor;
631  using mozilla::UniquePtr;
632  
633 -static const float kMaxAxisValue = 32767.0;
634 -static const char kJoystickPath[] = "/dev/input/js";
635 +static const char kEvdevPath[] = "/dev/input/event";
636 +
637 +static inline bool TestBit(const unsigned long* arr, int bit) {
638 +  return !!(arr[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
639 +}
640 +
641 +static inline double ScaleAxis(const input_absinfo& info, int value) {
642 +  return 2.0 * (value - info.minimum) / (double)(info.maximum - info.minimum) -
643 +         1.0;
644 +}
645  
646  // TODO: should find a USB identifier for each device so we can
647  // provide something that persists across connect/disconnect cycles.
648 -typedef struct {
649 +struct Gamepad {
650    GamepadHandle handle;
651 -  guint source_id;
652 -  int numAxes;
653 -  int numButtons;
654 -  char idstring[256];
655 -  char devpath[PATH_MAX];
656 -} Gamepad;
657 +  RefPtr<GamepadRemapper> remapper = nullptr;
658 +  guint source_id = UINT_MAX;
659 +  char idstring[256] = {0};
660 +  char devpath[PATH_MAX] = {0};
661 +  uint8_t key_map[KEY_MAX] = {0};
662 +  uint8_t abs_map[ABS_MAX] = {0};
663 +  std::unordered_map<uint16_t, input_absinfo> abs_info;
664 +};
665  
666  class LinuxGamepadService {
667   public:
668 @@ -66,7 +81,7 @@ class LinuxGamepadService {
669    bool is_gamepad(struct udev_device* dev);
670    void ReadUdevChange();
671  
672 -  // handler for data from /dev/input/jsN
673 +  // handler for data from /dev/input/eventN
674    static gboolean OnGamepadData(GIOChannel* source, GIOCondition condition,
675                                  gpointer data);
676  
677 @@ -114,8 +129,14 @@ void LinuxGamepadService::AddDevice(stru
678    g_io_channel_set_encoding(channel, nullptr, nullptr);
679    g_io_channel_set_buffered(channel, FALSE);
680    int fd = g_io_channel_unix_get_fd(channel);
681 +
682 +  struct input_id id {};
683 +  if (ioctl(fd, EVIOCGID, &id) == -1) {
684 +    return;
685 +  }
686 +
687    char name[128];
688 -  if (ioctl(fd, JSIOCGNAME(sizeof(name)), &name) == -1) {
689 +  if (ioctl(fd, EVIOCGNAME(sizeof(name)), &name) == -1) {
690      strcpy(name, "unknown");
691    }
692    const char* vendor_id =
693 @@ -131,20 +152,86 @@ void LinuxGamepadService::AddDevice(stru
694        model_id = mUdev.udev_device_get_sysattr_value(parent, "id/product");
695      }
696    }
697 +  if (!vendor_id && id.vendor != 0) {
698 +    vendor_id = (const char*)alloca(5);
699 +    snprintf((char*)vendor_id, 5, "%04x", id.vendor);
700 +  }
701 +  if (!model_id && id.product != 0) {
702 +    model_id = (const char*)alloca(5);
703 +    snprintf((char*)model_id, 5, "%04x", id.product);
704 +  }
705    snprintf(gamepad->idstring, sizeof(gamepad->idstring), "%s-%s-%s",
706             vendor_id ? vendor_id : "unknown", model_id ? model_id : "unknown",
707             name);
708  
709    char numAxes = 0, numButtons = 0;
710 -  ioctl(fd, JSIOCGAXES, &numAxes);
711 -  gamepad->numAxes = numAxes;
712 -  ioctl(fd, JSIOCGBUTTONS, &numButtons);
713 -  gamepad->numButtons = numButtons;
714 +  unsigned long key_bits[NLONGS(KEY_CNT)] = {0};
715 +  unsigned long abs_bits[NLONGS(ABS_CNT)] = {0};
716 +  ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits);
717 +  ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
718 +
719 +  /* Here, we try to support even strange cases where proper semantic
720 +   * BTN_GAMEPAD button are combined with arbitrary extra buttons. */
721 +  for (uint16_t i = BTN_JOYSTICK; i < KEY_MAX; i++) {
722 +    /* Do not map semantic buttons, they are handled directly */
723 +    if (i == BTN_GAMEPAD) {
724 +      i = BTN_THUMBR + 1;
725 +      continue;
726 +    }
727 +    if (i == BTN_DPAD_UP) {
728 +      i = BTN_DPAD_RIGHT + 1;
729 +      continue;
730 +    }
731 +    if (TestBit(key_bits, i)) {
732 +      gamepad->key_map[i] = numButtons++;
733 +    }
734 +  }
735 +  for (uint16_t i = 0; i < BTN_JOYSTICK; i++) {
736 +    if (TestBit(key_bits, i)) {
737 +      gamepad->key_map[i] = numButtons++;
738 +    }
739 +  }
740 +  for (uint16_t i = BTN_GAMEPAD; i <= BTN_THUMBR; i++) {
741 +    /* But if any semantic event exists, count them all */
742 +    if (TestBit(key_bits, i)) {
743 +      numButtons += BUTTON_INDEX_COUNT;
744 +      break;
745 +    }
746 +  }
747 +  for (uint16_t i = 0; i < ABS_MAX; ++i) {
748 +    if (TestBit(abs_bits, i)) {
749 +      gamepad->abs_info.emplace(i, input_absinfo{});
750 +      if (ioctl(fd, EVIOCGABS(i), &gamepad->abs_info[i]) < 0) {
751 +        continue;
752 +      }
753 +      if (gamepad->abs_info[i].minimum == gamepad->abs_info[i].maximum) {
754 +        gamepad->abs_info.erase(i);
755 +        continue;
756 +      }
757 +      gamepad->abs_map[i] = numAxes++;
758 +    }
759 +  }
760 +
761 +  if (numAxes == 0) {
762 +    NS_WARNING("Gamepad with zero axes detected?");
763 +  }
764 +  if (numButtons == 0) {
765 +    NS_WARNING("Gamepad with zero buttons detected?");
766 +  }
767 +
768 +  bool defaultRemapper = false;
769 +  RefPtr<GamepadRemapper> remapper =
770 +      GetGamepadRemapper(id.vendor, id.product, defaultRemapper);
771 +  MOZ_ASSERT(remapper);
772 +  remapper->SetAxisCount(numAxes);
773 +  remapper->SetButtonCount(numButtons);
774  
775    gamepad->handle = service->AddGamepad(
776 -      gamepad->idstring, mozilla::dom::GamepadMappingType::_empty,
777 -      mozilla::dom::GamepadHand::_empty, gamepad->numButtons, gamepad->numAxes,
778 -      0, 0, 0);  // TODO: Bug 680289, implement gamepad haptics for Linux.
779 +      gamepad->idstring, remapper->GetMappingType(), GamepadHand::_empty,
780 +      remapper->GetButtonCount(), remapper->GetAxisCount(), 0,
781 +      remapper->GetLightIndicatorCount(), remapper->GetTouchEventCount());
782 +  gamepad->remapper = remapper.forget();
783 +  // TODO: Bug 680289, implement gamepad haptics for Linux.
784    // TODO: Bug 1523355, implement gamepad lighindicator and touch for Linux.
785  
786    gamepad->source_id =
787 @@ -257,7 +344,7 @@ bool LinuxGamepadService::is_gamepad(str
788    if (!devpath) {
789      return false;
790    }
791 -  if (strncmp(kJoystickPath, devpath, sizeof(kJoystickPath) - 1) != 0) {
792 +  if (strncmp(kEvdevPath, devpath, sizeof(kEvdevPath) - 1) != 0) {
793      return false;
794    }
795  
796 @@ -292,7 +379,7 @@ gboolean LinuxGamepadService::OnGamepadD
797    if (condition & G_IO_ERR || condition & G_IO_HUP) return FALSE;
798  
799    while (true) {
800 -    struct js_event event;
801 +    struct input_event event {};
802      gsize count;
803      GError* err = nullptr;
804      if (g_io_channel_read_chars(source, (gchar*)&event, sizeof(event), &count,
805 @@ -301,18 +388,125 @@ gboolean LinuxGamepadService::OnGamepadD
806        break;
807      }
808  
809 -    // TODO: store device state?
810 -    if (event.type & JS_EVENT_INIT) {
811 -      continue;
812 -    }
813 -
814      switch (event.type) {
815 -      case JS_EVENT_BUTTON:
816 -        service->NewButtonEvent(gamepad->handle, event.number, !!event.value);
817 +      case EV_KEY:
818 +        switch (event.code) {
819 +          /* The gamepad events are meaningful, and according to
820 +           * https://www.kernel.org/doc/html/latest/input/gamepad.html
821 +           * "No other devices, that do not look/feel like a gamepad, shall
822 +           * report these events" */
823 +          case BTN_SOUTH:
824 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_PRIMARY,
825 +                                    !!event.value);
826 +            break;
827 +          case BTN_EAST:
828 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_SECONDARY,
829 +                                    !!event.value);
830 +            break;
831 +          case BTN_NORTH:
832 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_QUATERNARY,
833 +                                    !!event.value);
834 +            break;
835 +          case BTN_WEST:
836 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_TERTIARY,
837 +                                    !!event.value);
838 +            break;
839 +          case BTN_TL:
840 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_SHOULDER,
841 +                                    !!event.value);
842 +            break;
843 +          case BTN_TR:
844 +            service->NewButtonEvent(gamepad->handle,
845 +                                    BUTTON_INDEX_RIGHT_SHOULDER, !!event.value);
846 +            break;
847 +          case BTN_TL2:
848 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_TRIGGER,
849 +                                    !!event.value);
850 +            break;
851 +          case BTN_TR2:
852 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_RIGHT_TRIGGER,
853 +                                    !!event.value);
854 +            break;
855 +          case BTN_SELECT:
856 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_BACK_SELECT,
857 +                                    !!event.value);
858 +            break;
859 +          case BTN_START:
860 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_START,
861 +                                    !!event.value);
862 +            break;
863 +          case BTN_MODE:
864 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_META,
865 +                                    !!event.value);
866 +            break;
867 +          case BTN_THUMBL:
868 +            service->NewButtonEvent(
869 +                gamepad->handle, BUTTON_INDEX_LEFT_THUMBSTICK, !!event.value);
870 +            break;
871 +          case BTN_THUMBR:
872 +            service->NewButtonEvent(
873 +                gamepad->handle, BUTTON_INDEX_RIGHT_THUMBSTICK, !!event.value);
874 +            break;
875 +          case BTN_DPAD_UP:
876 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_UP,
877 +                                    !!event.value);
878 +            break;
879 +          case BTN_DPAD_DOWN:
880 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
881 +                                    !!event.value);
882 +            break;
883 +          case BTN_DPAD_LEFT:
884 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
885 +                                    !!event.value);
886 +            break;
887 +          case BTN_DPAD_RIGHT:
888 +            service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
889 +                                    !!event.value);
890 +            break;
891 +          default:
892 +            /* For non-gamepad events, this is the "anything goes" numbered
893 +             * handling that should be handled with remappers. */
894 +            gamepad->remapper->RemapButtonEvent(
895 +                gamepad->handle, gamepad->key_map[event.code], !!event.value);
896 +            break;
897 +        }
898          break;
899 -      case JS_EVENT_AXIS:
900 -        service->NewAxisMoveEvent(gamepad->handle, event.number,
901 -                                  ((float)event.value) / kMaxAxisValue);
902 +      case EV_ABS:
903 +        if (!gamepad->abs_info.count(event.code)) continue;
904 +        switch (event.code) {
905 +          case ABS_HAT0X:
906 +            service->NewButtonEvent(
907 +                gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
908 +                AxisNegativeAsButton(
909 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
910 +            service->NewButtonEvent(
911 +                gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
912 +                AxisPositiveAsButton(
913 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
914 +            break;
915 +          case ABS_HAT0Y:
916 +            service->NewButtonEvent(
917 +                gamepad->handle, BUTTON_INDEX_DPAD_UP,
918 +                AxisNegativeAsButton(
919 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
920 +            service->NewButtonEvent(
921 +                gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
922 +                AxisPositiveAsButton(
923 +                    ScaleAxis(gamepad->abs_info[event.code], event.value)));
924 +            break;
925 +          case ABS_HAT1X:
926 +          case ABS_HAT1Y:
927 +          case ABS_HAT2X:
928 +          case ABS_HAT2Y:
929 +          case ABS_HAT3X:
930 +          case ABS_HAT3Y:
931 +            break;
932 +          default:
933 +            gamepad->remapper->RemapAxisMoveEvent(
934 +                gamepad->handle, gamepad->abs_map[event.code],
935 +                ScaleAxis(gamepad->abs_info[event.code], event.value));
936 +            break;
937 +        }
938          break;
939      }
940    }
941 --- dom/gamepad/moz.build.orig  2023-06-08 22:09:34 UTC
942 +++ dom/gamepad/moz.build
943 @@ -59,7 +59,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "wi
944      UNIFIED_SOURCES += ["windows/WindowsGamepad.cpp"]
945  elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
946      UNIFIED_SOURCES += ["android/AndroidGamepad.cpp"]
947 -elif CONFIG["OS_ARCH"] == "Linux":
948 +elif CONFIG["OS_ARCH"] in ("Linux", "FreeBSD", "DragonFly"):
949      UNIFIED_SOURCES += ["linux/LinuxGamepad.cpp"]
950  else:
951      UNIFIED_SOURCES += ["fallback/FallbackGamepad.cpp"]
952
953
954 [FILE:402:patches/patch-build_autoconf_config.guess]
955 --- build/autoconf/config.guess.orig    2023-06-08 22:09:32 UTC
956 +++ build/autoconf/config.guess
957 @@ -284,7 +284,7 @@ case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME
958         GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
959         ;;
960      *:MidnightBSD:*:*)
961 -       GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
962 +       GUESS=%%MBSD64_TGT%%
963         ;;
964      *:ekkoBSD:*:*)
965         GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
966
967
968 [FILE:704:patches/patch-dom_media_flac_FlacDecoder.cpp]
969 Enable FLAC on platforms without ffvpx like powerpc*
970
971 --- dom/media/flac/FlacDecoder.cpp.orig 2023-06-08 22:09:33 UTC
972 +++ dom/media/flac/FlacDecoder.cpp
973 @@ -7,6 +7,7 @@
974  #include "FlacDecoder.h"
975  #include "MediaContainerType.h"
976  #include "mozilla/StaticPrefs_media.h"
977 +#include "PDMFactory.h"
978  
979  namespace mozilla {
980  
981 @@ -14,6 +15,10 @@ namespace mozilla {
982  bool FlacDecoder::IsEnabled() {
983  #ifdef MOZ_FFVPX
984    return StaticPrefs::media_flac_enabled();
985 +#elif defined(MOZ_FFMPEG)
986 +  RefPtr<PDMFactory> platform = new PDMFactory();
987 +  return StaticPrefs::media_flac_enabled() &&
988 +         (platform->SupportsMimeType("audio/flac"_ns) != media::DecodeSupport::Unsupported);
989  #else
990    return false;
991  #endif
992
993
994 [FILE:893:patches/patch-env-api-keys]
995 # Accept API keys from environment like before bug 1294585
996
997 --- build/moz.configure/keyfiles.configure.orig 2023-06-08 22:09:32 UTC
998 +++ build/moz.configure/keyfiles.configure
999 @@ -19,6 +19,7 @@ def keyfile(desc, default=None, help=Non
1000      @checking("for the %s key" % desc, lambda x: x and x is not no_key)
1001      @imports(_from="__builtin__", _import="open")
1002      @imports(_from="__builtin__", _import="IOError")
1003 +    @imports(_from="os", _import="environ")
1004      def keyfile(value):
1005          if value:
1006              try:
1007 @@ -29,7 +30,7 @@ def keyfile(desc, default=None, help=Non
1008                      raise FatalCheckError("'%s' is empty." % value[0])
1009              except IOError as e:
1010                  raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
1011 -        return no_key
1012 +        return environ.get("MOZ_%s_KEY" % desc.upper().replace(" ", "_")) or no_key
1013  
1014      return keyfile
1015  
1016
1017
1018 [FILE:1188:patches/patch-gfx_skia_skia_src_base_SkContainers.cpp]
1019 DragonFly eventually gets malloc_usable_size, check again when sysroot updates
1020
1021 --- gfx/skia/skia/src/base/SkContainers.cpp.orig        2023-06-08 22:09:35 UTC
1022 +++ gfx/skia/skia/src/base/SkContainers.cpp
1023 @@ -14,7 +14,7 @@
1024  
1025  #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
1026  #include <malloc/malloc.h>
1027 -#elif defined(SK_BUILD_FOR_ANDROID) || (defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__))
1028 +#elif defined(SK_BUILD_FOR_ANDROID) || (defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__NetBSD__))
1029  #include <malloc.h>
1030  #elif defined(SK_BUILD_FOR_WIN)
1031  #include <malloc.h>
1032 @@ -38,7 +38,7 @@ SkSpan<std::byte> complete_size(void* pt
1033      #elif defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 17
1034          completeSize = malloc_usable_size(ptr);
1035          SkASSERT(completeSize >= size);
1036 -    #elif defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__)
1037 +    #elif defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
1038          completeSize = malloc_usable_size(ptr);
1039          SkASSERT(completeSize >= size);
1040      #elif defined(SK_BUILD_FOR_WIN)
1041
1042
1043 [FILE:217:patches/patch-image_imgFrame.h]
1044 --- image/imgFrame.h.orig       2023-06-08 22:09:34 UTC
1045 +++ image/imgFrame.h
1046 @@ -9,6 +9,7 @@
1047  
1048  #include <functional>
1049  #include <utility>
1050 +#include <functional>
1051  
1052  #include "AnimationParams.h"
1053  #include "MainThreadUtils.h"
1054
1055
1056 [FILE:316:patches/patch-ipc_chromium_src_base_platform__thread__posix.cc]
1057 --- ipc/chromium/src/base/platform_thread_posix.cc.orig 2023-06-08 22:35:48 UTC
1058 +++ ipc/chromium/src/base/platform_thread_posix.cc
1059 @@ -16,6 +16,8 @@
1060  #elif defined(OS_LINUX)
1061  #  include <sys/syscall.h>
1062  #  include <sys/prctl.h>
1063 +#elif defined(OS_DRAGONFLY)
1064 +#  include <sys/lwp.h>
1065  #endif
1066  
1067  #if !defined(OS_MACOSX)
1068
1069
1070 [FILE:614:patches/patch-ipc_chromium_src_base_shared__memory__posix.cc]
1071 --- ipc/chromium/src/base/shared_memory_posix.cc.orig   2023-06-08 22:35:48 UTC
1072 +++ ipc/chromium/src/base/shared_memory_posix.cc
1073 @@ -284,6 +284,11 @@ bool SharedMemory::AppendPosixShmPrefix(
1074      StringAppendF(str, "snap.%s.", snap);
1075    }
1076  #  endif  // OS_LINUX
1077 +#  ifdef OS_DRAGONFLY
1078 +  // DragonFly BSD has a userland IPC implementation, we need to prefix the
1079 +  // path to shm_open(3), preferably with '/tmp'
1080 +  StringAppendF(str, "tmp/");
1081 +#  endif
1082    // Hopefully the "implementation defined" name length limit is long
1083    // enough for this.
1084    StringAppendF(str, "org.mozilla.ipc.%d.", static_cast<int>(pid));
1085
1086
1087 [FILE:318:patches/patch-js_src_old-configure.in]
1088 --- js/src/old-configure.in.orig        2023-06-08 22:35:48 UTC
1089 +++ js/src/old-configure.in
1090 @@ -652,7 +652,7 @@ then
1091      fi
1092  
1093         case "$target" in
1094 -           *-*-freebsd*)
1095 +           *-*-freebsd*|*-*-dragonfly*)
1096                         AC_DEFINE(_REENTRANT)
1097                         AC_DEFINE(_THREAD_SAFE)
1098                         dnl -pthread links in -lpthread, so don't specify it explicitly.
1099
1100
1101 [FILE:361:patches/patch-media_libcubeb_src_cubeb__jack.cpp]
1102 --- media/libcubeb/src/cubeb_jack.cpp.orig      2023-06-08 22:09:41 UTC
1103 +++ media/libcubeb/src/cubeb_jack.cpp
1104 @@ -8,7 +8,7 @@
1105   */
1106  #define _DEFAULT_SOURCE
1107  #define _BSD_SOURCE
1108 -#if !defined(__FreeBSD__) && !defined(__NetBSD__)
1109 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
1110  #define _POSIX_SOURCE
1111  #endif
1112  #include "cubeb-internal.h"
1113
1114
1115 [FILE:3900:patches/patch-pipewire_init]
1116     Chase ABI from multimedia/pipewire/files/patch-src_pipewire_pipewire_init
1117     
1118     Ref: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1819
1119
1120 diff --git third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
1121 index 49b64845100b..283c387db770 100644
1122 --- third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc.orig        2023-06-08 22:09:51 UTC
1123 +++ third_party/libwebrtc/modules/desktop_capture/linux/wayland/shared_screencast_stream.cc
1124 @@ -402,7 +402,7 @@ bool SharedScreenCastStreamPrivate::Star
1125  
1126    pw_stream_node_id_ = stream_node_id;
1127  
1128 -  pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
1129 +  pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
1130  
1131    pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
1132  
1133 --- third_party/libwebrtc/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc.orig    2023-06-08 22:09:50 UTC
1134 +++ third_party/libwebrtc/modules/desktop_capture/linux/wayland/test/test_screencast_stream_provider.cc
1135 @@ -36,7 +36,7 @@ TestScreenCastStreamProvider::TestScreen
1136      return;
1137    }
1138  
1139 -  pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
1140 +  pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
1141  
1142    pw_main_loop_ = pw_thread_loop_new("pipewire-test-main-loop", nullptr);
1143  
1144 --- third_party/libwebrtc/modules/portal/pipewire.sigs.orig     2023-06-08 22:09:49 UTC
1145 +++ third_party/libwebrtc/modules/portal/pipewire.sigs
1146 @@ -15,7 +15,7 @@ pw_loop * pw_loop_new(const spa_dict *pr
1147  
1148  
1149  // pipewire.h
1150 -void pw_init(int *argc, char **argv[]);
1151 +void pipewire_init(int *argc, char **argv[]);
1152  const char* pw_get_library_version();
1153  
1154  // properties.h
1155 --- third_party/pipewire/libpipewire/mozpipewire.cpp.orig       2023-06-08 22:09:51 UTC
1156 +++ third_party/pipewire/libpipewire/mozpipewire.cpp
1157 @@ -58,7 +58,7 @@ struct pw_context * (*pw_context_new_fn)
1158                                        struct pw_properties *props,
1159                                        size_t user_data_size);
1160  static int (*pw_core_disconnect_fn)(struct pw_core *core);
1161 -static void (*pw_init_fn)(int *argc, char **argv[]);
1162 +static void (*pipewire_init_fn)(int *argc, char **argv[]);
1163  static void (*pw_stream_add_listener_fn)(struct pw_stream *stream,
1164                                        struct spa_hook *listener,
1165                                        const struct pw_stream_events *events,
1166 @@ -101,7 +101,7 @@ bool IsPwLibraryLoaded() {
1167            IS_FUNC_LOADED(pw_context_destroy_fn) &&
1168            IS_FUNC_LOADED(pw_context_new_fn) &&
1169            IS_FUNC_LOADED(pw_core_disconnect_fn) &&
1170 -          IS_FUNC_LOADED(pw_init_fn) &&
1171 +          IS_FUNC_LOADED(pipewire_init_fn) &&
1172            IS_FUNC_LOADED(pw_stream_add_listener_fn) &&
1173            IS_FUNC_LOADED(pw_stream_connect_fn) &&
1174            IS_FUNC_LOADED(pw_stream_disconnect_fn) &&
1175 @@ -142,7 +142,7 @@ bool LoadPWLibrary() {
1176      GET_FUNC(pw_context_destroy, pwLib);
1177      GET_FUNC(pw_context_new, pwLib);
1178      GET_FUNC(pw_core_disconnect, pwLib);
1179 -    GET_FUNC(pw_init, pwLib);
1180 +    GET_FUNC(pipewire_init, pwLib);
1181      GET_FUNC(pw_stream_add_listener, pwLib);
1182      GET_FUNC(pw_stream_connect, pwLib);
1183      GET_FUNC(pw_stream_disconnect, pwLib);
1184 @@ -220,12 +220,12 @@ pw_core_disconnect(struct pw_core *core)
1185  }
1186  
1187  void
1188 -pw_init(int *argc, char **argv[])
1189 +pipewire_init(int *argc, char **argv[])
1190  {
1191    if (!LoadPWLibrary()) {
1192      return;
1193    }
1194 -  return pw_init_fn(argc, argv);
1195 +  return pipewire_init_fn(argc, argv);
1196  }
1197  
1198  void
1199 --- third_party/pipewire/pipewire/pipewire.h.orig       2023-06-08 22:09:51 UTC
1200 +++ third_party/pipewire/pipewire/pipewire.h
1201 @@ -69,9 +69,9 @@ extern "C" {
1202   * \{
1203   */
1204  void
1205 -pw_init(int *argc, char **argv[]);
1206 +pipewire_init(int *argc, char **argv[]);
1207  
1208 -void pw_deinit(void);
1209 +void pipewire_deinit(void);
1210  
1211  bool
1212  pw_debug_is_category_enabled(const char *name);
1213
1214
1215 [FILE:468:patches/patch-testing_mozbase_mozinfo_mozinfo_mozinfo.py]
1216 --- testing/mozbase/mozinfo/mozinfo/mozinfo.py.orig     2023-06-08 22:35:48 UTC
1217 +++ testing/mozbase/mozinfo/mozinfo/mozinfo.py
1218 @@ -131,7 +131,7 @@ elif system == "Linux":
1219  
1220      info["os"] = "linux"
1221      info["linux_distro"] = distribution
1222 -elif system in ["DragonFly", "FreeBSD", "NetBSD", "OpenBSD"]:
1223 +elif system in ["DragonFly", "FreeBSD", "NetBSD", "OpenBSD", "MidnightBSD"]:
1224      info["os"] = "bsd"
1225      version = os_version = sys.platform
1226  elif system == "Darwin":
1227
1228
1229 [FILE:278:patches/patch-third__party_dav1d_src_mem.h]
1230 --- third_party/dav1d/src/mem.h.orig    2023-06-08 22:09:50 UTC
1231 +++ third_party/dav1d/src/mem.h
1232 @@ -31,7 +31,7 @@
1233  #include <stdlib.h>
1234  
1235  #if defined(HAVE_ALIGNED_MALLOC) || defined(HAVE_MEMALIGN)
1236 -#include <malloc.h>
1237 +#include <stdlib.h>
1238  #endif
1239  
1240  #include "common/attributes.h"
1241
1242
1243 [FILE:361:patches/patch-third__party_libwebrtc_build_build__config.h]
1244 --- third_party/libwebrtc/build/build_config.h.orig     2023-06-08 22:09:49 UTC
1245 +++ third_party/libwebrtc/build/build_config.h
1246 @@ -76,7 +76,7 @@
1247  #define OS_WIN 1
1248  #elif defined(__Fuchsia__)
1249  #define OS_FUCHSIA 1
1250 -#elif defined(__FreeBSD__)
1251 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1252  #define OS_FREEBSD 1
1253  #elif defined(__NetBSD__)
1254  #define OS_NETBSD 1
1255
1256
1257 [FILE:515:patches/patch-third__party_sqlite3_src_moz.build]
1258 --- third_party/sqlite3/src/moz.build.orig      2023-06-08 22:35:48 UTC
1259 +++ third_party/sqlite3/src/moz.build
1260 @@ -92,7 +92,8 @@ DEFINES['SQLITE_TEMP_FILE_PREFIX'] = '"m
1261  
1262  # Enabling sqlite math functions
1263  DEFINES['SQLITE_ENABLE_MATH_FUNCTIONS'] = True
1264 -if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android":
1265 +if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android" or \
1266 +        CONFIG["OS_TARGET"] == "FreeBSD" or CONFIG["OS_TARGET"] == "DragonFly":
1267      OS_LIBS += [
1268          "m"
1269      ]
1270
1271
1272 [FILE:498:patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_port.h]
1273 --- toolkit/components/protobuf/src/google/protobuf/stubs/port.h.orig   2023-06-08 22:09:52 UTC
1274 +++ toolkit/components/protobuf/src/google/protobuf/stubs/port.h
1275 @@ -59,7 +59,7 @@
1276  #else
1277  #ifdef __APPLE__
1278  #include <machine/endian.h>  // __BYTE_ORDER
1279 -#elif defined(__FreeBSD__)
1280 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1281  #include <sys/endian.h>  // __BYTE_ORDER
1282  #elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
1283  #include <sys/isa_defs.h>  // __BYTE_ORDER
1284
1285
1286 [FILE:536:patches/patch-toolkit_xre_glxtest.cpp]
1287 --- toolkit/xre/glxtest/glxtest.cpp.orig        2023-06-08 22:09:52 UTC
1288 +++ toolkit/xre/glxtest/glxtest.cpp
1289 @@ -195,9 +195,14 @@ extern "C" {
1290  static void get_pci_status() {
1291    log("GLX_TEST: get_pci_status start\n");
1292  
1293 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1294 +  if (access("/dev/pci", F_OK) != 0) {
1295 +    record_warning("cannot access /dev/pci");
1296 +#else
1297    if (access("/sys/bus/pci/", F_OK) != 0 &&
1298        access("/sys/bus/pci_express/", F_OK) != 0) {
1299      record_warning("cannot access /sys/bus/pci");
1300 +#endif
1301      return;
1302    }
1303  
1304
1305
1306 [FILE:1519:patches/patch-tools_profiler_core_patform.cpp]
1307 commit 45a7951cb6a9b1735b9b6cec89db69b5933715c7
1308 Author: Christoph Moench-Tegeder <cmt@FreeBSD.org>
1309 Date:   Mon Mar 28 21:54:35 2022 +0200
1310
1311     FreeBSD can use sched_getcpu() from 1400046/1300524 on
1312
1313 diff --git tools/profiler/core/platform.cpp tools/profiler/core/platform.cpp
1314 index 92bcc1100687..2f17a88942a8 100644
1315 --- tools/profiler/core/platform.cpp.orig       2023-06-08 22:09:52 UTC
1316 +++ tools/profiler/core/platform.cpp
1317 @@ -115,6 +115,20 @@
1318  #  include <cpuid.h>
1319  #endif
1320  
1321 +#if defined(GP_OS_freebsd)
1322 +#include <sys/param.h>
1323 +// "after making CPU_SET macros compatible with glibc"
1324 +#  if __FreeBSD_version > 1400045 || (__FreeBSD_version > 1300523 && __FreeBSD_version < 1400000)
1325 +#  include <sched.h>
1326 +#  else
1327 +#    if __x86_64__ || __i386__
1328 +// similar cpuid_count() trick as on Darwin, using LLVM
1329 +// but not for all CPUs
1330 +#      include <cpuid.h>
1331 +#    endif
1332 +#  endif
1333 +#endif
1334 +
1335  #if defined(GP_OS_windows)
1336  #  include <processthreadsapi.h>
1337  
1338 @@ -6703,6 +6717,19 @@ void profiler_mark_thread_awake() {
1339      cpuId = ebx >> 24;
1340    }
1341  #  endif
1342 +#elif defined(GP_OS_freebsd) 
1343 +#  if __FreeBSD_version > 1400045 || (__FreeBSD_version > 1300523 && __FreeBSD_version < 1400000)
1344 +  cpuId = sched_getcpu();
1345 +#  elif defined(__amd64__)
1346 +  unsigned int eax, ebx, ecx, edx;
1347 +  __cpuid_count(1, 0, eax, ebx, ecx, edx);
1348 +  // Check if we have an APIC.
1349 +  if ((edx & (1 << 9))) {
1350 +    // APIC ID is bits 24-31 of EBX
1351 +    cpuId = ebx >> 24;
1352 +  }
1353 +#  endif
1354 +// the fallthrough is cpuID = 0
1355  #else
1356    cpuId = sched_getcpu();
1357  #endif
1358
1359
1360 [FILE:231:files/pkg-message-single]
1361 ==========================================================================
1362
1363   If Firefox segfaults, try setting MOZ_FORCE_DISABLE_E10S=1 in
1364   environment.
1365
1366 ==========================================================================
1367