summaryrefslogtreecommitdiff
path: root/www/firefox91
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2021-09-08 22:19:50 +0000
committernia <nia@pkgsrc.org>2021-09-08 22:19:50 +0000
commit96912dd319fa0d083072556956d2652788feeee1 (patch)
treea054bbe0f1814440147991ea12c32917ed709c37 /www/firefox91
parenta0352f1627a3cbb3c892a14cb29eee3002bbbaee (diff)
downloadpkgsrc-96912dd319fa0d083072556956d2652788feeee1.tar.gz
Add Firefox 91ESR as a starting point for the branch.
Diffstat (limited to 'www/firefox91')
-rw-r--r--www/firefox91/DESCR12
-rw-r--r--www/firefox91/Makefile193
-rw-r--r--www/firefox91/PLIST36
-rw-r--r--www/firefox91/PLIST.Linux2
-rw-r--r--www/firefox91/distinfo46
-rw-r--r--www/firefox91/files/desktop.in191
-rw-r--r--www/firefox91/files/nodejs-output-91.0.1.tgzbin0 -> 200966 bytes
-rw-r--r--www/firefox91/mozilla-common.mk225
-rw-r--r--www/firefox91/options.mk80
-rw-r--r--www/firefox91/patches/patch-aa26
-rw-r--r--www/firefox91/patches/patch-browser_app_profile_firefox.js17
-rw-r--r--www/firefox91/patches/patch-build_moz.configure_rust.configure15
-rw-r--r--www/firefox91/patches/patch-config_gcc-stl-wrapper.template.h31
-rw-r--r--www/firefox91/patches/patch-config_makefiles_rust.mk17
-rw-r--r--www/firefox91/patches/patch-dom_base_nsAttrName.h18
-rw-r--r--www/firefox91/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp17
-rw-r--r--www/firefox91/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h16
-rw-r--r--www/firefox91/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c19
-rw-r--r--www/firefox91/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp15
-rw-r--r--www/firefox91/patches/patch-gfx_thebes_gfxPlatform.cpp28
-rw-r--r--www/firefox91/patches/patch-gfx_wr_swgl_build.rs27
-rw-r--r--www/firefox91/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc22
-rw-r--r--www/firefox91/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc18
-rw-r--r--www/firefox91/patches/patch-ipc_glue_GeckoChildProcessHost.cpp21
-rw-r--r--www/firefox91/patches/patch-js_src_jit_ProcessExecutableMemory.cpp38
-rw-r--r--www/firefox91/patches/patch-js_src_jit_arm64_vixl_MozCpu-vixl.cpp38
-rw-r--r--www/firefox91/patches/patch-js_src_jsfriendapi.h14
-rw-r--r--www/firefox91/patches/patch-js_src_util_NativeStack.cpp32
-rw-r--r--www/firefox91/patches/patch-js_src_vm_ArrayBufferObject.cpp24
-rw-r--r--www/firefox91/patches/patch-media_ffvpx_libavutil_arm_bswap.h22
-rw-r--r--www/firefox91/patches/patch-media_libcubeb_src_cubeb__alsa.c12
-rw-r--r--www/firefox91/patches/patch-media_libcubeb_src_moz.build19
-rw-r--r--www/firefox91/patches/patch-media_libpng_pngpriv.h17
-rw-r--r--www/firefox91/patches/patch-media_libtheora_lib_info.c19
-rw-r--r--www/firefox91/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc63
-rw-r--r--www/firefox91/patches/patch-mozglue_misc_Uptime.cpp15
-rw-r--r--www/firefox91/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c110
-rw-r--r--www/firefox91/patches/patch-security_nss_lib_freebl_mpi_mpi.c35
-rw-r--r--www/firefox91/patches/patch-toolkit_components_terminator_nsTerminator.cpp27
-rw-r--r--www/firefox91/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js26
-rw-r--r--www/firefox91/patches/patch-toolkit_moz.configure23
-rw-r--r--www/firefox91/patches/patch-toolkit_mozapps_installer_packager.mk15
-rw-r--r--www/firefox91/patches/patch-widget_gtk_DMABufSurface.cpp32
-rw-r--r--www/firefox91/patches/patch-xpcom_base_nscore.h15
-rw-r--r--www/firefox91/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build15
45 files changed, 1703 insertions, 0 deletions
diff --git a/www/firefox91/DESCR b/www/firefox91/DESCR
new file mode 100644
index 00000000000..3202c32864e
--- /dev/null
+++ b/www/firefox91/DESCR
@@ -0,0 +1,12 @@
+Mozilla Firefox is a free, open-source and cross-platform web browser
+for Windows, Linux, MacOS X and many other operating systems.
+
+It is fast and easy to use, and offers many advantages over other web
+browsers, such as tabbed browsing and the ability to block pop-up
+windows.
+
+Firefox also offers excellent bookmark and history management, and it
+can be extended by developers using industry standards such as XML,
+CSS, JavaScript, C++, etc. Many extensions are available.
+
+This package provides Firefox 91 ESR.
diff --git a/www/firefox91/Makefile b/www/firefox91/Makefile
new file mode 100644
index 00000000000..316f9fccae4
--- /dev/null
+++ b/www/firefox91/Makefile
@@ -0,0 +1,193 @@
+# $NetBSD: Makefile,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
+MOZ_BRANCH= 91.0
+MOZ_BRANCH_MINOR= .1esr
+
+DISTNAME= firefox-${FIREFOX_VER}.source
+PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//:S/firefox-/firefox91-/}
+CATEGORIES= www
+MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
+EXTRACT_SUFX= .tar.xz
+
+DISTFILES= ${DEFAULT_DISTFILES} nodejs-output-91.0.tgz
+SITES.nodejs-output-91.0.tgz= ${MASTER_SITE_LOCAL}
+
+MAINTAINER= ryoon@NetBSD.org
+HOMEPAGE= https://www.mozilla.org/en-US/firefox/
+COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:tu:C/\\.[[:digit:]\.]*//})
+LICENSE= mpl-1.1
+
+# -------- BEFORE UPDATING THIS PACKAGE PLEASE READ & UNDERSTAND: -------
+#
+# This package works around a (stupid) build time dependency on nodejs
+# (which is not available for all architectures and unnecessary for the
+# real build). To do this, it places some additional burden on the
+# maintainer.
+#
+# While working on the package, please make sure you have
+#
+# FIREFOX_MAINTAINER=yes
+#
+# set in your build environment.
+# When the package is ready for commit (but before commit), do:
+#
+# make maintainer-files
+#
+# This will do another round (depending on state of your work dir at this
+# moment) of one or two builds and generate a cache of all output that
+# nodejs generates during a build.
+#
+# When this is done, just commit the results (they will be in the files/
+# directory).
+#
+# -----------------------------------------------------------------------
+
+UNLIMIT_RESOURCES+= datasize virtualsize
+
+WRKSRC= ${WRKDIR}/firefox-${FIREFOX_VER:S/esr//}
+
+MOZILLA_DIR= # empty
+
+# Note: when updating remember to conditionalise about-background.png in PLIST
+CONFIGURE_ARGS+= --enable-application=browser
+
+ALL_ENV+= MOZ_APP_NAME=${MOZILLA}
+
+#CFLAGS+= -I${PREFIX}/include/nspr
+# for lang/gcc6
+CFLAGS+= -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS
+CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS
+
+LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/${PKGBASE}
+LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib
+LDFLAGS.DragonFly+= -lplc4 -lnspr4
+LDFLAGS.FreeBSD+= -lplc4 -lnspr4
+LDFLAGS.Linux+= -lnspr4
+LDFLAGS.SunOS+= -lm
+
+# XXX not sure how to test this! likely unnecessary
+NOT_PAX_MPROTECT_SAFE+= lib/${PKGBASE}/plugin-container
+
+# Avoid ld "invalid section index" errors.
+BUILDLINK_TRANSFORM.SunOS+= rm:-fdata-sections
+BUILDLINK_TRANSFORM.SunOS+= rm:-ffunction-sections
+BUILDLINK_TRANSFORM.SunOS+= rm:-pie
+
+# Workaround for https://bugs.llvm.org/show_bug.cgi?id=46366
+BUILDLINK_TRANSFORM.NetBSD+= rm:-fexperimental-new-pass-manager
+
+SUBST_CLASSES+= dfly_malloc_h
+SUBST_STAGE.dfly_malloc_h= pre-configure
+SUBST_MESSAGE.dfly_malloc_h= Dont include malloc.h on dragonflybsd
+SUBST_SED.dfly_malloc_h= -e 's,HAVE_MALLOC_H,HAVE_MALLOC_H \&\& !defined(__DragonFly__),g'
+SUBST_FILES.dfly_malloc_h+= media/ffvpx/libavutil/mem.c
+
+.include "mozilla-common.mk"
+.include "options.mk"
+
+CHECK_INTERPRETER_SKIP+= lib/firefox-sdk/sdk/bin/header.py
+CHECK_INTERPRETER_SKIP+= lib/firefox-sdk/sdk/bin/typelib.py
+CHECK_INTERPRETER_SKIP+= lib/firefox-sdk/sdk/bin/xpidl.py
+CHECK_INTERPRETER_SKIP+= lib/firefox-sdk/sdk/bin/xpt.py
+
+CHECK_WRKREF_SKIP+= lib/${MOZILLA}/omni.ja
+
+MOZILLA= ${PKGBASE}
+MOZILLA_ICON= ${WRKSRC}/${OBJDIR}/dist/${MOZILLA}/browser/chrome/icons/default/default48.png
+.if !empty(PKG_OPTIONS:Mofficial-mozilla-branding)
+MOZILLA_NAME= Firefox
+.else
+MOZILLA_NAME= Browser
+.endif
+
+#
+# Generate list of subst entries for various .cargo-checksum.json files. These
+# are all handled together in one big substitution to simplify things rather
+# than one substitution entry per file, but are kept separate below to ease
+# updating and verification.
+#
+
+#CKSUM_CRATES+= third_party/rust/libc
+
+# patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs
+#CKSUMS+= a3540eab4dbc52e006e84e288bad17e1dae3865fea49020e0ed8b5a7724a9532
+#CKSUMS+= 5e58a2109f5eff0f497dfac150c161c1d517a2227b49e086da96c3d66522ac3a
+
+#CKSUM_CRATES+= third_party/rust/getrandom
+
+# patch-third__party_rust_getrandom_src_lib.rs
+#CKSUMS+= 0e52f6bde42d7bb05c297ce1c25b9879d61b28caba98f6226a152bff538db6c2
+#CKSUMS+= 394425b4ba03c21c494e64d993678f7014575b1e3d590b9ee452b5c2d83ec4ac
+
+#SUBST_CLASSES+= cksum
+#SUBST_STAGE.cksum= pre-configure
+#.for crate in ${CKSUM_CRATES}
+#SUBST_FILES.cksum+= ${crate}/.cargo-checksum.json
+#.endfor
+#.for from to in ${CKSUMS}
+#SUBST_SED.cksum+= -e 's,${from},${to},g'
+#.endfor
+
+pre-configure:
+ cd ${WRKSRC} && autoconf
+ cd ${WRKSRC}/js/src && autoconf
+ cd ${WRKSRC} && mkdir ${OBJDIR}
+ cd ${WRKSRC}/${OBJDIR} && touch old-configure.vars
+# Do not fetch Rust Cargo file via network during build
+.if !defined(FIREFOX_MAINTAINER)
+ mv ${WRKDIR}/dist ${WRKSRC}/${OBJDIR}
+.endif
+
+.if defined(FIREFOX_MAINTAINER)
+# Create files needed only by the firefox maintainer when updating
+# the package
+# XXX - manually removing the .*_done files is wrong!
+.PHONY: build-list
+build-list:
+ cd ${WRKSRC}/${OBJDIR}/dist/bin/browser/chrome && \
+ find . -type f | sort > ${OUT:Q}
+
+NODE_LIST= "${WRKDIR}/node.list"
+NO_NODE_LIST= "${WRKDIR}/no-node.list"
+NODE_FILES= "${WRKDIR}/node.flist"
+
+.PHONY: maintainer-files
+maintainer-files:
+ rm -f ${FILESDIR}/node-wrapper.sh
+ V=$$( node -v ) && \
+ printf '#! /bin/sh\n\nVERS=%s\n\nif [ "$$1" = "-v" ] || [ "$$1" = "--version" ]; then\n\tprintf "$${VERS}\\n"\nfi\n\nexit 0\n' $$V \
+ > ${FILESDIR}/node-wrapper.sh && \
+ chmod 0755 ${FILESDIR}/node-wrapper.sh
+ rm -f ${WRKDIR}/.build_done ${WRKDIR}/.configure_done
+ ${MAKE} MAINTAINER_INTERNAL=yes build
+ ${MAKE} MAINTAINER_INTERNAL=yes OUT="${NO_NODE_LIST}" build-list
+ ${MAKE} OUT="${NODE_LIST}" build-list
+ ${DIFF} -u "${NO_NODE_LIST}" "${NODE_LIST}" | \
+ ${AWK} \
+ '/^\+\.\//{ printf("dist/bin/browser/chrome/%s\n", gensub(/^\+\.\//, "", "")) }' \
+ > "${NODE_FILES}"
+ cd ${WRKSRC}/${OBJDIR} && tar -c -T "${NODE_FILES}" -z \
+ -f ${FILESDIR}/nodejs-output-${PKGVERSION_NOREV}.tgz
+.endif
+
+post-build:
+ ${SED} -e 's|@MOZILLA@|${MOZILLA}|g' \
+ -e 's|@MOZILLA_NAME@|${MOZILLA_NAME}|g' \
+ -e 's|@FIREFOX_ICON@|${MOZILLA}.png|g' \
+ < ${FILESDIR}/desktop.in \
+ > ${WRKDIR}/desktop
+
+INSTALLATION_DIRS+= share/applications share/pixmaps
+post-install:
+ ${ECHO} '#! /bin/sh' > ${DESTDIR}${PREFIX}/bin/${MOZILLA}
+ ${ECHO} '${PREFIX}/lib/${MOZILLA}/${MOZILLA} "$$@"' >> \
+ ${DESTDIR}${PREFIX}/bin/${MOZILLA}
+ ${CHMOD} 755 ${DESTDIR}${PREFIX}/bin/${MOZILLA}
+ ${INSTALL_DATA} ${WRKDIR}/desktop \
+ ${DESTDIR}${PREFIX}/share/applications/${MOZILLA}.desktop
+ ${INSTALL_DATA} ${MOZILLA_ICON} \
+ ${DESTDIR}${PREFIX}/share/pixmaps/${MOZILLA}.png
+
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/www/firefox91/PLIST b/www/firefox91/PLIST
new file mode 100644
index 00000000000..368eea769f3
--- /dev/null
+++ b/www/firefox91/PLIST
@@ -0,0 +1,36 @@
+@comment $NetBSD: PLIST,v 1.1 2021/09/08 22:19:50 nia Exp $
+bin/firefox91
+lib/firefox91/application.ini
+lib/firefox91/browser/chrome/icons/default/default128.png
+lib/firefox91/browser/chrome/icons/default/default16.png
+lib/firefox91/browser/chrome/icons/default/default32.png
+lib/firefox91/browser/chrome/icons/default/default48.png
+lib/firefox91/browser/chrome/icons/default/default64.png
+lib/firefox91/browser/features/doh-rollout@mozilla.org.xpi
+lib/firefox91/browser/features/formautofill@mozilla.org.xpi
+lib/firefox91/browser/features/pictureinpicture@mozilla.org.xpi
+lib/firefox91/browser/features/screenshots@mozilla.org.xpi
+lib/firefox91/browser/features/webcompat-reporter@mozilla.org.xpi
+lib/firefox91/browser/features/webcompat@mozilla.org.xpi
+lib/firefox91/browser/omni.ja
+lib/firefox91/defaults/pref/channel-prefs.js
+lib/firefox91/dependentlibs.list
+lib/firefox91/firefox91
+lib/firefox91/firefox91-bin
+lib/firefox91/fonts/TwemojiMozilla.ttf
+lib/firefox91/gmp-clearkey/0.1/libclearkey.so
+lib/firefox91/gmp-clearkey/0.1/manifest.json
+lib/firefox91/liblgpllibs.so
+${PLIST.ffvpx}lib/firefox91/libmozavcodec.so
+${PLIST.ffvpx}lib/firefox91/libmozavutil.so
+lib/firefox91/libmozgtk.so
+lib/firefox91/libmozsqlite3.so
+${PLIST.wayland}lib/firefox91/libmozwayland.so
+lib/firefox91/libxul.so
+lib/firefox91/omni.ja
+lib/firefox91/pingsender
+lib/firefox91/platform.ini
+lib/firefox91/plugin-container
+lib/firefox91/removed-files
+share/applications/firefox91.desktop
+share/pixmaps/firefox91.png
diff --git a/www/firefox91/PLIST.Linux b/www/firefox91/PLIST.Linux
new file mode 100644
index 00000000000..cfdefc2d9af
--- /dev/null
+++ b/www/firefox91/PLIST.Linux
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST.Linux,v 1.1 2021/09/08 22:19:50 nia Exp $
+lib/firefox/libmozsandbox.so
diff --git a/www/firefox91/distinfo b/www/firefox91/distinfo
new file mode 100644
index 00000000000..804e22f053e
--- /dev/null
+++ b/www/firefox91/distinfo
@@ -0,0 +1,46 @@
+$NetBSD: distinfo,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+SHA1 (firefox-91.0.1esr.source.tar.xz) = 69da1e09a886a884578a772e31a39b7b127b333e
+RMD160 (firefox-91.0.1esr.source.tar.xz) = 95bb15e2454deae11b7ae762dbd592d0e1c63c02
+SHA512 (firefox-91.0.1esr.source.tar.xz) = 79703b3ec615d10957350719b2c034df10fd47d140c3557cd7de665ef4430973b97c1906d5408ddaf8855c1424e87eb9b1b568322ad8fbdb956fca219a865d66
+Size (firefox-91.0.1esr.source.tar.xz) = 382907312 bytes
+SHA1 (nodejs-output-91.0.tgz) = 4c5220054c1364ff679351c46206f5a4886c03bf
+RMD160 (nodejs-output-91.0.tgz) = b21fe976a919cd891a757eaba2f4006d8e4ab747
+SHA512 (nodejs-output-91.0.tgz) = 3a457101a4aaa5ae955b77c41ba6b0d98eb5dd0ae9d6d8cc77c0c7bc0e844238a9c0d86cd1838ffb6a37ad8851f871c21e4ca1bb59d11e58fc42c5fec88c298c
+Size (nodejs-output-91.0.tgz) = 201061 bytes
+SHA1 (patch-aa) = 15b8567cee2af9853f6949c80345ffcb1fd3852a
+SHA1 (patch-browser_app_profile_firefox.js) = 89cea0a66457c96ad0b94aaa524aa5942ad781d0
+SHA1 (patch-build_moz.configure_rust.configure) = 25ddfacd29cebbc6db005dbe61a2a7446d480678
+SHA1 (patch-config_gcc-stl-wrapper.template.h) = 9d88c7b1ccfdd3c6bd2dcd9530a36ad4a501d97a
+SHA1 (patch-config_makefiles_rust.mk) = 72d7e9ecee3ccf7ef5f741aac8e35509b41ab7b8
+SHA1 (patch-dom_base_nsAttrName.h) = ac7ba441a3b27df2855cf2673eea36b1cb44ad49
+SHA1 (patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp) = e458c9c8dc66edc69c1874734af28a77fc5e3993
+SHA1 (patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h) = 2f73c76c48852613e0c55c1680fcc2a9eb3cf4ef
+SHA1 (patch-gfx_cairo_cairo_src_cairo-type1-subset.c) = 89a9d934ef76706c552c0b81e6cbc0f45b1ffd2c
+SHA1 (patch-gfx_skia_skia_src_core_SkCpu.cpp) = 36218819254f3681b9c717d652ea78c9f20d49ad
+SHA1 (patch-gfx_thebes_gfxPlatform.cpp) = f6f8996f0818a1b890698c7cc5054d49cb1e8924
+SHA1 (patch-gfx_wr_swgl_build.rs) = df6ebfaabb4d27994e59a9d0eaf12c7cf08415fb
+SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 4a6606da590cfb8d855bde58b9c6f90e98d0870c
+SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 35d20981d33ccdb1d8ffb8039e48798777f11658
+SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 260c29bacd8bf265951b7a412f850bf2b292c836
+SHA1 (patch-js_src_jit_ProcessExecutableMemory.cpp) = fad103cc698f9828ad58f742231984ec2bc27605
+SHA1 (patch-js_src_jit_arm64_vixl_MozCpu-vixl.cpp) = fdc522e3fb626b1b8a2ebf19ad60bfc25dfa4183
+SHA1 (patch-js_src_jsfriendapi.h) = b5cb687dbbda314fe0f16521c1c042c105c4bbe4
+SHA1 (patch-js_src_util_NativeStack.cpp) = a0a16d8d8d78d3cc3f4d2a508586f1a7821f7dba
+SHA1 (patch-js_src_vm_ArrayBufferObject.cpp) = 0501fdcae11568ae4ea78e0d2f6b3750b7a67d47
+SHA1 (patch-media_ffvpx_libavutil_arm_bswap.h) = de58daa0fd23d4fec50426602b65c9ea5862558a
+SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 31536f36cb33f16da309527b50eda9b721608115
+SHA1 (patch-media_libcubeb_src_moz.build) = e4e64a1135cf4157ae5b6f7c1710ebd076953479
+SHA1 (patch-media_libpng_pngpriv.h) = c8084332560017cd7c9b519b61d125fa28af0dbc
+SHA1 (patch-media_libtheora_lib_info.c) = f6dbf536d73859a1ff78304c2e9f6a6f74dac01f
+SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = f495b64d33db4940c0dfe8c36ddf82aa752b25d9
+SHA1 (patch-mozglue_misc_Uptime.cpp) = daefe25ef1ebc8e4d3735017b9e8ac68c4710a00
+SHA1 (patch-nsprpub_pr_src_pthreads_ptsynch.c) = 13e512c7ee9fa1e14ba415d62fa853e5fbfc91c0
+SHA1 (patch-security_nss_lib_freebl_mpi_mpi.c) = a7cd867916524770609d1c307a65b315b88456f4
+SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = 1c1397f6177728cf9deb2b74708069b9d09509c3
+SHA1 (patch-toolkit_modules_subprocess_subprocess__shared__unix.js) = 22a39e54e042ab2270a3cb54e4e307c8900cad12
+SHA1 (patch-toolkit_moz.configure) = bb6b7a358302e254e31016c3053088e6ed089f5a
+SHA1 (patch-toolkit_mozapps_installer_packager.mk) = 706635b76a7b525794aba95e95544f09e18bb662
+SHA1 (patch-widget_gtk_DMABufSurface.cpp) = 72bc9554f075734df12e1748fb8965dce8318de5
+SHA1 (patch-xpcom_base_nscore.h) = 1ac4d34d3c9e80bc1ac966c6c84cb320bc0fa1ec
+SHA1 (patch-xpcom_reflect_xptcall_md_unix_moz.build) = f7e491c7b62a5332066473bfc815e0050672a372
diff --git a/www/firefox91/files/desktop.in b/www/firefox91/files/desktop.in
new file mode 100644
index 00000000000..d72090e1aab
--- /dev/null
+++ b/www/firefox91/files/desktop.in
@@ -0,0 +1,191 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=@MOZILLA_NAME@ Web Browser
+Name[am]=
+Name[ar]=
+Name[az]=@MOZILLA_NAME@ Veb Səyyahı
+Name[be]=
+Name[bg]=Интернет браузър @MOZILLA_NAME@
+Name[bn]=
+Name[bs]=@MOZILLA_NAME@ web preglednik
+Name[ca]=Navegador web @MOZILLA_NAME@
+Name[cs]=Prohlížeč WWW @MOZILLA_NAME@
+Name[cy]=Y Porwr Gwe @MOZILLA_NAME@
+Name[da]=@MOZILLA_NAME@ - internetsurfning
+Name[de]=@MOZILLA_NAME@ Webbrowser
+Name[el]=Περιηγητής Διαδικτύου @MOZILLA_NAME@
+Name[en_CA]=@MOZILLA_NAME@ Web Browser
+Name[en_GB]=@MOZILLA_NAME@ Web Browser
+Name[es]=Navegador Web @MOZILLA_NAME@
+Name[et]=@MOZILLA_NAME@ veebibrauser
+Name[eu]=@MOZILLA_NAME@ web arakatzailea
+Name[fi]=@MOZILLA_NAME@, WWW-selain
+Name[fr]=Navigateur Web @MOZILLA_NAME@
+Name[ga]=Brabhsálaí Lín @MOZILLA_NAME@
+Name[gu]=એપીફની વૅબ બ્રાઉઝર
+Name[he]=דפדפן @MOZILLA_NAME@
+Name[hi]=
+Name[hr]=@MOZILLA_NAME@ Web preglednik
+Name[hu]=@MOZILLA_NAME@ webböngésző
+Name[id]=Web Browser @MOZILLA_NAME@
+Name[it]=Browser web @MOZILLA_NAME@
+Name[ja]=@MOZILLA_NAME@ ウェブ・ブラウザ
+Name[ko]=@MOZILLA_NAME@ 웹 브라우저
+Name[li]=@MOZILLA_NAME@ Web Browser
+Name[lt]=@MOZILLA_NAME@ web naršyklė
+Name[mk]=@MOZILLA_NAME@ веб прелистувач
+Name[ml]=എപ്പിഫാനി വെബ്ബ് ബ്രൌസ‌ര്
+Name[mn]=@MOZILLA_NAME@ веб хөтөч
+Name[ms]=Pelungsur Web @MOZILLA_NAME@
+Name[nb]=@MOZILLA_NAME@ nettleser
+Name[nl]=@MOZILLA_NAME@ Webbrowser
+Name[nn]=@MOZILLA_NAME@ nettlesar
+Name[no]=@MOZILLA_NAME@ nettleser
+Name[pa]=ਏਪੀਫਾਨੀ ਵੈੱਬ ਬਰਾਊਜ਼ਰ
+Name[pl]=Przeglądarka WWW @MOZILLA_NAME@
+Name[pt]=Navegador Web @MOZILLA_NAME@
+Name[pt_BR]=Navegador Web @MOZILLA_NAME@
+Name[ro]=Navigatorul @MOZILLA_NAME@
+Name[ru]=Веб-браузер @MOZILLA_NAME@
+Name[sk]=
+Name[sl]=Spletni brskalnik @MOZILLA_NAME@
+Name[sq]=@MOZILLA_NAME@ - Shfletuesi Web
+Name[sr]=
+Name[sr@Latn]=Veb čitač Spoznaja
+Name[sv]=Webbläsaren @MOZILLA_NAME@
+Name[ta]=எபிபனி வலை உலாவி
+Name[tk]=@MOZILLA_NAME@ Web Ahtarçisi
+Name[tr]=@MOZILLA_NAME@ Web Tarayıcı
+Name[uk]=Переглядач web @MOZILLA_NAME@
+Name[vi]=Trình Duyệt Web @MOZILLA_NAME@
+Name[wa]=Betchteu waibe epiphany
+Name[zh_CN]=@MOZILLA_NAME@ Web 浏览器
+Name[zh_TW]=@MOZILLA_NAME@ 網頁瀏覽器
+GenericName=Web Browser
+GenericName[ar]=متصفّح الانترنت
+GenericName[az]=Veb Səyyahı
+GenericName[be]=Вандроўнік па павуціньню
+GenericName[bg]=Браузър
+GenericName[bn]=ওয়েব ব্রাউজার
+GenericName[bs]=Web preglednik
+GenericName[ca]=Navegador web
+GenericName[cs]=Prohlížeč WWW
+GenericName[cy]=Porwr Gwe
+GenericName[da]=Internetsurfning
+GenericName[de]=Webbrowser
+GenericName[el]=Περιηγητής Ιστοσελίδων
+GenericName[en_CA]=Web Browser
+GenericName[en_GB]=Web Browser
+GenericName[es]=Navegador web
+GenericName[et]=Veebilehitseja
+GenericName[eu]=Web arakatzailea
+GenericName[fi]=WWW-selain
+GenericName[fr]=Navigateur Web @MOZILLA_NAME@
+GenericName[ga]=Brabhsálaí Lín
+GenericName[gu]=વેબ બ્રાઉઝર
+GenericName[he]=דפדפן אינטרנט
+GenericName[hi]=वेब ब्राउज़र
+GenericName[hr]=Web preglednik
+GenericName[hu]=Webböngésző
+GenericName[id]=Browser Web
+GenericName[it]=Browser web
+GenericName[ja]=GNOME ウェブ・ブラウザ
+GenericName[ko]=웹 브라우저
+GenericName[li]=Wèb Browser
+GenericName[lt]=Web naršyklė
+GenericName[mk]=Веб прелистувач
+GenericName[mn]=Веб хөтөч
+GenericName[ms]=Pelungsur Web
+GenericName[nb]=Nettleser
+GenericName[nl]=Web-browser
+GenericName[nn]=Nettlesar
+GenericName[no]=Nettleser
+GenericName[pa]=ਵੈਬ ਬਰਾਊਜ਼
+GenericName[pl]=Przeglądarka WWW
+GenericName[pt]=Navegador Web
+GenericName[pt_BR]=Navegador Web
+GenericName[ro]=Navigator Internet
+GenericName[ru]=Веб-браузер
+GenericName[sk]=WWW prehliadač
+GenericName[sl]=Spletni brskalnik
+GenericName[sq]=Shfletuesi Web
+GenericName[sr]=Веб читач
+GenericName[sr@Latn]=Veb čitač
+GenericName[sv]=Webbläsare
+GenericName[ta]=வலை உலாவி
+GenericName[th]=เว็บบราวเซอร์
+GenericName[tk]=Web Ahtarçysy
+GenericName[tr]=Web Tarayıcı
+GenericName[uk]=Переглядач web-сторінок
+GenericName[vi]=Trình duyệt Web
+GenericName[wa]=Betchteu waibe
+GenericName[zh_CN]=Web 浏览器
+GenericName[zh_TW]=網頁瀏覽器
+Comment=Browse the web
+Comment[ar]=تصفح الانترنت
+Comment[az]=Vebi gəzin
+Comment[be]=Вандраваць па павуціньню
+Comment[bg]=Сърфиране в интернет
+Comment[bn]=ওয়েব ব্রাউজ করুন
+Comment[bs]=Pregledaj na internetu
+Comment[ca]=Navegueu per la web
+Comment[cs]=Prohlížet WWW
+Comment[cy]=Pori'r we
+Comment[da]=Surf på internettet
+Comment[de]=Im Web surfen
+Comment[el]=Περιήγηση στον παγκόσμιο ιστό
+Comment[en_CA]=Browse the web
+Comment[en_GB]=Browse the web
+Comment[es]=Navegar por la web
+Comment[et]=Sirvi veebi
+Comment[eu]=Arakatu web-a
+Comment[fi]=Selaa WWW:tä
+Comment[fr]=Naviguer sur Internet
+Comment[ga]=Brabhsáil an Líon
+Comment[gu]=વેબમાં શોધો
+Comment[he]=גלוש ברשת
+Comment[hi]=वेब ब्राउज़ करें
+Comment[hr]=Pregledaj Web
+Comment[hu]=A világháló böngészése
+Comment[id]=Jelajah web
+Comment[it]=Esplora il web
+Comment[ja]=ウェブを閲覧します
+Comment[ko]=웹을 돌아 다닙니다
+Comment[li]=Blajere op internet
+Comment[lt]=Naršyti internete
+Comment[mk]=Прелистувајте на веб
+Comment[ml]=വലക്കെട്ട് തിരയുക
+Comment[mn]=Веб броузе хийх
+Comment[ms]=Layari web
+Comment[nb]=Surf på nettet
+Comment[nl]=Websurfen
+Comment[nn]=Surf på nettet
+Comment[no]=Surf på nettet
+Comment[pa]=ਵੈਬ ਬਰਾਊਜ਼
+Comment[pl]=Przeglądanie stron WWW
+Comment[pt]=Navegar na web
+Comment[pt_BR]=Navegar na web
+Comment[ro]=Navigare Internet
+Comment[ru]=Веб-браузер
+Comment[sk]=Prehliadať internet
+Comment[sl]=Brskaj po spletu
+Comment[sq]=Eksploro web-in
+Comment[sr]=Прегледај веб
+Comment[sr@Latn]=Pregledaj veb
+Comment[sv]=Surfa på nätet
+Comment[ta]=வலையில் உலாவு
+Comment[th]=ใช้งานเว็บบราวเซอร์ @MOZILLA_NAME@
+Comment[tk]=Webi Ahtar
+Comment[tr]=Web'e Gözat
+Comment[uk]=Програма перегляду web-сторінок
+Comment[vi]=Duyệt web
+Comment[wa]=Naivyî avå les waibes
+Comment[zh_CN]=浏览 Web
+Comment[zh_TW]=瀏覽網頁
+Exec=@MOZILLA@ %u
+Icon=@FIREFOX_ICON@
+StartupNotify=false
+Terminal=false
+Type=Application
+Categories=Application;Network;
+MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;
diff --git a/www/firefox91/files/nodejs-output-91.0.1.tgz b/www/firefox91/files/nodejs-output-91.0.1.tgz
new file mode 100644
index 00000000000..a6864593d7c
--- /dev/null
+++ b/www/firefox91/files/nodejs-output-91.0.1.tgz
Binary files differ
diff --git a/www/firefox91/mozilla-common.mk b/www/firefox91/mozilla-common.mk
new file mode 100644
index 00000000000..79d0bac20a6
--- /dev/null
+++ b/www/firefox91/mozilla-common.mk
@@ -0,0 +1,225 @@
+# $NetBSD: mozilla-common.mk,v 1.1 2021/09/08 22:19:50 nia Exp $
+#
+# common Makefile fragment for mozilla packages based on gecko 2.0.
+#
+# used by www/firefox91/Makefile
+
+.include "../../mk/bsd.prefs.mk"
+
+PYTHON_VERSIONS_INCOMPATIBLE= 27
+PYTHON_FOR_BUILD_ONLY= tool
+ALL_ENV+= PYTHON3=${PYTHONBIN}
+
+HAS_CONFIGURE= yes
+CONFIGURE_ARGS+= --prefix=${PREFIX}
+USE_TOOLS+= pkg-config perl gmake autoconf213 gm4 unzip zip
+UNLIMIT_RESOURCES+= datasize virtualsize
+
+USE_LANGUAGES+= c c++
+
+# ERROR: Only GCC 7.1 or newer is supported (found version 5.5.0).
+GCC_REQD+= 7
+
+TOOL_DEPENDS+= cbindgen>=0.19.0:../../devel/cbindgen
+
+.if defined(FIREFOX_MAINTAINER) && !defined(MAINTAINER_INTERNAL)
+TOOL_DEPENDS+= nodejs-[0-9]*:../../lang/nodejs
+USE_TOOLS+= diff
+.else
+CONFIGURE_ENV+= NODEJS="${FILESDIR}/node-wrapper.sh"
+.endif
+
+TOOL_DEPENDS+= ${PYPKGPREFIX}-sqlite3-[0-9]*:../../databases/py-sqlite3
+TOOL_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat
+
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+TOOL_DEPENDS+= nasm>=2.14:../../devel/nasm
+TOOL_DEPENDS+= yasm>=1.1:../../devel/yasm
+.endif
+
+# This is to work around build failures where an upstream configuration script
+# is confused by having more than one approximate match to MACHINE_GNU_PLATFORM
+# "i486" when attempting to select the Rust compiler target.
+.if !empty(MACHINE_PLATFORM:MNetBSD-*-i386)
+CONFIGURE_ARGS+= --target=i586-unknown-netbsd
+CONFIGURE_ARGS+= --host=i586-unknown-netbsd
+.else
+CONFIGURE_ARGS+= --target=${MACHINE_GNU_PLATFORM}
+CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM}
+.endif
+
+CONFIGURE_ENV+= BINDGEN_CFLAGS="-isystem${PREFIX}/include/nspr \
+ -isystem${X11BASE}/include/pixman-1"
+
+test:
+ cd ${WRKSRC}/${OBJDIR}/dist/bin && \
+ ./run-mozilla.sh ${WRKSRC}/mach check-spidermonkey
+
+# tar(1) of OpenBSD 5.5 has no --exclude command line option.
+.if ${OPSYS} == "OpenBSD"
+TOOLS_PLATFORM.tar= ${TOOLS_PATH.bsdtar}
+USE_TOOLS+= bsdtar
+.endif
+
+PLIST_VARS+= i386
+.if ${MACHINE_ARCH} == "i386"
+# This is required for SSE2 code under i386.
+CXXFLAGS+= -mstackrealign
+PLIST.i386= yes
+.endif
+
+CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}security/nss/tests/libpkix/libpkix.sh
+CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}security/nss/tests/multinit/multinit.sh
+CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}js/src/tests/update-test262.sh
+CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}intl/icu/source/configure
+CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}browser/components/loop/run-all-loop-tests.sh
+CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}browser/extensions/loop/run-all-loop-tests.sh
+#CHECK_PORTABILITY_SKIP+= ${MOZILLA_DIR}modules/pdfium/update.sh
+
+CONFIGURE_ARGS+= --enable-default-toolkit=cairo-gtk3
+CONFIGURE_ARGS+= --enable-release
+# Disable Rust SIMD option to fix build with lang/rust-1.33.0
+# This should be enabled later again.
+#CONFIGURE_ARGS+= --enable-rust-simd
+CONFIGURE_ARGS+= --disable-tests
+# Mozilla Bug 1432751
+#CONFIGURE_ARGS+= --enable-system-cairo
+CONFIGURE_ARGS+= --enable-system-pixman
+# webrtc option requires internal libvpx
+#CONFIGURE_ARGS+= --with-system-libvpx
+CONFIGURE_ARGS+= --enable-system-ffi
+CONFIGURE_ARGS+= --with-system-icu
+CONFIGURE_ARGS+= --with-system-nss
+CONFIGURE_ARGS+= --with-system-nspr
+#CONFIGURE_ARGS+= --with-system-jpeg
+CONFIGURE_ARGS+= --with-system-zlib
+CONFIGURE_ARGS+= --with-system-libevent=${BUILDLINK_PREFIX.libevent}
+CONFIGURE_ARGS+= --disable-crashreporter
+CONFIGURE_ARGS+= --disable-necko-wifi
+CONFIGURE_ARGS+= --enable-chrome-format=omni
+CONFIGURE_ARGS+= --with-system-webp
+
+#CONFIGURE_ARGS+= --enable-readline
+CONFIGURE_ARGS+= --disable-icf
+CONFIGURE_ARGS+= --disable-updater
+
+#CONFIGURE_ARGS+= --with-libclang-path=${PREFIX}/lib
+
+SUBST_CLASSES+= fix-paths
+SUBST_STAGE.fix-paths= pre-configure
+SUBST_MESSAGE.fix-paths= Fixing absolute paths.
+SUBST_FILES.fix-paths+= ${MOZILLA_DIR}xpcom/io/nsAppFileLocationProvider.cpp
+SUBST_SED.fix-paths+= -e 's,/usr/lib/mozilla/plugins,${PREFIX}/lib/netscape/plugins,g'
+
+CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}build/autoconf/config.guess
+CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}js/src/build/autoconf/config.guess
+CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}nsprpub/build/autoconf/config.guess
+CONFIG_GUESS_OVERRIDE+= ${MOZILLA_DIR}/js/ctypes/libffi/config.guess
+CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}build/autoconf/config.sub
+CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}js/src/build/autoconf/config.sub
+CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}nsprpub/build/autoconf/config.sub
+CONFIG_SUB_OVERRIDE+= ${MOZILLA_DIR}/js/ctypes/libffi/config.sub
+
+CONFIGURE_ENV+= CPP=${CPP:Q}
+ALL_ENV+= SHELL=${CONFIG_SHELL:Q}
+
+# Build outside ${WRKSRC}
+# Try to avoid conflict with config/makefiles/xpidl/Makefile.in
+.if ${MAINTAINER_INTERNAL:Uno} == "yes
+OBJDIR= ../no-node-build
+.else
+OBJDIR= ../build
+.endif
+CONFIGURE_DIRS= ${OBJDIR}
+CONFIGURE_SCRIPT= ${WRKSRC}/configure
+
+PLIST_VARS+= ffvpx
+
+.if ${MACHINE_ARCH} == "aarch64" || \
+ !empty(MACHINE_ARCH:M*arm*) || \
+ ${MACHINE_ARCH} == "i386" || \
+ ${MACHINE_ARCH} == "x86_64"
+PLIST.ffvpx= yes # see media/ffvpx/ffvpxcommon.mozbuild
+.endif
+
+# See ${WRKSRC}/security/sandbox/mac/Sandbox.mm: On Darwin, sandboxing
+# support is only available when the toolkit is cairo-cocoa.
+CONFIGURE_ARGS.Darwin+= --disable-sandbox
+
+# Makefiles sometimes call "rm -f" without more arguments. Kludge around ...
+.PHONY: create-rm-wrapper
+pre-configure: create-rm-wrapper
+create-rm-wrapper:
+ printf '#!/bin/sh\n[ "$$*" = "-f" ] && exit 0\nexec /bin/rm $$@\n' > \
+ ${WRAPPER_DIR}/bin/rm
+ chmod +x ${WRAPPER_DIR}/bin/rm
+
+.PHONY: fix-clang-wrapper
+pre-configure: fix-clang-wrapper
+fix-clang-wrapper:
+.if empty(PKGSRC_COMPILER:M*clang*)
+# Firefox requires Clang during the build, even when building with GCC.
+# XXX: When using GCC, pkgsrc provides 'clang' wrappers that are actually gcc.
+# This breaks the build.
+# PR pkg/55647 https://gnats.netbsd.org/55647
+ ${LN} -sf ${PREFIX}/bin/clang ${WRKDIR}/.cwrapper/bin/clang
+ ${LN} -sf ${PREFIX}/bin/clang++ ${WRKDIR}/.cwrapper/bin/clang++
+ ${LN} -sf ${PREFIX}/bin/clang-cpp ${WRKDIR}/.cwrapper/bin/clang-cpp
+.endif
+
+# The configure test for __thread succeeds, but later we end up with:
+# dist/bin/libxul.so: undefined reference to `__tls_get_addr'
+CONFIGURE_ENV.NetBSD+= ac_cv_thread_keyword=no
+# In unspecified case, clock_gettime(CLOCK_MONOTONIC, ...) fails.
+CONFIGURE_ENV.NetBSD+= ac_cv_clock_monotonic=
+
+.include "../../mk/atomic64.mk"
+BUILDLINK_API_DEPENDS.libevent+= libevent>=1.1
+.include "../../devel/libevent/buildlink3.mk"
+.include "../../devel/libffi/buildlink3.mk"
+BUILDLINK_API_DEPENDS.nspr+= nspr>=4.32
+.include "../../devel/nspr/buildlink3.mk"
+.include "../../textproc/icu/buildlink3.mk"
+BUILDLINK_API_DEPENDS.nss+= nss>=3.68
+.include "../../devel/nss/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+#.include "../../mk/jpeg.buildlink3.mk"
+.include "../../graphics/MesaLib/buildlink3.mk"
+#BUILDLINK_API_DEPENDS.cairo+= cairo>=1.10.2nb4
+#.include "../../graphics/cairo/buildlink3.mk"
+BUILDLINK_API_DEPENDS.libwebp+= libwebp>=1.0.2
+.include "../../graphics/libwebp/buildlink3.mk"
+BUILDLINK_DEPMETHOD.clang= build
+.include "../../lang/clang/buildlink3.mk"
+.if !empty(MACHINE_PLATFORM:MNetBSD-8.*-*)
+BUILDLINK_DEPMETHOD.gcc8= full
+.include "../../lang/gcc8/buildlink3.mk"
+CWRAPPERS_PREPEND.cxx+= \
+ -L${BUILDLINK_PREFIX.gcc8}/gcc8/lib \
+ ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.gcc8}/gcc8/lib \
+ -stdlib++-isystem \
+ ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++ \
+ -stdlib++-isystem \
+ ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++/${MACHINE_GNU_PLATFORM} \
+ -stdlib++-isystem \
+ ${BUILDLINK_PREFIX.gcc8}/gcc8/include/c++/backward
+.endif
+RUST_REQ= 1.51.0
+.include "../../lang/rust/rust.mk"
+# webrtc option requires internal libvpx
+#BUILDLINK_API_DEPENDS.libvpx+= libvpx>=1.3.0
+#.include "../../multimedia/libvpx/buildlink3.mk"
+.include "../../net/libIDL/buildlink3.mk"
+# textproc/hunspell 1.3 is too old
+#.include "../../textproc/hunspell/buildlink3.mk"
+.include "../../multimedia/ffmpeg4/buildlink3.mk"
+.include "../../x11/libXt/buildlink3.mk"
+BUILDLINK_API_DEPENDS.pixman+= pixman>=0.25.2
+.include "../../x11/pixman/buildlink3.mk"
+.include "../../x11/gtk2/buildlink3.mk"
+.include "../../x11/gtk3/buildlink3.mk"
+PLIST_VARS+= wayland
+.if ${PKG_BUILD_OPTIONS.gtk3:Mwayland}
+PLIST.wayland= yes
+.endif
+.include "../../lang/python/pyversion.mk"
diff --git a/www/firefox91/options.mk b/www/firefox91/options.mk
new file mode 100644
index 00000000000..5ae8059d186
--- /dev/null
+++ b/www/firefox91/options.mk
@@ -0,0 +1,80 @@
+# $NetBSD: options.mk,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.firefox
+
+PKG_SUPPORTED_OPTIONS= official-mozilla-branding
+PKG_SUPPORTED_OPTIONS+= debug debug-info mozilla-jemalloc webrtc
+PKG_SUPPORTED_OPTIONS+= alsa pulseaudio dbus
+
+.if ${OPSYS} == "Linux"
+PKG_SUGGESTED_OPTIONS+= pulseaudio mozilla-jemalloc dbus webrtc
+.else
+PKG_SUGGESTED_OPTIONS+= dbus
+.endif
+
+.if ${OPSYS} == "NetBSD" && empty(OS_VERSION:M[0-8].*)
+PKG_SUGGESTED_OPTIONS+= webrtc
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Malsa)
+CONFIGURE_ARGS+= --enable-alsa
+.include "../../audio/alsa-lib/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-alsa
+.endif
+
+.if !empty(PKG_OPTIONS:Mmozilla-jemalloc)
+CONFIGURE_ARGS+= --enable-jemalloc
+CONFIGURE_ARGS+= --enable-replace-malloc
+.else
+CONFIGURE_ARGS+= --disable-jemalloc
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+CONFIGURE_ARGS+= --enable-debug="-g -Og"
+CONFIGURE_ARGS+= --disable-optimize
+CONFIGURE_ARGS+= --enable-debug-js-modules
+CONFIGURE_ARGS+= --disable-install-strip
+.else
+. if !empty(PKG_OPTIONS:Mdebug-info)
+CONFIGURE_ARGS+= --enable-debug-symbols
+CONFIGURE_ARGS+= --enable-optimize=-O2
+CONFIGURE_ARGS+= --disable-install-strip
+. else
+CONFIGURE_ARGS+= --disable-debug-symbols
+CONFIGURE_ARGS+= --enable-optimize=-O2
+CONFIGURE_ARGS+= --enable-install-strip
+. endif
+CONFIGURE_ARGS+= --disable-debug
+.endif
+
+.if !empty(PKG_OPTIONS:Mpulseaudio)
+.include "../../audio/pulseaudio/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-pulseaudio
+.else
+CONFIGURE_ARGS+= --disable-pulseaudio
+.endif
+
+.if !empty(PKG_OPTIONS:Mdbus)
+.include "../../sysutils/dbus-glib/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-dbus
+.else
+CONFIGURE_ARGS+= --disable-dbus
+.endif
+
+.if !empty(PKG_OPTIONS:Mofficial-mozilla-branding)
+CONFIGURE_ARGS+= --enable-official-branding
+LICENSE= mozilla-trademark-license
+RESTRICTED= Trademark holder prohibits distribution of modified versions.
+NO_BIN_ON_CDROM= ${RESTRICTED}
+NO_BIN_ON_FTP= ${RESTRICTED}
+.endif
+
+.if !empty(PKG_OPTIONS:Mwebrtc)
+.include "../../graphics/libv4l/buildlink3.mk"
+CONFIGURE_ARGS+= --enable-webrtc
+.else
+CONFIGURE_ARGS+= --disable-webrtc
+.endif
diff --git a/www/firefox91/patches/patch-aa b/www/firefox91/patches/patch-aa
new file mode 100644
index 00000000000..2a043a7592e
--- /dev/null
+++ b/www/firefox91/patches/patch-aa
@@ -0,0 +1,26 @@
+$NetBSD: patch-aa,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* Add Sun audio support
+
+--- 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 ========================================================
diff --git a/www/firefox91/patches/patch-browser_app_profile_firefox.js b/www/firefox91/patches/patch-browser_app_profile_firefox.js
new file mode 100644
index 00000000000..0a68fe69abd
--- /dev/null
+++ b/www/firefox91/patches/patch-browser_app_profile_firefox.js
@@ -0,0 +1,17 @@
+$NetBSD: patch-browser_app_profile_firefox.js,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-build_moz.configure_rust.configure b/www/firefox91/patches/patch-build_moz.configure_rust.configure
new file mode 100644
index 00000000000..dd65d004248
--- /dev/null
+++ b/www/firefox91/patches/patch-build_moz.configure_rust.configure
@@ -0,0 +1,15 @@
+$NetBSD: patch-build_moz.configure_rust.configure,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* Do not match rumprun toolchain for NetBSD,
+ narrowed should be one not two.
+
+--- build/moz.configure/rust.configure.orig 2020-12-03 23:12:39.000000000 +0000
++++ build/moz.configure/rust.configure
+@@ -371,6 +371,7 @@ def detect_rustc_target(
+ for c in candidates
+ if c.target.raw_os == host_or_target.raw_os
+ and 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/firefox91/patches/patch-config_gcc-stl-wrapper.template.h b/www/firefox91/patches/patch-config_gcc-stl-wrapper.template.h
new file mode 100644
index 00000000000..9889fceff3b
--- /dev/null
+++ b/www/firefox91/patches/patch-config_gcc-stl-wrapper.template.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-config_gcc-stl-wrapper.template.h,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+--- config/gcc-stl-wrapper.template.h.orig 2021-04-08 21:20:01.000000000 +0000
++++ config/gcc-stl-wrapper.template.h
+@@ -32,8 +32,8 @@
+ // bug 1694575 (iosfwd).
+ // Please be careful when adding more exceptions, especially regarding
+ // the header not directly or indirectly including <new>.
+-#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
+@@ -51,7 +51,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
+@@ -80,4 +80,6 @@
+ # include "mozilla/throw_gcc.h"
+ #endif
+
++#undef moz_dont_include_mzalloc_for_${HEADER}
++
+ #endif // if mozilla_${HEADER}_h
diff --git a/www/firefox91/patches/patch-config_makefiles_rust.mk b/www/firefox91/patches/patch-config_makefiles_rust.mk
new file mode 100644
index 00000000000..4b4e223f854
--- /dev/null
+++ b/www/firefox91/patches/patch-config_makefiles_rust.mk
@@ -0,0 +1,17 @@
+$NetBSD: patch-config_makefiles_rust.mk,v 1.1 2021/09/08 22:19:50 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 2021-01-14 21:11:33.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
+
+ # We also need to rebuild the rust stdlib so that it's instrumented. Because
+ # build-std is still pretty experimental, we need to explicitly request
diff --git a/www/firefox91/patches/patch-dom_base_nsAttrName.h b/www/firefox91/patches/patch-dom_base_nsAttrName.h
new file mode 100644
index 00000000000..ee8243ff977
--- /dev/null
+++ b/www/firefox91/patches/patch-dom_base_nsAttrName.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-dom_base_nsAttrName.h,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp b/www/firefox91/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp
new file mode 100644
index 00000000000..7fd375dbc3b
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h b/www/firefox91/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h
new file mode 100644
index 00000000000..76ed10bf170
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c b/www/firefox91/patches/patch-gfx_cairo_cairo_src_cairo-type1-subset.c
new file mode 100644
index 00000000000..1206b4ff753
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp b/www/firefox91/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp
new file mode 100644
index 00000000000..d09ff3e1a4a
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-gfx_thebes_gfxPlatform.cpp b/www/firefox91/patches/patch-gfx_thebes_gfxPlatform.cpp
new file mode 100644
index 00000000000..72364e2084d
--- /dev/null
+++ b/www/firefox91/patches/patch-gfx_thebes_gfxPlatform.cpp
@@ -0,0 +1,28 @@
+$NetBSD: patch-gfx_thebes_gfxPlatform.cpp,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-gfx_wr_swgl_build.rs b/www/firefox91/patches/patch-gfx_wr_swgl_build.rs
new file mode 100644
index 00000000000..6cdde220f54
--- /dev/null
+++ b/www/firefox91/patches/patch-gfx_wr_swgl_build.rs
@@ -0,0 +1,27 @@
+$NetBSD: patch-gfx_wr_swgl_build.rs,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+Work around an internal compiler error on i386 when optimization is enabled:
+
+ cargo:warning=In file included from src/gl.cc:2637:0:
+ cargo:warning=src/rasterize.h: In function 'void draw_quad_spans(int, Point2D*, uint32_t, glsl::Interpolants*, Texture&, Texture&, const ClipRect&) [with P = unsigned char]':
+ cargo:warning=src/rasterize.h:782:20: internal compiler error: in convert_move, at expr.c:231
+ cargo:warning= static inline void draw_quad_spans(int nump, Point2D p[4], uint32_t z,
+ cargo:warning= ^~~~~~~~~~~~~~~
+
+
+--- gfx/wr/swgl/build.rs.orig 2021-08-23 14:57:16.000000000 +0000
++++ gfx/wr/swgl/build.rs
+@@ -196,6 +196,13 @@ fn main() {
+ }
+ }
+
++ // Work around a compiler bug
++ let target_triple = std::env::var("TARGET").expect("The TARGET environment variable must be set");
++ let target_name = target_triple.split('-').next().unwrap();
++ if ["i386", "i586", "i686"].contains(&target_name) {
++ build.flag("-O0");
++ }
++
+ build.file("src/gl.cc")
+ .define("_GLIBCXX_USE_CXX11_ABI", Some("0"))
+ .include(shader_dir)
diff --git a/www/firefox91/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc b/www/firefox91/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
new file mode 100644
index 00000000000..7803fb00f1c
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc b/www/firefox91/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
new file mode 100644
index 00000000000..7712aeed3e8
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-ipc_glue_GeckoChildProcessHost.cpp b/www/firefox91/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
new file mode 100644
index 00000000000..bc12ac4df10
--- /dev/null
+++ b/www/firefox91/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
@@ -0,0 +1,21 @@
+$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-js_src_jit_ProcessExecutableMemory.cpp b/www/firefox91/patches/patch-js_src_jit_ProcessExecutableMemory.cpp
new file mode 100644
index 00000000000..38c511c3978
--- /dev/null
+++ b/www/firefox91/patches/patch-js_src_jit_ProcessExecutableMemory.cpp
@@ -0,0 +1,38 @@
+$NetBSD: patch-js_src_jit_ProcessExecutableMemory.cpp,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+PaX MPROTECT safety for NetBSD.
+
+--- js/src/jit/ProcessExecutableMemory.cpp.orig 2021-02-11 21:17:13.000000000 +0000
++++ js/src/jit/ProcessExecutableMemory.cpp
+@@ -362,9 +362,16 @@ static void* ReserveProcessExecutableMem
+ // Note that randomAddr is just a hint: if the address is not available
+ // mmap will pick a different address.
+ void* randomAddr = ComputeRandomAllocationAddress();
++#ifdef PROT_MPROTECT
++ void* p = MozTaggedAnonymousMmap(randomAddr, bytes,
++ PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
++ MAP_PRIVATE | MAP_ANON, -1, 0,
++ "js-executable-memory");
++#else
+ void* p = MozTaggedAnonymousMmap(randomAddr, bytes, PROT_NONE,
+ MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1,
+ 0, "js-executable-memory");
++#endif
+ if (p == MAP_FAILED) {
+ return nullptr;
+ }
+@@ -409,8 +416,12 @@ static unsigned ProtectionSettingToFlags
+
+ [[nodiscard]] static bool CommitPages(void* addr, size_t bytes,
+ ProtectionSetting protection) {
+- void* p = MozTaggedAnonymousMmap(
+- addr, bytes, ProtectionSettingToFlags(protection),
++ void* p = MozTaggedAnonymousMmap(addr, bytes,
++#ifdef PROT_MPROTECT
++ ProtectionSettingToFlags(protection) | PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
++#else
++ ProtectionSettingToFlags(protection),
++#endif
+ MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0, "js-executable-memory");
+ if (p == MAP_FAILED) {
+ return false;
diff --git a/www/firefox91/patches/patch-js_src_jit_arm64_vixl_MozCpu-vixl.cpp b/www/firefox91/patches/patch-js_src_jit_arm64_vixl_MozCpu-vixl.cpp
new file mode 100644
index 00000000000..7791f80eccd
--- /dev/null
+++ b/www/firefox91/patches/patch-js_src_jit_arm64_vixl_MozCpu-vixl.cpp
@@ -0,0 +1,38 @@
+$NetBSD: patch-js_src_jit_arm64_vixl_MozCpu-vixl.cpp,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+NetBSD/aarch64 does not have the Linux-specific membarrier(2) syscall.
+
+--- js/src/jit/arm64/vixl/MozCpu-vixl.cpp.orig 2020-11-12 18:04:48.000000000 +0000
++++ js/src/jit/arm64/vixl/MozCpu-vixl.cpp
+@@ -42,6 +42,8 @@
+ # elif defined(__ANDROID__)
+ # include <sys/syscall.h>
+ # include <unistd.h>
++# elif defined(__NetBSD__)
++ // nothing
+ # else
+ # error "Missing platform-specific declarations for membarrier syscall!"
+ # endif // __linux__ / ANDROID
+@@ -49,7 +51,11 @@
+ # include "vm/JSContext.h" // TlsContext
+
+ static int membarrier(int cmd, int flags) {
++#if defined(__NetBSD__)
++ return ENOSYS;
++#else
+ return syscall(__NR_membarrier, cmd, flags);
++#endif
+ }
+
+ // These definitions come from the Linux kernel source, for kernels before 4.16
+@@ -116,7 +122,9 @@ uint32_t CPU::GetCacheType() {
+ }
+
+ bool CPU::CanFlushICacheFromBackgroundThreads() {
+-#if defined(__aarch64__) && (defined(__linux__) || defined(__android__))
++#if defined(__NetBSD__) && defined(__aarch64__)
++ return false;
++#elif defined(__aarch64__) && (defined(__linux__) || defined(__android__))
+ // On linux, check the kernel supports membarrier(2), that is, it's a kernel
+ // above Linux 4.16 included.
+ //
diff --git a/www/firefox91/patches/patch-js_src_jsfriendapi.h b/www/firefox91/patches/patch-js_src_jsfriendapi.h
new file mode 100644
index 00000000000..0959f6384d4
--- /dev/null
+++ b/www/firefox91/patches/patch-js_src_jsfriendapi.h
@@ -0,0 +1,14 @@
+$NetBSD: patch-js_src_jsfriendapi.h,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* Fix va_list error.
+
+--- js/src/jsfriendapi.h.orig 2020-09-17 00:32:45.000000000 +0000
++++ js/src/jsfriendapi.h
+@@ -10,6 +10,7 @@
+ #include "mozilla/MemoryReporting.h"
+ #include "mozilla/PodOperations.h"
+
++#include <stdarg.h>
+ #include "jspubtd.h"
+
+ #include "js/CallArgs.h"
diff --git a/www/firefox91/patches/patch-js_src_util_NativeStack.cpp b/www/firefox91/patches/patch-js_src_util_NativeStack.cpp
new file mode 100644
index 00000000000..1e7c05cbc02
--- /dev/null
+++ b/www/firefox91/patches/patch-js_src_util_NativeStack.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-js_src_util_NativeStack.cpp,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-js_src_vm_ArrayBufferObject.cpp b/www/firefox91/patches/patch-js_src_vm_ArrayBufferObject.cpp
new file mode 100644
index 00000000000..6cfefcb3848
--- /dev/null
+++ b/www/firefox91/patches/patch-js_src_vm_ArrayBufferObject.cpp
@@ -0,0 +1,24 @@
+$NetBSD: patch-js_src_vm_ArrayBufferObject.cpp,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+PaX MPROTECT safety for NetBSD.
+
+--- js/src/vm/ArrayBufferObject.cpp.orig 2021-05-20 21:29:34.000000000 +0000
++++ js/src/vm/ArrayBufferObject.cpp
+@@ -189,9 +189,17 @@ void* js::MapBufferMemory(size_t mappedS
+ MOZ_ASSERT(data);
+ memset(data, 0, mappedSize);
+ #else // !XP_WIN && !__wasi__
++
++#ifdef PROT_MPROTECT
++ void* data =
++ MozTaggedAnonymousMmap(nullptr, mappedSize,
++ PROT_MPROTECT(PROT_EXEC | PROT_WRITE | PROT_READ),
++ MAP_PRIVATE | MAP_ANON, -1, 0, "wasm-reserved");
++#else
+ void* data =
+ MozTaggedAnonymousMmap(nullptr, mappedSize, PROT_NONE,
+ MAP_PRIVATE | MAP_ANON, -1, 0, "wasm-reserved");
++#endif
+ if (data == MAP_FAILED) {
+ return nullptr;
+ }
diff --git a/www/firefox91/patches/patch-media_ffvpx_libavutil_arm_bswap.h b/www/firefox91/patches/patch-media_ffvpx_libavutil_arm_bswap.h
new file mode 100644
index 00000000000..e7dd36204bb
--- /dev/null
+++ b/www/firefox91/patches/patch-media_ffvpx_libavutil_arm_bswap.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-media_ffvpx_libavutil_arm_bswap.h,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-media_libcubeb_src_cubeb__alsa.c b/www/firefox91/patches/patch-media_libcubeb_src_cubeb__alsa.c
new file mode 100644
index 00000000000..ca718e8f7f2
--- /dev/null
+++ b/www/firefox91/patches/patch-media_libcubeb_src_cubeb__alsa.c
@@ -0,0 +1,12 @@
+$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-media_libcubeb_src_moz.build b/www/firefox91/patches/patch-media_libcubeb_src_moz.build
new file mode 100644
index 00000000000..005c87aa9c1
--- /dev/null
+++ b/www/firefox91/patches/patch-media_libcubeb_src_moz.build
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libcubeb_src_moz.build,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-media_libpng_pngpriv.h b/www/firefox91/patches/patch-media_libpng_pngpriv.h
new file mode 100644
index 00000000000..ecf8b877a7c
--- /dev/null
+++ b/www/firefox91/patches/patch-media_libpng_pngpriv.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-media_libpng_pngpriv.h,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-media_libtheora_lib_info.c b/www/firefox91/patches/patch-media_libtheora_lib_info.c
new file mode 100644
index 00000000000..03e686a912b
--- /dev/null
+++ b/www/firefox91/patches/patch-media_libtheora_lib_info.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libtheora_lib_info.c,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc b/www/firefox91/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc
new file mode 100644
index 00000000000..da2d82a67aa
--- /dev/null
+++ b/www/firefox91/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc
@@ -0,0 +1,63 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* Fix buiuld under NetBSD.
+ NetBSD's sys/videoio.h does not have v4l2_capability.device_caps
+ and video capture does not work for me anyway.
+
+--- third_party/libwebrtc/webrtc/modules/video_capture/linux/device_info_linux.cc.orig 2021-05-20 21:30:20.000000000 +0000
++++ third_party/libwebrtc/webrtc/modules/video_capture/linux/device_info_linux.cc
+@@ -207,10 +207,12 @@ uint32_t DeviceInfoLinux::NumberOfDevice
+ sprintf(device, "/dev/video%d", n);
+ if ((fd = open(device, O_RDONLY)) != -1) {
+ // query device capabilities and make sure this is a video capture device
++#if !defined(__NetBSD__)
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
+ close(fd);
+ continue;
+ }
++#endif
+
+ close(fd);
+ count++;
+@@ -241,10 +243,12 @@ int32_t DeviceInfoLinux::GetDeviceName(u
+ sprintf(device, "/dev/video%d", device_index);
+ if ((fd = open(device, O_RDONLY)) != -1) {
+ // query device capabilities and make sure this is a video capture device
++#if !defined(__NetBSD__)
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
+ close(fd);
+ continue;
+ }
++#endif
+ if (count == deviceNumber) {
+ // Found the device
+ found = true;
+@@ -328,10 +332,12 @@ int32_t DeviceInfoLinux::CreateCapabilit
+ struct v4l2_capability cap;
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
+ // skip devices without video capture capability
++#if !defined(__NetBSD__)
+ if (!IsVideoCaptureDevice(&cap)) {
+ close(fd);
+ continue;
+ }
++#endif
+
+ if (cap.bus_info[0] != 0) {
+ if (strncmp((const char*)cap.bus_info, (const char*)deviceUniqueIdUTF8,
+@@ -384,6 +390,7 @@ bool DeviceInfoLinux::IsDeviceNameMatche
+ return false;
+ }
+
++#ifndef __NetBSD__
+ bool DeviceInfoLinux::IsVideoCaptureDevice(struct v4l2_capability* cap)
+ {
+ if (cap->capabilities & V4L2_CAP_DEVICE_CAPS) {
+@@ -392,6 +399,7 @@ bool DeviceInfoLinux::IsVideoCaptureDevi
+ return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
+ }
+ }
++#endif
+
+ int32_t DeviceInfoLinux::FillCapabilities(int fd) {
+ // set image format
diff --git a/www/firefox91/patches/patch-mozglue_misc_Uptime.cpp b/www/firefox91/patches/patch-mozglue_misc_Uptime.cpp
new file mode 100644
index 00000000000..85639b1e4a6
--- /dev/null
+++ b/www/firefox91/patches/patch-mozglue_misc_Uptime.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-mozglue_misc_Uptime.cpp,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* Define uptime-related functions for NetBSD too.
+
+--- mozglue/misc/Uptime.cpp.orig 2021-05-20 21:29:40.000000000 +0000
++++ mozglue/misc/Uptime.cpp
+@@ -76,7 +76,7 @@ Maybe<uint64_t> NowIncludingSuspendMs()
+ return Some(interrupt_time / kHNSperMS);
+ }
+
+-#elif defined(XP_LINUX) // including Android
++#elif defined(OS_LINUX) || defined(XP_UNIX) // including Android
+ # include <time.h>
+
+ // Number of nanoseconds in a millisecond.
diff --git a/www/firefox91/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c b/www/firefox91/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
new file mode 100644
index 00000000000..ee2bc6c5653
--- /dev/null
+++ b/www/firefox91/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
@@ -0,0 +1,110 @@
+$NetBSD: patch-nsprpub_pr_src_pthreads_ptsynch.c,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-security_nss_lib_freebl_mpi_mpi.c b/www/firefox91/patches/patch-security_nss_lib_freebl_mpi_mpi.c
new file mode 100644
index 00000000000..fe8c5ca138d
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-toolkit_components_terminator_nsTerminator.cpp b/www/firefox91/patches/patch-toolkit_components_terminator_nsTerminator.cpp
new file mode 100644
index 00000000000..f8c597aa4ff
--- /dev/null
+++ b/www/firefox91/patches/patch-toolkit_components_terminator_nsTerminator.cpp
@@ -0,0 +1,27 @@
+$NetBSD: patch-toolkit_components_terminator_nsTerminator.cpp,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* Fix segfault on exit under NetBSD
+
+--- toolkit/components/terminator/nsTerminator.cpp.orig 2021-04-08 21:20:12.000000000 +0000
++++ toolkit/components/terminator/nsTerminator.cpp
+@@ -37,7 +37,7 @@
+ #if defined(XP_WIN)
+ # include <windows.h>
+ #else
+-# include <unistd.h>
++# include <time.h>
+ #endif
+
+ #include "mozilla/AppShutdown.h"
+@@ -238,7 +238,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 we are still alive then we just crash.
diff --git a/www/firefox91/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js b/www/firefox91/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js
new file mode 100644
index 00000000000..cbabcf1e5fa
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 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/firefox91/patches/patch-toolkit_moz.configure b/www/firefox91/patches/patch-toolkit_moz.configure
new file mode 100644
index 00000000000..71e7f5e1e5e
--- /dev/null
+++ b/www/firefox91/patches/patch-toolkit_moz.configure
@@ -0,0 +1,23 @@
+$NetBSD: patch-toolkit_moz.configure,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+* skia part: support bigendian architectures
+
+--- toolkit/moz.configure.orig 2020-12-03 23:14:21.000000000 +0000
++++ toolkit/moz.configure
+@@ -927,11 +927,11 @@ set_config("MOZ_IPDL_TESTS", depends_if(
+ 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
+
+
diff --git a/www/firefox91/patches/patch-toolkit_mozapps_installer_packager.mk b/www/firefox91/patches/patch-toolkit_mozapps_installer_packager.mk
new file mode 100644
index 00000000000..5cdb97e9a41
--- /dev/null
+++ b/www/firefox91/patches/patch-toolkit_mozapps_installer_packager.mk
@@ -0,0 +1,15 @@
+$NetBSD: patch-toolkit_mozapps_installer_packager.mk,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-widget_gtk_DMABufSurface.cpp b/www/firefox91/patches/patch-widget_gtk_DMABufSurface.cpp
new file mode 100644
index 00000000000..e1934fd2d4b
--- /dev/null
+++ b/www/firefox91/patches/patch-widget_gtk_DMABufSurface.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-widget_gtk_DMABufSurface.cpp,v 1.1 2021/09/08 22:19:50 nia Exp $
+
+No eventfd on netbsd, fix build
+
+--- widget/gtk/DMABufSurface.cpp.orig 2021-04-08 21:20:12.000000000 +0000
++++ widget/gtk/DMABufSurface.cpp
+@@ -18,7 +18,9 @@
+ #include <sys/time.h>
+ #include <dlfcn.h>
+ #include <sys/mman.h>
++#ifndef __NetBSD__
+ #include <sys/eventfd.h>
++#endif
+ #include <poll.h>
+ #include <sys/ioctl.h>
+
+@@ -97,6 +99,7 @@ void DMABufSurface::GlobalRefAdd() {
+ }
+
+ void DMABufSurface::GlobalRefCountCreate() {
++#ifndef __NetBSD__
+ MOZ_ASSERT(!mGlobalRefCountFd);
+ mGlobalRefCountFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK | EFD_SEMAPHORE);
+ if (mGlobalRefCountFd < 0) {
+@@ -106,6 +109,7 @@ void DMABufSurface::GlobalRefCountCreate
+ mGlobalRefCountFd = 0;
+ return;
+ }
++#endif
+ }
+
+ void DMABufSurface::GlobalRefCountImport(int aFd) {
diff --git a/www/firefox91/patches/patch-xpcom_base_nscore.h b/www/firefox91/patches/patch-xpcom_base_nscore.h
new file mode 100644
index 00000000000..c9a4a455815
--- /dev/null
+++ b/www/firefox91/patches/patch-xpcom_base_nscore.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-xpcom_base_nscore.h,v 1.1 2021/09/08 22:19:50 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/firefox91/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build b/www/firefox91/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build
new file mode 100644
index 00000000000..9e7d31bf967
--- /dev/null
+++ b/www/firefox91/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 2021/09/08 22:19:50 nia Exp $
+
+Make NetBSD/sparc64 use the same xptcall bindings as all other sparc64 ports
+
+--- xpcom/reflect/xptcall/md/unix/moz.build.orig 2020-12-03 23:14:25.000000000 +0000
++++ xpcom/reflect/xptcall/md/unix/moz.build
+@@ -225,7 +225,7 @@ if CONFIG["OS_ARCH"] == "OpenBSD" and CO
+ ]
+
+ if (
+- CONFIG["OS_ARCH"] in ("OpenBSD", "FreeBSD", "Linux", "SunOS")
++ CONFIG["OS_ARCH"] in ("OpenBSD", "FreeBSD", "NetBSD", "Linux", "SunOS")
+ and CONFIG["CPU_ARCH"] == "sparc64"
+ ):
+ SOURCES += [