pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

import firefox102 into wip for debugging with clang



Module Name:	pkgsrc-wip
Committed By:	nikita <nikita%NetBSD.org@localhost>
Pushed By:	nikita
Date:		Mon May 15 22:56:09 2023 +0200
Changeset:	bd6b1a357270a63baec95e517e9b17ddf0200b85

Added Files:
	firefox102/DESCR
	firefox102/Makefile
	firefox102/PLIST
	firefox102/PLIST.Linux
	firefox102/TODO
	firefox102/distinfo
	firefox102/files/desktop.in
	firefox102/files/node-wrapper.sh
	firefox102/files/replace-moz.build.awk
	firefox102/mozilla-common.mk
	firefox102/options.mk
	firefox102/patch-dom_media_webrtc_sdp_RsdparsaSdpGlue.cpp
	firefox102/patch-gfx_2d_Rect.h
	firefox102/patch-toolkit_components_telemetry_pingsender_pingsender.cpp
	firefox102/patch-tools_profiler_public_ProfilerThreadRegistration.h
	firefox102/patch-tools_profiler_public_ProfilerThreadRegistry.h
	firefox102/patch-tools_profiler_tests_gtest_GeckoProfiler.cpp
	firefox102/patches/patch-Cargo.lock
	firefox102/patches/patch-Cargo.toml
	firefox102/patches/patch-browser_app_profile_firefox.js
	firefox102/patches/patch-build_moz.configure_rust.configure
	firefox102/patches/patch-config_gcc-stl-wrapper.template.h
	firefox102/patches/patch-config_makefiles_rust.mk
	firefox102/patches/patch-dom_base_nsAttrName.h
	firefox102/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp
	firefox102/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h
	firefox102/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp
	firefox102/patches/patch-gfx_skia_skia_src_core_SkVM.cpp
	firefox102/patches/patch-gfx_wr_swgl_build.rs
	firefox102/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
	firefox102/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
	firefox102/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
	firefox102/patches/patch-js_src_jit_ProcessExecutableMemory.cpp
	firefox102/patches/patch-js_src_util_NativeStack.cpp
	firefox102/patches/patch-js_src_vm_ArrayBufferObject.cpp
	firefox102/patches/patch-media_ffvpx_libavutil_arm_bswap.h
	firefox102/patches/patch-media_libcubeb_src_cubeb__alsa.c
	firefox102/patches/patch-media_libcubeb_src_cubeb__jack.cpp
	firefox102/patches/patch-media_libcubeb_src_moz.build
	firefox102/patches/patch-media_libpng_pngpriv.h
	firefox102/patches/patch-media_libtheora_lib_info.c
	firefox102/patches/patch-modules_fdlibm_src_math__private.h
	firefox102/patches/patch-mozglue_misc_Uptime.cpp
	firefox102/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
	firefox102/patches/patch-python_mozbuild_mozbuild_action_langpack_manifest.py
	firefox102/patches/patch-security_nss_lib_freebl_mpi_mpi.c
	firefox102/patches/patch-third__party_js_cfworker_build.sh
	firefox102/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc
	firefox102/patches/patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc
	firefox102/patches/patch-third__party_rust_bindgen_src_clang.rs
	firefox102/patches/patch-third__party_rust_bindgen_src_ir_comp.rs
	firefox102/patches/patch-third__party_rust_bindgen_src_ir_ty.rs
	firefox102/patches/patch-third__party_rust_bindgen_src_ir_var.rs
	firefox102/patches/patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c
	firefox102/patches/patch-toolkit_components_terminator_nsTerminator.cpp
	firefox102/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js
	firefox102/patches/patch-toolkit_moz.configure
	firefox102/patches/patch-toolkit_mozapps_installer_packager.mk
	firefox102/patches/patch-toolkit_xre_glxtest_cpp
	firefox102/patches/patch-widget_gtk_DMABufSurface.cpp
	firefox102/patches/patch-xpcom_base_nscore.h
	firefox102/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build

Log Message:
import firefox102 into wip for debugging with clang

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=bd6b1a357270a63baec95e517e9b17ddf0200b85

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 firefox102/DESCR                                   |  15 ++
 firefox102/Makefile                                | 179 ++++++++++++++++
 firefox102/PLIST                                   |  44 ++++
 firefox102/PLIST.Linux                             |   2 +
 firefox102/TODO                                    |  50 +++++
 firefox102/distinfo                                |  53 +++++
 firefox102/files/desktop.in                        | 191 +++++++++++++++++
 firefox102/files/node-wrapper.sh                   |   9 +
 firefox102/files/replace-moz.build.awk             |  22 ++
 firefox102/mozilla-common.mk                       | 232 +++++++++++++++++++++
 firefox102/options.mk                              |  97 +++++++++
 .../patch-dom_media_webrtc_sdp_RsdparsaSdpGlue.cpp |  14 ++
 firefox102/patch-gfx_2d_Rect.h                     |  14 ++
 ..._components_telemetry_pingsender_pingsender.cpp |  14 ++
 ...ls_profiler_public_ProfilerThreadRegistration.h |  23 ++
 ...-tools_profiler_public_ProfilerThreadRegistry.h |  23 ++
 ...ch-tools_profiler_tests_gtest_GeckoProfiler.cpp |  33 +++
 firefox102/patches/patch-Cargo.lock                |  33 +++
 firefox102/patches/patch-Cargo.toml                |  32 +++
 .../patches/patch-browser_app_profile_firefox.js   |  41 ++++
 .../patch-build_moz.configure_rust.configure       |  15 ++
 .../patch-config_gcc-stl-wrapper.template.h        |  31 +++
 firefox102/patches/patch-config_makefiles_rust.mk  |  30 +++
 firefox102/patches/patch-dom_base_nsAttrName.h     |  18 ++
 ...c_common_third__party_smhasher_src_PMurHash.cpp |  17 ++
 ...gle_checkout_src_compiler_translator_InfoSink.h |  16 ++
 .../patches/patch-gfx_skia_skia_src_core_SkCpu.cpp |  15 ++
 .../patches/patch-gfx_skia_skia_src_core_SkVM.cpp  |  19 ++
 firefox102/patches/patch-gfx_wr_swgl_build.rs      |  27 +++
 ...pc_chromium_src_base_message__pump__libevent.cc |  22 ++
 ...pc_chromium_src_base_platform__thread__posix.cc |  18 ++
 .../patch-ipc_glue_GeckoChildProcessHost.cpp       |  21 ++
 .../patch-js_src_jit_ProcessExecutableMemory.cpp   |  38 ++++
 .../patches/patch-js_src_util_NativeStack.cpp      |  32 +++
 .../patches/patch-js_src_vm_ArrayBufferObject.cpp  |  24 +++
 .../patch-media_ffvpx_libavutil_arm_bswap.h        |  22 ++
 .../patches/patch-media_libcubeb_src_cubeb__alsa.c |  12 ++
 .../patch-media_libcubeb_src_cubeb__jack.cpp       |  15 ++
 .../patches/patch-media_libcubeb_src_moz.build     |  19 ++
 firefox102/patches/patch-media_libpng_pngpriv.h    |  17 ++
 .../patches/patch-media_libtheora_lib_info.c       |  19 ++
 .../patch-modules_fdlibm_src_math__private.h       |  18 ++
 firefox102/patches/patch-mozglue_misc_Uptime.cpp   |  15 ++
 .../patch-nsprpub_pr_src_pthreads_ptsynch.c        | 110 ++++++++++
 ...n_mozbuild_mozbuild_action_langpack_manifest.py |  27 +++
 .../patch-security_nss_lib_freebl_mpi_mpi.c        |  35 ++++
 .../patch-third__party_js_cfworker_build.sh        |  20 ++
 ...les_video__capture_linux_device__info__linux.cc |  63 ++++++
 ...system__wrappers_source_cpu__features__linux.cc |  25 +++
 .../patch-third__party_rust_bindgen_src_clang.rs   |  36 ++++
 .../patch-third__party_rust_bindgen_src_ir_comp.rs |  33 +++
 .../patch-third__party_rust_bindgen_src_ir_ty.rs   | 123 +++++++++++
 .../patch-third__party_rust_bindgen_src_ir_var.rs  |  40 ++++
 ...ch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c |  27 +++
 ...-toolkit_components_terminator_nsTerminator.cpp |  27 +++
 ..._modules_subprocess_subprocess__shared__unix.js |  26 +++
 firefox102/patches/patch-toolkit_moz.configure     |  57 +++++
 .../patch-toolkit_mozapps_installer_packager.mk    |  15 ++
 firefox102/patches/patch-toolkit_xre_glxtest_cpp   |  17 ++
 .../patches/patch-widget_gtk_DMABufSurface.cpp     |  32 +++
 firefox102/patches/patch-xpcom_base_nscore.h       |  15 ++
 .../patch-xpcom_reflect_xptcall_md_unix_moz.build  |  15 ++
 62 files changed, 2344 insertions(+)

diffs:
diff --git a/firefox102/DESCR b/firefox102/DESCR
new file mode 100644
index 0000000000..a52f4a07f3
--- /dev/null
+++ b/firefox102/DESCR
@@ -0,0 +1,15 @@
+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.
+
+Note: Due to upstream's trademark policies, this package identifies as
+"Nightly" rather than "Firefox" by default.
+
+This package provides Firefox 102 Extended Support Release.
diff --git a/firefox102/Makefile b/firefox102/Makefile
new file mode 100644
index 0000000000..887a8d3058
--- /dev/null
+++ b/firefox102/Makefile
@@ -0,0 +1,179 @@
+# $NetBSD: Makefile,v 1.20 2023/05/14 19:50:11 nia Exp $
+
+FIREFOX_VER=		${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
+MOZ_BRANCH=		102.11
+MOZ_BRANCH_MINOR=	.0esr
+
+DISTNAME=	firefox-${FIREFOX_VER}.source
+PKGNAME=	${DISTNAME:S/.source//:S/b/beta/:S/esr//:S/firefox-/firefox102-/g}
+PKGREVISION=	1
+CATEGORIES=	www
+MASTER_SITES+=	${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
+EXTRACT_SUFX=	.tar.xz
+
+NODEJSKIT=		nodejs-output-95.0.tgz
+DISTFILES=		${DEFAULT_DISTFILES} ${NODEJSKIT}
+SITES.${NODEJSKIT}=	${MASTER_SITE_LOCAL}
+
+MAINTAINER=	ryoon%NetBSD.org@localhost
+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-${PKGVERSION_NOREV}
+
+MOZILLA_DIR=	# empty
+
+# Note: In --enable-chrome-format=flat case,
+#       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
+
+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}
+
+.if !empty(PKG_OPTIONS:Mofficial-mozilla-branding)
+MOZILLA_NAME=		Firefox
+MOZILLA_BRANDING=	official
+.else
+MOZILLA_NAME=		Browser
+MOZILLA_BRANDING=	unofficial
+.endif
+
+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
+
+pre-patch:
+	for f in $$(find ${WRKSRC}/third_party/libwebrtc -name moz.build -type f) ; \
+	do \
+		${AWK} -f ${FILESDIR}/replace-moz.build.awk $$f > $$f.new; mv $$f.new $$f ; \
+	done
+
+post-build:
+	${SED} -e 's|@MOZILLA@|${MOZILLA}|g'				\
+	  -e 's|@MOZILLA_NAME@|${MOZILLA_NAME}|g'			\
+	  -e 's|@FIREFOX_ICON@|${MOZILLA}|g'				\
+	  < ${FILESDIR}/desktop.in					\
+	  > ${WRKDIR}/desktop
+
+INSTALLATION_DIRS+=	share/applications
+
+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
+.for i in 16 22 24 32 48 64 128 256
+	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/icons/hicolor/${i}x${i}/apps
+	${INSTALL_DATA} ${WRKSRC}/browser/branding/${MOZILLA_BRANDING}/default${i}.png \
+	  ${DESTDIR}${PREFIX}/share/icons/hicolor/${i}x${i}/apps/${MOZILLA}.png
+.endfor
+
+.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/firefox102/PLIST b/firefox102/PLIST
new file mode 100644
index 0000000000..9ff89af481
--- /dev/null
+++ b/firefox102/PLIST
@@ -0,0 +1,44 @@
+@comment $NetBSD: PLIST,v 1.1 2022/07/21 23:56:38 nia Exp $
+bin/firefox102
+lib/firefox102/application.ini
+lib/firefox102/browser/chrome/icons/default/default128.png
+lib/firefox102/browser/chrome/icons/default/default16.png
+lib/firefox102/browser/chrome/icons/default/default32.png
+lib/firefox102/browser/chrome/icons/default/default48.png
+lib/firefox102/browser/chrome/icons/default/default64.png
+lib/firefox102/browser/features/doh-rollout%mozilla.org.xpi@localhost
+lib/firefox102/browser/features/formautofill%mozilla.org.xpi@localhost
+lib/firefox102/browser/features/pictureinpicture%mozilla.org.xpi@localhost
+lib/firefox102/browser/features/screenshots%mozilla.org.xpi@localhost
+lib/firefox102/browser/features/webcompat-reporter%mozilla.org.xpi@localhost
+lib/firefox102/browser/features/webcompat%mozilla.org.xpi@localhost
+lib/firefox102/browser/omni.ja
+lib/firefox102/defaults/pref/channel-prefs.js
+lib/firefox102/dependentlibs.list
+lib/firefox102/firefox102
+lib/firefox102/firefox102-bin
+lib/firefox102/fonts/TwemojiMozilla.ttf
+lib/firefox102/gmp-clearkey/0.1/libclearkey.so
+lib/firefox102/gmp-clearkey/0.1/manifest.json
+lib/firefox102/libipcclientcerts.so
+lib/firefox102/liblgpllibs.so
+${PLIST.ffvpx}lib/firefox102/libmozavcodec.so
+${PLIST.ffvpx}lib/firefox102/libmozavutil.so
+lib/firefox102/libmozgtk.so
+lib/firefox102/libmozsqlite3.so
+${PLIST.wayland}lib/firefox102/libmozwayland.so
+lib/firefox102/libxul.so
+lib/firefox102/omni.ja
+lib/firefox102/pingsender
+lib/firefox102/platform.ini
+lib/firefox102/plugin-container
+lib/firefox102/removed-files
+share/applications/firefox102.desktop
+share/icons/hicolor/128x128/apps/firefox102.png
+share/icons/hicolor/16x16/apps/firefox102.png
+share/icons/hicolor/22x22/apps/firefox102.png
+share/icons/hicolor/24x24/apps/firefox102.png
+share/icons/hicolor/256x256/apps/firefox102.png
+share/icons/hicolor/32x32/apps/firefox102.png
+share/icons/hicolor/48x48/apps/firefox102.png
+share/icons/hicolor/64x64/apps/firefox102.png
diff --git a/firefox102/PLIST.Linux b/firefox102/PLIST.Linux
new file mode 100644
index 0000000000..be7819d168
--- /dev/null
+++ b/firefox102/PLIST.Linux
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST.Linux,v 1.1 2022/07/21 23:56:38 nia Exp $
+lib/firefox/libmozsandbox.so
diff --git a/firefox102/TODO b/firefox102/TODO
new file mode 100644
index 0000000000..d4c28d52b1
--- /dev/null
+++ b/firefox102/TODO
@@ -0,0 +1,50 @@
+Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: DRM device has no render node (t=2.47243) [GFX1-]: glxtest: DRM device has no render node
+ATTENTION: default value of option mesa_glthread overridden by environment.
+ATTENTION: default value of option mesa_glthread overridden by environment.
+[GLX] window 14d has VisualID 0x20
+GL_VENDOR: Intel
+mVendor: Intel
+GL_RENDERER: Mesa Intel(R) HD Graphics 5500 (BDW GT2)
+mRenderer: Unknown
+mIsMesa: 1
+[Parent 5791, GLXVsyncThread] WARNING: robust_buffer_access_behavior marked as unsupported: file /usr/work/www/firefox102/work/firefox-102.11.0/gfx/gl/GLContextFeatures.cpp:630
+ATTENTION: default value of option mesa_glthread overridden by environment.
+Initializing context 0x780ee35f6d80 surface 0x0 on display 0x780eeb875000
+[Parent 5791, Renderer] WARNING: robust_buffer_access_behavior marked as unsupported: file /usr/work/www/firefox102/work/firefox-102.11.0/gfx/gl/GLContextFeatures.cpp:630
+[Parent 16464, IPC Launch #1] WARNING: Problem closing fd: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/chromium/src/base/process_util_posix.cc:184
+[Parent 16464, IPC Launch #1] WARNING: Problem closing fd: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/chromium/src/base/process_util_posix.cc:184
+[Socket 16464, Main Thread] WARNING: 'NS_FAILED(rv)', file /usr/work/www/firefox102/work/firefox-102.11.0/netwerk/protocol/http/nsHttpHandler.cpp:339
+[Parent 5791, Main Thread] WARNING: Can't get nsINetworkLinkService.: file /usr/work/www/firefox102/work/firefox-102.11.0/dom/media/VideoUtils.cpp:1020
+[Parent 5791, Main Thread] WARNING: Can't get nsINetworkLinkService.: file /usr/work/www/firefox102/work/firefox-102.11.0/dom/media/VideoUtils.cpp:1020
+[2023-05-15T20:54:52Z WARN  webrender::device::gl] Missing optimized shader source for gpu_cache_update
+[Parent 18407, IPC Launch #1] WARNING: Problem closing fd: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/chromium/src/base/process_util_posix.cc:184
+[Parent 18407, IPC Launch #1] WARNING: Problem closing fd: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/chromium/src/base/process_util_posix.cc:184
+Assertion failure: i < NUM_TEST_EV_ROOTS (Could not find built-in EV root), at /usr/work/www/firefox102/work/firefox-102.11.0/security/certverifier/ExtendedValidation.cpp:1246
+#01: void std::__introsort_loop<unsigned short*, long, __gnu_cxx::__ops::_Iter_less_iter>(unsigned short*, unsigned short*, long, __gnu_cxx::__ops::_Iter_less_iter)[/usr/pkg/lib/firefox102/libxul.so +0x8ec3026]
+#02: std::vector<unsigned char, std::allocator<unsigned char> >::_M_erase(__gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::allocator<unsigned char> > >, __gnu_cxx::__normal_iterator<unsigned char*, std::vector<unsigned char, std::al[/usr/pkg/lib/firefox102/libxul.so +0x8f364a6]
+#03: std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::a[/usr/pkg/lib/firefox102/libxul.so +0x33b3a0c]
+#04: std::__throw_bad_alloc()[/usr/pkg/lib/firefox102/libxul.so +0x33abf5a]
+#05: std::__throw_bad_alloc()[/usr/pkg/lib/firefox102/libxul.so +0x339ec9a]
+#06: std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<ch[/usr/pkg/lib/firefox102/libxul.so +0x3c19e53]
+#07: std::function<void (unsigned int&&)>::operator()(unsigned int&&) const[/usr/pkg/lib/firefox102/libxul.so +0x3ba6f84]
+#08: std::function<void (unsigned int&&)>::operator()(unsigned int&&) const[/usr/pkg/lib/firefox102/libxul.so +0x3ba6fe3]
+#09: std::function<void (unsigned int&&)>::operator()(unsigned int&&) const[/usr/pkg/lib/firefox102/libxul.so +0x3ba7592]
+#10: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >& std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allo[/usr/pkg/lib/firefox102/libxul.so +0x33c807e]
+#11: PR_Select[/usr/pkg/lib/nspr/libnspr4.so +0x2a2f6]
+#12: __libc_thr_exit[/usr/lib/libpthread.so.1 +0xd2df]
+#13: _lwp_exit[/usr/lib/libc.so.12 +0x9b800]
+[Socket 16464, IPC I/O Child] WARNING: [DDAC20A42371DFB6.1794589F47B2F83A]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Socket 16464, IPC I/O Child] WARNING: [DDAC20A42371DFB6.1794589F47B2F83A]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+[Child 18407, IPC I/O Child] WARNING: [31EFD23C31F9CB3E.4331ED07FB629BAE]: Ignoring message 'EVENT_MESSAGE' to peer 1.1 due to a missing broker: file /usr/work/www/firefox102/work/firefox-102.11.0/ipc/glue/NodeController.cpp:350
+Exiting due to channel error.
+[Socket 16464, Main Thread] WARNING: Shutting down Socket process early due to a crash!: file /usr/work/www/firefox102/work/firefox-102.11.0/netwerk/ipc/SocketProcessChild.cpp:177
+[1]   Segmentation fault (core dumped) /usr/pkg/lib/firefox102/firefox102 "${@}"
+
diff --git a/firefox102/distinfo b/firefox102/distinfo
new file mode 100644
index 0000000000..bb1ba6aa7c
--- /dev/null
+++ b/firefox102/distinfo
@@ -0,0 +1,53 @@
+$NetBSD: distinfo,v 1.12 2023/05/14 19:50:11 nia Exp $
+
+BLAKE2s (firefox-102.11.0esr.source.tar.xz) = 887d19cbbb6ec1439c010eb4da55664a77815742d861d2bc540e92acedf73a7b
+SHA512 (firefox-102.11.0esr.source.tar.xz) = fdfed404c87f33001c0ab50f9899fa80c897fac645be8ed832e426f412aafbf1468b1c8301bad463b3f5535b6d6f2005a96a748b6e2d6bf5afbc3b5bc10983d6
+Size (firefox-102.11.0esr.source.tar.xz) = 477769716 bytes
+BLAKE2s (nodejs-output-95.0.tgz) = c44b37d3605524a49157002f01c29f568f04194b0e635bc312de7ffdeb9a74c9
+SHA512 (nodejs-output-95.0.tgz) = 2faf326f4e100b66f8597c365cc2eb5d0eee26aae92a7e2446891f2178041aa71ba16eae37000acacd43a657025ec11c18db73b112f5c49cc21cdb882da6d798
+Size (nodejs-output-95.0.tgz) = 200627 bytes
+SHA1 (patch-Cargo.lock) = 717351e88b0b58d21dd0159e4eb4a7d5b08d5afe
+SHA1 (patch-Cargo.toml) = 13f8d0bf2a1e2cab7c770c6783497ba923a21d9e
+SHA1 (patch-browser_app_profile_firefox.js) = 0035b23bae450a3d743e1dbf95f354bf74432e56
+SHA1 (patch-build_moz.configure_rust.configure) = 25ddfacd29cebbc6db005dbe61a2a7446d480678
+SHA1 (patch-config_gcc-stl-wrapper.template.h) = 9d1f15ff487efa9202114d19ed5668b4e7aa032a
+SHA1 (patch-config_makefiles_rust.mk) = 188178b184d79737247ed3770cc8f4370cd7f6c0
+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) = b2adce9e65662283a11b6dcff40e95523e940045
+SHA1 (patch-gfx_skia_skia_src_core_SkCpu.cpp) = 36218819254f3681b9c717d652ea78c9f20d49ad
+SHA1 (patch-gfx_skia_skia_src_core_SkVM.cpp) = cdb2c2b0d512c0eb8403abba9b74c218d3a306ea
+SHA1 (patch-gfx_wr_swgl_build.rs) = df6ebfaabb4d27994e59a9d0eaf12c7cf08415fb
+SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 298642a3527804115b398fb7904a3596962932e3
+SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 35d20981d33ccdb1d8ffb8039e48798777f11658
+SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 6cdd0fe60455eab8f9846257c2bfea207f19478b
+SHA1 (patch-js_src_jit_ProcessExecutableMemory.cpp) = fad103cc698f9828ad58f742231984ec2bc27605
+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) = 2ef11da83c90c41490db4c0d9809c3e1826b488a
+SHA1 (patch-media_libcubeb_src_cubeb__jack.cpp) = fc546c5e6582fd5eda64ba83287dfbbb3c9e229f
+SHA1 (patch-media_libcubeb_src_moz.build) = e027285ea24f2626b1328d4c6e9a31ed55445f99
+SHA1 (patch-media_libpng_pngpriv.h) = c8084332560017cd7c9b519b61d125fa28af0dbc
+SHA1 (patch-media_libtheora_lib_info.c) = f6dbf536d73859a1ff78304c2e9f6a6f74dac01f
+SHA1 (patch-modules_fdlibm_src_math__private.h) = 6ae3b0077b4a8c6088c35769fa1972cfc44ea9c1
+SHA1 (patch-mozglue_misc_Uptime.cpp) = daefe25ef1ebc8e4d3735017b9e8ac68c4710a00
+SHA1 (patch-nsprpub_pr_src_pthreads_ptsynch.c) = 13e512c7ee9fa1e14ba415d62fa853e5fbfc91c0
+SHA1 (patch-python_mozbuild_mozbuild_action_langpack_manifest.py) = 99b9e258a56a28610856298c2b80157668209f36
+SHA1 (patch-security_nss_lib_freebl_mpi_mpi.c) = a7cd867916524770609d1c307a65b315b88456f4
+SHA1 (patch-third__party_js_cfworker_build.sh) = 46cdf97b99cf01080f290ae8d9a33b5f869fc3e4
+SHA1 (patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc) = 2e951d7d91934751608e99628fc144632d8a3b5c
+SHA1 (patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc) = b90e22b50879f7adcc1da3a993f52c0701b720f8
+SHA1 (patch-third__party_rust_bindgen_src_clang.rs) = e3b749622a95a93d3667588355480fc82a9e54f6
+SHA1 (patch-third__party_rust_bindgen_src_ir_comp.rs) = 770fc5cf5a25bb86cb7adb9379d3c63eed0d9d86
+SHA1 (patch-third__party_rust_bindgen_src_ir_ty.rs) = 8151426f3c633a16e51e71745689aed5995abadf
+SHA1 (patch-third__party_rust_bindgen_src_ir_var.rs) = d2701055a3cf74ac210c350f0ed823922acfd6ad
+SHA1 (patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c) = ba423726a4859f19aa627bb127e5597eac323016
+SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = bd7b2a0f2407c3ab95515b2f143c41c3ca6fb0c4
+SHA1 (patch-toolkit_modules_subprocess_subprocess__shared__unix.js) = 2303b753066298305ccae80d72765dbc4da5e0dc
+SHA1 (patch-toolkit_moz.configure) = 8de54693dc47b0993f220cc5a04af98925de1fb5
+SHA1 (patch-toolkit_mozapps_installer_packager.mk) = 706635b76a7b525794aba95e95544f09e18bb662
+SHA1 (patch-toolkit_xre_glxtest_cpp) = 07dc19086a0e9d12bcb0c9ca0cc58bd0562bcfdd
+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/firefox102/files/desktop.in b/firefox102/files/desktop.in
new file mode 100644
index 0000000000..d72090e1aa
--- /dev/null
+++ b/firefox102/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/firefox102/files/node-wrapper.sh b/firefox102/files/node-wrapper.sh
new file mode 100755
index 0000000000..2f6b52bdd6
--- /dev/null
+++ b/firefox102/files/node-wrapper.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+VERS=v14.18.1
+
+if [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
+	printf "${VERS}\n"
+fi
+
+exit 0
diff --git a/firefox102/files/replace-moz.build.awk b/firefox102/files/replace-moz.build.awk
new file mode 100644
index 0000000000..f9420142a9
--- /dev/null
+++ b/firefox102/files/replace-moz.build.awk
@@ -0,0 +1,22 @@
+/^if CONFIG\[\"OS_TARGET\"\] == \"Android\":/{
+	flag = 1;
+	print $0;
+	next;
+}
+/^if CONFIG\[\"OS_TARGET\"\] == \"Linux\":/{
+	flag = 0;
+	sub(/^if CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\":");
+	print $0;
+	next;
+}
+{
+	if (flag != 1) {
+		sub(/^    DEFINES\[\"WEBRTC_LINUX\"\] = True/, "    if CONFIG\[\"OS_TARGET\"\] == \"Linux\":\n        DEFINES\[\"WEBRTC_LINUX\"\] = True\n    else:\n        DEFINES\[\"WEBRTC_BSD\"\] = True");
+		sub(/^if not CONFIG\[\"MOZ_DEBUG\"\] and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if not CONFIG[\"MOZ_DEBUG\"] and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+		sub(/^if CONFIG\[\"MOZ_DEBUG\"\] == \"1\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG[\"MOZ_DEBUG\"] == \"1\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+		sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"aarch64\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG[\"CPU_ARCH\"] == \"aarch64\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+		sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"x86\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG[\"CPU_ARCH\"] == \"x86\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+		sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"x86_64\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG[\"CPU_ARCH\"] == \"x86_64\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+	}
+	print $0;
+}
diff --git a/firefox102/mozilla-common.mk b/firefox102/mozilla-common.mk
new file mode 100644
index 0000000000..b65e9a680a
--- /dev/null
+++ b/firefox102/mozilla-common.mk
@@ -0,0 +1,232 @@
+# $NetBSD: mozilla-common.mk,v 1.3 2022/11/02 20:36:32 gutteridge Exp $
+#
+# common Makefile fragment for mozilla packages based on gecko 2.0.
+#
+# used by www/firefox/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.24.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
+CFLAGS+=		-msse2
+.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 ${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"
+
+do-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
+.else
+USE_TOOLS+=		tar
+.endif
+
+.if ${MACHINE_ARCH} == "i386"
+# This is required for SSE2 code under i386.
+CXXFLAGS+=	-mstackrealign
+.endif
+
+CHECK_PORTABILITY_SKIP+=	${MOZILLA_DIR}security/nss/tests/*/*.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
+CONFIGURE_ARGS+=	--disable-crashreporter
+CONFIGURE_ARGS+=	--enable-chrome-format=omni
+CONFIGURE_ARGS+=	--with-system-webp
+
+#CONFIGURE_ARGS+=	--enable-readline
+CONFIGURE_ARGS+=	--disable-icf
+CONFIGURE_ARGS+=	--disable-updater
+
+.include "../../mk/compiler.mk"
+
+.if empty(PKGSRC_COMPILER:Mclang)
+# Set path to "clang for cbindgen" when target compiler is not clang.
+CONFIGURE_ARGS+=	--with-clang-path=${PREFIX}/bin/clang
+.endif
+CONFIGURE_ARGS+=	--with-libclang-path=${PREFIX}/lib
+
+# RLBox WASM sandbox
+.if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386"
+# For wasm-ld command
+BUILD_DEPENDS+=		lld-[0-9]*:../../wip/lld
+.include "../../wip/wasi-libc/buildlink3.mk"
+.include "../../wip/wasi-libcxx/buildlink3.mk"
+# NB the exact versions of the clang and wasi-compiler-rt dependencies must
+# be kept in sync, or build failures will occur due to path mismatches.
+.include "../../wip/wasi-compiler-rt/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-wasi-sysroot=${PREFIX}/wasi
+CONFIGURE_ENV+=		WASM_CC=${PREFIX}/bin/clang
+CONFIGURE_ENV+=		WASM_CXX=${PREFIX}/bin/clang++
+.else
+CONFIGURE_ARGS+=	--without-wasm-sandboxed-libraries
+.endif
+
+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'
+
+.include "../../sysutils/pciutils/libname.mk"
+SUBST_CLASSES+=				fix-libpci-soname
+SUBST_STAGE.fix-libpci-soname=		pre-configure
+SUBST_MESSAGE.fix-libpci-soname=	Fixing libpci soname
+SUBST_FILES.fix-libpci-soname+=		${MOZILLA_DIR}toolkit/xre/glxtest.cpp
+SUBST_SED.fix-libpci-soname+=		-e 's,"libpci.so, "lib${PCIUTILS_LIBNAME}.so,'
+
+# Workaround for link of libxul.so as of 96.0.
+# There are too many -ldl under third_paty/libwebrtc.
+BUILDLINK_TRANSFORM.NetBSD+=	rm:-ldl
+
+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" || \
+    ${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
+
+# 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 "../../sysutils/pciutils/buildlink3.mk"
+.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.34
+.include "../../devel/nspr/buildlink3.mk"
+.include "../../textproc/icu/buildlink3.mk"
+BUILDLINK_API_DEPENDS.nss+=	nss>=3.79
+.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 "../../wip/clang/buildlink3.mk"
+RUST_REQ=	1.59.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/ffmpeg5/buildlink3.mk"
+.include "../../x11/libXt/buildlink3.mk"
+.include "../../x11/libXtst/buildlink3.mk"
+BUILDLINK_API_DEPENDS.pixman+= pixman>=0.25.2
+.include "../../x11/pixman/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/firefox102/options.mk b/firefox102/options.mk
new file mode 100644
index 0000000000..b711f35468
--- /dev/null
+++ b/firefox102/options.mk
@@ -0,0 +1,97 @@
+# $NetBSD: options.mk,v 1.3 2022/08/07 18:08:08 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+=	dbus
+PKG_SUPPORTED_OPTIONS+=	alsa pulseaudio sunaudio jack
+
+PKG_SUGGESTED_OPTIONS+=	dbus
+
+.if ${OPSYS} == "Linux"
+PKG_SUGGESTED_OPTIONS+=	pulseaudio mozilla-jemalloc webrtc
+.endif
+
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "SunOS"
+PKG_SUGGESTED_OPTIONS+=	sunaudio
+.endif
+
+.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} >= 090000
+PKG_SUGGESTED_OPTIONS+=	webrtc
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Malsa)
+AUDIO_BACKENDS+=	alsa
+.include "../../audio/alsa-lib/buildlink3.mk"
+.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)
+AUDIO_BACKENDS+=	pulseaudio
+.include "../../audio/pulseaudio/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mdbus)
+.include "../../sysutils/dbus-glib/buildlink3.mk"
+CONFIGURE_ARGS+=	--enable-dbus
+.else
+CONFIGURE_ARGS+=	--disable-dbus
+.  if ${OPSYS} == "Linux"
+CONFIGURE_ARGS+=	--disable-necko-wifi
+.  endif
+.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}
+.else
+CONFIGURE_ARGS+=	--with-branding=browser/branding/unofficial
+.endif
+
+.if !empty(PKG_OPTIONS:Msunaudio)
+AUDIO_BACKENDS+=	sunaudio
+.endif
+
+.if !empty(PKG_OPTIONS:Mjack)
+AUDIO_BACKENDS+=	jack
+.include "../../audio/jack/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mwebrtc)
+.include "../../graphics/libv4l/buildlink3.mk"
+CONFIGURE_ARGS+=	--enable-webrtc
+.else
+CONFIGURE_ARGS+=	--disable-webrtc
+.endif
+
+CONFIGURE_ARGS+=	--audio-backends=${AUDIO_BACKENDS:ts,}
diff --git a/firefox102/patch-dom_media_webrtc_sdp_RsdparsaSdpGlue.cpp b/firefox102/patch-dom_media_webrtc_sdp_RsdparsaSdpGlue.cpp
new file mode 100644
index 0000000000..f073d56c9f
--- /dev/null
+++ b/firefox102/patch-dom_media_webrtc_sdp_RsdparsaSdpGlue.cpp
@@ -0,0 +1,14 @@
+$NetBSD$
+
+GCC 13 fixes.
+
+--- dom/media/webrtc/sdp/RsdparsaSdpGlue.cpp.orig	2023-05-12 14:15:02.145219021 +0200
++++ dom/media/webrtc/sdp/RsdparsaSdpGlue.cpp	2023-05-12 14:15:48.433146715 +0200
+@@ -3,6 +3,7 @@
+ /* 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/. */
++#include <cstdint>
+ #include <string>
+ 
+ #include "sdp/RsdparsaSdpInc.h"
diff --git a/firefox102/patch-gfx_2d_Rect.h b/firefox102/patch-gfx_2d_Rect.h
new file mode 100644
index 0000000000..0c55edc6e0
--- /dev/null
+++ b/firefox102/patch-gfx_2d_Rect.h
@@ -0,0 +1,14 @@
+$NetBSD$
+
+GCC 13 fixes.
+
+--- gfx/2d/Rect.h.orig	2023-05-12 14:17:38.303449723 +0200
++++ gfx/2d/Rect.h	2023-05-12 14:18:04.645202892 +0200
+@@ -15,6 +15,7 @@
+ #include "mozilla/Maybe.h"
+ 
+ #include <cmath>
++#include <cstdint>
+ 
+ namespace mozilla {
+ 
diff --git a/firefox102/patch-toolkit_components_telemetry_pingsender_pingsender.cpp b/firefox102/patch-toolkit_components_telemetry_pingsender_pingsender.cpp
new file mode 100644
index 0000000000..51cf0d5837
--- /dev/null
+++ b/firefox102/patch-toolkit_components_telemetry_pingsender_pingsender.cpp
@@ -0,0 +1,14 @@
+$NetBSD$
+
+GCC 13 fixes.
+
+--- toolkit/components/telemetry/pingsender/pingsender.cpp.orig	2023-05-12 14:19:10.322882448 +0200
++++ toolkit/components/telemetry/pingsender/pingsender.cpp	2023-05-12 14:19:26.908660689 +0200
+@@ -3,6 +3,7 @@
+  * 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/. */
+ 
++#include <cstdint>
+ #include <cstdlib>
+ #include <cstring>
+ #include <ctime>
diff --git a/firefox102/patch-tools_profiler_public_ProfilerThreadRegistration.h b/firefox102/patch-tools_profiler_public_ProfilerThreadRegistration.h
new file mode 100644
index 0000000000..925a4a7916
--- /dev/null
+++ b/firefox102/patch-tools_profiler_public_ProfilerThreadRegistration.h
@@ -0,0 +1,23 @@
+$NetBSD$
+
+GCC 13 fixes.
+
+--- tools/profiler/public/ProfilerThreadRegistration.h.orig	2023-05-12 18:38:17.497857025 +0200
++++ tools/profiler/public/ProfilerThreadRegistration.h	2023-05-12 18:40:07.902690604 +0200
+@@ -214,14 +214,14 @@
+       DataLock mDataLock;
+     };
+ 
+-    [[nodiscard]] RWOnThreadWithLock LockedRWOnThread() {
++    [[nodiscard]] RWOnThreadWithLock GetLockedRWOnThread() {
+       return RWOnThreadWithLock{mThreadRegistration->mData,
+                                 mThreadRegistration->mDataMutex};
+     }
+ 
+     template <typename F>
+     auto WithLockedRWOnThread(F&& aF) {
+-      RWOnThreadWithLock lockedData = LockedRWOnThread();
++      RWOnThreadWithLock lockedData = GetLockedRWOnThread();
+       return std::forward<F>(aF)(lockedData.DataRef());
+     }
+ 
diff --git a/firefox102/patch-tools_profiler_public_ProfilerThreadRegistry.h b/firefox102/patch-tools_profiler_public_ProfilerThreadRegistry.h
new file mode 100644
index 0000000000..ae7be3546b
--- /dev/null
+++ b/firefox102/patch-tools_profiler_public_ProfilerThreadRegistry.h
@@ -0,0 +1,23 @@
+$NetBSD$
+
+GCC 13 fixes.
+
+--- tools/profiler/public/ProfilerThreadRegistry.h.orig	2023-05-12 18:43:33.901805488 +0200
++++ tools/profiler/public/ProfilerThreadRegistry.h	2023-05-12 18:44:46.758075369 +0200
+@@ -177,14 +177,14 @@
+       ThreadRegistration::DataLock mDataLock;
+     };
+ 
+-    [[nodiscard]] RWFromAnyThreadWithLock LockedRWFromAnyThread() {
++    [[nodiscard]] RWFromAnyThreadWithLock GetLockedRWFromAnyThread() {
+       return RWFromAnyThreadWithLock{mThreadRegistration->mData,
+                                      mThreadRegistration->mDataMutex};
+     }
+ 
+     template <typename F>
+     auto WithLockedRWFromAnyThread(F&& aF) {
+-      RWFromAnyThreadWithLock lockedData = LockedRWFromAnyThread();
++      RWFromAnyThreadWithLock lockedData = GetLockedRWFromAnyThread();
+       return std::forward<F>(aF)(lockedData.DataRef());
+     }
+ 
diff --git a/firefox102/patch-tools_profiler_tests_gtest_GeckoProfiler.cpp b/firefox102/patch-tools_profiler_tests_gtest_GeckoProfiler.cpp
new file mode 100644
index 0000000000..fd396060ba
--- /dev/null
+++ b/firefox102/patch-tools_profiler_tests_gtest_GeckoProfiler.cpp
@@ -0,0 +1,33 @@
+$NetBSD$
+
+GCC 13 fixes.
+
+--- tools/profiler/tests/gtest/GeckoProfiler.cpp.orig	2023-05-12 18:45:52.823502307 +0200
++++ tools/profiler/tests/gtest/GeckoProfiler.cpp	2023-05-12 18:47:25.421971082 +0200
+@@ -621,7 +621,7 @@
+       EXPECT_FALSE(TR::IsDataMutexLockedOnCurrentThread());
+       {
+         TR::OnThreadRef::RWOnThreadWithLock rwOnThreadWithLock =
+-            aOnThreadRef.LockedRWOnThread();
++            aOnThreadRef.GetLockedRWOnThread();
+         EXPECT_TRUE(TR::IsDataMutexLockedOnCurrentThread());
+         TestConstLockedRWOnThread(rwOnThreadWithLock.DataCRef(),
+                                   beforeRegistration, afterRegistration,
+@@ -1020,7 +1020,7 @@
+         EXPECT_FALSE(TR::IsDataMutexLockedOnCurrentThread());
+         {
+           TRy::OffThreadRef::RWFromAnyThreadWithLock rwFromAnyThreadWithLock =
+-              aOffThreadRef.LockedRWFromAnyThread();
++              aOffThreadRef.GetLockedRWFromAnyThread();
+           if (profiler_current_thread_id() == testThreadId) {
+             EXPECT_TRUE(TR::IsDataMutexLockedOnCurrentThread());
+           }
+@@ -1157,7 +1157,7 @@
+             PR_Sleep(PR_MillisecondsToInterval(1));
+           }
+           TRy::OffThreadRef::RWFromAnyThreadWithLock rwFromAnyThreadWithLock =
+-              aOffThreadRef.LockedRWFromAnyThread();
++              aOffThreadRef.GetLockedRWFromAnyThread();
+           ++otherThreadReads;
+           if (otherThreadReads % 1000 == 0) {
+             PR_Sleep(PR_MillisecondsToInterval(1));
diff --git a/firefox102/patches/patch-Cargo.lock b/firefox102/patches/patch-Cargo.lock
new file mode 100644
index 0000000000..c4cf8cf8f4
--- /dev/null
+++ b/firefox102/patches/patch-Cargo.lock
@@ -0,0 +1,33 @@
+$NetBSD$
+
+rust-bindgen upstream (#2338 and #2319), Self
+Updates the bundled rust-bindgen crate to be compatible
+with Clang/LLVM 16.
+
+clang: Detect anonymous items explicitly, rather than relying on empty names.
+In Clang 16, anonymous items may return names like `(anonymous union at ...)`
+rather than emoty names.
+The right way to detect them is using clang_Cursor_isAnonymous.
+Fixes https://github.com/rust-lang/rust-bindgen/issues/2312
+Closes https://github.com/rust-lang/rust-bindgen/pull/2316
+
+ir: Don't crash with built-in unexposed types from libclang.
+This fixes https://github.com/rust-lang/rust-bindgen/issues/2325
+
+The issue is that `__bf16` is not exposed at all by libclang, which
+causes us to crash. It's a bit of a shame libclang doesn't expose it but
+there's no rust equivalent I think, so this should be ok for now.
+
+Unfortunately no test because the header crashes older clang versions.
+
+--- Cargo.lock.orig	2023-05-13 01:55:05.593291732 +0200
++++ Cargo.lock	2023-05-13 01:55:28.140873785 +0200
+@@ -394,8 +394,6 @@
+ [[package]]
+ name = "bindgen"
+ version = "0.56.0"
+-source = "registry+https://github.com/rust-lang/crates.io-index";
+-checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239"
+ dependencies = [
+  "bitflags",
+  "cexpr",
diff --git a/firefox102/patches/patch-Cargo.toml b/firefox102/patches/patch-Cargo.toml
new file mode 100644
index 0000000000..84f57a0932
--- /dev/null
+++ b/firefox102/patches/patch-Cargo.toml
@@ -0,0 +1,32 @@
+$NetBSD$
+
+rust-bindgen upstream (#2338 and #2319), Self
+Updates the bundled rust-bindgen crate to be compatible
+with Clang/LLVM 16.
+
+clang: Detect anonymous items explicitly, rather than relying on empty names.
+In Clang 16, anonymous items may return names like `(anonymous union at ...)`
+rather than emoty names.
+The right way to detect them is using clang_Cursor_isAnonymous.
+Fixes https://github.com/rust-lang/rust-bindgen/issues/2312
+Closes https://github.com/rust-lang/rust-bindgen/pull/2316
+
+ir: Don't crash with built-in unexposed types from libclang.
+This fixes https://github.com/rust-lang/rust-bindgen/issues/2325
+
+The issue is that `__bf16` is not exposed at all by libclang, which
+causes us to crash. It's a bit of a shame libclang doesn't expose it but
+there's no rust equivalent I think, so this should be ok for now.
+
+Unfortunately no test because the header crashes older clang versions.
+
+--- Cargo.toml.orig	2023-05-13 01:11:33.156937081 +0200
++++ Cargo.toml	2023-05-13 01:12:30.660636037 +0200
+@@ -116,6 +116,7 @@
+ packed_simd = { package = "packed_simd_2", git = "https://github.com/hsivonen/packed_simd";, rev="f38664024b29d44c506431eada7c112629bb1aa9" }
+ midir = { git = "https://github.com/mozilla/midir.git";, rev = "4c11f0ffb5d6a10de4aff40a7b81218b33b94e6f" }
+ minidump_writer_linux = { git = "https://github.com/rust-minidump/minidump-writer.git";, rev = "75ada456c92a429704691a85e1cb42fef8cafc0d" }
++bindgen = { path = "third_party/rust/bindgen" }
+ 
+ # Patch mio 0.6 to use winapi 0.3 and miow 0.3, getting rid of winapi 0.2.
+ # There is not going to be new version of mio 0.6, mio now being >= 0.7.11.
diff --git a/firefox102/patches/patch-browser_app_profile_firefox.js b/firefox102/patches/patch-browser_app_profile_firefox.js
new file mode 100644
index 0000000000..2ed0c4c4d7
--- /dev/null
+++ b/firefox102/patches/patch-browser_app_profile_firefox.js
@@ -0,0 +1,41 @@
+$NetBSD: patch-browser_app_profile_firefox.js,v 1.2 2022/12/21 10:10:37 nia Exp $
+
+This patch modifies default Firefox settings - see the comments above
+each one.
+
+--- browser/app/profile/firefox.js.orig	2022-11-07 21:06:43.000000000 +0000
++++ browser/app/profile/firefox.js
+@@ -2049,7 +2049,11 @@ pref("reader.pocket.ctaVersion", "");
+ 
+ pref("view_source.tab", true);
+ 
+-pref("dom.serviceWorkers.enabled", true);
++// On NetBSD, many web applications (e.g. Telegram, Mastodon, Twitter)
++// will freeze until the service worker is restarted in about:serviceworkers.
++// This is a workaround that makes most of these sites function.
++// The root cause of this should be investigated.
++pref("dom.serviceWorkers.enabled", false);
+ 
+ // Enable Push API.
+ pref("dom.push.enabled", true);
+@@ -2225,6 +2229,20 @@ 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);
++
++// Firefox includes a complex mechanism for "blacklisting" GPUs that
++// appears to fail on a NetBSD system where the only available OpenGL
++// implementations are all from Mesa.  WebRender was supposed to be
++// enabled by default from Firefox 91 onwards and appears to greatly
++// improve performance even with acceleration disabled at the kernel
++// level.
++pref("gfx.webrender.all", true);
++
+ // Discovery prefs
+ pref("browser.discovery.enabled", true);
+ pref("browser.discovery.containers.enabled", true);
diff --git a/firefox102/patches/patch-build_moz.configure_rust.configure b/firefox102/patches/patch-build_moz.configure_rust.configure
new file mode 100644
index 0000000000..3a03dd4f3c
--- /dev/null
+++ b/firefox102/patches/patch-build_moz.configure_rust.configure
@@ -0,0 +1,15 @@
+$NetBSD: patch-build_moz.configure_rust.configure,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-config_gcc-stl-wrapper.template.h b/firefox102/patches/patch-config_gcc-stl-wrapper.template.h
new file mode 100644
index 0000000000..8a095e7381
--- /dev/null
+++ b/firefox102/patches/patch-config_gcc-stl-wrapper.template.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-config_gcc-stl-wrapper.template.h,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+--- config/gcc-stl-wrapper.template.h.orig	2021-09-04 13:24:51.000000000 +0000
++++ config/gcc-stl-wrapper.template.h
+@@ -32,8 +32,8 @@
+ // limits) and 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_cmath
+@@ -55,7 +55,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
+@@ -84,4 +84,6 @@
+ #  include "mozilla/throw_gcc.h"
+ #endif
+ 
++#undef moz_dont_include_mzalloc_for_${HEADER}
++
+ #endif  // if mozilla_${HEADER}_h
diff --git a/firefox102/patches/patch-config_makefiles_rust.mk b/firefox102/patches/patch-config_makefiles_rust.mk
new file mode 100644
index 0000000000..fc815195da
--- /dev/null
+++ b/firefox102/patches/patch-config_makefiles_rust.mk
@@ -0,0 +1,30 @@
+$NetBSD: patch-config_makefiles_rust.mk,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+NetBSD doesn't get along with parallel rust builds (it causes issues
+with ld.so) which are the default. Force -j1.
+
+Use less memory to fix build under NetBSD/i386.
+From: https://bugzilla.mozilla.org/show_bug.cgi?id=1644409
+
+--- config/makefiles/rust.mk.orig	2022-06-08 14:10:19.000000000 +0000
++++ config/makefiles/rust.mk
+@@ -58,6 +58,9 @@ ifdef MOZ_TSAN
+ cargo_build_flags += -Zbuild-std=std,panic_abort
+ RUSTFLAGS += -Zsanitizer=thread
+ endif
++ifeq ($(OS_ARCH),NetBSD)
++cargo_build_flags += -j1
++endif
+ 
+ rustflags_sancov =
+ ifdef LIBFUZZER
+@@ -90,7 +93,8 @@ ifndef rustflags_sancov
+ # Never enable when coverage is enabled to work around https://github.com/rust-lang/rust/issues/90045.
+ ifndef MOZ_CODE_COVERAGE
+ ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
+-cargo_rustc_flags += -Clto
++cargo_rustc_flags += -Clto=thin
++export CARGO_PROFILE_RELEASE_LTO=thin
+ endif
+ # We need -Cembed-bitcode=yes for all crates when using -Clto.
+ RUSTFLAGS += -Cembed-bitcode=yes
diff --git a/firefox102/patches/patch-dom_base_nsAttrName.h b/firefox102/patches/patch-dom_base_nsAttrName.h
new file mode 100644
index 0000000000..9c488fb6af
--- /dev/null
+++ b/firefox102/patches/patch-dom_base_nsAttrName.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-dom_base_nsAttrName.h,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp b/firefox102/patches/patch-gfx_angle_checkout_src_common_third__party_smhasher_src_PMurHash.cpp
new file mode 100644
index 0000000000..414bb0c1d7
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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/firefox102/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h b/firefox102/patches/patch-gfx_angle_checkout_src_compiler_translator_InfoSink.h
new file mode 100644
index 0000000000..67b25d4c83
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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	2021-10-28 18:03:11.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 "GLSLANG/ShaderLang.h"
+ #include "compiler/translator/Common.h"
diff --git a/firefox102/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp b/firefox102/patches/patch-gfx_skia_skia_src_core_SkCpu.cpp
new file mode 100644
index 0000000000..5dd27e8c4d
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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/firefox102/patches/patch-gfx_skia_skia_src_core_SkVM.cpp b/firefox102/patches/patch-gfx_skia_skia_src_core_SkVM.cpp
new file mode 100644
index 0000000000..d6990abd2e
--- /dev/null
+++ b/firefox102/patches/patch-gfx_skia_skia_src_core_SkVM.cpp
@@ -0,0 +1,19 @@
+$NetBSD: patch-gfx_skia_skia_src_core_SkVM.cpp,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+Work with PaX MPROTECT on NetBSD by stating that we will later make this memory
+block executable.
+
+--- gfx/skia/skia/src/core/SkVM.cpp.orig	2022-07-05 12:21:05.000000000 +0000
++++ gfx/skia/skia/src/core/SkVM.cpp
+@@ -2076,7 +2076,11 @@ namespace skvm {
+         // Allocate space that we can remap as executable.
+         const size_t page = sysconf(_SC_PAGESIZE);
+         fJITSize = ((a.size() + page - 1) / page) * page;  // mprotect works at page granularity.
++#ifdef PROT_MPROTECT
++        fJITBuf = mmap(nullptr,fJITSize, PROT_READ|PROT_WRITE|PROT_MPROTECT(PROT_WRITE), MAP_ANONYMOUS|MAP_PRIVATE, -1,0);
++#else
+         fJITBuf = mmap(nullptr,fJITSize, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1,0);
++#endif
+ 
+         // Assemble the program for real.
+         a = Assembler{fJITBuf};
diff --git a/firefox102/patches/patch-gfx_wr_swgl_build.rs b/firefox102/patches/patch-gfx_wr_swgl_build.rs
new file mode 100644
index 0000000000..269e5341d1
--- /dev/null
+++ b/firefox102/patches/patch-gfx_wr_swgl_build.rs
@@ -0,0 +1,27 @@
+$NetBSD: patch-gfx_wr_swgl_build.rs,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc b/firefox102/patches/patch-ipc_chromium_src_base_message__pump__libevent.cc
new file mode 100644
index 0000000000..57976e9e93
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 nia Exp $
+
+Allow older libevent
+
+--- ipc/chromium/src/base/message_pump_libevent.cc.orig	2022-06-16 21:32:07.000000000 +0000
++++ ipc/chromium/src/base/message_pump_libevent.cc
+@@ -24,6 +24,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), \
+@@ -44,6 +45,7 @@ CHECK_EVENT_SIZEOF(SHORT, short);
+ CHECK_EVENT_SIZEOF(SIZE_T, size_t);
+ CHECK_EVENT_SIZEOF(TIME_T, time_t);
+ CHECK_EVENT_SIZEOF(VOID_P, void*);
++#endif
+ 
+ // Lifecycle of struct event
+ // Libevent uses two main data structures:
diff --git a/firefox102/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc b/firefox102/patches/patch-ipc_chromium_src_base_platform__thread__posix.cc
new file mode 100644
index 0000000000..ffda116516
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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/firefox102/patches/patch-ipc_glue_GeckoChildProcessHost.cpp b/firefox102/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
new file mode 100644
index 0000000000..107035be92
--- /dev/null
+++ b/firefox102/patches/patch-ipc_glue_GeckoChildProcessHost.cpp
@@ -0,0 +1,21 @@
+$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Support Solaris
+* Fix NetBSD linking
+
+--- ipc/glue/GeckoChildProcessHost.cpp.orig	2022-01-08 15:41:40.900244448 +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/process_util.h"
diff --git a/firefox102/patches/patch-js_src_jit_ProcessExecutableMemory.cpp b/firefox102/patches/patch-js_src_jit_ProcessExecutableMemory.cpp
new file mode 100644
index 0000000000..b7de109716
--- /dev/null
+++ b/firefox102/patches/patch-js_src_jit_ProcessExecutableMemory.cpp
@@ -0,0 +1,38 @@
+$NetBSD: patch-js_src_jit_ProcessExecutableMemory.cpp,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-js_src_util_NativeStack.cpp b/firefox102/patches/patch-js_src_util_NativeStack.cpp
new file mode 100644
index 0000000000..08b8029d4e
--- /dev/null
+++ b/firefox102/patches/patch-js_src_util_NativeStack.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-js_src_util_NativeStack.cpp,v 1.1 2022/07/21 23:56:39 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@localhost */
+   pthread_attr_get_np(thread, &sattr);
++#    elif defined(__sun)
+ #    else
+   /*
+    * FIXME: this function is non-portable;
diff --git a/firefox102/patches/patch-js_src_vm_ArrayBufferObject.cpp b/firefox102/patches/patch-js_src_vm_ArrayBufferObject.cpp
new file mode 100644
index 0000000000..d1f7b2f73f
--- /dev/null
+++ b/firefox102/patches/patch-js_src_vm_ArrayBufferObject.cpp
@@ -0,0 +1,24 @@
+$NetBSD: patch-js_src_vm_ArrayBufferObject.cpp,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-media_ffvpx_libavutil_arm_bswap.h b/firefox102/patches/patch-media_ffvpx_libavutil_arm_bswap.h
new file mode 100644
index 0000000000..64faf76655
--- /dev/null
+++ b/firefox102/patches/patch-media_ffvpx_libavutil_arm_bswap.h
@@ -0,0 +1,22 @@
+$NetBSD: patch-media_ffvpx_libavutil_arm_bswap.h,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-media_libcubeb_src_cubeb__alsa.c b/firefox102/patches/patch-media_libcubeb_src_cubeb__alsa.c
new file mode 100644
index 0000000000..9a5e8a4849
--- /dev/null
+++ b/firefox102/patches/patch-media_libcubeb_src_cubeb__alsa.c
@@ -0,0 +1,12 @@
+$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+--- media/libcubeb/src/cubeb_alsa.c.orig	2021-09-04 13:25:19.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 "cubeb-internal.h"
+ #include "cubeb/cubeb.h"
diff --git a/firefox102/patches/patch-media_libcubeb_src_cubeb__jack.cpp b/firefox102/patches/patch-media_libcubeb_src_cubeb__jack.cpp
new file mode 100644
index 0000000000..0ecf5e0e15
--- /dev/null
+++ b/firefox102/patches/patch-media_libcubeb_src_cubeb__jack.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-media_libcubeb_src_cubeb__jack.cpp,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Enable strdup(3) for NetBSD too.
+
+--- media/libcubeb/src/cubeb_jack.cpp.orig	2022-04-28 22:03:04.000000000 +0000
++++ media/libcubeb/src/cubeb_jack.cpp
+@@ -8,7 +8,7 @@
+  */
+ #define _DEFAULT_SOURCE
+ #define _BSD_SOURCE
+-#ifndef __FreeBSD__
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ #define _POSIX_SOURCE
+ #endif
+ #include "cubeb-internal.h"
diff --git a/firefox102/patches/patch-media_libcubeb_src_moz.build b/firefox102/patches/patch-media_libcubeb_src_moz.build
new file mode 100644
index 0000000000..cf418c76e2
--- /dev/null
+++ b/firefox102/patches/patch-media_libcubeb_src_moz.build
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libcubeb_src_moz.build,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Add Sun audio support                                                         
+
+--- media/libcubeb/src/moz.build.orig	2022-04-28 22:02:59.000000000 +0000
++++ media/libcubeb/src/moz.build
+@@ -22,6 +22,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"]
diff --git a/firefox102/patches/patch-media_libpng_pngpriv.h b/firefox102/patches/patch-media_libpng_pngpriv.h
new file mode 100644
index 0000000000..0c35135fc2
--- /dev/null
+++ b/firefox102/patches/patch-media_libpng_pngpriv.h
@@ -0,0 +1,17 @@
+$NetBSD: patch-media_libpng_pngpriv.h,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-media_libtheora_lib_info.c b/firefox102/patches/patch-media_libtheora_lib_info.c
new file mode 100644
index 0000000000..0bf38e4e3e
--- /dev/null
+++ b/firefox102/patches/patch-media_libtheora_lib_info.c
@@ -0,0 +1,19 @@
+$NetBSD: patch-media_libtheora_lib_info.c,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-modules_fdlibm_src_math__private.h b/firefox102/patches/patch-modules_fdlibm_src_math__private.h
new file mode 100644
index 0000000000..9724bf279a
--- /dev/null
+++ b/firefox102/patches/patch-modules_fdlibm_src_math__private.h
@@ -0,0 +1,18 @@
+$NetBSD: patch-modules_fdlibm_src_math__private.h,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Fix PR pkg/56457, build failure on NetBSD/i386.
+  Do not use FreeBSD-specific definition.
+
+--- modules/fdlibm/src/math_private.h.orig	2021-09-27 22:47:42.000000000 +0000
++++ modules/fdlibm/src/math_private.h
+@@ -30,8 +30,8 @@
+  * Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
+  */
+ 
+-typedef double      __double_t;
+-typedef __double_t  double_t;
++#include <math.h>
++typedef double_t __double_t;
+ 
+ /*
+  * The original fdlibm code used statements like:
diff --git a/firefox102/patches/patch-mozglue_misc_Uptime.cpp b/firefox102/patches/patch-mozglue_misc_Uptime.cpp
new file mode 100644
index 0000000000..86d200d73d
--- /dev/null
+++ b/firefox102/patches/patch-mozglue_misc_Uptime.cpp
@@ -0,0 +1,15 @@
+$NetBSD: patch-mozglue_misc_Uptime.cpp,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c b/firefox102/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
new file mode 100644
index 0000000000..a2fc8480eb
--- /dev/null
+++ b/firefox102/patches/patch-nsprpub_pr_src_pthreads_ptsynch.c
@@ -0,0 +1,110 @@
+$NetBSD: patch-nsprpub_pr_src_pthreads_ptsynch.c,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-python_mozbuild_mozbuild_action_langpack_manifest.py b/firefox102/patches/patch-python_mozbuild_mozbuild_action_langpack_manifest.py
new file mode 100644
index 0000000000..90af465c6e
--- /dev/null
+++ b/firefox102/patches/patch-python_mozbuild_mozbuild_action_langpack_manifest.py
@@ -0,0 +1,27 @@
+$NetBSD$
+
+Allow to override build date with SOURCE_DATE_EPOCH
+in order to make build reproducible.
+For more information see https://reproducible-builds.org, and
+https://reproducible-builds.org/specs/source-date-epoch/
+for the definition of this variable.
+
+--- python/mozbuild/mozbuild/action/langpack_manifest.py.orig	2023-05-13 02:22:29.641354307 +0200
++++ python/mozbuild/mozbuild/action/langpack_manifest.py	2023-05-13 02:24:00.832424983 +0200
+@@ -16,6 +16,7 @@
+ import json
+ import io
+ import datetime
++import time
+ import requests
+ import mozversioncontrol
+ import mozpack.path as mozpath
+@@ -105,7 +106,7 @@
+         dt = get_dt_from_hg(path)
+ 
+     if dt is None:
+-        dt = datetime.datetime.utcnow()
++        dt = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
+ 
+     dt = dt.replace(microsecond=0)
+     return dt.strftime("%Y%m%d%H%M%S")
diff --git a/firefox102/patches/patch-security_nss_lib_freebl_mpi_mpi.c b/firefox102/patches/patch-security_nss_lib_freebl_mpi_mpi.c
new file mode 100644
index 0000000000..e15633913a
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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/firefox102/patches/patch-third__party_js_cfworker_build.sh b/firefox102/patches/patch-third__party_js_cfworker_build.sh
new file mode 100644
index 0000000000..a6292fc5a9
--- /dev/null
+++ b/firefox102/patches/patch-third__party_js_cfworker_build.sh
@@ -0,0 +1,20 @@
+$NetBSD: patch-third__party_js_cfworker_build.sh,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+shell portability
+
+--- third_party/js/cfworker/build.sh.orig	2022-04-28 22:03:47.000000000 +0000
++++ third_party/js/cfworker/build.sh
+@@ -4,9 +4,10 @@ set -euo pipefail
+ # Path to mach relative to /third_party/js/cfworker
+ MACH=$(realpath "../../../mach")
+ 
+-if [[ $(uname -a) == *MSYS* ]]; then
+-  MACH="python ${MACH}"
+-fi
++# uname -a is not a good idea here. Someone could have MSYS in the hostname.
++#if uname -a | grep MSYS > /dev/null; then
++#  MACH="python ${MACH}"
++#fi
+ 
+ NODE="${MACH} node"
+ NPM="${MACH} npm"
diff --git a/firefox102/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc b/firefox102/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc
new file mode 100644
index 0000000000..9c81f9e43e
--- /dev/null
+++ b/firefox102/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc
@@ -0,0 +1,63 @@
+$NetBSD: patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc,v 1.1 2022/07/21 23:56:39 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/modules/video_capture/linux/device_info_linux.cc.orig	2021-05-20 21:30:20.000000000 +0000
++++ third_party/libwebrtc/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/firefox102/patches/patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc b/firefox102/patches/patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc
new file mode 100644
index 0000000000..a045e813e2
--- /dev/null
+++ b/firefox102/patches/patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc
@@ -0,0 +1,25 @@
+$NetBSD: patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Fix build under NetBSD at least.
+
+--- third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc.orig	2022-01-13 19:26:15.000000000 +0000
++++ third_party/libwebrtc/system_wrappers/source/cpu_features_linux.cc
+@@ -8,7 +8,9 @@
+  *  be found in the AUTHORS file in the root of the source tree.
+  */
+ 
++#if !defined(__NetBSD__)
+ #include <features.h>
++#endif
+ #include <stdlib.h>
+ #include <string.h>
+ 
+@@ -30,7 +32,7 @@
+ #include "rtc_base/system/arch.h"
+ #include "system_wrappers/include/cpu_features_wrapper.h"
+ 
+-#if defined(WEBRTC_ARCH_ARM_FAMILY)
++#if defined(WEBRTC_ARCH_ARM_FAMILY) && defined(__linux__)
+ #include <asm/hwcap.h>
+ 
+ namespace webrtc {
diff --git a/firefox102/patches/patch-third__party_rust_bindgen_src_clang.rs b/firefox102/patches/patch-third__party_rust_bindgen_src_clang.rs
new file mode 100644
index 0000000000..fb4a8628b8
--- /dev/null
+++ b/firefox102/patches/patch-third__party_rust_bindgen_src_clang.rs
@@ -0,0 +1,36 @@
+$NetBSD$
+
+rust-bindgen upstream (#2338 and #2319), Self
+Updates the bundled rust-bindgen crate to be compatible
+with Clang/LLVM 16.
+
+clang: Detect anonymous items explicitly, rather than relying on empty names.
+In Clang 16, anonymous items may return names like `(anonymous union at ...)`
+rather than emoty names.
+The right way to detect them is using clang_Cursor_isAnonymous.
+Fixes https://github.com/rust-lang/rust-bindgen/issues/2312
+Closes https://github.com/rust-lang/rust-bindgen/pull/2316
+
+ir: Don't crash with built-in unexposed types from libclang.
+This fixes https://github.com/rust-lang/rust-bindgen/issues/2325
+
+The issue is that `__bf16` is not exposed at all by libclang, which
+causes us to crash. It's a bit of a shame libclang doesn't expose it but
+there's no rust equivalent I think, so this should be ok for now.
+
+Unfortunately no test because the header crashes older clang versions.
+
+--- third_party/rust/bindgen/src/clang.rs.orig	2023-05-13 01:13:19.851639954 +0200
++++ third_party/rust/bindgen/src/clang.rs	2023-05-13 01:15:51.240925636 +0200
+@@ -54,6 +54,11 @@
+         unsafe { clang_isDeclaration(self.kind()) != 0 }
+     }
+ 
++    /// Is this cursor's referent an anonymous record or so?
++    pub fn is_anonymous(&self) -> bool {
++        unsafe { clang_Cursor_isAnonymous(self.x) != 0 }
++    }
++
+     /// Get this cursor's referent's spelling.
+     pub fn spelling(&self) -> String {
+         unsafe { cxstring_into_string(clang_getCursorSpelling(self.x)) }
diff --git a/firefox102/patches/patch-third__party_rust_bindgen_src_ir_comp.rs b/firefox102/patches/patch-third__party_rust_bindgen_src_ir_comp.rs
new file mode 100644
index 0000000000..1d82afea75
--- /dev/null
+++ b/firefox102/patches/patch-third__party_rust_bindgen_src_ir_comp.rs
@@ -0,0 +1,33 @@
+$NetBSD$
+
+rust-bindgen upstream (#2338 and #2319), Self
+Updates the bundled rust-bindgen crate to be compatible
+with Clang/LLVM 16.
+
+clang: Detect anonymous items explicitly, rather than relying on empty names.
+In Clang 16, anonymous items may return names like `(anonymous union at ...)`
+rather than emoty names.
+The right way to detect them is using clang_Cursor_isAnonymous.
+Fixes https://github.com/rust-lang/rust-bindgen/issues/2312
+Closes https://github.com/rust-lang/rust-bindgen/pull/2316
+
+ir: Don't crash with built-in unexposed types from libclang.
+This fixes https://github.com/rust-lang/rust-bindgen/issues/2325
+
+The issue is that `__bf16` is not exposed at all by libclang, which
+causes us to crash. It's a bit of a shame libclang doesn't expose it but
+there's no rust equivalent I think, so this should be ok for now.
+
+Unfortunately no test because the header crashes older clang versions.
+
+--- third_party/rust/bindgen/src/ir/comp.rs.orig	2023-05-13 03:05:52.709272405 +0200
++++ third_party/rust/bindgen/src/ir/comp.rs	2023-05-13 03:08:36.774355149 +0200
+@@ -1372,7 +1372,7 @@
+ 
+                     // A declaration of an union or a struct without name could
+                     // also be an unnamed field, unfortunately.
+-                    if cur.spelling().is_empty() &&
++                    if cur.is_anonymous() &&
+                         cur.kind() != CXCursor_EnumDecl
+                     {
+                         let ty = cur.cur_type();
diff --git a/firefox102/patches/patch-third__party_rust_bindgen_src_ir_ty.rs b/firefox102/patches/patch-third__party_rust_bindgen_src_ir_ty.rs
new file mode 100644
index 0000000000..e9c27d2731
--- /dev/null
+++ b/firefox102/patches/patch-third__party_rust_bindgen_src_ir_ty.rs
@@ -0,0 +1,123 @@
+$NetBSD$
+
+rust-bindgen upstream (#2338 and #2319), Self
+Updates the bundled rust-bindgen crate to be compatible
+with Clang/LLVM 16.
+
+clang: Detect anonymous items explicitly, rather than relying on empty names.
+In Clang 16, anonymous items may return names like `(anonymous union at ...)`
+rather than emoty names.
+The right way to detect them is using clang_Cursor_isAnonymous.
+Fixes https://github.com/rust-lang/rust-bindgen/issues/2312
+Closes https://github.com/rust-lang/rust-bindgen/pull/2316
+
+ir: Don't crash with built-in unexposed types from libclang.
+This fixes https://github.com/rust-lang/rust-bindgen/issues/2325
+
+The issue is that `__bf16` is not exposed at all by libclang, which
+causes us to crash. It's a bit of a shame libclang doesn't expose it but
+there's no rust equivalent I think, so this should be ok for now.
+
+Unfortunately no test because the header crashes older clang versions.
+
+--- third_party/rust/bindgen/src/ir/ty.rs.orig	2023-04-03 19:42:41.000000000 +0200
++++ third_party/rust/bindgen/src/ir/ty.rs	2023-05-13 01:43:32.212969772 +0200
+@@ -737,7 +737,12 @@
+ 
+         let layout = ty.fallible_layout(ctx).ok();
+         let cursor = ty.declaration();
+-        let mut name = cursor.spelling();
++        let is_anonymous = cursor.is_anonymous();
++        let mut name = if is_anonymous {
++            None
++        } else {
++            Some(cursor.spelling()).filter(|n| !n.is_empty())
++        };
+ 
+         debug!(
+             "from_clang_ty: {:?}, ty: {:?}, loc: {:?}",
+@@ -771,7 +776,7 @@
+             if is_canonical_objcpointer && is_template_type_param {
+                 // Objective-C generics are just ids with fancy name.
+                 // To keep it simple, just name them ids
+-                name = "id".to_owned();
++                name = Some("id".to_owned());
+             }
+         }
+ 
+@@ -900,7 +905,7 @@
+                                         return Err(ParseError::Recurse);
+                                     }
+                                 } else {
+-                                    name = location.spelling();
++                                    name = Some(location.spelling());
+                                 }
+ 
+                                 let complex = CompInfo::from_ty(
+@@ -942,7 +947,7 @@
+                                                 CXType_Typedef
+                                             );
+ 
+-                                            name = current.spelling();
++                                            name = Some(current.spelling());
+ 
+                                             let inner_ty = cur
+                                                 .typedef_type()
+@@ -1126,10 +1131,10 @@
+                 CXType_Enum => {
+                     let enum_ = Enum::from_ty(ty, ctx).expect("Not an enum?");
+ 
+-                    if name.is_empty() {
++                    if !is_anonymous {
+                         let pretty_name = ty.spelling();
+                         if clang::is_valid_identifier(&pretty_name) {
+-                            name = pretty_name;
++                            name = Some(pretty_name);
+                         }
+                     }
+ 
+@@ -1144,12 +1149,12 @@
+                     )
+                     .expect("Not a complex type?");
+ 
+-                    if name.is_empty() {
++                    if !is_anonymous {
+                         // The pretty-printed name may contain typedefed name,
+                         // but may also be "struct (anonymous at .h:1)"
+                         let pretty_name = ty.spelling();
+                         if clang::is_valid_identifier(&pretty_name) {
+-                            name = pretty_name;
++                            name = Some(pretty_name);
+                         }
+                     }
+ 
+@@ -1161,8 +1166,7 @@
+                         location,
+                         None,
+                         ctx,
+-                    )
+-                    .expect("Not able to resolve vector element?");
++                    )?;
+                     TypeKind::Vector(inner, ty.num_elements().unwrap())
+                 }
+                 CXType_ConstantArray => {
+@@ -1189,7 +1193,9 @@
+                 CXType_ObjCClass | CXType_ObjCInterface => {
+                     let interface = ObjCInterface::from_ty(&location, ctx)
+                         .expect("Not a valid objc interface?");
+-                    name = interface.rust_name();
++                    if !is_anonymous {
++                        name = Some(interface.rust_name());
++                    }
+                     TypeKind::ObjCInterface(interface)
+                 }
+                 CXType_Dependent => {
+@@ -1207,7 +1213,7 @@
+             }
+         };
+ 
+-        let name = if name.is_empty() { None } else { Some(name) };
++        name = name.filter(|n| !n.is_empty());
+ 
+         let is_const = ty.is_const() ||
+             (ty.kind() == CXType_ConstantArray &&
diff --git a/firefox102/patches/patch-third__party_rust_bindgen_src_ir_var.rs b/firefox102/patches/patch-third__party_rust_bindgen_src_ir_var.rs
new file mode 100644
index 0000000000..a6f2af8e99
--- /dev/null
+++ b/firefox102/patches/patch-third__party_rust_bindgen_src_ir_var.rs
@@ -0,0 +1,40 @@
+$NetBSD$
+
+rust-bindgen upstream (#2338 and #2319), Self
+Updates the bundled rust-bindgen crate to be compatible
+with Clang/LLVM 16.
+
+clang: Detect anonymous items explicitly, rather than relying on empty names.
+In Clang 16, anonymous items may return names like `(anonymous union at ...)`
+rather than emoty names.
+The right way to detect them is using clang_Cursor_isAnonymous.
+Fixes https://github.com/rust-lang/rust-bindgen/issues/2312
+Closes https://github.com/rust-lang/rust-bindgen/pull/2316
+
+ir: Don't crash with built-in unexposed types from libclang.
+This fixes https://github.com/rust-lang/rust-bindgen/issues/2325
+
+The issue is that `__bf16` is not exposed at all by libclang, which
+causes us to crash. It's a bit of a shame libclang doesn't expose it but
+there's no rust equivalent I think, so this should be ok for now.
+
+Unfortunately no test because the header crashes older clang versions.
+
+--- third_party/rust/bindgen/src/ir/var.rs.orig	2023-05-13 01:44:21.240433172 +0200
++++ third_party/rust/bindgen/src/ir/var.rs	2023-05-13 01:47:51.806534744 +0200
+@@ -301,11 +301,11 @@
+                 let ty = match Item::from_ty(&ty, cursor, None, ctx) {
+                     Ok(ty) => ty,
+                     Err(e) => {
+-                        assert_eq!(
+-                            ty.kind(),
+-                            CXType_Auto,
++                        assert!(
++                        matches!(ty.kind(), CXType_Auto | CXType_Unexposed),
+                             "Couldn't resolve constant type, and it \
+-                             wasn't an nondeductible auto type!"
++                             wasn't an nondeductible auto type or unexposed \
++                             type!"
+                         );
+                         return Err(e);
+                     }
diff --git a/firefox102/patches/patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c b/firefox102/patches/patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c
new file mode 100644
index 0000000000..8fc9b1d663
--- /dev/null
+++ b/firefox102/patches/patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c
@@ -0,0 +1,27 @@
+$NetBSD: patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+Work with PaX MPROTECT on NetBSD by stating that we will later make this memory
+block executable.
+
+--- third_party/wasm2c/wasm2c/wasm-rt-os-unix.c.orig	2022-07-05 12:21:22.000000000 +0000
++++ third_party/wasm2c/wasm2c/wasm-rt-os-unix.c
+@@ -48,6 +48,12 @@ void* os_mmap(void* hint, size_t size, i
+     /* At most 16 G is allowed */
+     return NULL;
+ 
++#ifdef PROT_MPROTECT
++    map_prot |= PROT_MPROTECT(PROT_READ);
++    map_prot |= PROT_MPROTECT(PROT_WRITE);
++    map_prot |= PROT_MPROTECT(PROT_EXEC);
++#endif
++
+   if (prot & MMAP_PROT_READ)
+     map_prot |= PROT_READ;
+ 
+@@ -279,4 +285,4 @@ void os_print_last_error(const char* msg
+ #else
+   // https://stackoverflow.com/questions/26541150/warning-iso-c-forbids-an-empty-translation-unit
+   typedef int make_iso_compilers_happy;
+-#endif
+\ No newline at end of file
++#endif
diff --git a/firefox102/patches/patch-toolkit_components_terminator_nsTerminator.cpp b/firefox102/patches/patch-toolkit_components_terminator_nsTerminator.cpp
new file mode 100644
index 0000000000..d169f36f02
--- /dev/null
+++ b/firefox102/patches/patch-toolkit_components_terminator_nsTerminator.cpp
@@ -0,0 +1,27 @@
+$NetBSD: patch-toolkit_components_terminator_nsTerminator.cpp,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Fix segfault on exit under NetBSD
+
+--- toolkit/components/terminator/nsTerminator.cpp.orig	2022-06-16 21:35:58.000000000 +0000
++++ toolkit/components/terminator/nsTerminator.cpp
+@@ -34,7 +34,7 @@
+ #if defined(XP_WIN)
+ #  include <windows.h>
+ #else
+-#  include <unistd.h>
++#  include <time.h>
+ #endif
+ 
+ #include "mozilla/AppShutdown.h"
+@@ -184,7 +184,10 @@ void RunWatchdog(void* arg) {
+ #if defined(XP_WIN)
+     Sleep(HEARTBEAT_INTERVAL_MS /* ms */);
+ #else
+-    usleep(HEARTBEAT_INTERVAL_MS * 1000 /* usec */);
++    struct timespec tickd;
++    tickd.tv_sec = HEARTBEAT_INTERVAL_MS;
++    tickd.tv_nsec = 0;
++    nanosleep(&tickd, NULL);
+ #endif
+ 
+     if (gHeartbeat++ < timeToLive) {
diff --git a/firefox102/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js b/firefox102/patches/patch-toolkit_modules_subprocess_subprocess__shared__unix.js
new file mode 100644
index 0000000000..345cce8209
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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	2022-05-20 10:44:23.277253777 +0000
++++ toolkit/modules/subprocess/subprocess_shared_unix.js
+@@ -13,7 +13,15 @@
+ 
+ var 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/firefox102/patches/patch-toolkit_moz.configure b/firefox102/patches/patch-toolkit_moz.configure
new file mode 100644
index 0000000000..b8420b28dc
--- /dev/null
+++ b/firefox102/patches/patch-toolkit_moz.configure
@@ -0,0 +1,57 @@
+$NetBSD: patch-toolkit_moz.configure,v 1.1 2022/07/21 23:56:39 nia Exp $
+
+* Add Sun audio support and enable for NetBSD and SunOS by default.
+* Enable ALSA for NetBSD too.
+
+--- toolkit/moz.configure.orig	2022-04-28 23:01:47.000000000 +0000
++++ toolkit/moz.configure
+@@ -198,6 +198,10 @@ def audio_backends_default(target):
+         return ("sndio",)
+     elif target.os == "OSX":
+         return ("audiounit",)
++    elif target.os == "NetBSD":
++        return ("sunaudio",)
++    elif target.os == "SunOS":
++        return ("sunaudio",)
+     elif target.os == "WINNT":
+         return ("wasapi",)
+     else:
+@@ -216,6 +220,7 @@ option(
+         "oss",
+         "pulseaudio",
+         "sndio",
++        "sunaudio",
+         "wasapi",
+     ),
+     default=audio_backends_default,
+@@ -236,6 +241,7 @@ def imply_alsa(values, target):
+         any("alsa" in value for value in values)
+         and target.kernel != "Linux"
+         and target.os != "FreeBSD"
++        and target.os != "NetBSD"
+     ):
+         die("Cannot enable ALSA on %s", target.os)
+     return any("alsa" in value for value in values) or None
+@@ -290,6 +296,13 @@ def imply_sndio(values, target):
+         die("Cannot enable sndio on %s", target.os)
+     return any("sndio" in value for value in values) or None
+ 
++@depends("--enable-audio-backends", target)
++def imply_sunaudio(values, target):
++    if any("sunaudio" in value for value in values) and (
++        target.os != "NetBSD" and target.os != "SunOS"
++    ):
++        die("Cannot enable sunaudio on %s", target.os)
++    return any("sunaudio" in value for value in values) or None
+ 
+ @depends("--enable-audio-backends", target)
+ def imply_wasapi(values, target):
+@@ -314,6 +327,8 @@ imply_option("--enable-pulseaudio", impl
+ 
+ imply_option("--enable-sndio", imply_sndio, reason="--enable-audio-backends")
+ 
++set_config("MOZ_SUNAUDIO", imply_sunaudio, when="--enable-audio-backends")
++
+ set_config("MOZ_WASAPI", imply_wasapi, when="--enable-audio-backends")
+ 
+ # ALSA cubeb backend
diff --git a/firefox102/patches/patch-toolkit_mozapps_installer_packager.mk b/firefox102/patches/patch-toolkit_mozapps_installer_packager.mk
new file mode 100644
index 0000000000..b31e1f177b
--- /dev/null
+++ b/firefox102/patches/patch-toolkit_mozapps_installer_packager.mk
@@ -0,0 +1,15 @@
+$NetBSD: patch-toolkit_mozapps_installer_packager.mk,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-toolkit_xre_glxtest_cpp b/firefox102/patches/patch-toolkit_xre_glxtest_cpp
new file mode 100644
index 0000000000..c4d6215701
--- /dev/null
+++ b/firefox102/patches/patch-toolkit_xre_glxtest_cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+https://bugzilla.mozilla.org/show_bug.cgi?id=1776713
+
+Index: toolkit/xre/glxtest.cpp
+--- toolkit/xre/glxtest.cpp.orig
++++ toolkit/xre/glxtest.cpp
+@@ -258,6 +258,9 @@ static void close_logging() {
+ #define PCI_BASE_CLASS_DISPLAY 0x03
+ 
+ static int get_pci_status() {
++#ifdef __OpenBSD__ || ifdef __NetBSD__ || ifdef __FreeBSD__
++  return 1;
++#endif
+   void* libpci = dlopen("libpci.so.3", RTLD_LAZY);
+   if (!libpci) {
+     libpci = dlopen("libpci.so", RTLD_LAZY);
diff --git a/firefox102/patches/patch-widget_gtk_DMABufSurface.cpp b/firefox102/patches/patch-widget_gtk_DMABufSurface.cpp
new file mode 100644
index 0000000000..9441efb54a
--- /dev/null
+++ b/firefox102/patches/patch-widget_gtk_DMABufSurface.cpp
@@ -0,0 +1,32 @@
+$NetBSD: patch-widget_gtk_DMABufSurface.cpp,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-xpcom_base_nscore.h b/firefox102/patches/patch-xpcom_base_nscore.h
new file mode 100644
index 0000000000..c67e7d838a
--- /dev/null
+++ b/firefox102/patches/patch-xpcom_base_nscore.h
@@ -0,0 +1,15 @@
+$NetBSD: patch-xpcom_base_nscore.h,v 1.1 2022/07/21 23:56:39 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/firefox102/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build b/firefox102/patches/patch-xpcom_reflect_xptcall_md_unix_moz.build
new file mode 100644
index 0000000000..f088071398
--- /dev/null
+++ b/firefox102/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 2022/07/21 23:56:39 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 += [


Home | Main Index | Thread Index | Old Index