summaryrefslogtreecommitdiff
path: root/www/firefox78/patches
diff options
context:
space:
mode:
Diffstat (limited to 'www/firefox78/patches')
-rw-r--r--www/firefox78/patches/patch-aa36
-rw-r--r--www/firefox78/patches/patch-browser_app_profile_firefox.js17
-rw-r--r--www/firefox78/patches/patch-build_moz.configure_rust.configure17
-rw-r--r--www/firefox78/patches/patch-config_gcc-stl-wrapper.template.h31
-rw-r--r--www/firefox78/patches/patch-config_makefiles_rust.mk17
-rw-r--r--www/firefox78/patches/patch-configure.in12
-rw-r--r--www/firefox78/patches/patch-dom_base_nsAttrName.h18
-rw-r--r--www/firefox78/patches/patch-dom_media_CubebUtils.cpp13
-rw-r--r--www/firefox78/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp17
-rw-r--r--www/firefox78/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h16
-rw-r--r--www/firefox78/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c19
-rw-r--r--www/firefox78/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp15
-rw-r--r--www/firefox78/patches/patch-gfx_thebes_gfxPlatform.cpp28
-rw-r--r--www/firefox78/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc22
-rw-r--r--www/firefox78/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc18
-rw-r--r--www/firefox78/patches/patch-ipc_glue_GeckoChildProcessHost.cpp21
-rw-r--r--www/firefox78/patches/patch-js_src_jsfriendapi.h14
-rw-r--r--www/firefox78/patches/patch-js_src_util_NativeStack.cpp32
-rw-r--r--www/firefox78/patches/patch-media_ffvpx_libavutil_arm_bswap.h22
-rw-r--r--www/firefox78/patches/patch-media_libcubeb_src_cubeb__alsa.c12
-rw-r--r--www/firefox78/patches/patch-media_libcubeb_src_moz.build19
-rw-r--r--www/firefox78/patches/patch-media_libpng_pngpriv.h17
-rw-r--r--www/firefox78/patches/patch-media_libtheora_lib_info.c19
-rw-r--r--www/firefox78/patches/patch-media_libvorbis_lib_vorbis__info.c19
-rw-r--r--www/firefox78/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc22
-rw-r--r--www/firefox78/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c110
-rw-r--r--www/firefox78/patches/patch-security_nss_lib_freebl_mpi_mpi.c35
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_.cargo-checksum.json15
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_lib.rs38
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_device.rs145
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_fd.rs58
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_mod.rs21
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_monitor.rs100
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_transaction.rs61
-rw-r--r--www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_uhid.rs90
-rw-r--r--www/firefox78/patches/patch-third__party_rust_getrandom_src_lib.rs24
-rw-r--r--www/firefox78/patches/patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs78
-rw-r--r--www/firefox78/patches/patch-toolkit_components_terminator_nsTerminator.cpp27
-rw-r--r--www/firefox78/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js26
-rw-r--r--www/firefox78/patches/patch-toolkit_moz.configure23
-rw-r--r--www/firefox78/patches/patch-toolkit_mozapps_installer_packager.mk15
-rw-r--r--www/firefox78/patches/patch-widget_gtk_WaylandDMABufSurface.cpp32
-rw-r--r--www/firefox78/patches/patch-xpcom_base_nscore.h15
-rw-r--r--www/firefox78/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build15
44 files changed, 1421 insertions, 0 deletions
diff --git a/www/firefox78/patches/patch-aa b/www/firefox78/patches/patch-aa
new file mode 100644
index 00000000000..d190d064eda
--- /dev/null
+++ b/www/firefox78/patches/patch-aa
@@ -0,0 +1,36 @@
+$NetBSD: patch-aa,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Add Sun audio support
+* Include include/nss/nss for workaround for neqo-crypto 0.1.6 of firefox-72.0
+
+--- old-configure.in.orig Tue Jan 7 17:23:36 2020
++++ old-configure.in Fri Jan 17 16:03:40 2020
+@@ -1960,6 +1960,19 @@
+ AC_DEFINE(MOZ_WEBM_ENCODER)
+ AC_SUBST(MOZ_WEBM_ENCODER)
+
++dnl ==================================
++dnl = Check sunaudio availability
++dnl ==================================
++
++dnl If using Solaris or NetBSD, ensure that sunaudio is available
++case "$OS_TARGET" in
++SunOS|NetBSD)
++ MOZ_SUNAUDIO=1
++ ;;
++esac
++
++AC_SUBST(MOZ_SUNAUDIO)
++
+ dnl ========================================================
+ dnl NegotiateAuth
+ dnl ========================================================
+@@ -2744,7 +2757,7 @@
+ AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
+ AC_SUBST(MOZ_TREE_PIXMAN)
+
+-BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
++BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS -I${PREFIX}/include/nss/nss"
+ AC_SUBST(BINDGEN_SYSTEM_FLAGS)
+ BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
+ AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
diff --git a/www/firefox78/patches/patch-browser_app_profile_firefox.js b/www/firefox78/patches/patch-browser_app_profile_firefox.js
new file mode 100644
index 00000000000..d0e63fcb5d0
--- /dev/null
+++ b/www/firefox78/patches/patch-browser_app_profile_firefox.js
@@ -0,0 +1,17 @@
+$NetBSD: patch-browser_app_profile_firefox.js,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+--- browser/app/profile/firefox.js.orig 2019-07-06 01:48:29.000000000 +0000
++++ browser/app/profile/firefox.js
+@@ -1851,6 +1851,12 @@ pref("fission.frontend.simulate-messages
+ pref("toolkit.coverage.enabled", false);
+ pref("toolkit.coverage.endpoint.base", "https://coverage.mozilla.org");
+
++// Select UI locale from LANG/LC_MESSAGE environmental variables
++pref("intl.locale.requested", "");
++
++// Enable system addons, for example langpacks from www/firefox-l10n
++pref("extensions.autoDisableScopes", 11);
++
+ // Discovery prefs
+ pref("browser.discovery.enabled", true);
+ pref("browser.discovery.containers.enabled", true);
diff --git a/www/firefox78/patches/patch-build_moz.configure_rust.configure b/www/firefox78/patches/patch-build_moz.configure_rust.configure
new file mode 100644
index 00000000000..cb60e6203c0
--- /dev/null
+++ b/www/firefox78/patches/patch-build_moz.configure_rust.configure
@@ -0,0 +1,17 @@
+$NetBSD: patch-build_moz.configure_rust.configure,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Do not match rumprun toolchain for NetBSD,
+ narrowed should be one not two.
+
+--- build/moz.configure/rust.configure.orig 2019-10-10 18:07:24.000000000 +0000
++++ build/moz.configure/rust.configure
+@@ -321,7 +321,8 @@ def rust_triple_alias(host_or_target, ho
+ narrowed = [
+ c for c in candidates
+ if c.target.raw_os == host_or_target.raw_os and
+- c.target.raw_cpu == host_or_target.raw_cpu
++ c.target.raw_cpu == host_or_target.raw_cpu and
++ not c.rust_target.endswith("-rumprun-netbsd")
+ ]
+ if len(narrowed) == 1:
+ return narrowed[0].rust_target
diff --git a/www/firefox78/patches/patch-config_gcc-stl-wrapper.template.h b/www/firefox78/patches/patch-config_gcc-stl-wrapper.template.h
new file mode 100644
index 00000000000..97d92d9416b
--- /dev/null
+++ b/www/firefox78/patches/patch-config_gcc-stl-wrapper.template.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-config_gcc-stl-wrapper.template.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+--- config/gcc-stl-wrapper.template.h.orig 2020-04-03 19:34:34.000000000 +0000
++++ config/gcc-stl-wrapper.template.h
+@@ -28,8 +28,8 @@
+ #endif
+
+ // Don't include mozalloc for cstdlib. See bug 1245076.
+-#ifndef moz_dont_include_mozalloc_for_cstdlib
+-# define moz_dont_include_mozalloc_for_cstdlib
++#ifndef moz_dont_include_mozalloc_for_${HEADER}
++# define moz_dont_include_mozalloc_for_${HEADER}
+ #endif
+
+ #ifndef moz_dont_include_mozalloc_for_type_traits
+@@ -43,7 +43,7 @@
+ // Include mozalloc after the STL header and all other headers it includes
+ // have been preprocessed.
+ #if !defined(MOZ_INCLUDE_MOZALLOC_H) && \
+- !defined(moz_dont_include_mozalloc_for_${HEADER})
++ !defined(moz_dont_include_mozalloc_for_cstdlib)
+ # define MOZ_INCLUDE_MOZALLOC_H
+ # define MOZ_INCLUDE_MOZALLOC_H_FROM_${HEADER}
+ #endif
+@@ -72,4 +72,6 @@
+ # include "mozilla/throw_gcc.h"
+ #endif
+
++#undef moz_dont_include_mzalloc_for_${HEADER}
++
+ #endif // if mozilla_${HEADER}_h
diff --git a/www/firefox78/patches/patch-config_makefiles_rust.mk b/www/firefox78/patches/patch-config_makefiles_rust.mk
new file mode 100644
index 00000000000..7517ff60ac4
--- /dev/null
+++ b/www/firefox78/patches/patch-config_makefiles_rust.mk
@@ -0,0 +1,17 @@
+$NetBSD: patch-config_makefiles_rust.mk,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+NetBSD doesn't get along with parallel rust builds (it causes issues
+with ld.so) which are the default. Force -j1.
+
+--- config/makefiles/rust.mk.orig 2020-04-03 19:34:34.000000000 +0000
++++ config/makefiles/rust.mk
+@@ -52,6 +52,9 @@ endif
+ ifeq (1,$(MOZ_PARALLEL_BUILD))
+ cargo_build_flags += -j1
+ endif
++ifeq ($(OS_ARCH),NetBSD)
++cargo_build_flags += -j1
++endif
+
+ # These flags are passed via `cargo rustc` and only apply to the final rustc
+ # invocation (i.e., only the top-level crate, not its dependencies).
diff --git a/www/firefox78/patches/patch-configure.in b/www/firefox78/patches/patch-configure.in
new file mode 100644
index 00000000000..de060521c1c
--- /dev/null
+++ b/www/firefox78/patches/patch-configure.in
@@ -0,0 +1,12 @@
+$NetBSD: patch-configure.in,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Accept Python 3.x from pkgsrc.
+
+--- configure.in.orig 2020-05-21 22:37:47.000000000 +0000
++++ configure.in
+@@ -22,4 +22,4 @@ SRCDIR=$(dirname $0)
+ TOPSRCDIR="$SRCDIR"
+ export OLD_CONFIGURE="$SRCDIR"/old-configure
+
+-exec python3 "$TOPSRCDIR/configure.py" "$@"
++exec ${PYTHON3} "$TOPSRCDIR/configure.py" "$@"
diff --git a/www/firefox78/patches/patch-dom_base_nsAttrName.h b/www/firefox78/patches/patch-dom_base_nsAttrName.h
new file mode 100644
index 00000000000..c93c7778c2a
--- /dev/null
+++ b/www/firefox78/patches/patch-dom_base_nsAttrName.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-dom_base_nsAttrName.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+cbindgen gets confused by NetBSD's types being macros too
+https://mail-index.netbsd.org/tech-pkg/2018/10/25/msg020395.html
+
+--- dom/base/nsAttrName.h.orig 2019-01-18 00:20:23.000000000 +0000
++++ dom/base/nsAttrName.h
+@@ -16,6 +16,10 @@
+ #include "mozilla/dom/NodeInfo.h"
+ #include "nsAtom.h"
+ #include "nsDOMString.h"
++#ifdef __NetBSD__
++/* This is also a macro which causes problems with cbindgen */
++#undef uintptr_t
++#endif
+
+ #define NS_ATTRNAME_NODEINFO_BIT 1
+ class nsAttrName {
diff --git a/www/firefox78/patches/patch-dom_media_CubebUtils.cpp b/www/firefox78/patches/patch-dom_media_CubebUtils.cpp
new file mode 100644
index 00000000000..ec192124cea
--- /dev/null
+++ b/www/firefox78/patches/patch-dom_media_CubebUtils.cpp
@@ -0,0 +1,13 @@
+$NetBSD: patch-dom_media_CubebUtils.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+--- dom/media/CubebUtils.cpp.orig Wed Jan 8 01:23:31 2020
++++ dom/media/CubebUtils.cpp
+@@ -140,7 +140,7 @@ const char kBrandBundleURL[] = "chrome://branding/loca
+
+ const char* AUDIOSTREAM_BACKEND_ID_STR[] = {
+ "jack", "pulse", "alsa", "audiounit", "audioqueue", "wasapi",
+- "winmm", "directsound", "sndio", "opensl", "audiotrack", "kai"};
++ "winmm", "directsound", "sndio", "opensl", "audiotrack", "kai", "sun"};
+ /* Index for failures to create an audio stream the first time. */
+ const int CUBEB_BACKEND_INIT_FAILURE_FIRST =
+ ArrayLength(AUDIOSTREAM_BACKEND_ID_STR);
diff --git a/www/firefox78/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp b/www/firefox78/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp
new file mode 100644
index 00000000000..1ece669624e
--- /dev/null
+++ b/www/firefox78/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix build where _LITTLE_ENDIAN is not an integer.
+
+--- gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp.orig 2019-07-06 01:48:31.000000000 +0000
++++ gfx/angle/checkout/src/common/third_party/smhasher/src/PMurHash.cpp
+@@ -91,8 +91,8 @@ on big endian machines, or a byte-by-byt
+ /* gcc 'may' define __LITTLE_ENDIAN__ or __BIG_ENDIAN__ to 1 (Note the trailing __),
+ * or even _LITTLE_ENDIAN or _BIG_ENDIAN (Note the single _ prefix) */
+ #if !defined(__BYTE_ORDER)
+-# if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__ == 1 || \
+- defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN == 1
++# if defined(__LITTLE_ENDIAN__) && __LITTLE_ENDIAN__-0 == 1 || \
++ defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN-0 == 1
+ # define __BYTE_ORDER __LITTLE_ENDIAN
+ # elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__ == 1 || defined(_BIG_ENDIAN) && _BIG_ENDIAN == 1
+ # define __BYTE_ORDER __BIG_ENDIAN
diff --git a/www/firefox78/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h b/www/firefox78/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h
new file mode 100644
index 00000000000..7a3546388ba
--- /dev/null
+++ b/www/firefox78/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h
@@ -0,0 +1,16 @@
+$NetBSD: patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* isinf/isnan in make.h is defined as macro. Use non-macro version
+ to fix build.
+
+--- gfx/angle/checkout/src/compiler/translator/InfoSink.h.orig 2018-10-18 20:06:05.000000000 +0000
++++ gfx/angle/checkout/src/compiler/translator/InfoSink.h
+@@ -7,7 +7,7 @@
+ #ifndef COMPILER_TRANSLATOR_INFOSINK_H_
+ #define COMPILER_TRANSLATOR_INFOSINK_H_
+
+-#include <math.h>
++#include <cmath>
+ #include <stdlib.h>
+ #include "compiler/translator/Common.h"
+ #include "compiler/translator/Severity.h"
diff --git a/www/firefox78/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c b/www/firefox78/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c
new file mode 100644
index 00000000000..1ee62288105
--- /dev/null
+++ b/www/firefox78/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-gfx_cairo_cairo_src_cairo-type1-subset.c,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix undefined behavior when calling <ctype.h> functions with illegal values.
+
+gfx/cairo/cairo/src/cairo-type1-subset.c:273:11: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1642081
+
+--- gfx/cairo/cairo/src/cairo-type1-subset.c.orig 2020-05-07 18:34:10.000000000 +0000
++++ gfx/cairo/cairo/src/cairo-type1-subset.c
+@@ -270,7 +270,7 @@ cairo_type1_font_subset_find_segments (c
+ font->eexec_segment = (char *) p + font->header_segment_size;
+ font->eexec_segment_is_ascii = TRUE;
+ for (i = 0; i < 4; i++) {
+- if (!isxdigit(font->eexec_segment[i]))
++ if (!isxdigit((unsigned char) font->eexec_segment[i]))
+ font->eexec_segment_is_ascii = FALSE;
+ }
+ }
diff --git a/www/firefox78/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp b/www/firefox78/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp
new file mode 100644
index 00000000000..a30cda2625d
--- /dev/null
+++ b/www/firefox78/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-gfx_skia_skia_src_core_SkCpu.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+NetBSD/aarch64 doesn't have <sys/auxv.h>.
+
+--- gfx/skia/skia/src/core/SkCpu.cpp.orig 2019-03-05 00:32:47.658232017 +0900
++++ gfx/skia/skia/src/core/SkCpu.cpp 2019-03-05 00:33:10.203589997 +0900
+@@ -70,7 +70,7 @@
+ return features;
+ }
+
+-#elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>)
++#elif defined(SK_CPU_ARM64) && __has_include(<sys/auxv.h>) && !defined(__NetBSD__)
+ #include <sys/auxv.h>
+
+ static uint32_t read_cpu_features() {
diff --git a/www/firefox78/patches/patch-gfx_thebes_gfxPlatform.cpp b/www/firefox78/patches/patch-gfx_thebes_gfxPlatform.cpp
new file mode 100644
index 00000000000..244ed67d76c
--- /dev/null
+++ b/www/firefox78/patches/patch-gfx_thebes_gfxPlatform.cpp
@@ -0,0 +1,28 @@
+$NetBSD: patch-gfx_thebes_gfxPlatform.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Don't rely on CrossProcessSemaphore on NetBSD. It has some implementation
+issues that cause issues (kern/55386, not available on NetBSD<9)
+
+This idea is borrowed from macOS which has the same limitation.
+
+--- gfx/thebes/gfxPlatform.cpp.orig 2020-06-03 01:04:50.000000000 +0000
++++ gfx/thebes/gfxPlatform.cpp
+@@ -2922,6 +2922,10 @@ bool gfxPlatform::UsesOffMainThreadCompo
+ }
+
+ bool gfxPlatform::UsesTiling() const {
++#ifdef __NetBSD__
++ // Avoid relying on CrossProcessSemaphore
++ return true;
++#else
+ bool usesSkia = GetDefaultContentBackend() == BackendType::SKIA;
+
+ // We can't just test whether the PaintThread is initialized here because
+@@ -2934,6 +2938,7 @@ bool gfxPlatform::UsesTiling() const {
+ return StaticPrefs::layers_enable_tiles_AtStartup() ||
+ (StaticPrefs::layers_enable_tiles_if_skia_pomtp_AtStartup() &&
+ usesSkia && usesPOMTP);
++#endif
+ }
+
+ bool gfxPlatform::ContentUsesTiling() const {
diff --git a/www/firefox78/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc b/www/firefox78/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
new file mode 100644
index 00000000000..b0a61d0b87d
--- /dev/null
+++ b/www/firefox78/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
@@ -0,0 +1,22 @@
+$NetBSD: patch-ipc_chromium_src_base_message__pump__libevent.cc,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Allow older libevent
+
+--- ipc/chromium/src/base/message_pump_libevent.cc.orig 2019-03-07 16:53:35.000000000 +0000
++++ ipc/chromium/src/base/message_pump_libevent.cc
+@@ -22,6 +22,7 @@
+
+ // This macro checks that the _EVENT_SIZEOF_* constants defined in
+ // ipc/chromiume/src/third_party/<platform>/event2/event-config.h are correct.
++#if 0
+ #if defined(_EVENT_SIZEOF_SHORT)
+ # define CHECK_EVENT_SIZEOF(TYPE, type) \
+ static_assert(_EVENT_SIZEOF_##TYPE == sizeof(type), \
+@@ -41,6 +42,7 @@ CHECK_EVENT_SIZEOF(PTHREAD_T, pthread_t)
+ CHECK_EVENT_SIZEOF(SHORT, short);
+ CHECK_EVENT_SIZEOF(SIZE_T, size_t);
+ CHECK_EVENT_SIZEOF(VOID_P, void*);
++#endif
+
+ // Lifecycle of struct event
+ // Libevent uses two main data structures:
diff --git a/www/firefox78/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc b/www/firefox78/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
new file mode 100644
index 00000000000..5a57b7d8dca
--- /dev/null
+++ b/www/firefox78/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
@@ -0,0 +1,18 @@
+$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Support NetBSD
+* Support Solaris (we can't rely on pthread_setname_np so ignore it).
+
+--- ipc/chromium/src/base/platform_thread_posix.cc.orig 2019-03-07 16:53:35.000000000 +0000
++++ ipc/chromium/src/base/platform_thread_posix.cc
+@@ -12,7 +12,9 @@
+ #if defined(OS_MACOSX)
+ # include <mach/mach.h>
+ #elif defined(OS_NETBSD)
+-# include <lwp.h>
++_Pragma("GCC visibility push(default)")
++#include <lwp.h>
++_Pragma("GCC visibility pop")
+ #elif defined(OS_LINUX)
+ # include <sys/syscall.h>
+ # include <sys/prctl.h>
diff --git a/www/firefox78/patches/patch-ipc_glue_GeckoChildProcessHost.cpp b/www/firefox78/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
new file mode 100644
index 00000000000..7f3ab6a63f6
--- /dev/null
+++ b/www/firefox78/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
@@ -0,0 +1,21 @@
+$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Support Solaris
+* Fix NetBSD linking
+
+--- ipc/glue/GeckoChildProcessHost.cpp.orig 2017-07-31 16:20:47.000000000 +0000
++++ ipc/glue/GeckoChildProcessHost.cpp
+@@ -4,7 +4,13 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#if defined(__NetBSD__)
++_Pragma("GCC visibility push(default)")
++#endif
+ #include "GeckoChildProcessHost.h"
++#if defined(__NetBSD__)
++_Pragma("GCC visibility pop")
++#endif
+
+ #include "base/command_line.h"
+ #include "base/string_util.h"
diff --git a/www/firefox78/patches/patch-js_src_jsfriendapi.h b/www/firefox78/patches/patch-js_src_jsfriendapi.h
new file mode 100644
index 00000000000..9ad8253511f
--- /dev/null
+++ b/www/firefox78/patches/patch-js_src_jsfriendapi.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-js_src_jsfriendapi.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Fix va_list error.
+
+--- js/src/jsfriendapi.h.orig 2020-05-22 02:11:19.000000000 +0000
++++ js/src/jsfriendapi.h
+@@ -14,6 +14,7 @@
+ #include "mozilla/PodOperations.h"
+ #include "mozilla/UniquePtr.h"
+
++#include <stdarg.h>
+ #include "jspubtd.h"
+
+ #include "js/CallArgs.h"
diff --git a/www/firefox78/patches/patch-js_src_util_NativeStack.cpp b/www/firefox78/patches/patch-js_src_util_NativeStack.cpp
new file mode 100644
index 00000000000..cb5fd63e8bc
--- /dev/null
+++ b/www/firefox78/patches/patch-js_src_util_NativeStack.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-js_src_util_NativeStack.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Support SunOS.
+
+--- js/src/util/NativeStack.cpp.orig 2020-04-03 19:34:51.000000000 +0000
++++ js/src/util/NativeStack.cpp
+@@ -13,7 +13,7 @@
+ # if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+ # include <pthread_np.h>
+ # endif
+-# if defined(SOLARIS) || defined(AIX)
++# if defined(__sun) || defined(AIX)
+ # include <ucontext.h>
+ # endif
+ # if defined(ANDROID) && !defined(__aarch64__)
+@@ -40,7 +40,7 @@ void* js::GetNativeStackBaseImpl() {
+ return static_cast<void*>(pTib->StackBase);
+ }
+
+-#elif defined(SOLARIS)
++#elif defined(__sun)
+
+ static_assert(JS_STACK_GROWTH_DIRECTION < 0);
+
+@@ -128,6 +128,7 @@ void* js::GetNativeStackBaseImpl() {
+ # elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD)
+ /* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */
+ pthread_attr_get_np(thread, &sattr);
++# elif defined(__sun)
+ # else
+ /*
+ * FIXME: this function is non-portable;
diff --git a/www/firefox78/patches/patch-media_ffvpx_libavutil_arm_bswap.h b/www/firefox78/patches/patch-media_ffvpx_libavutil_arm_bswap.h
new file mode 100644
index 00000000000..0dcb4339d79
--- /dev/null
+++ b/www/firefox78/patches/patch-media_ffvpx_libavutil_arm_bswap.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-media_ffvpx_libavutil_arm_bswap.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix NetBSD aarch64 build.
+
+--- media/ffvpx/libavutil/arm/bswap.h.orig 2019-10-30 17:35:56.000000000 +0000
++++ media/ffvpx/libavutil/arm/bswap.h
+@@ -23,6 +23,8 @@
+ #include "config.h"
+ #include "libavutil/attributes.h"
+
++#ifndef __aarch64__
++
+ #ifdef __ARMCC_VERSION
+
+ #if HAVE_ARMV6
+@@ -64,4 +66,6 @@ static av_always_inline av_const uint32_
+
+ #endif /* __ARMCC_VERSION */
+
++#endif /* __aarch64__ */
++
+ #endif /* AVUTIL_ARM_BSWAP_H */
diff --git a/www/firefox78/patches/patch-media_libcubeb_src_cubeb__alsa.c b/www/firefox78/patches/patch-media_libcubeb_src_cubeb__alsa.c
new file mode 100644
index 00000000000..23dba20f3eb
--- /dev/null
+++ b/www/firefox78/patches/patch-media_libcubeb_src_cubeb__alsa.c
@@ -0,0 +1,12 @@
+$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+--- media/libcubeb/src/cubeb_alsa.c.orig 2019-12-02 12:23:28.000000000 +0000
++++ media/libcubeb/src/cubeb_alsa.c
+@@ -7,6 +7,7 @@
+ #undef NDEBUG
+ #define _DEFAULT_SOURCE
+ #define _BSD_SOURCE
++#define _NETBSD_SOURCE
+ #define _XOPEN_SOURCE 500
+ #include <pthread.h>
+ #include <sys/time.h>
diff --git a/www/firefox78/patches/patch-media_libcubeb_src_moz.build b/www/firefox78/patches/patch-media_libcubeb_src_moz.build
new file mode 100644
index 00000000000..f49cb786551
--- /dev/null
+++ b/www/firefox78/patches/patch-media_libcubeb_src_moz.build
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libcubeb_src_moz.build,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Add Sun audio support
+
+--- media/libcubeb/src/moz.build.orig 2020-04-03 19:35:03.000000000 +0000
++++ media/libcubeb/src/moz.build
+@@ -23,6 +23,12 @@ if CONFIG['MOZ_ALSA']:
+ ]
+ DEFINES['USE_ALSA'] = True
+
++if CONFIG['MOZ_SUNAUDIO']:
++ SOURCES += [
++ 'cubeb_sun.c',
++ ]
++ DEFINES['USE_SUN'] = True
++
+ if CONFIG['MOZ_PULSEAUDIO'] or CONFIG['MOZ_JACK']:
+ SOURCES += [
+ 'cubeb_resampler.cpp',
diff --git a/www/firefox78/patches/patch-media_libpng_pngpriv.h b/www/firefox78/patches/patch-media_libpng_pngpriv.h
new file mode 100644
index 00000000000..928ca368547
--- /dev/null
+++ b/www/firefox78/patches/patch-media_libpng_pngpriv.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-media_libpng_pngpriv.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix _POSIX_SOURCE on SunOS.
+
+--- media/libpng/pngpriv.h.orig 2018-06-05 19:47:32.000000000 +0000
++++ media/libpng/pngpriv.h
+@@ -36,8 +36,10 @@
+ * still required (as of 2011-05-02.)
+ */
+ #ifndef _POSIX_SOURCE
++#if !defined(__sun) || (__STDC_VERSION__-0 < 199901L)
+ # define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+ #endif
++#endif
+
+ #ifndef PNG_VERSION_INFO_ONLY
+ /* Standard library headers not required by png.h: */
diff --git a/www/firefox78/patches/patch-media_libtheora_lib_info.c b/www/firefox78/patches/patch-media_libtheora_lib_info.c
new file mode 100644
index 00000000000..f1c09c37bee
--- /dev/null
+++ b/www/firefox78/patches/patch-media_libtheora_lib_info.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libtheora_lib_info.c,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix undefined behavior when calling <ctype.h> functions with illegal values.
+
+media/libtheora/lib/info.c:32:8: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1642081
+
+--- media/libtheora/lib/info.c.orig 2020-05-07 18:34:12.000000000 +0000
++++ media/libtheora/lib/info.c
+@@ -29,7 +29,7 @@
+ static int oc_tagcompare(const char *_s1,const char *_s2,int _n){
+ int c;
+ for(c=0;c<_n;c++){
+- if(toupper(_s1[c])!=toupper(_s2[c]))return !0;
++ if(toupper((unsigned char)_s1[c])!=toupper((unsigned char)_s2[c]))return !0;
+ }
+ return _s1[c]!='=';
+ }
diff --git a/www/firefox78/patches/patch-media_libvorbis_lib_vorbis__info.c b/www/firefox78/patches/patch-media_libvorbis_lib_vorbis__info.c
new file mode 100644
index 00000000000..f305f6f57ea
--- /dev/null
+++ b/www/firefox78/patches/patch-media_libvorbis_lib_vorbis__info.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libvorbis_lib_vorbis__info.c,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix undefined behavior when calling <ctype.h> functions with illegal values.
+
+media/libvorbis/lib/vorbis_info.c:81:8: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1642081
+
+--- media/libvorbis/lib/vorbis_info.c.orig 2020-05-07 18:34:46.000000000 +0000
++++ media/libvorbis/lib/vorbis_info.c
+@@ -78,7 +78,7 @@ void vorbis_comment_add_tag(vorbis_comme
+ static int tagcompare(const char *s1, const char *s2, int n){
+ int c=0;
+ while(c < n){
+- if(toupper(s1[c]) != toupper(s2[c]))
++ if(toupper((unsigned char) s1[c]) != toupper((unsigned char) s2[c]))
+ return !0;
+ c++;
+ }
diff --git a/www/firefox78/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc b/www/firefox78/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc
new file mode 100644
index 00000000000..587cd400d76
--- /dev/null
+++ b/www/firefox78/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc
@@ -0,0 +1,22 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+NetBSD videoio lacks V4L2_CAP_DEVICE_CAPS
+
+--- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc.orig 2020-07-22 15:56:23.000000000 +0000
++++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
+@@ -385,11 +385,15 @@ bool DeviceInfoLinux::IsDeviceNameMatche
+
+ bool DeviceInfoLinux::IsVideoCaptureDevice(struct v4l2_capability* cap)
+ {
++#ifdef V4L2_CAP_DEVICE_CAPS
+ if (cap->capabilities & V4L2_CAP_DEVICE_CAPS) {
+ return cap->device_caps & V4L2_CAP_VIDEO_CAPTURE;
+ } else {
+ return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
+ }
++#else
++ return 1;
++#endif
+ }
+
+ int32_t DeviceInfoLinux::FillCapabilities(int fd) {
diff --git a/www/firefox78/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c b/www/firefox78/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
new file mode 100644
index 00000000000..f4afdb09197
--- /dev/null
+++ b/www/firefox78/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
@@ -0,0 +1,110 @@
+$NetBSD: patch-nsprpub_pr_src_pthreads_ptsynch.c,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+firefox: Workaround broken pthread_equal() usage
+
+Switch to an internal version of pthread_equal() without sanity checks.
+
+Problems detected on NetBSD 9.99.46.
+
+--- nsprpub/pr/src/pthreads/ptsynch.c.orig 2020-01-17 21:34:42.000000000 +0000
++++ nsprpub/pr/src/pthreads/ptsynch.c
+@@ -25,6 +25,13 @@ static pthread_condattr_t _pt_cvar_attr;
+ extern PTDebug pt_debug; /* this is shared between several modules */
+ #endif /* defined(DEBUG) */
+
++/* XXX, pthread_equal() is misused to compare non-valid thread pointers */
++static int
++pt_pthread_equal(pthread_t t1, pthread_t t2)
++{
++ return t1 == t2;
++}
++
+ #if defined(FREEBSD)
+ /*
+ * On older versions of FreeBSD, pthread_mutex_trylock returns EDEADLK.
+@@ -197,9 +204,9 @@ PR_IMPLEMENT(PRStatus) PR_Unlock(PRLock
+ PR_ASSERT(lock != NULL);
+ PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(lock->mutex));
+ PR_ASSERT(PR_TRUE == lock->locked);
+- PR_ASSERT(pthread_equal(lock->owner, self));
++ PR_ASSERT(pt_pthread_equal(lock->owner, self));
+
+- if (!lock->locked || !pthread_equal(lock->owner, self)) {
++ if (!lock->locked || !pt_pthread_equal(lock->owner, self)) {
+ return PR_FAILURE;
+ }
+
+@@ -225,7 +232,7 @@ PR_IMPLEMENT(void) PR_AssertCurrentThrea
+ * to the correctness of PR_AssertCurrentThreadOwnsLock(), but
+ * this particular order makes the assertion more likely to
+ * catch errors. */
+- PR_ASSERT(lock->locked && pthread_equal(lock->owner, pthread_self()));
++ PR_ASSERT(lock->locked && pt_pthread_equal(lock->owner, pthread_self()));
+ }
+
+ /**************************************************************/
+@@ -281,7 +288,7 @@ static void pt_PostNotifyToCvar(PRCondVa
+ _PT_Notified *notified = &cvar->lock->notified;
+
+ PR_ASSERT(PR_TRUE == cvar->lock->locked);
+- PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));
++ PR_ASSERT(pt_pthread_equal(cvar->lock->owner, pthread_self()));
+ PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex));
+
+ while (1)
+@@ -369,7 +376,7 @@ PR_IMPLEMENT(PRStatus) PR_WaitCondVar(PR
+ PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(cvar->lock->mutex));
+ PR_ASSERT(PR_TRUE == cvar->lock->locked);
+ /* and it better be by us */
+- PR_ASSERT(pthread_equal(cvar->lock->owner, pthread_self()));
++ PR_ASSERT(pt_pthread_equal(cvar->lock->owner, pthread_self()));
+
+ if (_PT_THREAD_INTERRUPTED(thred)) {
+ goto aborted;
+@@ -582,7 +589,7 @@ PR_IMPLEMENT(PRIntn) PR_GetMonitorEntryC
+
+ rv = pthread_mutex_lock(&mon->lock);
+ PR_ASSERT(0 == rv);
+- if (pthread_equal(mon->owner, self)) {
++ if (pt_pthread_equal(mon->owner, self)) {
+ count = mon->entryCount;
+ }
+ rv = pthread_mutex_unlock(&mon->lock);
+@@ -598,7 +605,7 @@ PR_IMPLEMENT(void) PR_AssertCurrentThrea
+ rv = pthread_mutex_lock(&mon->lock);
+ PR_ASSERT(0 == rv);
+ PR_ASSERT(mon->entryCount != 0 &&
+- pthread_equal(mon->owner, pthread_self()));
++ pt_pthread_equal(mon->owner, pthread_self()));
+ rv = pthread_mutex_unlock(&mon->lock);
+ PR_ASSERT(0 == rv);
+ #endif
+@@ -614,7 +621,7 @@ PR_IMPLEMENT(void) PR_EnterMonitor(PRMon
+ PR_ASSERT(0 == rv);
+ if (mon->entryCount != 0)
+ {
+- if (pthread_equal(mon->owner, self)) {
++ if (pt_pthread_equal(mon->owner, self)) {
+ goto done;
+ }
+ while (mon->entryCount != 0)
+@@ -646,8 +653,8 @@ PR_IMPLEMENT(PRStatus) PR_ExitMonitor(PR
+ PR_ASSERT(0 == rv);
+ /* the entries should be > 0 and we'd better be the owner */
+ PR_ASSERT(mon->entryCount > 0);
+- PR_ASSERT(pthread_equal(mon->owner, self));
+- if (mon->entryCount == 0 || !pthread_equal(mon->owner, self))
++ PR_ASSERT(pt_pthread_equal(mon->owner, self));
++ if (mon->entryCount == 0 || !pt_pthread_equal(mon->owner, self))
+ {
+ rv = pthread_mutex_unlock(&mon->lock);
+ PR_ASSERT(0 == rv);
+@@ -695,7 +702,7 @@ PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor
+ /* the entries better be positive */
+ PR_ASSERT(mon->entryCount > 0);
+ /* and it better be owned by us */
+- PR_ASSERT(pthread_equal(mon->owner, pthread_self()));
++ PR_ASSERT(pt_pthread_equal(mon->owner, pthread_self()));
+
+ /* tuck these away 'till later */
+ saved_entries = mon->entryCount;
diff --git a/www/firefox78/patches/patch-security_nss_lib_freebl_mpi_mpi.c b/www/firefox78/patches/patch-security_nss_lib_freebl_mpi_mpi.c
new file mode 100644
index 00000000000..5af6ca7a0d6
--- /dev/null
+++ b/www/firefox78/patches/patch-security_nss_lib_freebl_mpi_mpi.c
@@ -0,0 +1,35 @@
+$NetBSD: patch-security_nss_lib_freebl_mpi_mpi.c,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix undefined behavior when calling <ctype.h> functions with illegal values.
+
+security/nss/lib/freebl/mpi/mpi.c:4565:15: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
+ xch = toupper(ch);
+
+security/nss/lib/freebl/mpi/mpi.c:4611:14: error: array subscript is of type 'char' [-Werror,-Wchar-subscripts]
+ ch = tolower(ch);
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1642081
+
+--- security/nss/lib/freebl/mpi/mpi.c.orig 2020-05-07 18:35:01.000000000 +0000
++++ security/nss/lib/freebl/mpi/mpi.c
+@@ -4560,9 +4560,9 @@ s_mp_tovalue(char ch, int r)
+ int val, xch;
+
+ if (r > 36)
+- xch = ch;
++ xch = (unsigned char) ch;
+ else
+- xch = toupper(ch);
++ xch = toupper((unsigned char) ch);
+
+ if (isdigit(xch))
+ val = xch - '0';
+@@ -4608,7 +4608,7 @@ s_mp_todigit(mp_digit val, int r, int lo
+ ch = s_dmap_1[val];
+
+ if (r <= 36 && low)
+- ch = tolower(ch);
++ ch = tolower((unsigned char) ch);
+
+ return ch;
+
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_.cargo-checksum.json b/www/firefox78/patches/patch-third__party_rust_authenticator_.cargo-checksum.json
new file mode 100644
index 00000000000..7c3d4386615
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_.cargo-checksum.json
@@ -0,0 +1,15 @@
+$NetBSD: patch-third__party_rust_authenticator_.cargo-checksum.json,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/.cargo-checksum.json.orig 2020-07-08 21:55:03.000000000 +0000
++++ third_party/rust/authenticator/.cargo-checksum.json
+@@ -1 +1 @@
+-{"files":{"Cargo.lock":"4e90be1a6ead1f94b74ab22da0ad669e69bb7c112849d0e43e8942b83ca5ba7b","Cargo.toml":"31b25c3aadc79a147603253dee37c7fcd74e1a20bb62dd3d3b506e097b555fa2","LICENSE":"e866c8f5864d4cacfe403820e722e9dc03fe3c7565efa5e4dad9051d827bb92a","README.md":"f7b1f971632873f3d3c322c2f5cf980fbcd0116786efb580b89fe6ddac07fc07","build.rs":"bc308b771ae9741d775370e3efe45e9cca166fd1d0335f4214b00497042ccc55","examples/main.rs":"7af9e288b1836fb9362589b6bf54c1f1d277bdf64df60c1caccef98c1bfe792c","rustfmt.toml":"de4e1daab481c1572805aed3e51e72c5dc1b3e5af757bc675e1717b251c6e922","src/capi.rs":"99f0d0742bf102451698c7e32db0fc4941b8ac10bec2fb309f41e7e5d99b05bd","src/consts.rs":"4c34980f94d1017e5e75e29b26750c1678e0609c9227296951ffbb9e180a5adf","src/freebsd/device.rs":"914ac446ff24cc3fc050732372e286e1fedf8341a8d4754e392bc9f38393b142","src/freebsd/mod.rs":"42dcb57fbeb00140003a8ad39acac9b547062b8f281a3fa5deb5f92a6169dde6","src/freebsd/monitor.rs":"3683370931b15f05403d240a788a87b1bea801284ee74b849e1f330a4a231dd0","src/freebsd/transaction.rs":"e3615cfdd7f23e9a80a53c32e0fa2a5ae290a432b009bed2b2e74e0df77f8266","src/freebsd/uhid.rs":"d19ade6e808e63981ba5f93d482d676ffa9dff29cb2b7011486591f69ddbbdcd","src/hidproto.rs":"9de8d86509d706e3a0ade2b5a57eec7730afd4073d9cdd99aa8ca1376be37f83","src/lib.rs":"4b43ad18b4eae9356ba6d7954542a38f3015ab8a72ab1fde28169aaf343721d8","src/linux/device.rs":"2271fbb8d176ec01f83a899c0c8194a954465fdd8670a9b136ab88baaba2ee48","src/linux/hidraw.rs":"0d5804d1cd99e7c30c8bde3089f8ed98d7d683d3cd487821e29b133b1ee90228","src/linux/hidwrapper.h":"72785db3a9b27ea72b6cf13a958fee032af54304522d002f56322473978a20f9","src/linux/hidwrapper.rs":"4be65676cf3220929700bf4906938dcbd1538ba53d40c60b08f9ba8890c910f6","src/linux/ioctl_aarch64le.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_armle.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_mips64le.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64be.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64le.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_powerpcbe.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_s390xbe.rs":"2d8b265cd39a9f46816f83d5a5df0701c13eb842bc609325bad42ce50add3bf0","src/linux/ioctl_x86.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_x86_64.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/mod.rs":"446e435126d2a58f167f648dd95cba28e8ac9c17f1f799e1eaeab80ea800fc57","src/linux/monitor.rs":"57890c5f000829c5c0f44032fe5364126e60451605d517c79ba4d4fe4fd6c94b","src/linux/transaction.rs":"92b47d064c1fa5fe2674f65d06c519601480fc1c2b03667ade19a186a6ec9d13","src/macos/device.rs":"29863c88f851a957ec754f16aae6f789b300b00fcfe9a6c198a7cdcf1c9fcfe4","src/macos/iokit.rs":"a0fd818224718e96ad5d106dfc235f4bc9218a59f5114b9f9825abe3ee62bce7","src/macos/mod.rs":"333e561554fc901d4f6092f6e4c85823e2b0c4ff31c9188d0e6d542b71a0a07c","src/macos/monitor.rs":"d3a1dadfbfb5bfd665d75493d72bfbca3da9c43692262230f10d5feadb928e62","src/macos/transaction.rs":"cf2e67530401b0ef18e978557f470aa2661b3a5f4ef64cd3053d6e11f2f19b2b","src/manager.rs":"7428fc23038b004841936d8f27f8dc33234d5c06361efa75b73c7a5c035dae75","src/openbsd/device.rs":"b5de51a8b3ae0e542373a2064cff1ae6e1f91ac78e1406805d9ca8a05ce758c9","src/openbsd/mod.rs":"514274d414042ff84b3667a41a736e78581e22fda87ccc97c2bc05617e381a30","src/openbsd/monitor.rs":"953800ab8fd6adf5d70633059b20d2cf0f5a2701d92e58a06d1ec33208983bc4","src/openbsd/transaction.rs":"10be1ce983c72513fec57baaa6869ef02b9cdbd8ea66bb2dfe24d857faf054f5","src/statemachine.rs":"28477fba601f5086b85e911da1e4f04af3f0060329e6e0e1172b960f9c52fd41","src/stub/device.rs":"32e134fc8826667d16b02fe32831fc29f4d52d0a7a065d7d649c4a1c5faa0dcc","src/stub/mod.rs":"6a7fec504a52d403b0241b18cd8b95088a31807571f4c0a67e4055afc74f4453","src/stub/transaction.rs":"8655bc37b69c318ff0bc69a62fcb31820eb6ad7921a53e0cecffa15e80d97630","src/u2fhid-capi.h":"fc2575f720ab8f6bc0c523c57310f35c464576bd5150c3c2b1873d3abde5909b","src/u2fprotocol.rs":"77b6d5005d8b3d98cd96e480013c1e97155da5df3cf5e19819ee82ac8e3b6c7d","src/u2ftypes.rs":"cf972d805b15a95f4c18d556aa01660ce451f1d3bce1516b0ce73d17e73199aa","src/util.rs":"c517750c9bf00f44fb63cada8c40d0227a4d3765488499a1f4d3c0f01daa67a7","src/windows/device.rs":"86a6ecc239608977a963f375336780746e90e95c3eb9ff303347beb983c40ab6","src/windows/mod.rs":"218e7f2fe91ecb390c12bba5a5ffdad2c1f0b22861c937f4d386262e5b3dd617","src/windows/monitor.rs":"d8e8316e5bd9fc6ebed737bd8d6e0713c99287aca04f392f6319cdfd8576f754","src/windows/transaction.rs":"1b9a5af866048911ccaec8c94b698b28ae1b80e3d4842f9d6ed38462f459c796","src/windows/winapi.rs":"a4286fd5e8dcb178e37df512ba7752b2a3c38fe30e1176022767d2c05c242bf8"},"package":"ff593fb4dd388fe452c5e63d4d668699466bd46b571c4b852dfbca4bac8f0706"}
+\ No newline at end of file
++{"files":{},"package":"ff593fb4dd388fe452c5e63d4d668699466bd46b571c4b852dfbca4bac8f0706"}
+\ No newline at end of file
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_lib.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_lib.rs
new file mode 100644
index 00000000000..4de23763cb2
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_lib.rs
@@ -0,0 +1,38 @@
+$NetBSD: patch-third__party_rust_authenticator_src_lib.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/lib.rs.orig 2020-07-08 19:27:16.000000000 +0000
++++ third_party/rust/authenticator/src/lib.rs
+@@ -5,7 +5,7 @@
+ #[macro_use]
+ mod util;
+
+-#[cfg(any(target_os = "linux", target_os = "freebsd"))]
++#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
+ pub mod hidproto;
+
+ #[cfg(any(target_os = "linux"))]
+@@ -22,6 +22,10 @@ extern crate devd_rs;
+ #[path = "freebsd/mod.rs"]
+ pub mod platform;
+
++#[cfg(any(target_os = "netbsd"))]
++#[path = "netbsd/mod.rs"]
++pub mod platform;
++
+ #[cfg(any(target_os = "openbsd"))]
+ #[path = "openbsd/mod.rs"]
+ pub mod platform;
+@@ -41,6 +45,7 @@ pub mod platform;
+ target_os = "linux",
+ target_os = "freebsd",
+ target_os = "openbsd",
++ target_os = "netbsd",
+ target_os = "macos",
+ target_os = "windows"
+ )))]
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_device.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_device.rs
new file mode 100644
index 00000000000..c6013bbfb4b
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_device.rs
@@ -0,0 +1,145 @@
+$NetBSD: patch-third__party_rust_authenticator_src_netbsd_device.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/netbsd/device.rs.orig 2020-07-15 16:29:34.208835297 +0000
++++ third_party/rust/authenticator/src/netbsd/device.rs
+@@ -0,0 +1,134 @@
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++extern crate libc;
++
++use std::mem;
++use std::io::Read;
++use std::io::Write;
++use std::io;
++
++use consts::CID_BROADCAST;
++use consts::HID_RPT_SIZE;
++use platform::fd::Fd;
++use platform::uhid;
++use u2ftypes::U2FDevice;
++use util::io_err;
++
++#[derive(Debug)]
++pub struct Device {
++ fd: Fd,
++ cid: [u8; 4],
++}
++
++impl Device {
++ pub fn new(fd: Fd) -> io::Result<Self> {
++ Ok(Self { fd, cid: CID_BROADCAST })
++ }
++
++ pub fn is_u2f(&mut self) -> bool {
++ if !uhid::is_u2f_device(&self.fd) {
++ return false;
++ }
++ // This step is not strictly necessary -- NetBSD puts fido
++ // devices into raw mode automatically by default, but in
++ // principle that might change, and this serves as a test to
++ // verify that we're running on a kernel with support for raw
++ // mode at all so we don't get confused issuing writes that try
++ // to set the report descriptor rather than transfer data on
++ // the output interrupt pipe as we need.
++ match uhid::hid_set_raw(&self.fd, true) {
++ Ok(_) => (),
++ Err(_) => return false,
++ }
++ if let Err(_) = self.ping() {
++ return false;
++ }
++ true
++ }
++
++ fn ping(&mut self) -> io::Result<()> {
++ for i in 0..10 {
++ let mut buf = vec![0u8; 1 + HID_RPT_SIZE];
++
++ buf[0] = 0; // report number
++ buf[1] = 0xff; // CID_BROADCAST
++ buf[2] = 0xff;
++ buf[3] = 0xff;
++ buf[4] = 0xff;
++ buf[5] = 0x81; // ping
++ buf[6] = 0;
++ buf[7] = 1; // one byte
++
++ self.write(&buf[..])?;
++
++ // Wait for response
++ let mut pfd: libc::pollfd = unsafe { mem::zeroed() };
++ pfd.fd = self.fd.fileno;
++ pfd.events = libc::POLLIN;
++ let nfds = unsafe { libc::poll(&mut pfd, 1, 100) };
++ if nfds == -1 {
++ return Err(io::Error::last_os_error());
++ }
++ if nfds == 0 {
++ debug!("device timeout {}", i);
++ continue;
++ }
++
++ // Read response
++ self.read(&mut buf[..])?;
++
++ return Ok(());
++ }
++
++ Err(io_err("no response from device"))
++ }
++}
++
++impl PartialEq for Device {
++ fn eq(&self, other: &Device) -> bool {
++ self.fd == other.fd
++ }
++}
++
++impl Read for Device {
++ fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
++ let bufp = buf.as_mut_ptr() as *mut libc::c_void;
++ let nread = unsafe { libc::read(self.fd.fileno, bufp, buf.len()) };
++ if nread == -1 {
++ return Err(io::Error::last_os_error());
++ }
++ Ok(nread as usize)
++ }
++}
++
++impl Write for Device {
++ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
++ // Always skip the first byte (report number)
++ let data = &buf[1..];
++ let data_ptr = data.as_ptr() as *const libc::c_void;
++ let nwrit = unsafe {
++ libc::write(self.fd.fileno, data_ptr, data.len())
++ };
++ if nwrit == -1 {
++ return Err(io::Error::last_os_error());
++ }
++ // Pretend we wrote the report number byte
++ Ok(nwrit as usize + 1)
++ }
++
++ fn flush(&mut self) -> io::Result<()> {
++ Ok(())
++ }
++}
++
++impl U2FDevice for Device {
++ fn get_cid<'a>(&'a self) -> &'a [u8; 4] {
++ &self.cid
++ }
++
++ fn set_cid(&mut self, cid: [u8; 4]) {
++ self.cid = cid;
++ }
++}
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_fd.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_fd.rs
new file mode 100644
index 00000000000..e0bccd2461e
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_fd.rs
@@ -0,0 +1,58 @@
+$NetBSD: patch-third__party_rust_authenticator_src_netbsd_fd.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/netbsd/fd.rs.orig 2020-07-15 16:29:34.209237373 +0000
++++ third_party/rust/authenticator/src/netbsd/fd.rs
+@@ -0,0 +1,47 @@
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++extern crate libc;
++
++use std::ffi::CString;
++use std::io;
++use std::mem;
++use std::os::raw::c_int;
++use std::os::unix::io::RawFd;
++
++#[derive(Debug)]
++pub struct Fd {
++ pub fileno: RawFd,
++}
++
++impl Fd {
++ pub fn open(path: &str, flags: c_int) -> io::Result<Fd> {
++ let cpath = CString::new(path.as_bytes())?;
++ let rv = unsafe { libc::open(cpath.as_ptr(), flags) };
++ if rv == -1 {
++ return Err(io::Error::last_os_error());
++ }
++ Ok(Fd { fileno: rv })
++ }
++}
++
++impl Drop for Fd {
++ fn drop(&mut self) {
++ unsafe { libc::close(self.fileno) };
++ }
++}
++
++impl PartialEq for Fd {
++ fn eq(&self, other: &Fd) -> bool {
++ let mut st: libc::stat = unsafe { mem::zeroed() };
++ let mut sto: libc::stat = unsafe { mem::zeroed() };
++ if unsafe { libc::fstat(self.fileno, &mut st) } == -1 {
++ return false;
++ }
++ if unsafe { libc::fstat(other.fileno, &mut sto) } == -1 {
++ return false;
++ }
++ (st.st_dev == sto.st_dev) & (st.st_ino == sto.st_ino)
++ }
++}
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_mod.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_mod.rs
new file mode 100644
index 00000000000..753518e94cc
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_mod.rs
@@ -0,0 +1,21 @@
+$NetBSD: patch-third__party_rust_authenticator_src_netbsd_mod.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/netbsd/mod.rs.orig 2020-07-15 16:29:34.210141360 +0000
++++ third_party/rust/authenticator/src/netbsd/mod.rs
+@@ -0,0 +1,10 @@
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++pub mod device;
++pub mod transaction;
++
++mod fd;
++mod monitor;
++mod uhid;
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_monitor.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_monitor.rs
new file mode 100644
index 00000000000..a7ba8ae64c8
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_monitor.rs
@@ -0,0 +1,100 @@
+$NetBSD: patch-third__party_rust_authenticator_src_netbsd_monitor.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/netbsd/monitor.rs.orig 2020-07-15 16:29:34.210607689 +0000
++++ third_party/rust/authenticator/src/netbsd/monitor.rs
+@@ -0,0 +1,89 @@
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++use std::collections::HashMap;
++use std::ffi::OsString;
++use std::io;
++use std::sync::Arc;
++use std::thread;
++use std::time::Duration;
++
++use runloop::RunLoop;
++
++use platform::fd::Fd;
++
++// XXX Should use drvctl, but it doesn't do pubsub properly yet so
++// DRVGETEVENT requires write access to /dev/drvctl. Instead, for now,
++// just poll every 500ms.
++const POLL_TIMEOUT: u64 = 500;
++
++pub struct Monitor<F>
++where
++ F: Fn(Fd, &dyn Fn() -> bool) + Send + Sync + 'static,
++{
++ runloops: HashMap<OsString, RunLoop>,
++ new_device_cb: Arc<F>,
++}
++
++impl<F> Monitor<F>
++where
++ F: Fn(Fd, &dyn Fn() -> bool) + Send + Sync + 'static,
++{
++ pub fn new(new_device_cb: F) -> Self {
++ Self {
++ runloops: HashMap::new(),
++ new_device_cb: Arc::new(new_device_cb),
++ }
++ }
++
++ pub fn run(&mut self, alive: &dyn Fn() -> bool) -> io::Result<()> {
++ while alive() {
++ for n in 0..100 {
++ let uhidpath = format!("/dev/uhid{}", n);
++ match Fd::open(&uhidpath, libc::O_RDWR | libc::O_CLOEXEC) {
++ Ok(uhid) => {
++ self.add_device(uhid, OsString::from(&uhidpath));
++ },
++ Err(ref err) => {
++ match err.raw_os_error() {
++ Some(libc::EBUSY) => continue,
++ Some(libc::ENOENT) => break,
++ _ => self.remove_device(OsString::from(&uhidpath)),
++ }
++ },
++ }
++ }
++ thread::sleep(Duration::from_millis(POLL_TIMEOUT));
++ }
++ self.remove_all_devices();
++ Ok(())
++ }
++
++ fn add_device(&mut self, fd: Fd, path: OsString) {
++ let f = self.new_device_cb.clone();
++
++ let runloop = RunLoop::new(move |alive| {
++ if alive() {
++ f(fd, alive);
++ }
++ });
++
++ if let Ok(runloop) = runloop {
++ self.runloops.insert(path.clone(), runloop);
++ }
++ }
++
++ fn remove_device(&mut self, path: OsString) {
++ if let Some(runloop) = self.runloops.remove(&path) {
++ runloop.cancel();
++ }
++ }
++
++ fn remove_all_devices(&mut self) {
++ while !self.runloops.is_empty() {
++ let path = self.runloops.keys().next().unwrap().clone();
++ self.remove_device(path);
++ }
++ }
++}
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_transaction.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_transaction.rs
new file mode 100644
index 00000000000..499c5f86f70
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_transaction.rs
@@ -0,0 +1,61 @@
+$NetBSD: patch-third__party_rust_authenticator_src_netbsd_transaction.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/netbsd/transaction.rs.orig 2020-07-15 16:29:34.212621486 +0000
++++ third_party/rust/authenticator/src/netbsd/transaction.rs
+@@ -0,0 +1,50 @@
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++use runloop::RunLoop;
++use util::OnceCallback;
++
++use platform::fd::Fd;
++use platform::monitor::Monitor;
++
++pub struct Transaction {
++ // Handle to the thread loop.
++ thread: Option<RunLoop>,
++}
++
++impl Transaction {
++ pub fn new<F, T>(
++ timeout: u64,
++ callback: OnceCallback<T>,
++ new_device_cb: F,
++ ) -> Result<Self, ::Error>
++ where
++ F: Fn(Fd, &dyn Fn() -> bool) + Sync + Send + 'static,
++ T: 'static,
++ {
++ let thread = RunLoop::new_with_timeout(
++ move |alive| {
++ // Create a new device monitor.
++ let mut monitor = Monitor::new(new_device_cb);
++
++ // Start polling for new devices.
++ try_or!(monitor.run(alive), |_| callback.call(Err(::Error::Unknown)));
++
++ // Send an error, if the callback wasn't called already.
++ callback.call(Err(::Error::NotAllowed));
++ },
++ timeout,
++ )
++ .map_err(|_| ::Error::Unknown)?;
++
++ Ok(Self {
++ thread: Some(thread),
++ })
++ }
++
++ pub fn cancel(&mut self) {
++ // This must never be None.
++ self.thread.take().unwrap().cancel();
++ }
++}
diff --git a/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_uhid.rs b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_uhid.rs
new file mode 100644
index 00000000000..f0bcc03ee82
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_authenticator_src_netbsd_uhid.rs
@@ -0,0 +1,90 @@
+$NetBSD: patch-third__party_rust_authenticator_src_netbsd_uhid.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Add NetBSD support for U2F.
+
+Submitted upstream:
+
+https://github.com/mozilla/authenticator-rs/pull/116
+
+--- third_party/rust/authenticator/src/netbsd/uhid.rs.orig 2020-07-15 16:29:34.213005315 +0000
++++ third_party/rust/authenticator/src/netbsd/uhid.rs
+@@ -0,0 +1,79 @@
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++extern crate libc;
++
++use std::io;
++use std::mem;
++use std::os::raw::c_int;
++use std::os::raw::c_uchar;
++
++use hidproto::ReportDescriptor;
++use hidproto::has_fido_usage;
++use platform::fd::Fd;
++use util::io_err;
++
++/* sys/ioccom.h */
++
++const IOCPARM_MASK: u32 = 0x1fff;
++const IOCPARM_SHIFT: u32 = 16;
++const IOCGROUP_SHIFT: u32 = 8;
++
++//const IOC_VOID: u32 = 0x20000000;
++const IOC_OUT: u32 = 0x40000000;
++const IOC_IN: u32 = 0x80000000;
++//const IOC_INOUT: u32 = IOC_IN|IOC_OUT;
++
++macro_rules! ioctl {
++ ($dir:expr, $name:ident, $group:expr, $nr:expr, $ty:ty) => {
++ unsafe fn $name(fd: libc::c_int, val: *mut $ty)
++ -> io::Result<libc::c_int> {
++ let ioc = ($dir as u32)
++ | ((mem::size_of::<$ty>() as u32 & IOCPARM_MASK)
++ << IOCPARM_SHIFT)
++ | (($group as u32) << IOCGROUP_SHIFT)
++ | ($nr as u32);
++ let rv = libc::ioctl(fd, ioc as libc::c_ulong, val);
++ if rv == -1 {
++ return Err(io::Error::last_os_error());
++ }
++ Ok(rv)
++ }
++ };
++}
++
++#[allow(non_camel_case_types)]
++#[repr(C)]
++struct usb_ctl_report_desc {
++ ucrd_size: c_int,
++ ucrd_data: [c_uchar; 1024],
++}
++
++ioctl!(IOC_OUT, usb_get_report_desc, b'U', 21, usb_ctl_report_desc);
++
++fn read_report_descriptor(fd: &Fd) -> io::Result<ReportDescriptor> {
++ let mut desc = unsafe { mem::zeroed() };
++ unsafe { usb_get_report_desc(fd.fileno, &mut desc) }?;
++ if desc.ucrd_size < 0 {
++ return Err(io_err("negative report descriptor size"));
++ }
++ let size = desc.ucrd_size as usize;
++ let value = Vec::from(&desc.ucrd_data[..size]);
++ Ok(ReportDescriptor { value })
++}
++
++pub fn is_u2f_device(fd: &Fd) -> bool {
++ match read_report_descriptor(fd) {
++ Ok(desc) => has_fido_usage(desc),
++ Err(_) => false,
++ }
++}
++
++ioctl!(IOC_IN, usb_hid_set_raw_ioctl, b'h', 2, c_int);
++
++pub fn hid_set_raw(fd: &Fd, raw: bool) -> io::Result<()> {
++ let mut raw_int: c_int = if raw { 1 } else { 0 };
++ unsafe { usb_hid_set_raw_ioctl(fd.fileno, &mut raw_int) }?;
++ Ok(())
++}
diff --git a/www/firefox78/patches/patch-third__party_rust_getrandom_src_lib.rs b/www/firefox78/patches/patch-third__party_rust_getrandom_src_lib.rs
new file mode 100644
index 00000000000..0f0c1754235
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_getrandom_src_lib.rs
@@ -0,0 +1,24 @@
+$NetBSD: patch-third__party_rust_getrandom_src_lib.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+https://github.com/rust-random/getrandom/pull/115
+
+--- third_party/rust/getrandom/src/lib.rs.orig 2020-06-02 23:37:31.000000000 +0000
++++ third_party/rust/getrandom/src/lib.rs
+@@ -17,7 +17,7 @@
+ //! | macOS, iOS | [`SecRandomCopyBytes`][4]
+ //! | FreeBSD | [`kern.arandom`][5]
+ //! | OpenBSD, Bitrig | [`getentropy`][6]
+-//! | NetBSD | [`/dev/urandom`][7] after reading from `/dev/random` once
++//! | NetBSD | [`kern.arandom`][5]
+ //! | Dragonfly BSD | [`/dev/random`][8]
+ //! | Solaris, illumos | [`getrandom`][9] system call if available, otherwise [`/dev/random`][10]
+ //! | Fuchsia OS | [`cprng_draw`][11]
+@@ -184,7 +184,7 @@ mod_use!(cfg(target_os = "illumos"), sol
+ mod_use!(cfg(target_os = "ios"), macos);
+ mod_use!(cfg(target_os = "linux"), linux_android);
+ mod_use!(cfg(target_os = "macos"), macos);
+-mod_use!(cfg(target_os = "netbsd"), use_file);
++mod_use!(cfg(target_os = "netbsd"), freebsd);
+ mod_use!(cfg(target_os = "openbsd"), openbsd_bitrig);
+ mod_use!(cfg(target_os = "redox"), use_file);
+ mod_use!(cfg(target_os = "solaris"), solaris_illumos);
diff --git a/www/firefox78/patches/patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs b/www/firefox78/patches/patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
new file mode 100644
index 00000000000..06452ddb255
--- /dev/null
+++ b/www/firefox78/patches/patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
@@ -0,0 +1,78 @@
+$NetBSD: patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Based on: https://bugzilla.mozilla.org/show_bug.cgi?id=1594342
+
+--- third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig 2020-01-03 18:58:20.000000000 +0000
++++ third_party/rust/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+@@ -1,6 +1,7 @@
+ pub type clock_t = ::c_uint;
+ pub type suseconds_t = ::c_int;
+ pub type dev_t = u64;
++pub type key_t = c_long;
+ pub type blksize_t = i32;
+ pub type fsblkcnt_t = u64;
+ pub type fsfilcnt_t = u64;
+@@ -282,6 +283,30 @@ s_no_extra_traits! {
+ }
+
+ #[repr(packed)]
++ pub struct ipc_perm {
++ pub cuid: ::uid_t,
++ pub cgid: ::gid_t,
++ pub uid: ::uid_t,
++ pub gid: ::gid_t,
++ pub mode: ::mode_t,
++ pub seq: ::c_ushort,
++ pub key: ::key_t,
++ }
++
++ #[repr(packed)]
++ pub struct shmid_ds {
++ pub shm_perm: ::ipc_perm,
++ pub shm_segsz: ::size_t,
++ pub shm_lpid: ::pid_t,
++ pub shm_cpid: ::pid_t,
++ pub shm_nattch: ::c_short,
++ pub shm_atime: ::time_t,
++ pub shm_dtime: ::time_t,
++ pub shm_ctime: ::time_t,
++ pub shm_internal: *mut ::c_void,
++ }
++
++ #[repr(packed)]
+ pub struct in_addr {
+ pub s_addr: ::in_addr_t,
+ }
+@@ -907,11 +932,18 @@ pub const SCM_CREDS: ::c_int = 0x10;
+
+ pub const O_DSYNC : ::c_int = 0x10000;
+
++pub const MAP_ANONYMOUS : ::c_int = 0x1000;
+ pub const MAP_RENAME : ::c_int = 0x20;
+ pub const MAP_NORESERVE : ::c_int = 0x40;
+ pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
+ pub const MAP_WIRED: ::c_int = 0x800;
+
++pub const IPC_PRIVATE: ::key_t = 0;
++pub const IPC_CREAT: ::c_int = 0x1000;
++pub const IPC_EXCL: ::c_int = 0x2000;
++pub const IPC_NOWAIT: ::c_int = 0x4000;
++pub const IPC_RMID: ::c_int = 0;
++
+ pub const DCCP_TYPE_REQUEST: ::c_int = 0;
+ pub const DCCP_TYPE_RESPONSE: ::c_int = 1;
+ pub const DCCP_TYPE_DATA: ::c_int = 2;
+@@ -1583,6 +1615,13 @@ extern {
+ pid: ::pid_t,
+ addr: *mut ::c_void,
+ data: ::c_int) -> ::c_int;
++ pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
++ pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
++ shmflg: ::c_int) -> *mut ::c_void;
++ pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
++ #[cfg_attr(target_os = "netbsd", link_name = "__shmctl50")]
++ pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
++ buf: *mut ::shmid_ds) -> ::c_int;
+ pub fn pthread_setname_np(t: ::pthread_t,
+ name: *const ::c_char,
+ arg: *mut ::c_void) -> ::c_int;
diff --git a/www/firefox78/patches/patch-toolkit_components_terminator_nsTerminator.cpp b/www/firefox78/patches/patch-toolkit_components_terminator_nsTerminator.cpp
new file mode 100644
index 00000000000..4e8b37008fe
--- /dev/null
+++ b/www/firefox78/patches/patch-toolkit_components_terminator_nsTerminator.cpp
@@ -0,0 +1,27 @@
+$NetBSD: patch-toolkit_components_terminator_nsTerminator.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Fix segfault on exit under NetBSD
+
+--- toolkit/components/terminator/nsTerminator.cpp.orig 2020-05-21 22:38:09.000000000 +0000
++++ toolkit/components/terminator/nsTerminator.cpp
+@@ -36,7 +36,7 @@
+ #if defined(XP_WIN)
+ # include <windows.h>
+ #else
+-# include <unistd.h>
++# include <time.h>
+ #endif
+
+ #include "mozilla/ArrayUtils.h"
+@@ -180,7 +180,10 @@ void RunWatchdog(void* arg) {
+ #if defined(XP_WIN)
+ Sleep(1000 /* ms */);
+ #else
+- usleep(1000000 /* usec */);
++ struct timespec tickd;
++ tickd.tv_sec = 1;
++ tickd.tv_nsec = 0;
++ nanosleep(&tickd, NULL);
+ #endif
+ if (gHeartbeat++ < timeToLive) {
+ #if !defined(MOZ_VALGRIND) || !defined(MOZ_CODE_COVERAGE)
diff --git a/www/firefox78/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js b/www/firefox78/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js
new file mode 100644
index 00000000000..9fb4ebf47b0
--- /dev/null
+++ b/www/firefox78/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js
@@ -0,0 +1,26 @@
+$NetBSD: patch-toolkit_modules_subprocess_subprocess__shared__unix.js,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Fix broken native messaging on NetBSD and possibly other BSDs too:
+https://bugzilla.mozilla.org/show_bug.cgi?id=1543602
+
+Please remove this patch when the upstream issue is resolved.
+
+--- toolkit/modules/subprocess/subprocess_shared_unix.js.orig 2019-07-06 01:49:01.000000000 +0000
++++ toolkit/modules/subprocess/subprocess_shared_unix.js
+@@ -12,7 +12,15 @@
+
+ const LIBC = OS.Constants.libc;
+
+-const LIBC_CHOICES = ["libc.so", "libSystem.B.dylib", "a.out"];
++/* libc.so isn't meant to be dlopen'ed. On Linux it's usually an ld
++ * script so one cannot dlopen it. On NetBSD (and possibly other
++ * BSDs too) dlopen'ing libc.so will succeed, but some global symbols,
++ * especially environ(7), are pointing to unused memory regions
++ * because they are meant to be overridden by the main executable.
++ * So the most portable way to access libc symbols is to do it through
++ * the NULL handle, i.e. the one which NSPR calls "a.out".
++ */
++const LIBC_CHOICES = ["a.out"];
+
+ const unix = {
+ pid_t: ctypes.int32_t,
diff --git a/www/firefox78/patches/patch-toolkit_moz.configure b/www/firefox78/patches/patch-toolkit_moz.configure
new file mode 100644
index 00000000000..bdf66ac6db5
--- /dev/null
+++ b/www/firefox78/patches/patch-toolkit_moz.configure
@@ -0,0 +1,23 @@
+$NetBSD: patch-toolkit_moz.configure,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* skia part: support bigendian architectures
+
+--- toolkit/moz.configure.orig 2018-05-03 16:58:41.000000000 +0000
++++ toolkit/moz.configure
+@@ -932,11 +932,11 @@ include('nss.configure')
+ # ==============================================================
+ option('--disable-skia', help='Disable use of Skia')
+
+-@depends('--disable-skia')
+-def skia(value):
+- if not value:
+- die('--disable-skia is not supported anymore')
+- else:
++@depends('--disable-skia', target)
++def skia(value, target):
++ if value.origin == 'default' and target.endianness == 'big':
++ return None
++ if value:
+ return True
+
+ set_config('MOZ_ENABLE_SKIA', skia)
diff --git a/www/firefox78/patches/patch-toolkit_mozapps_installer_packager.mk b/www/firefox78/patches/patch-toolkit_mozapps_installer_packager.mk
new file mode 100644
index 00000000000..e5dd4ccef66
--- /dev/null
+++ b/www/firefox78/patches/patch-toolkit_mozapps_installer_packager.mk
@@ -0,0 +1,15 @@
+$NetBSD: patch-toolkit_mozapps_installer_packager.mk,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Symbolic link to lib/firefox/firefox causes 'Couldn't load XPCOM.' error.
+
+--- toolkit/mozapps/installer/packager.mk.orig 2020-01-29 07:05:13.000000000 +0000
++++ toolkit/mozapps/installer/packager.mk
+@@ -145,7 +145,7 @@ endif
+ (cd $(DESTDIR)$(installdir) && tar -xf -)
+ $(NSINSTALL) -D $(DESTDIR)$(bindir)
+ $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME)
+- ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
++ #ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)
+
+ upload:
+ $(PYTHON3) -u $(MOZILLA_DIR)/build/upload.py --base-path $(DIST) $(UPLOAD_FILES)
diff --git a/www/firefox78/patches/patch-widget_gtk_WaylandDMABufSurface.cpp b/www/firefox78/patches/patch-widget_gtk_WaylandDMABufSurface.cpp
new file mode 100644
index 00000000000..e669075bae7
--- /dev/null
+++ b/www/firefox78/patches/patch-widget_gtk_WaylandDMABufSurface.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-widget_gtk_WaylandDMABufSurface.cpp,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Fix build under NetBSD.
+
+--- widget/gtk/WaylandDMABufSurface.cpp.orig 2020-06-19 02:17:05.000000000 +0000
++++ widget/gtk/WaylandDMABufSurface.cpp
+@@ -18,7 +18,9 @@
+ #include <sys/time.h>
+ #include <dlfcn.h>
+ #include <sys/mman.h>
++#if !defined(__NetBSD__)
+ #include <sys/eventfd.h>
++#endif
+ #include <poll.h>
+
+ #include "mozilla/widget/gbm.h"
+@@ -91,6 +93,7 @@ void WaylandDMABufSurface::GlobalRefAdd(
+ }
+
+ void WaylandDMABufSurface::GlobalRefCountCreate() {
++#if !defined(__NetBSD__)
+ MOZ_ASSERT(!mGlobalRefCountFd);
+ mGlobalRefCountFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK | EFD_SEMAPHORE);
+ if (mGlobalRefCountFd < 0) {
+@@ -98,6 +101,7 @@ void WaylandDMABufSurface::GlobalRefCoun
+ mGlobalRefCountFd = 0;
+ return;
+ }
++#endif
+ }
+
+ void WaylandDMABufSurface::GlobalRefCountImport(int aFd) {
diff --git a/www/firefox78/patches/patch-xpcom_base_nscore.h b/www/firefox78/patches/patch-xpcom_base_nscore.h
new file mode 100644
index 00000000000..b45821a3851
--- /dev/null
+++ b/www/firefox78/patches/patch-xpcom_base_nscore.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-xpcom_base_nscore.h,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+* Support llvm/clang
+
+--- xpcom/base/nscore.h.orig 2019-03-07 16:53:44.000000000 +0000
++++ xpcom/base/nscore.h
+@@ -76,7 +76,7 @@
+ * NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
+ */
+
+-#if defined(__i386__) && defined(__GNUC__)
++#if defined(__i386__) && defined(__GNUC__) && !(defined(__clang__) && __clang_major__ == 3 && __clang_minor__ == 4 && __clang_patchlevel__ == 0)
+ # define NS_FASTCALL __attribute__((regparm(3), stdcall))
+ # define NS_CONSTRUCTOR_FASTCALL __attribute__((regparm(3), stdcall))
+ #elif defined(XP_WIN) && !defined(_WIN64)
diff --git a/www/firefox78/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build b/www/firefox78/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build
new file mode 100644
index 00000000000..162ebdeee63
--- /dev/null
+++ b/www/firefox78/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build
@@ -0,0 +1,15 @@
+$NetBSD: patch-xpcom_reflect_xptcall_md_unix_moz.build,v 1.1 2020/07/30 08:09:28 nia Exp $
+
+Make NetBSD/sparc64 use the same xptcall bindings as all other sparc64 ports
+
+--- xpcom/reflect/xptcall/md/unix/moz.build.orig 2019-07-06 01:49:01.000000000 +0000
++++ xpcom/reflect/xptcall/md/unix/moz.build
+@@ -217,7 +217,7 @@ if CONFIG['OS_ARCH'] == 'OpenBSD' and CO
+ 'xptcstubs_sparc_openbsd.cpp',
+ ]
+
+-if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD', 'Linux', 'SunOS') and CONFIG['CPU_ARCH'] == 'sparc64':
++if CONFIG['OS_ARCH'] in ('OpenBSD', 'FreeBSD', 'NetBSD', 'Linux', 'SunOS') and CONFIG['CPU_ARCH'] == 'sparc64':
+ SOURCES += [
+ 'xptcinvoke_asm_sparc64_openbsd.s',
+ 'xptcinvoke_sparc64_openbsd.cpp',