1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Mozilla web browser
8 HOMEPAGE= https://www.mozilla.org/en-US/firefox/
12 SITES[main]= MOZILLA/firefox/releases/115.0.3esr/source
13 DISTFILE[1]= firefox-115.0.3esr.source.tar.xz:main
15 SPKGS[standard]= single
17 OPTIONS_AVAILABLE= none
18 OPTIONS_STANDARD= none
20 BUILD_DEPENDS= autoconf213:single:standard
21 cbindgen:single:standard
23 evdev-proto:single:standard
26 libnotify:dev:standard
28 nodejs:primary:standard
33 python-sqlite3:single:python_used
39 clang15:complete:standard
41 BUILDRUN_DEPENDS= dbus-glib:primary:standard
42 ffmpeg:primary:standard
43 harfbuzz: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
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
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
64 LICENSE_TERMS= single:{{WRKSRC}}/toolkit/content/license.html
65 LICENSE_FILE= MPL:stock
69 FPC_EQUIVALENT= www/firefox
72 CONFIGURE_OUTSOURCE= yes
73 CONFIGURE_ENV= PYTHON3={{PYTHON_CMD}}
74 SETUPTOOLS_USE_DISTUTILS=stdlib
75 BINDGEN_CFLAGS="-I{{LOCALBASE}}/include"
77 MAKE_ENV= PYTHON3={{PYTHON_CMD}}
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
90 --enable-system-pixman
93 --disable-debug-symbols
102 --prefix="{{PREFIX}}"
104 --with-system-graphite2
105 --with-system-harfbuzz
108 --with-system-libevent
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
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)
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
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 ;\
143 @${ECHO_CMD} LDFLAGS=\"-Wl,-rpath,${PREFIX}/lib/firefox\" \
144 >> ${WRKSRC}/.mozconfig
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 &&\
156 ${LN} -s ../lib/firefox/firefox firefox)
159 ${PAXCTL} +m ${STAGEDIR}${PREFIX}/lib/firefox/plugin-container
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
167 * Improved Tabbed Browsing, with tab grouping;
170 * Search Suggestions;
177 * Phishing Protection;
179 * Search Engine Manager.
183 0bcc571c44f94ac6b8c26e896fd771eb7bd41b2a8ec35598bced0102c1b855fa 516725896 firefox-115.0.3esr.source.tar.xz
186 [FILE:990:manifests/plist.single]
187 %%ONLY-LINUX%%lib/firefox/
193 %%ONLY-LINUX%%lib/firefox/browser/crashreporter-override.ini
213 lib/firefox/browser/omni.ja
214 lib/firefox/browser/chrome/icons/default/
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/
231 share/applications/firefox.desktop
232 share/pixmaps/firefox.png
235 [FILE:4626:patches/patch-addon-search]
236 https://github.com/mozilla/addons/issues/708
237 https://github.com/mozilla/addons-frontend/issues/4610
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);
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%¤tAppVersion=%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%¤tAppVersion=%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%¤tAppVersion=%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%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
260 pref("extensions.update.interval", 86400); // Check for updates to Extensions and
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) {
274 addon.sourceURI = lazy.NetUtil.newURI(file.url);
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
283 for (let platform of this.targetPlatforms) {
284 - if (platform.os == Services.appinfo.OS) {
285 + if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
288 if (platform.abi === abi) {
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();
300 + setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
301 + setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
303 #ifdef HAS_DLL_BLOCKLIST
304 DllBlocklist_Initialize(gBlocklistInitFlags);
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"),
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
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);
335 -static const int kARGBAlphaOffset =
336 - SurfaceFormat::A8R8G8B8_UINT32 == SurfaceFormat::B8G8R8A8 ? 3 : 0;
337 +static const int kARGBAlphaOffset = 0;
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
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
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
354 -# error "bad endianness"
357 // The following values are OS and endian-independent synonyms.
359 --- gfx/skia/skia/modules/skcms/skcms.cc.orig 2023-06-08 22:09:35 UTC
360 +++ gfx/skia/skia/modules/skcms/skcms.cc
362 #include <avx512fintrin.h>
363 #include <avx512dqintrin.h>
366 + #define SKCMS_PORTABLE
369 static bool runtime_cpu_detection = true;
370 @@ -324,20 +326,28 @@ enum {
371 static uint16_t read_big_u16(const uint8_t* ptr) {
373 memcpy(&be, ptr, sizeof(be));
374 -#if defined(_MSC_VER)
375 - return _byteswap_ushort(be);
376 +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
379 + #if defined(_MSC_VER)
380 + return _byteswap_ushort(be);
382 return __builtin_bswap16(be);
387 static uint32_t read_big_u32(const uint8_t* ptr) {
389 memcpy(&be, ptr, sizeof(be));
390 -#if defined(_MSC_VER)
391 - return _byteswap_ulong(be);
392 +#if __BYTE_ORDER == __ORDER_BIG_ENDIAN__
395 + #if defined(_MSC_VER)
396 + return _byteswap_ulong(be);
398 return __builtin_bswap32(be);
405 [FILE:3723:patches/patch-bug1559213]
407 Author: Jory A. Pratt <anarchy@gentoo.org>
408 Date: Thu Jun 13 11:53:00 2019 -0700
410 Bug 1559213 - Allow to use system av1 libs instead of bundled.
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(-)
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"]
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"]
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']:
440 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
441 + system_headers += [
442 + 'graphite2/Font.h',
443 + 'graphite2/Segment.h',
446 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
447 + system_headers += [
448 + 'harfbuzz/hb-glib.h',
449 + 'harfbuzz/hb-ot.h',
453 if CONFIG['MOZ_SYSTEM_LIBVPX']:
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",
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']
468 if CONFIG["MOZ_OMX"]:
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']:
478 - 'media_libdav1d_asm',
480 + if CONFIG["MOZ_SYSTEM_AV1"]:
481 + CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
482 + OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
486 + 'media_libdav1d_asm',
488 if CONFIG['MOZ_WAYLAND']:
489 LOCAL_INCLUDES += ['/media/mozva']
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
498 +# ==============================================================
499 +option("--with-system-graphite2",
500 + help="Use system graphite2 (located with pkgconfig)")
502 +system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2",
503 + when="--with-system-graphite2")
505 +set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True))
508 +# ==============================================================
509 +option("--with-system-harfbuzz",
510 + help="Use system harfbuzz (located with pkgconfig)")
512 +system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 2.7.4",
513 + when="--with-system-harfbuzz")
515 +set_config("MOZ_SYSTEM_HARFBUZZ", depends_if(system_harfbuzz)(lambda _: True))
518 "--enable-geckodriver",
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);
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);
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)
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)
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)
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)
544 --- media/libcubeb/src/cubeb_alsa.c.orig 2023-06-08 22:09:41 UTC
545 +++ media/libcubeb/src/cubeb_alsa.c
547 * accompanying file LICENSE for details.
550 +#if defined(__FreeBSD__)
553 #define _DEFAULT_SOURCE
555 #if defined(__NetBSD__)
556 #define _NETBSD_SOURCE /* timersub() */
558 #define _XOPEN_SOURCE 500
560 #include "cubeb-internal.h"
561 #include "cubeb/cubeb.h"
562 #include "cubeb_tracing.h"
565 [FILE:14560:patches/patch-bug1680982]
567 Author: Greg V <greg@unrelenting.technology>
568 Date: Sun Dec 6 22:07:00 2020 +0000
570 Bug 1680982 - Use evdev instead of the Linux legacy joystick API for gamepads
572 Using evdev is a prerequisite for adding rumble (haptic feedback) and LED support.
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)
583 Differential Revision: https://phabricator.services.mozilla.com/D98868
585 dom/gamepad/linux/LinuxGamepad.cpp | 262 ++++++++++++++++++++++++++++++++-----
586 dom/gamepad/moz.build | 2 +-
587 2 files changed, 229 insertions(+), 35 deletions(-)
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
594 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
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.
602 + * Ref: https://www.kernel.org/doc/html/latest/input/gamepad.html
605 +#include <unordered_map>
609 -#include <linux/joystick.h>
610 +#include <linux/input.h>
613 #include <sys/ioctl.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"
623 +#define LONG_BITS (sizeof(long) * 8)
624 +#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
628 using namespace mozilla::dom;
629 @@ -36,19 +41,29 @@ using mozilla::udev_list_entry;
630 using mozilla::udev_monitor;
631 using mozilla::UniquePtr;
633 -static const float kMaxAxisValue = 32767.0;
634 -static const char kJoystickPath[] = "/dev/input/js";
635 +static const char kEvdevPath[] = "/dev/input/event";
637 +static inline bool TestBit(const unsigned long* arr, int bit) {
638 + return !!(arr[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
641 +static inline double ScaleAxis(const input_absinfo& info, int value) {
642 + return 2.0 * (value - info.minimum) / (double)(info.maximum - info.minimum) -
646 // TODO: should find a USB identifier for each device so we can
647 // provide something that persists across connect/disconnect cycles.
650 GamepadHandle handle;
654 - char idstring[256];
655 - char devpath[PATH_MAX];
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;
666 class LinuxGamepadService {
668 @@ -66,7 +81,7 @@ class LinuxGamepadService {
669 bool is_gamepad(struct udev_device* dev);
670 void ReadUdevChange();
672 - // handler for data from /dev/input/jsN
673 + // handler for data from /dev/input/eventN
674 static gboolean OnGamepadData(GIOChannel* source, GIOCondition condition,
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);
682 + struct input_id id {};
683 + if (ioctl(fd, EVIOCGID, &id) == -1) {
688 - if (ioctl(fd, JSIOCGNAME(sizeof(name)), &name) == -1) {
689 + if (ioctl(fd, EVIOCGNAME(sizeof(name)), &name) == -1) {
690 strcpy(name, "unknown");
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");
697 + if (!vendor_id && id.vendor != 0) {
698 + vendor_id = (const char*)alloca(5);
699 + snprintf((char*)vendor_id, 5, "%04x", id.vendor);
701 + if (!model_id && id.product != 0) {
702 + model_id = (const char*)alloca(5);
703 + snprintf((char*)model_id, 5, "%04x", id.product);
705 snprintf(gamepad->idstring, sizeof(gamepad->idstring), "%s-%s-%s",
706 vendor_id ? vendor_id : "unknown", model_id ? model_id : "unknown",
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);
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;
727 + if (i == BTN_DPAD_UP) {
728 + i = BTN_DPAD_RIGHT + 1;
731 + if (TestBit(key_bits, i)) {
732 + gamepad->key_map[i] = numButtons++;
735 + for (uint16_t i = 0; i < BTN_JOYSTICK; i++) {
736 + if (TestBit(key_bits, i)) {
737 + gamepad->key_map[i] = numButtons++;
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;
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) {
753 + if (gamepad->abs_info[i].minimum == gamepad->abs_info[i].maximum) {
754 + gamepad->abs_info.erase(i);
757 + gamepad->abs_map[i] = numAxes++;
761 + if (numAxes == 0) {
762 + NS_WARNING("Gamepad with zero axes detected?");
764 + if (numButtons == 0) {
765 + NS_WARNING("Gamepad with zero buttons detected?");
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);
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.
787 @@ -257,7 +344,7 @@ bool LinuxGamepadService::is_gamepad(str
791 - if (strncmp(kJoystickPath, devpath, sizeof(kJoystickPath) - 1) != 0) {
792 + if (strncmp(kEvdevPath, devpath, sizeof(kEvdevPath) - 1) != 0) {
796 @@ -292,7 +379,7 @@ gboolean LinuxGamepadService::OnGamepadD
797 if (condition & G_IO_ERR || condition & G_IO_HUP) return FALSE;
800 - struct js_event event;
801 + struct input_event event {};
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
809 - // TODO: store device state?
810 - if (event.type & JS_EVENT_INIT) {
814 switch (event.type) {
815 - case JS_EVENT_BUTTON:
816 - service->NewButtonEvent(gamepad->handle, event.number, !!event.value);
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" */
824 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_PRIMARY,
828 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_SECONDARY,
832 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_QUATERNARY,
836 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_TERTIARY,
840 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_SHOULDER,
844 + service->NewButtonEvent(gamepad->handle,
845 + BUTTON_INDEX_RIGHT_SHOULDER, !!event.value);
848 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_TRIGGER,
852 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_RIGHT_TRIGGER,
856 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_BACK_SELECT,
860 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_START,
864 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_META,
868 + service->NewButtonEvent(
869 + gamepad->handle, BUTTON_INDEX_LEFT_THUMBSTICK, !!event.value);
872 + service->NewButtonEvent(
873 + gamepad->handle, BUTTON_INDEX_RIGHT_THUMBSTICK, !!event.value);
876 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_UP,
879 + case BTN_DPAD_DOWN:
880 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
883 + case BTN_DPAD_LEFT:
884 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
887 + case BTN_DPAD_RIGHT:
888 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
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);
899 - case JS_EVENT_AXIS:
900 - service->NewAxisMoveEvent(gamepad->handle, event.number,
901 - ((float)event.value) / kMaxAxisValue);
903 + if (!gamepad->abs_info.count(event.code)) continue;
904 + switch (event.code) {
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)));
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)));
933 + gamepad->remapper->RemapAxisMoveEvent(
934 + gamepad->handle, gamepad->abs_map[event.code],
935 + ScaleAxis(gamepad->abs_info[event.code], event.value));
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"]
951 UNIFIED_SOURCES += ["fallback/FallbackGamepad.cpp"]
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
961 - GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
962 + GUESS=%%MBSD64_TGT%%
965 GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
968 [FILE:704:patches/patch-dom_media_flac_FlacDecoder.cpp]
969 Enable FLAC on platforms without ffvpx like powerpc*
971 --- dom/media/flac/FlacDecoder.cpp.orig 2023-06-08 22:09:33 UTC
972 +++ dom/media/flac/FlacDecoder.cpp
974 #include "FlacDecoder.h"
975 #include "MediaContainerType.h"
976 #include "mozilla/StaticPrefs_media.h"
977 +#include "PDMFactory.h"
981 @@ -14,6 +15,10 @@ namespace mozilla {
982 bool FlacDecoder::IsEnabled() {
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);
994 [FILE:893:patches/patch-env-api-keys]
995 # Accept API keys from environment like before bug 1294585
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")
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))
1012 + return environ.get("MOZ_%s_KEY" % desc.upper().replace(" ", "_")) or no_key
1018 [FILE:1188:patches/patch-gfx_skia_skia_src_base_SkContainers.cpp]
1019 DragonFly eventually gets malloc_usable_size, check again when sysroot updates
1021 --- gfx/skia/skia/src/base/SkContainers.cpp.orig 2023-06-08 22:09:35 UTC
1022 +++ gfx/skia/skia/src/base/SkContainers.cpp
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__))
1030 #elif defined(SK_BUILD_FOR_WIN)
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)
1043 [FILE:217:patches/patch-image_imgFrame.h]
1044 --- image/imgFrame.h.orig 2023-06-08 22:09:34 UTC
1045 +++ image/imgFrame.h
1048 #include <functional>
1050 +#include <functional>
1052 #include "AnimationParams.h"
1053 #include "MainThreadUtils.h"
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
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>
1067 #if !defined(OS_MACOSX)
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);
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/");
1082 // Hopefully the "implementation defined" name length limit is long
1084 StringAppendF(str, "org.mozilla.ipc.%d.", static_cast<int>(pid));
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
1095 + *-*-freebsd*|*-*-dragonfly*)
1096 AC_DEFINE(_REENTRANT)
1097 AC_DEFINE(_THREAD_SAFE)
1098 dnl -pthread links in -lpthread, so don't specify it explicitly.
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
1106 #define _DEFAULT_SOURCE
1108 -#if !defined(__FreeBSD__) && !defined(__NetBSD__)
1109 +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
1110 #define _POSIX_SOURCE
1112 #include "cubeb-internal.h"
1115 [FILE:3900:patches/patch-pipewire_init]
1116 Chase ABI from multimedia/pipewire/files/patch-src_pipewire_pipewire_init
1118 Ref: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1819
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
1126 pw_stream_node_id_ = stream_node_id;
1128 - pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
1129 + pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
1131 pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
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
1139 - pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
1140 + pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
1142 pw_main_loop_ = pw_thread_loop_new("pipewire-test-main-loop", nullptr);
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
1150 -void pw_init(int *argc, char **argv[]);
1151 +void pipewire_init(int *argc, char **argv[]);
1152 const char* pw_get_library_version();
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)
1188 -pw_init(int *argc, char **argv[])
1189 +pipewire_init(int *argc, char **argv[])
1191 if (!LoadPWLibrary()) {
1194 - return pw_init_fn(argc, argv);
1195 + return pipewire_init_fn(argc, argv);
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" {
1205 -pw_init(int *argc, char **argv[]);
1206 +pipewire_init(int *argc, char **argv[]);
1208 -void pw_deinit(void);
1209 +void pipewire_deinit(void);
1212 pw_debug_is_category_enabled(const char *name);
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":
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"]:
1225 version = os_version = sys.platform
1226 elif system == "Darwin":
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
1235 #if defined(HAVE_ALIGNED_MALLOC) || defined(HAVE_MEMALIGN)
1236 -#include <malloc.h>
1237 +#include <stdlib.h>
1240 #include "common/attributes.h"
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
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__)
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
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":
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
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
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");
1293 +#if defined(__FreeBSD__) || defined(__DragonFly__)
1294 + if (access("/dev/pci", F_OK) != 0) {
1295 + record_warning("cannot access /dev/pci");
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");
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
1311 FreeBSD can use sched_getcpu() from 1400046/1300524 on
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 @@
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>
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>
1335 #if defined(GP_OS_windows)
1336 # include <processthreadsapi.h>
1338 @@ -6703,6 +6717,19 @@ void profiler_mark_thread_awake() {
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;
1354 +// the fallthrough is cpuID = 0
1356 cpuId = sched_getcpu();
1360 [FILE:231:files/pkg-message-single]
1361 ==========================================================================
1363 If Firefox segfaults, try setting MOZ_FORCE_DISABLE_E10S=1 in
1366 ==========================================================================