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/105.0.1/source
13 DISTFILE[1]= firefox-105.0.1.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
22 nodejs:primary:standard
27 python-sqlite3:single:python_used
28 evdev-proto:single:standard
29 BUILDRUN_DEPENDS= dbus-glib:primary:standard
30 ffmpeg:primary:standard
31 harfbuzz:primary:standard
33 libcanberra:primary:standard
34 libevent:single:standard
35 libffi:single:standard
36 libnotify:primary:standard
37 libproxy:single:standard
38 libdrm:single:standard
40 RUN_DEPENDS= pciutils:library:standard
42 USES= cpe desktop-utils:single gmake jpeg perl:build
43 pkgconfig png python:build zlib clang:keepcc
44 GNOME_COMPONENTS= gdkpixbuf gtk3
45 XORG_COMPONENTS= pixman xcb
48 LICENSE_TERMS= single:{{WRKSRC}}/toolkit/content/license.html
49 LICENSE_FILE= MPL:stock
53 FPC_EQUIVALENT= www/firefox
56 CONFIGURE_OUTSOURCE= yes
57 CONFIGURE_ENV= PYTHON3={{PYTHON_CMD}}
58 SETUPTOOLS_USE_DISTUTILS=stdlib
59 BINDGEN_CFLAGS="-I{{LOCALBASE}}/include"
61 MAKE_ENV= PYTHON3={{PYTHON_CMD}}
64 QMAKE_ARGS= --enable-application=browser
65 --enable-chrome-format=omni
66 --enable-default-toolkit=cairo-gtk3
67 --enable-install-strip
68 --enable-official-branding
74 --enable-system-pixman
77 --disable-debug-symbols
88 --with-system-graphite2
89 --with-system-harfbuzz
92 --with-system-libevent
97 --without-wasm-sandboxed-libraries
98 VAR_OPSYS[linux]= QMAKE_ARGS=--disable-elf-hack
101 ${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
102 ${WRKSRC}/browser/app/nsBrowserApp.cpp
103 ${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \
104 -e '/^Icon/s/=.*/=firefox/' \
105 ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop
106 (cd ${WRKSRC}/gfx/angle/checkout/src/compiler/translator && \
107 ${REINPLACE_CMD} -e 's|<math.h>|<cmath>|' \
108 InfoSink.h IntermNode.cpp)
110 ${REINPLACE_CMD} -e 's|MOZ_SCTP|MOZ_DISABLE_SCTP|' \
111 ${WRKSRC}/netwerk/moz.build
112 # disable rust checksums
113 ${REINPLACE_CMD} -e 's/"files":{[^}]*}/"files":{}/' \
114 ${WRKSRC}/third_party/rust/libc/.cargo-checksum.json
115 # Set mozilla options
116 @${ECHO_CMD} "--=> Setting configuration <=--"
117 @for arg in ${QMAKE_ARGS}; do \
118 ${ECHO_CMD} ".mozconfig << $$arg" ;\
119 ${ECHO_CMD} ac_add_options $$arg >> ${WRKSRC}/.mozconfig ;\
121 @${ECHO_CMD} LDFLAGS=\"-Wl,-rpath,${PREFIX}/lib/firefox\" \
122 >> ${WRKSRC}/.mozconfig
125 ${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps \
126 ${STAGEDIR}${PREFIX}/share/applications
127 ${INSTALL_DATA} ${WRKSRC}/taskcluster/docker/firefox-snap/firefox.desktop \
128 ${STAGEDIR}${PREFIX}/share/applications/
129 ${LN} -sf ${PREFIX}/lib/firefox/browser/chrome/icons/default/default48.png \
130 ${STAGEDIR}${PREFIX}/share/pixmaps/firefox.png
133 (cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
134 (cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
136 [FILE:527:descriptions/desc.single]
137 Firefox is a full-featured standard-compliant web browser, built on the
138 Mozilla codebase by thousands of contributors around the world.
139 It is extensible through thousands of user-contributed extensions, and
142 * Improved Tabbed Browsing, with tab grouping;
145 * Search Suggestions;
152 * Phishing Protection;
154 * Search Engine Manager.
158 70ecea0d26242d0c3613b9524405d72a22b52ae346072ac229a58c48634975cd 475536540 firefox-105.0.1.source.tar.xz
161 [FILE:981:manifests/plist.single]
162 %%ONLY-LINUX%%lib/firefox/
168 %%ONLY-LINUX%%lib/firefox/browser/crashreporter-override.ini
187 lib/firefox/browser/omni.ja
188 lib/firefox/browser/chrome/icons/default/
194 lib/firefox/browser/features/
195 formautofill@mozilla.org.xpi
196 pictureinpicture@mozilla.org.xpi
197 screenshots@mozilla.org.xpi
198 webcompat-reporter@mozilla.org.xpi
199 webcompat@mozilla.org.xpi
200 lib/firefox/defaults/pref/channel-prefs.js
201 lib/firefox/fonts/TwemojiMozilla.ttf
202 lib/firefox/gmp-clearkey/0.1/
205 share/applications/firefox.desktop
206 share/pixmaps/firefox.png
209 [FILE:4568:patches/patch-addon-search]
210 https://github.com/mozilla/addons/issues/708
211 https://github.com/mozilla/addons-frontend/issues/4610
213 diff --git browser/app/profile/firefox.js browser/app/profile/firefox.js
214 index af08811..77a3b18 100644
215 --- browser/app/profile/firefox.js
216 +++ browser/app/profile/firefox.js
217 @@ -38,7 +38,7 @@ pref("extensions.postDownloadThirdPartyPrompt", true);
218 // Preferences for AMO integration
219 pref("extensions.getAddons.cache.enabled", true);
220 pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%");
221 -pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
222 +pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=Linux&appver=%VERSION%");
223 pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
224 pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%");
225 pref("extensions.getAddons.discovery.api_url", "https://services.addons.mozilla.org/api/v4/discovery/?lang=%LOCALE%&edition=%DISTRIBUTION%");
226 @@ -193,8 +193,8 @@ pref("app.update.langpack.enabled", true);
229 pref("extensions.update.enabled", true);
230 -pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
231 -pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
232 +pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
233 +pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=Linux&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
234 pref("extensions.update.interval", 86400); // Check for updates to Extensions and
237 diff --git toolkit/mozapps/extensions/internal/AddonRepository.jsm toolkit/mozapps/extensions/internal/AddonRepository.jsm
238 index 661c902..a41b32f 100644
239 --- toolkit/mozapps/extensions/internal/AddonRepository.jsm
240 +++ toolkit/mozapps/extensions/internal/AddonRepository.jsm
241 @@ -592,7 +592,7 @@ var AddonRepository = {
242 addon.version = String(aEntry.current_version.version);
243 if (Array.isArray(aEntry.current_version.files)) {
244 for (let file of aEntry.current_version.files) {
245 - if (file.platform == "all" || file.platform == lazy.PLATFORM) {
246 + if (file.platform == "all" || file.platform == "linux" || file.platform == lazy.PLATFORM) {
248 addon.sourceURI = NetUtil.newURI(file.url);
250 diff --git toolkit/mozapps/extensions/internal/XPIDatabase.jsm toolkit/mozapps/extensions/internal/XPIDatabase.jsm
251 index f8c99c7..c6ba8a1 100644
252 --- toolkit/mozapps/extensions/internal/XPIDatabase.jsm
253 +++ toolkit/mozapps/extensions/internal/XPIDatabase.jsm
254 @@ -520,7 +520,7 @@ class AddonInternal {
255 // Something is causing errors in here
257 for (let platform of this.targetPlatforms) {
258 - if (platform.os == Services.appinfo.OS) {
259 + if (platform.os == "Linux" || platform.os == Services.appinfo.OS) {
262 if (platform.abi === abi) {
265 [FILE:501:patches/patch-browser_app_nsBrowserApp.cpp]
266 diff --git browser/app/nsBrowserApp.cpp browser/app/nsBrowserApp.cpp
267 index 87c2e16..a41f1d9 100644
268 --- browser/app/nsBrowserApp.cpp
269 +++ browser/app/nsBrowserApp.cpp
270 @@ -337,6 +337,9 @@ int main(int argc, char* argv[], char* envp[]) {
274 + setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
275 + setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
277 #ifdef HAS_DLL_BLOCKLIST
278 DllBlocklist_Initialize(gBlocklistInitFlags);
282 [FILE:4140:patches/patch-bug1559213]
284 Author: Jory A. Pratt <anarchy@gentoo.org>
285 Date: Thu Jun 13 11:53:00 2019 -0700
287 Bug 1559213 - Allow to use system av1 libs instead of bundled.
289 config/external/moz.build | 5 +++--
290 config/system-headers.mozbuild | 8 ++++++++
291 dom/media/platforms/moz.build | 5 +++++
292 toolkit/moz.configure | 19 ++++++++++++++++++-
293 4 files changed, 34 insertions(+), 3 deletions(-)
295 diff --git config/external/moz.build config/external/moz.build
296 index ab77121..75595d9 100644
297 --- config/external/moz.build
298 +++ config/external/moz.build
299 @@ -49,8 +49,9 @@ if not CONFIG["MOZ_SYSTEM_LIBVPX"]:
300 external_dirs += ["media/libvpx"]
302 if CONFIG["MOZ_AV1"]:
303 - external_dirs += ["media/libaom"]
304 - external_dirs += ["media/libdav1d"]
305 + if not CONFIG["MOZ_SYSTEM_AV1"]:
306 + external_dirs += ["media/libaom"]
307 + external_dirs += ["media/libdav1d"]
309 if not CONFIG["MOZ_SYSTEM_PNG"]:
310 external_dirs += ["media/libpng"]
311 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
312 index a1b58eb..65729f9 100644
313 --- config/system-headers.mozbuild
314 +++ config/system-headers.mozbuild
315 @@ -1289,6 +1289,14 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
319 +if CONFIG['MOZ_SYSTEM_AV1']:
320 + system_headers += [
321 + 'aom/aom_decoder.h',
327 if CONFIG['MOZ_SYSTEM_LIBVPX']:
330 diff --git dom/media/platforms/moz.build dom/media/platforms/moz.build
331 index 8509aec..eb6f129 100644
332 --- dom/media/platforms/moz.build
333 +++ dom/media/platforms/moz.build
334 @@ -78,6 +78,11 @@ if CONFIG["MOZ_AV1"]:
335 "agnostic/AOMDecoder.cpp",
336 "agnostic/DAV1DDecoder.cpp",
338 + if CONFIG['MOZ_SYSTEM_AV1']:
339 + CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBAOM_CFLAGS']
340 + OS_LIBS += CONFIG['MOZ_SYSTEM_LIBAOM_LIBS']
341 + CXXFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
342 + OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
344 if CONFIG["MOZ_OMX"]:
346 diff --git media/ffvpx/libavcodec/moz.build media/ffvpx/libavcodec/moz.build
347 index 0069865..e806fc8 100644
348 --- media/ffvpx/libavcodec/moz.build
349 +++ media/ffvpx/libavcodec/moz.build
350 @@ -112,9 +112,15 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
354 + if CONFIG["MOZ_SYSTEM_AV1"]:
355 + CFLAGS += CONFIG['MOZ_SYSTEM_LIBDAV1D_CFLAGS']
356 + OS_LIBS += CONFIG['MOZ_SYSTEM_LIBDAV1D_LIBS']
360 + 'media_libdav1d_asm',
364 - 'media_libdav1d_asm',
368 diff --git toolkit/moz.configure toolkit/moz.configure
369 index 0069865..e806fc8 100644
370 --- toolkit/moz.configure
371 +++ toolkit/moz.configure
372 @@ -523,7 +523,23 @@ def av1(value):
376 -@depends(target, when=av1 & compile_environment)
377 +option("--with-system-av1",
378 + help="Use system av1 (located with pkgconfig)")
380 +system_libaom_info = pkg_check_modules("MOZ_SYSTEM_LIBAOM", "aom >= 1.0.0",
381 + when="--with-system-av1")
383 +system_libdav1d_info = pkg_check_modules("MOZ_SYSTEM_LIBDAV1D", "dav1d >= 0.1.1",
384 + when="--with-system-av1")
386 +@depends(system_libaom_info, system_libdav1d_info)
387 +def system_av1(system_libaom_info, system_libdav1d_info):
388 + has_av1_libs = False
389 + if system_libaom_info and system_libdav1d_info:
390 + has_av1_libs = True
391 + return has_av1_libs
393 +@depends(target, when=av1 & depends(system_av1)(lambda v: not v) & compile_environment)
394 def dav1d_asm(target):
395 if target.cpu in ("aarch64", "x86", "x86_64"):
397 @@ -539,6 +555,7 @@ set_config("MOZ_DAV1D_ASM", dav1d_asm)
398 set_define("MOZ_DAV1D_ASM", dav1d_asm)
399 set_config("MOZ_AV1", av1)
400 set_define("MOZ_AV1", av1)
401 +set_config("MOZ_SYSTEM_AV1", depends_if(system_av1)(lambda _: True))
403 # JXL Image Codec Support
404 # ==============================================================
407 [FILE:2109:patches/patch-bug1659612]
408 media/libcubeb/src/cubeb_alsa.c:613:9: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned int, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
409 r = snprintf(node_name, sizeof(node_name), "pcm.%s", string);
411 media/libcubeb/src/cubeb_alsa.c:613:9: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
412 media/libcubeb/src/cubeb_alsa.c:1168:3: error: implicitly declaring library function 'alloca' with type 'void *(unsigned int)' [-Werror,-Wimplicit-function-declaration]
413 snd_pcm_hw_params_alloca(&hw_params);
415 /usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
416 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
418 /usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
419 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
421 media/libcubeb/src/cubeb_alsa.c:1168:3: note: include the header <stdlib.h> or explicitly provide a declaration for 'alloca'
422 /usr/local/include/alsa/pcm.h:737:39: note: expanded from macro 'snd_pcm_hw_params_alloca'
423 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
425 /usr/local/include/alsa/global.h:106:57: note: expanded from macro '__snd_alloca'
426 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
430 --- media/libcubeb/src/cubeb_alsa.c.orig 2021-08-31 14:26:24.530548000 +0200
431 +++ media/libcubeb/src/cubeb_alsa.c 2021-08-31 14:26:43.081470000 +0200
433 * accompanying file LICENSE for details.
436 -#define _DEFAULT_SOURCE
438 -#define _XOPEN_SOURCE 500
439 +#define _GNU_SOURCE 1
440 #include "cubeb-internal.h"
441 #include "cubeb/cubeb.h"
442 #include <alsa/asoundlib.h>
445 [FILE:2800:patches/patch-bug1664115]
446 Revert bug 1647717 to workaround the issue of occational tab crashing when
447 using any cubeb backends other than pulse-rust to play media. The loss of
448 such change will be that users will not be able to do profiling on threads
451 --- dom/media/AudioStream.cpp.orig 2022-09-08 21:05:37.835865000 +0200
452 +++ dom/media/AudioStream.cpp 2022-09-08 21:12:51.417935000 +0200
456 #include "webaudio/blink/DenormalDisabler.h"
457 -#include "AudioThreadRegistry.h"
458 #include "mozilla/StaticPrefs_media.h"
460 // Use abort() instead of exception in SoundTouch.
462 mOutChannels(aOutputChannels),
464 mDataSource(aSource),
465 - mAudioThreadId(ProfilerThreadId{}),
466 - mSandboxed(CubebUtils::SandboxEnabled()),
467 mPlaybackComplete(false),
469 mPreservesPitch(true),
471 aWriter.Available());
474 -bool AudioStream::CheckThreadIdChanged() {
475 - ProfilerThreadId id = profiler_current_thread_id();
476 - if (id != mAudioThreadId) {
477 - mAudioThreadId = id;
478 - mAudioThreadChanged = true;
481 - mAudioThreadChanged = false;
485 void AudioStream::AssertIsOnAudioThread() const {
486 // This can be called right after CheckThreadIdChanged, because the audio
487 // thread can change when not sandboxed.
491 long AudioStream::DataCallback(void* aBuffer, long aFrames) {
492 - if (CheckThreadIdChanged() && !mSandboxed) {
493 - CubebUtils::GetAudioThreadRegistry()->Register(mAudioThreadId);
495 WebCore::DenormalDisabler disabler;
496 if (!mCallbacksStarted) {
497 mCallbacksStarted = true;
499 mDumpFile.Write(static_cast<const AudioDataValue*>(aBuffer),
500 aFrames * mOutChannels);
502 - if (!mSandboxed && writer.Available() != 0) {
503 - CubebUtils::GetAudioThreadRegistry()->Unregister(mAudioThreadId);
505 return aFrames - writer.Available();
508 --- dom/media/AudioStream.h.orig 2022-09-08 21:13:08.562133000 +0200
509 +++ dom/media/AudioStream.h 2022-09-08 21:15:22.121196000 +0200
512 template <typename Function, typename... Args>
513 int InvokeCubeb(Function aFunction, Args&&... aArgs) MOZ_REQUIRES(mMonitor);
514 - bool CheckThreadIdChanged();
515 void AssertIsOnAudioThread() const;
517 soundtouch::SoundTouch* mTimeStretcher;
519 // the default device is used. It is set
520 // during the Init() in decoder thread.
521 RefPtr<AudioDeviceInfo> mSinkInfo;
522 - // Contains the id of the audio thread, from profiler_get_thread_id.
523 - std::atomic<ProfilerThreadId> mAudioThreadId;
524 - const bool mSandboxed = false;
526 MozPromiseHolder<MediaSink::EndedPromise> mEndedPromise
527 MOZ_GUARDED_BY(mMonitor);
530 [FILE:14717:patches/patch-bug1680982]
532 Author: Greg V <greg@unrelenting.technology>
533 Date: Sun Dec 6 22:07:00 2020 +0000
535 Bug 1680982 - Use evdev instead of the Linux legacy joystick API for gamepads
537 Using evdev is a prerequisite for adding rumble (haptic feedback) and LED support.
539 - BTN_GAMEPAD semantic buttons are interpreted directly,
540 since all kernel drivers are supposed to use them correctly:
541 https://www.kernel.org/doc/html/latest/input/gamepad.html
542 - BTN_JOYSTICK legacy style numbered buttons use the model specific remappers
543 - we support even strange devices that combine both styles in one device
544 - the Linux gamepad module is enabled on FreeBSD and DragonFly, because
545 these kernels provide evdev, and libudev-devd provides enough of libudev
546 (evdev headers are provided by the devel/evdev-proto package)
548 Differential Revision: https://phabricator.services.mozilla.com/D98868
550 dom/gamepad/linux/LinuxGamepad.cpp | 262 ++++++++++++++++++++++++++++++++-----
551 dom/gamepad/moz.build | 2 +-
552 2 files changed, 229 insertions(+), 35 deletions(-)
554 diff --git dom/gamepad/linux/LinuxGamepad.cpp dom/gamepad/linux/LinuxGamepad.cpp
555 index deee47b9d267..31f0aad7ae4a 100644
556 --- dom/gamepad/linux/LinuxGamepad.cpp
557 +++ dom/gamepad/linux/LinuxGamepad.cpp
559 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
562 - * LinuxGamepadService: A Linux backend for the GamepadService.
563 - * Derived from the kernel documentation at
564 - * http://www.kernel.org/doc/Documentation/input/joystick-api.txt
565 + * LinuxGamepadService: An evdev backend for the GamepadService.
567 + * Ref: https://www.kernel.org/doc/html/latest/input/gamepad.html
570 +#include <unordered_map>
574 -#include <linux/joystick.h>
575 +#include <linux/input.h>
578 #include <sys/ioctl.h>
581 #include "mozilla/dom/GamepadHandle.h"
582 #include "mozilla/dom/GamepadPlatformService.h"
583 +#include "mozilla/dom/GamepadRemapping.h"
584 #include "mozilla/Tainting.h"
585 #include "mozilla/UniquePtr.h"
588 +#define LONG_BITS (sizeof(long) * 8)
589 +#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
593 using namespace mozilla::dom;
594 @@ -36,19 +41,29 @@ using mozilla::udev_list_entry;
595 using mozilla::udev_monitor;
596 using mozilla::UniquePtr;
598 -static const float kMaxAxisValue = 32767.0;
599 -static const char kJoystickPath[] = "/dev/input/js";
600 +static const char kEvdevPath[] = "/dev/input/event";
602 +static inline bool TestBit(const unsigned long* arr, int bit) {
603 + return !!(arr[bit / LONG_BITS] & (1LL << (bit % LONG_BITS)));
606 +static inline double ScaleAxis(const input_absinfo& info, int value) {
607 + return 2.0 * (value - info.minimum) / (double)(info.maximum - info.minimum) -
611 // TODO: should find a USB identifier for each device so we can
612 // provide something that persists across connect/disconnect cycles.
615 GamepadHandle handle;
619 - char idstring[256];
620 - char devpath[PATH_MAX];
622 + RefPtr<GamepadRemapper> remapper = nullptr;
623 + guint source_id = UINT_MAX;
624 + char idstring[256] = {0};
625 + char devpath[PATH_MAX] = {0};
626 + uint8_t key_map[KEY_MAX] = {0};
627 + uint8_t abs_map[ABS_MAX] = {0};
628 + std::unordered_map<uint16_t, input_absinfo> abs_info;
631 class LinuxGamepadService {
633 @@ -66,7 +81,7 @@ class LinuxGamepadService {
634 bool is_gamepad(struct udev_device* dev);
635 void ReadUdevChange();
637 - // handler for data from /dev/input/jsN
638 + // handler for data from /dev/input/eventN
639 static gboolean OnGamepadData(GIOChannel* source, GIOCondition condition,
642 @@ -114,8 +129,14 @@ void LinuxGamepadService::AddDevice(struct udev_device* dev) {
643 g_io_channel_set_encoding(channel, nullptr, nullptr);
644 g_io_channel_set_buffered(channel, FALSE);
645 int fd = g_io_channel_unix_get_fd(channel);
647 + struct input_id id {};
648 + if (ioctl(fd, EVIOCGID, &id) == -1) {
653 - if (ioctl(fd, JSIOCGNAME(sizeof(name)), &name) == -1) {
654 + if (ioctl(fd, EVIOCGNAME(sizeof(name)), &name) == -1) {
655 strcpy(name, "unknown");
657 const char* vendor_id =
658 @@ -131,20 +152,86 @@ void LinuxGamepadService::AddDevice(struct udev_device* dev) {
659 model_id = mUdev.udev_device_get_sysattr_value(parent, "id/product");
662 + if (!vendor_id && id.vendor != 0) {
663 + vendor_id = (const char*)alloca(5);
664 + snprintf((char*)vendor_id, 5, "%04x", id.vendor);
666 + if (!model_id && id.product != 0) {
667 + model_id = (const char*)alloca(5);
668 + snprintf((char*)model_id, 5, "%04x", id.product);
670 snprintf(gamepad->idstring, sizeof(gamepad->idstring), "%s-%s-%s",
671 vendor_id ? vendor_id : "unknown", model_id ? model_id : "unknown",
674 char numAxes = 0, numButtons = 0;
675 - ioctl(fd, JSIOCGAXES, &numAxes);
676 - gamepad->numAxes = numAxes;
677 - ioctl(fd, JSIOCGBUTTONS, &numButtons);
678 - gamepad->numButtons = numButtons;
679 + unsigned long key_bits[NLONGS(KEY_CNT)] = {0};
680 + unsigned long abs_bits[NLONGS(ABS_CNT)] = {0};
681 + ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(key_bits)), key_bits);
682 + ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)), abs_bits);
684 + /* Here, we try to support even strange cases where proper semantic
685 + * BTN_GAMEPAD button are combined with arbitrary extra buttons. */
686 + for (uint16_t i = BTN_JOYSTICK; i < KEY_MAX; i++) {
687 + /* Do not map semantic buttons, they are handled directly */
688 + if (i == BTN_GAMEPAD) {
689 + i = BTN_THUMBR + 1;
692 + if (i == BTN_DPAD_UP) {
693 + i = BTN_DPAD_RIGHT + 1;
696 + if (TestBit(key_bits, i)) {
697 + gamepad->key_map[i] = numButtons++;
700 + for (uint16_t i = 0; i < BTN_JOYSTICK; i++) {
701 + if (TestBit(key_bits, i)) {
702 + gamepad->key_map[i] = numButtons++;
705 + for (uint16_t i = BTN_GAMEPAD; i <= BTN_THUMBR; i++) {
706 + /* But if any semantic event exists, count them all */
707 + if (TestBit(key_bits, i)) {
708 + numButtons += BUTTON_INDEX_COUNT;
712 + for (uint16_t i = 0; i < ABS_MAX; ++i) {
713 + if (TestBit(abs_bits, i)) {
714 + gamepad->abs_info.emplace(i, input_absinfo{});
715 + if (ioctl(fd, EVIOCGABS(i), &gamepad->abs_info[i]) < 0) {
718 + if (gamepad->abs_info[i].minimum == gamepad->abs_info[i].maximum) {
719 + gamepad->abs_info.erase(i);
722 + gamepad->abs_map[i] = numAxes++;
726 + if (numAxes == 0) {
727 + NS_WARNING("Gamepad with zero axes detected?");
729 + if (numButtons == 0) {
730 + NS_WARNING("Gamepad with zero buttons detected?");
733 + bool defaultRemapper = false;
734 + RefPtr<GamepadRemapper> remapper =
735 + GetGamepadRemapper(id.vendor, id.product, defaultRemapper);
736 + MOZ_ASSERT(remapper);
737 + remapper->SetAxisCount(numAxes);
738 + remapper->SetButtonCount(numButtons);
740 gamepad->handle = service->AddGamepad(
741 - gamepad->idstring, mozilla::dom::GamepadMappingType::_empty,
742 - mozilla::dom::GamepadHand::_empty, gamepad->numButtons, gamepad->numAxes,
743 - 0, 0, 0); // TODO: Bug 680289, implement gamepad haptics for Linux.
744 + gamepad->idstring, remapper->GetMappingType(), GamepadHand::_empty,
745 + remapper->GetButtonCount(), remapper->GetAxisCount(), 0,
746 + remapper->GetLightIndicatorCount(), remapper->GetTouchEventCount());
747 + gamepad->remapper = remapper.forget();
748 + // TODO: Bug 680289, implement gamepad haptics for Linux.
749 // TODO: Bug 1523355, implement gamepad lighindicator and touch for Linux.
752 @@ -257,7 +344,7 @@ bool LinuxGamepadService::is_gamepad(struct udev_device* dev) {
756 - if (strncmp(kJoystickPath, devpath, sizeof(kJoystickPath) - 1) != 0) {
757 + if (strncmp(kEvdevPath, devpath, sizeof(kEvdevPath) - 1) != 0) {
761 @@ -292,7 +379,7 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
762 if (condition & G_IO_ERR || condition & G_IO_HUP) return FALSE;
765 - struct js_event event;
766 + struct input_event event {};
768 GError* err = nullptr;
769 if (g_io_channel_read_chars(source, (gchar*)&event, sizeof(event), &count,
770 @@ -301,18 +388,125 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
774 - // TODO: store device state?
775 - if (event.type & JS_EVENT_INIT) {
779 switch (event.type) {
780 - case JS_EVENT_BUTTON:
781 - service->NewButtonEvent(gamepad->handle, event.number, !!event.value);
783 + switch (event.code) {
784 + /* The gamepad events are meaningful, and according to
785 + * https://www.kernel.org/doc/html/latest/input/gamepad.html
786 + * "No other devices, that do not look/feel like a gamepad, shall
787 + * report these events" */
789 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_PRIMARY,
793 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_SECONDARY,
797 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_QUATERNARY,
801 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_TERTIARY,
805 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_SHOULDER,
809 + service->NewButtonEvent(gamepad->handle,
810 + BUTTON_INDEX_RIGHT_SHOULDER, !!event.value);
813 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_LEFT_TRIGGER,
817 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_RIGHT_TRIGGER,
821 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_BACK_SELECT,
825 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_START,
829 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_META,
833 + service->NewButtonEvent(
834 + gamepad->handle, BUTTON_INDEX_LEFT_THUMBSTICK, !!event.value);
837 + service->NewButtonEvent(
838 + gamepad->handle, BUTTON_INDEX_RIGHT_THUMBSTICK, !!event.value);
841 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_UP,
844 + case BTN_DPAD_DOWN:
845 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
848 + case BTN_DPAD_LEFT:
849 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
852 + case BTN_DPAD_RIGHT:
853 + service->NewButtonEvent(gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
857 + /* For non-gamepad events, this is the "anything goes" numbered
858 + * handling that should be handled with remappers. */
859 + gamepad->remapper->RemapButtonEvent(
860 + gamepad->handle, gamepad->key_map[event.code], !!event.value);
864 - case JS_EVENT_AXIS:
865 - service->NewAxisMoveEvent(gamepad->handle, event.number,
866 - ((float)event.value) / kMaxAxisValue);
868 + if (!gamepad->abs_info.count(event.code)) continue;
869 + switch (event.code) {
871 + service->NewButtonEvent(
872 + gamepad->handle, BUTTON_INDEX_DPAD_LEFT,
873 + AxisNegativeAsButton(
874 + ScaleAxis(gamepad->abs_info[event.code], event.value)));
875 + service->NewButtonEvent(
876 + gamepad->handle, BUTTON_INDEX_DPAD_RIGHT,
877 + AxisPositiveAsButton(
878 + ScaleAxis(gamepad->abs_info[event.code], event.value)));
881 + service->NewButtonEvent(
882 + gamepad->handle, BUTTON_INDEX_DPAD_UP,
883 + AxisNegativeAsButton(
884 + ScaleAxis(gamepad->abs_info[event.code], event.value)));
885 + service->NewButtonEvent(
886 + gamepad->handle, BUTTON_INDEX_DPAD_DOWN,
887 + AxisPositiveAsButton(
888 + ScaleAxis(gamepad->abs_info[event.code], event.value)));
898 + gamepad->remapper->RemapAxisMoveEvent(
899 + gamepad->handle, gamepad->abs_map[event.code],
900 + ScaleAxis(gamepad->abs_info[event.code], event.value));
906 diff --git dom/gamepad/moz.build dom/gamepad/moz.build
907 index 5f55d5a95e96..544b7f927736 100644
908 --- dom/gamepad/moz.build
909 +++ dom/gamepad/moz.build
910 @@ -59,7 +59,7 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
911 UNIFIED_SOURCES += ["windows/WindowsGamepad.cpp"]
912 elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
913 UNIFIED_SOURCES += ["android/AndroidGamepad.cpp"]
914 -elif CONFIG["OS_ARCH"] == "Linux":
915 +elif CONFIG["OS_ARCH"] in ("Linux", "FreeBSD", "DragonFly"):
916 UNIFIED_SOURCES += ["linux/LinuxGamepad.cpp"]
918 UNIFIED_SOURCES += ["fallback/FallbackGamepad.cpp"]
921 [FILE:9644:patches/patch-bug847568]
922 # Allow building against system-wide graphite2/harfbuzz.
924 diff --git config/system-headers.mozbuild config/system-headers.mozbuild
925 index a1b58eb..a0a0943 100644
926 --- config/system-headers.mozbuild
927 +++ config/system-headers.mozbuild
928 @@ -1289,6 +1289,19 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
932 +if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
933 + system_headers += [
934 + 'graphite2/Font.h',
935 + 'graphite2/Segment.h',
938 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
939 + system_headers += [
940 + 'harfbuzz/hb-glib.h',
941 + 'harfbuzz/hb-ot.h',
945 if CONFIG['MOZ_SYSTEM_LIBVPX']:
948 diff --git dom/base/moz.build dom/base/moz.build
949 index d390adf..4508f19 100644
950 --- dom/base/moz.build
951 +++ dom/base/moz.build
952 @@ -576,6 +576,9 @@ FINAL_LIBRARY = "xul"
953 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
954 CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
956 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
957 + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
961 script="gen-usecounters.py",
962 diff --git gfx/graphite2/geckoextra/moz.build gfx/graphite2/geckoextra/moz.build
964 index 0000000..24e8d7a
966 +++ gfx/graphite2/geckoextra/moz.build
968 +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
969 +# vim: set filetype=python:
970 +# This Source Code Form is subject to the terms of the Mozilla Public
971 +# License, v. 2.0. If a copy of the MPL was not distributed with this
972 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
974 +EXPORTS.graphite2 += [
975 + 'include/GraphiteExtra.h',
976 + 'include/GraphiteStructsForRLBox.h',
979 +UNIFIED_SOURCES += [
980 + '../geckoextra/src/GraphiteExtra.cpp',
983 +CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
985 +# Match bundled graphite2 configuration
986 +AllowCompilerWarnings()
988 +FINAL_LIBRARY = 'gkmedias'
989 diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
990 index b91d9c1..a97e6eb 100755
991 --- gfx/graphite2/moz-gr-update.sh
992 +++ gfx/graphite2/moz-gr-update.sh
996 # Script used to update the Graphite2 library in the mozilla source tree
997 +# and bump version for --with-system-graphite2
999 # This script lives in gfx/graphite2, along with the library source,
1000 # but must be run from the top level of the mozilla-central tree.
1001 @@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
1002 #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
1003 #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
1005 +# chase version for --with-system-graphite2
1006 +perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
1007 + if /GR2_VERSION_REQUIRE/" old-configure.in
1009 # summarize what's been touched
1010 echo Updated to $RELEASE.
1011 echo Here is what changed in the gfx/graphite2 directory:
1014 -hg stat gfx/graphite2
1015 +hg stat old-configure.in gfx/graphite2
1018 echo If gfx/graphite2/src/files.mk has changed, please make corresponding
1019 diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
1020 index 3180257..4587a3b 100644
1021 --- gfx/harfbuzz/README-mozilla
1022 +++ gfx/harfbuzz/README-mozilla
1023 @@ -21,3 +21,8 @@ from within the gfx/harfbuzz directory.
1025 If the collection of source files changes, manual updates to moz.build may be
1026 needed as we don't use the upstream makefiles.
1028 +The in-tree copy may be omitted during build by --with-system-harfbuzz.
1029 +Make sure to keep pkg-config version check within toolkit/moz.configure in sync
1030 +with checkout version or increment latest tag by one if it's not based
1031 +on upstream release.
1032 diff --git gfx/moz.build gfx/moz.build
1033 index 4d6d63d..cd57b0c 100644
1036 @@ -10,6 +10,14 @@ with Files("**"):
1037 with Files("wr/**"):
1038 BUG_COMPONENT = ("Core", "Graphics: WebRender")
1040 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
1041 + DIRS += ["graphite2/geckoextra"]
1043 + DIRS += ["graphite2/src" ]
1045 +if not CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1046 + DIRS += ["harfbuzz/src"]
1051 @@ -19,8 +27,6 @@ DIRS += [
1060 diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
1061 index 5e0fd17..860b80a 100755
1062 --- gfx/skia/generate_mozbuild.py
1063 +++ gfx/skia/generate_mozbuild.py
1064 @@ -96,6 +96,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
1065 '-Wno-unused-private-field',
1068 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
1069 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
1071 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
1073 "/gfx/cairo/cairo/src",
1074 diff --git gfx/skia/moz.build gfx/skia/moz.build
1075 index 524bd28..615c93b 100755
1076 --- gfx/skia/moz.build
1077 +++ gfx/skia/moz.build
1078 @@ -488,6 +488,9 @@ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
1079 '-Wno-unused-private-field',
1082 +if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
1083 + CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
1085 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk', 'android'):
1087 "/gfx/cairo/cairo/src",
1088 diff --git gfx/thebes/moz.build gfx/thebes/moz.build
1089 index baa6f09..4f02a9e 100644
1090 --- gfx/thebes/moz.build
1091 +++ gfx/thebes/moz.build
1092 @@ -286,7 +286,13 @@ if CONFIG["MOZ_WAYLAND"]:
1094 LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
1096 -DEFINES["GRAPHITE2_STATIC"] = True
1097 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
1098 + CXXFLAGS += CONFIG["MOZ_GRAPHITE2_CFLAGS"]
1100 + DEFINES["GRAPHITE2_STATIC"] = True
1102 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1103 + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
1105 if CONFIG["CC_TYPE"] == "clang":
1106 # Suppress warnings from Skia header files.
1107 diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
1108 index 301eb9a..7cece5e 100644
1109 --- intl/unicharutil/util/moz.build
1110 +++ intl/unicharutil/util/moz.build
1111 @@ -25,6 +25,9 @@ UNIFIED_SOURCES += [
1112 "nsUnicodeProperties.cpp",
1115 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1116 + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
1118 include("/ipc/chromium/chromium-config.mozbuild")
1121 diff --git netwerk/dns/moz.build netwerk/dns/moz.build
1122 index f769e27..315bdd4 100644
1123 --- netwerk/dns/moz.build
1124 +++ netwerk/dns/moz.build
1125 @@ -102,6 +102,9 @@ GeneratedFile(
1126 "etld_data.inc", script="prepare_tlds.py", inputs=["effective_tld_names.dat"]
1129 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1130 + CXXFLAGS += CONFIG["MOZ_HARFBUZZ_CFLAGS"]
1132 # need to include etld_data.inc
1135 diff --git old-configure.in old-configure.in
1136 index d147957..d332b34 100644
1137 --- old-configure.in
1138 +++ old-configure.in
1139 @@ -1335,6 +1335,27 @@ fi
1140 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1141 AC_SUBST(MOZ_MACBUNDLE_ID)
1143 +dnl ========================================================
1144 +dnl Check for graphite2
1145 +dnl ========================================================
1146 +if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
1147 + dnl graphite2.pc has bogus version, check manually
1148 + _SAVE_CFLAGS=$CFLAGS
1149 + CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
1150 + AC_TRY_COMPILE([ #include <graphite2/Font.h>
1151 + #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
1152 + ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
1153 + * 100 + GR2_VERSION_BUGFIX >= \
1154 + (major) * 10000 + (minor) * 100 + (bugfix) )
1156 + #if !GR2_VERSION_REQUIRE(1,3,14)
1157 + #error "Insufficient graphite2 version."
1160 + [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
1161 + CFLAGS=$_SAVE_CFLAGS
1164 dnl ========================================================
1165 dnl = Child Process Name for IPC
1166 dnl ========================================================
1167 diff --git toolkit/library/moz.build toolkit/library/moz.build
1168 index 2c3f869..e8a9d23 100644
1169 --- toolkit/library/moz.build
1170 +++ toolkit/library/moz.build
1171 @@ -269,6 +269,12 @@ if CONFIG["MOZ_SYSTEM_PNG"]:
1172 if CONFIG["MOZ_SYSTEM_WEBP"]:
1173 OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
1175 +if CONFIG["MOZ_SYSTEM_GRAPHITE2"]:
1176 + OS_LIBS += CONFIG["MOZ_GRAPHITE2_LIBS"]
1178 +if CONFIG["MOZ_SYSTEM_HARFBUZZ"]:
1179 + OS_LIBS += CONFIG["MOZ_HARFBUZZ_LIBS"]
1181 if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
1182 OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
1184 diff --git toolkit/moz.configure toolkit/moz.configure
1185 index 0069865..9bb1864 100644
1186 --- toolkit/moz.configure
1187 +++ toolkit/moz.configure
1188 @@ -1058,6 +1058,25 @@ def geckodriver_default(enable_tests, target, cross_compile, hazard, asan, autom
1193 +# ==============================================================
1194 +option("--with-system-graphite2",
1195 + help="Use system graphite2 (located with pkgconfig)")
1197 +system_graphite2 = pkg_check_modules("MOZ_GRAPHITE2", "graphite2",
1198 + when="--with-system-graphite2")
1200 +set_config("MOZ_SYSTEM_GRAPHITE2", depends_if(system_graphite2)(lambda _: True))
1203 +# ==============================================================
1204 +option("--with-system-harfbuzz",
1205 + help="Use system harfbuzz (located with pkgconfig)")
1207 +system_harfbuzz = pkg_check_modules("MOZ_HARFBUZZ", "harfbuzz >= 2.7.4",
1208 + when="--with-system-harfbuzz")
1210 +set_config("MOZ_SYSTEM_HARFBUZZ", depends_if(system_harfbuzz)(lambda _: True))
1213 "--enable-geckodriver",
1216 [FILE:704:patches/patch-dom_media_flac_FlacDecoder.cpp]
1217 Enable FLAC on platforms without ffvpx like powerpc*
1219 --- dom/media/flac/FlacDecoder.cpp.orig 2021-04-15 19:44:28 UTC
1220 +++ dom/media/flac/FlacDecoder.cpp
1222 #include "FlacDecoder.h"
1223 #include "MediaContainerType.h"
1224 #include "mozilla/StaticPrefs_media.h"
1225 +#include "PDMFactory.h"
1229 @@ -14,6 +15,10 @@ namespace mozilla {
1230 bool FlacDecoder::IsEnabled() {
1232 return StaticPrefs::media_flac_enabled();
1233 +#elif defined(MOZ_FFMPEG)
1234 + RefPtr<PDMFactory> platform = new PDMFactory();
1235 + return StaticPrefs::media_flac_enabled() &&
1236 + (platform->SupportsMimeType("audio/flac"_ns) != media::DecodeSupport::Unsupported);
1242 [FILE:914:patches/patch-env-api-keys]
1243 # Accept API keys from environment like before bug 1294585
1245 --- build/moz.configure/keyfiles.configure
1246 +++ build/moz.configure/keyfiles.configure
1247 @@ -19,6 +19,7 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x):
1248 @checking("for the %s key" % desc, lambda x: x and x is not no_key)
1249 @imports(_from="__builtin__", _import="open")
1250 @imports(_from="__builtin__", _import="IOError")
1251 + @imports(_from="os", _import="environ")
1255 @@ -29,7 +30,7 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x):
1256 raise FatalCheckError("'%s' is empty." % value[0])
1257 except IOError as e:
1258 raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
1260 + return environ.get("MOZ_%s_KEY" % desc.upper().replace(" ", "_")) or no_key
1266 [FILE:997:patches/patch-gfx_skia_skia_src_core_SkCpu.cpp]
1267 Regressed by https://svnweb.freebsd.org/changeset/base/324815
1269 gfx/skia/skia/src/core/SkCpu.cpp:81:27: error: use of undeclared identifier 'getauxval'
1270 uint32_t hwcaps = getauxval(AT_HWCAP);
1273 --- gfx/skia/skia/src/core/SkCpu.cpp.orig 2020-02-07 22:13:22 UTC
1274 +++ gfx/skia/skia/src/core/SkCpu.cpp
1279 +#elif defined(SK_CPU_ARM64) && defined(__FreeBSD__)
1280 + #include <machine/armreg.h>
1281 + #ifndef ID_AA64ISAR0_CRC32_VAL
1282 + #define ID_AA64ISAR0_CRC32_VAL ID_AA64ISAR0_CRC32
1285 + static uint32_t read_cpu_features() {
1286 + uint32_t features = 0;
1287 + uint64_t id_aa64isar0;
1289 + id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1);
1290 + if (ID_AA64ISAR0_CRC32_VAL(id_aa64isar0) == ID_AA64ISAR0_CRC32_BASE) {
1291 + features |= SkCpu::CRC32;
1296 #elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
1297 #include <sys/auxv.h>
1301 [FILE:228:patches/patch-image_imgFrame.h]
1302 --- image/imgFrame.h.orig 2020-04-29 21:55:18 UTC
1303 +++ image/imgFrame.h
1305 #define mozilla_image_imgFrame_h
1308 +#include <functional>
1310 #include "AnimationParams.h"
1311 #include "MainThreadUtils.h"
1314 [FILE:316:patches/patch-ipc_chromium_src_base_platform__thread__posix.cc]
1315 --- ipc/chromium/src/base/platform_thread_posix.cc.orig 2020-04-29 20:59:57 UTC
1316 +++ ipc/chromium/src/base/platform_thread_posix.cc
1318 #elif defined(OS_LINUX)
1319 # include <sys/syscall.h>
1320 # include <sys/prctl.h>
1321 +#elif defined(OS_DRAGONFLY)
1322 +# include <sys/lwp.h>
1325 #if !defined(OS_MACOSX)
1328 [FILE:615:patches/patch-ipc_chromium_src_base_shared__memory__posix.cc]
1329 --- ipc/chromium/src/base/shared_memory_posix.cc.orig 2020-04-29 20:59:57 UTC
1330 +++ ipc/chromium/src/base/shared_memory_posix.cc
1331 @@ -182,6 +182,11 @@ bool SharedMemory::AppendPosixShmPrefix(
1332 StringAppendF(str, "snap.%s.", kSnap);
1335 +# ifdef OS_DRAGONFLY
1336 + // DragonFly BSD has a userland IPC implementation, we need to prefix the
1337 + // path to shm_open(3), preferably with '/tmp'
1338 + StringAppendF(str, "tmp/");
1340 // Hopefully the "implementation defined" name length limit is long
1342 StringAppendF(str, "org.mozilla.ipc.%d.", static_cast<int>(pid));
1345 [FILE:318:patches/patch-js_src_old-configure.in]
1346 --- js/src/old-configure.in.orig 2021-09-04 13:25:05 UTC
1347 +++ js/src/old-configure.in
1348 @@ -858,7 +858,7 @@ then
1353 + *-*-freebsd*|*-*-dragonfly*)
1354 AC_DEFINE(_REENTRANT)
1355 AC_DEFINE(_THREAD_SAFE)
1356 dnl -pthread links in -lpthread, so don't specify it explicitly.
1359 [FILE:297:patches/patch-media_libcubeb_src_cubeb__jack.cpp]
1360 --- media/libcubeb/src/cubeb_jack.cpp.orig 2020-04-29 21:00:35 UTC
1361 +++ media/libcubeb/src/cubeb_jack.cpp
1364 #define _DEFAULT_SOURCE
1366 -#ifndef __FreeBSD__
1367 +#if !(defined __FreeBSD__ || defined __DragonFly__)
1368 #define _POSIX_SOURCE
1373 [FILE:3961:patches/patch-pipewire_init]
1374 Chase ABI from multimedia/pipewire/files/patch-src_pipewire_pipewire_init
1376 https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1819
1378 diff --git third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
1379 index 2fd3b1a575..79a14d7d7e 100644
1380 --- third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
1381 +++ third_party/libwebrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
1382 @@ -279,7 +279,7 @@ void BaseCapturerPipeWire::InitPipeWire() {
1384 #endif // defined(WEBRTC_DLOPEN_PIPEWIRE)
1386 - pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
1387 + pipewire_init(/*argc=*/nullptr, /*argc=*/nullptr);
1389 pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
1390 pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
1391 diff --git third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs
1392 index 3e21e9dc07..f561dcf619 100644
1393 --- third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs
1394 +++ third_party/libwebrtc/modules/desktop_capture/linux/pipewire.sigs
1395 @@ -16,7 +16,7 @@ void pw_loop_destroy(pw_loop *loop);
1396 pw_loop * pw_loop_new(pw_properties *properties);
1399 -void pw_init(int *argc, char **argv[]);
1400 +void pipewire_init(int *argc, char **argv[]);
1403 pw_properties * pw_properties_new_string(const char *args);
1404 diff --git third_party/pipewire/libpipewire/mozpipewire.cpp third_party/pipewire/libpipewire/mozpipewire.cpp
1405 index 1ecfc3196a..6f44b35964 100644
1406 --- third_party/pipewire/libpipewire/mozpipewire.cpp
1407 +++ third_party/pipewire/libpipewire/mozpipewire.cpp
1408 @@ -58,7 +58,7 @@ struct pw_context * (*pw_context_new_fn)(struct pw_loop *main_loop,
1409 struct pw_properties *props,
1410 size_t user_data_size);
1411 static int (*pw_core_disconnect_fn)(struct pw_core *core);
1412 -static void (*pw_init_fn)(int *argc, char **argv[]);
1413 +static void (*pipewire_init_fn)(int *argc, char **argv[]);
1414 static void (*pw_stream_add_listener_fn)(struct pw_stream *stream,
1415 struct spa_hook *listener,
1416 const struct pw_stream_events *events,
1417 @@ -96,7 +96,7 @@ bool IsPwLibraryLoaded() {
1418 IS_FUNC_LOADED(pw_context_destroy_fn) &&
1419 IS_FUNC_LOADED(pw_context_new_fn) &&
1420 IS_FUNC_LOADED(pw_core_disconnect_fn) &&
1421 - IS_FUNC_LOADED(pw_init_fn) &&
1422 + IS_FUNC_LOADED(pipewire_init_fn) &&
1423 IS_FUNC_LOADED(pw_stream_add_listener_fn) &&
1424 IS_FUNC_LOADED(pw_stream_connect_fn) &&
1425 IS_FUNC_LOADED(pw_stream_dequeue_buffer_fn) &&
1426 @@ -133,7 +133,7 @@ bool LoadPWLibrary() {
1427 GET_FUNC(pw_context_destroy, pwLib);
1428 GET_FUNC(pw_context_new, pwLib);
1429 GET_FUNC(pw_core_disconnect, pwLib);
1430 - GET_FUNC(pw_init, pwLib);
1431 + GET_FUNC(pipewire_init, pwLib);
1432 GET_FUNC(pw_stream_add_listener, pwLib);
1433 GET_FUNC(pw_stream_connect, pwLib);
1434 GET_FUNC(pw_stream_dequeue_buffer, pwLib);
1435 @@ -207,12 +207,12 @@ pw_core_disconnect(struct pw_core *core)
1439 -pw_init(int *argc, char **argv[])
1440 +pipewire_init(int *argc, char **argv[])
1442 if (!LoadPWLibrary()) {
1445 - return pw_init_fn(argc, argv);
1446 + return pipewire_init_fn(argc, argv);
1450 diff --git third_party/pipewire/pipewire/pipewire.h third_party/pipewire/pipewire/pipewire.h
1451 index 69c523bd62..378502004c 100644
1452 --- third_party/pipewire/pipewire/pipewire.h
1453 +++ third_party/pipewire/pipewire/pipewire.h
1454 @@ -114,9 +114,9 @@ extern "C" {
1455 * \brief PipeWire initialization and infrastructure functions
1458 -pw_init(int *argc, char **argv[]);
1459 +pipewire_init(int *argc, char **argv[]);
1461 -void pw_deinit(void);
1462 +void pipewire_deinit(void);
1465 pw_debug_is_category_enabled(const char *name);
1468 [FILE:278:patches/patch-third__party_dav1d_src_mem.h]
1469 --- third_party/dav1d/src/mem.h.orig 2021-03-18 13:51:06 UTC
1470 +++ third_party/dav1d/src/mem.h
1474 #if defined(HAVE_ALIGNED_MALLOC) || defined(HAVE_MEMALIGN)
1475 -#include <malloc.h>
1476 +#include <stdlib.h>
1479 #include "common/attributes.h"
1482 [FILE:361:patches/patch-third__party_libwebrtc_build_build__config.h]
1483 --- third_party/libwebrtc/build/build_config.h.orig 2022-01-26 20:57:35 UTC
1484 +++ third_party/libwebrtc/build/build_config.h
1487 #elif defined(__Fuchsia__)
1488 #define OS_FUCHSIA 1
1489 -#elif defined(__FreeBSD__)
1490 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1491 #define OS_FREEBSD 1
1492 #elif defined(__NetBSD__)
1496 [FILE:521:patches/patch-third__party_sqlite3_src_moz.build]
1497 --- third_party/sqlite3/src/moz.build.old 2021-08-09 16:08:59.381182000 -0500
1498 +++ third_party/sqlite3/src/moz.build 2021-08-09 16:10:25.370954000 -0500
1501 # Enabling sqlite math functions
1502 DEFINES['SQLITE_ENABLE_MATH_FUNCTIONS'] = True
1503 -if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android":
1504 +if CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "Android" or \
1505 + CONFIG["OS_TARGET"] == "FreeBSD" or CONFIG["OS_TARGET"] == "DragonFly":
1511 [FILE:498:patches/patch-toolkit_components_protobuf_src_google_protobuf_stubs_port.h]
1512 --- toolkit/components/protobuf/src/google/protobuf/stubs/port.h.orig 2022-09-22 18:17:47 UTC
1513 +++ toolkit/components/protobuf/src/google/protobuf/stubs/port.h
1517 #include <machine/endian.h> // __BYTE_ORDER
1518 -#elif defined(__FreeBSD__)
1519 +#elif defined(__FreeBSD__) || defined(__DragonFly__)
1520 #include <sys/endian.h> // __BYTE_ORDER
1521 #elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
1522 #include <sys/isa_defs.h> // __BYTE_ORDER
1525 [FILE:231:files/pkg-message-single]
1526 ==========================================================================
1528 If Firefox segfaults, try setting MOZ_FORCE_DISABLE_E10S=1 in
1531 ==========================================================================