diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build
--- third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/adaptation/resource_adaptation_api_gn/moz.build	2022-06-12 05:56:24.362902434 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("resource_adaptation_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/array_view_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/array_view_gn/moz.build
--- third_party/libwebrtc/api/array_view_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/array_view_gn/moz.build	2022-06-12 05:56:24.396949966 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("array_view_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio/aec3_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio/aec3_config_gn/moz.build
--- third_party/libwebrtc/api/audio/aec3_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio/aec3_config_gn/moz.build	2022-06-12 05:56:24.439471290 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec3_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build
--- third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio/aec3_factory_gn/moz.build	2022-06-12 05:56:24.435207869 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec3_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build
--- third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio/audio_frame_api_gn/moz.build	2022-06-12 05:56:24.438045217 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_frame_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build
--- third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio/audio_mixer_api_gn/moz.build	2022-06-12 05:56:24.436619124 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_mixer_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio/echo_control_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio/echo_control_gn/moz.build
--- third_party/libwebrtc/api/audio/echo_control_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio/echo_control_gn/moz.build	2022-06-12 05:56:24.440889538 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("echo_control_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/L16/audio_decoder_L16_gn/moz.build	2022-06-12 05:56:24.402664256 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_L16_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/L16/audio_encoder_L16_gn/moz.build	2022-06-12 05:56:24.404102381 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_L16_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/audio_codecs_api_gn/moz.build	2022-06-12 05:56:24.430891569 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -155,7 +158,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -171,7 +174,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -213,4 +216,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_codecs_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/builtin_audio_decoder_factory_gn/moz.build	2022-06-12 05:56:24.432353129 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FIX"] = "0"
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FLOAT"] = "1"
@@ -172,7 +175,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -188,7 +191,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -243,4 +246,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("builtin_audio_decoder_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/builtin_audio_encoder_factory_gn/moz.build	2022-06-12 05:56:24.416568585 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FIX"] = "0"
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FLOAT"] = "1"
@@ -172,7 +175,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -188,7 +191,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -243,4 +246,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("builtin_audio_encoder_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/g711/audio_decoder_g711_gn/moz.build	2022-06-12 05:56:24.413668420 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_g711_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/g711/audio_encoder_g711_gn/moz.build	2022-06-12 05:56:24.415105914 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_g711_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/g722/audio_decoder_g722_gn/moz.build	2022-06-12 05:56:24.399803143 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_g722_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_config_gn/moz.build	2022-06-12 05:56:24.398365329 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_g722_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/g722/audio_encoder_g722_gn/moz.build	2022-06-12 05:56:24.401232172 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_g722_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/ilbc/audio_decoder_ilbc_gn/moz.build	2022-06-12 05:56:24.417998024 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_ilbc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_config_gn/moz.build	2022-06-12 05:56:24.419412666 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_ilbc_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/ilbc/audio_encoder_ilbc_gn/moz.build	2022-06-12 05:56:24.420847805 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_ilbc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_fix_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_fix_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_fix_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_fix_gn/moz.build	2022-06-12 05:56:24.405299505 +0900
@@ -66,4 +66,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_isac_fix_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_float_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_float_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_float_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_float_gn/moz.build	2022-06-12 05:56:24.412242818 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -145,7 +148,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -161,7 +164,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_isac_float_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_gn/moz.build	2022-06-12 05:56:24.408195092 +0900
@@ -65,14 +65,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FIX"] = "0"
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FLOAT"] = "1"
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -225,4 +228,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_isac_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_fix_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_fix_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_fix_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_fix_gn/moz.build	2022-06-12 05:56:24.410821915 +0900
@@ -66,4 +66,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_isac_fix_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_float_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_float_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_float_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_float_gn/moz.build	2022-06-12 05:56:24.409626685 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -145,7 +148,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -161,7 +164,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_isac_float_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_gn/moz.build	2022-06-12 05:56:24.406743591 +0900
@@ -65,14 +65,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FIX"] = "0"
     DEFINES["WEBRTC_USE_BUILTIN_ISAC_FLOAT"] = "1"
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -225,4 +228,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_isac_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_multiopus_gn/moz.build	2022-06-12 05:56:24.429446030 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_multiopus_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_config_gn/moz.build	2022-06-12 05:56:24.422266915 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_opus_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/opus/audio_decoder_opus_gn/moz.build	2022-06-12 05:56:24.423701875 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_decoder_opus_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_multiopus_gn/moz.build	2022-06-12 05:56:24.425134730 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_multiopus_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_config_gn/moz.build	2022-06-12 05:56:24.426572735 +0900
@@ -72,14 +72,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -157,7 +160,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -173,7 +176,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -215,4 +218,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_opus_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build
--- third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_codecs/opus/audio_encoder_opus_gn/moz.build	2022-06-12 05:56:24.428007384 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_opus_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/audio_options_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/audio_options_api_gn/moz.build
--- third_party/libwebrtc/api/audio_options_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/audio_options_api_gn/moz.build	2022-06-12 05:56:24.364324910 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_options_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/bitrate_allocation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/bitrate_allocation_gn/moz.build
--- third_party/libwebrtc/api/bitrate_allocation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/bitrate_allocation_gn/moz.build	2022-06-12 05:56:24.395533010 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bitrate_allocation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/call_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/call_api_gn/moz.build
--- third_party/libwebrtc/api/call_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/call_api_gn/moz.build	2022-06-12 05:56:24.374370026 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("call_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/callfactory_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/callfactory_api_gn/moz.build
--- third_party/libwebrtc/api/callfactory_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/callfactory_api_gn/moz.build	2022-06-12 05:56:24.357205106 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("callfactory_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build
--- third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/crypto/frame_decryptor_interface_gn/moz.build	2022-06-12 05:56:24.445152207 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frame_decryptor_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build
--- third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/crypto/frame_encryptor_interface_gn/moz.build	2022-06-12 05:56:24.442299811 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frame_encryptor_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/crypto/options_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/crypto/options_gn/moz.build
--- third_party/libwebrtc/api/crypto/options_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/crypto/options_gn/moz.build	2022-06-12 05:56:24.443735251 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("options_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/fec_controller_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/fec_controller_api_gn/moz.build
--- third_party/libwebrtc/api/fec_controller_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/fec_controller_api_gn/moz.build	2022-06-12 05:56:24.358631890 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fec_controller_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build
--- third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/frame_transformer_interface_gn/moz.build	2022-06-12 05:56:24.453730935 +0900
@@ -64,14 +64,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frame_transformer_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/function_view_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/function_view_gn/moz.build
--- third_party/libwebrtc/api/function_view_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/function_view_gn/moz.build	2022-06-12 05:56:24.455146629 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("function_view_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build
--- third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/libjingle_logging_api_gn/moz.build	2022-06-12 05:56:24.375787643 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("jingle_logging_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/media_stream_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/media_stream_interface_gn/moz.build
--- third_party/libwebrtc/api/media_stream_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/media_stream_interface_gn/moz.build	2022-06-12 05:56:24.377227812 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("media_stream_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build
--- third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/neteq/default_neteq_controller_factory_gn/moz.build	2022-06-12 05:56:24.446583359 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("default_neteq_controller_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build
--- third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/neteq/neteq_api_gn/moz.build	2022-06-12 05:56:24.450875874 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("neteq_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build
--- third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/neteq/neteq_controller_api_gn/moz.build	2022-06-12 05:56:24.448001026 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -151,7 +154,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -167,7 +170,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -201,4 +204,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("neteq_controller_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build
--- third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/neteq/tick_timer_gn/moz.build	2022-06-12 05:56:24.449437248 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("tick_timer_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build
--- third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/network_state_predictor_api_gn/moz.build	2022-06-12 05:56:24.324142629 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("network_state_predictor_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/numerics/numerics_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/numerics/numerics_gn/moz.build
--- third_party/libwebrtc/api/numerics/numerics_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/numerics/numerics_gn/moz.build	2022-06-12 05:56:24.378661419 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("numerics_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/priority_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/priority_gn/moz.build
--- third_party/libwebrtc/api/priority_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/priority_gn/moz.build	2022-06-12 05:56:24.433769103 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("priority_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/refcountedbase_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/refcountedbase_gn/moz.build
--- third_party/libwebrtc/api/refcountedbase_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/refcountedbase_gn/moz.build	2022-06-12 05:56:24.322700226 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("refcountedbase_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/rtc_error_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/rtc_error_gn/moz.build
--- third_party/libwebrtc/api/rtc_error_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/rtc_error_gn/moz.build	2022-06-12 05:56:24.351480817 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_error_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build
--- third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/rtc_event_log/rtc_event_log_gn/moz.build	2022-06-12 05:56:24.355790845 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_log_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/rtp_headers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/rtp_headers_gn/moz.build
--- third_party/libwebrtc/api/rtp_headers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/rtp_headers_gn/moz.build	2022-06-12 05:56:24.381501592 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_headers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/rtp_packet_info_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/rtp_packet_info_gn/moz.build
--- third_party/libwebrtc/api/rtp_packet_info_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/rtp_packet_info_gn/moz.build	2022-06-12 05:56:24.452303941 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_packet_info_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/rtp_parameters_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/rtp_parameters_gn/moz.build
--- third_party/libwebrtc/api/rtp_parameters_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/rtp_parameters_gn/moz.build	2022-06-12 05:56:24.354353591 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -149,7 +152,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -165,7 +168,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -207,4 +210,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_parameters_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build
--- third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/rtp_transceiver_direction_gn/moz.build	2022-06-12 05:56:24.360049036 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_transceiver_direction_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/scoped_refptr_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/scoped_refptr_gn/moz.build
--- third_party/libwebrtc/api/scoped_refptr_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/scoped_refptr_gn/moz.build	2022-06-12 05:56:24.380075580 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("scoped_refptr_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/simulated_network_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/simulated_network_api_gn/moz.build
--- third_party/libwebrtc/api/simulated_network_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/simulated_network_api_gn/moz.build	2022-06-12 05:56:24.394113490 +0900
@@ -64,14 +64,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("simulated_network_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build
--- third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/task_queue/task_queue_gn/moz.build	2022-06-12 05:56:24.361472313 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("task_queue_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build
--- third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/bitrate_settings_gn/moz.build	2022-06-12 05:56:24.382929689 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bitrate_settings_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build
--- third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/field_trial_based_config_gn/moz.build	2022-06-12 05:56:24.385520665 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("field_trial_based_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/goog_cc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/goog_cc_gn/moz.build
--- third_party/libwebrtc/api/transport/goog_cc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/goog_cc_gn/moz.build	2022-06-12 05:56:24.389815945 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("goog_cc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/network_control_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/network_control_gn/moz.build
--- third_party/libwebrtc/api/transport/network_control_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/network_control_gn/moz.build	2022-06-12 05:56:24.388374514 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("network_control_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build
--- third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/rtp/dependency_descriptor_gn/moz.build	2022-06-12 05:56:24.391256525 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("dependency_descriptor_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build
--- third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/rtp/rtp_source_gn/moz.build	2022-06-12 05:56:24.392686846 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_source_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/stun_types_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/stun_types_gn/moz.build
--- third_party/libwebrtc/api/transport/stun_types_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/stun_types_gn/moz.build	2022-06-12 05:56:24.384092729 +0900
@@ -56,4 +56,13 @@
     "/third_party/libwebrtc/api/transport/stun.cc"
 ]
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("stun_types_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport/webrtc_key_value_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport/webrtc_key_value_config_gn/moz.build
--- third_party/libwebrtc/api/transport/webrtc_key_value_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport/webrtc_key_value_config_gn/moz.build	2022-06-12 05:56:24.386939504 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_key_value_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/transport_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/transport_api_gn/moz.build
--- third_party/libwebrtc/api/transport_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/transport_api_gn/moz.build	2022-06-12 05:56:24.352912931 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("transport_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/units/data_rate_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/units/data_rate_gn/moz.build
--- third_party/libwebrtc/api/units/data_rate_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/units/data_rate_gn/moz.build	2022-06-12 05:56:24.321264676 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("data_rate_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/units/data_size_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/units/data_size_gn/moz.build
--- third_party/libwebrtc/api/units/data_size_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/units/data_size_gn/moz.build	2022-06-12 05:56:24.316899094 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("data_size_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/units/frequency_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/units/frequency_gn/moz.build
--- third_party/libwebrtc/api/units/frequency_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/units/frequency_gn/moz.build	2022-06-12 05:56:24.315388683 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frequency_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/units/time_delta_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/units/time_delta_gn/moz.build
--- third_party/libwebrtc/api/units/time_delta_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/units/time_delta_gn/moz.build	2022-06-12 05:56:24.319812133 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("time_delta_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/units/timestamp_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/units/timestamp_gn/moz.build
--- third_party/libwebrtc/api/units/timestamp_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/units/timestamp_gn/moz.build	2022-06-12 05:56:24.318363228 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("timestamp_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build
--- third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/builtin_video_bitrate_allocator_factory_gn/moz.build	2022-06-12 05:56:24.347191288 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("builtin_video_bitrate_allocator_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/encoded_frame_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/encoded_frame_gn/moz.build
--- third_party/libwebrtc/api/video/encoded_frame_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/encoded_frame_gn/moz.build	2022-06-12 05:56:24.327043667 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("encoded_frame_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/encoded_image_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/encoded_image_gn/moz.build
--- third_party/libwebrtc/api/video/encoded_image_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/encoded_image_gn/moz.build	2022-06-12 05:56:24.335674062 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("encoded_image_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build
--- third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/recordable_encoded_frame_gn/moz.build	2022-06-12 05:56:24.334229865 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("recordable_encoded_frame_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_adaptation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_adaptation_gn/moz.build
--- third_party/libwebrtc/api/video/video_adaptation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_adaptation_gn/moz.build	2022-06-12 05:56:24.348628762 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_adaptation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build
--- third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_bitrate_allocation_gn/moz.build	2022-06-12 05:56:24.325587518 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_bitrate_allocation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build
--- third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_bitrate_allocator_factory_gn/moz.build	2022-06-12 05:56:24.328484527 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_bitrate_allocator_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build
--- third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_bitrate_allocator_gn/moz.build	2022-06-12 05:56:24.337111266 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_bitrate_allocator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build
--- third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_codec_constants_gn/moz.build	2022-06-12 05:56:24.331362100 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_codec_constants_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_frame_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_frame_gn/moz.build
--- third_party/libwebrtc/api/video/video_frame_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_frame_gn/moz.build	2022-06-12 05:56:24.341416044 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -154,7 +157,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -170,7 +173,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -212,4 +215,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_frame_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build
--- third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_frame_i010_gn/moz.build	2022-06-12 05:56:24.344292515 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_frame_i010_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_frame_i420_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_frame_i420_gn/moz.build
--- third_party/libwebrtc/api/video/video_frame_i420_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_frame_i420_gn/moz.build	2022-06-12 05:56:24.345739086 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_frame_i420_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build
--- third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_frame_metadata_gn/moz.build	2022-06-12 05:56:24.342851093 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_frame_metadata_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_frame_nv12_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_frame_nv12_gn/moz.build
--- third_party/libwebrtc/api/video/video_frame_nv12_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_frame_nv12_gn/moz.build	2022-06-12 05:56:24.339976365 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_frame_nv12_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_frame_type_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_frame_type_gn/moz.build
--- third_party/libwebrtc/api/video/video_frame_type_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_frame_type_gn/moz.build	2022-06-12 05:56:24.350048262 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_frame_type_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build
--- third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_rtp_headers_gn/moz.build	2022-06-12 05:56:24.332804183 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -155,7 +158,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -171,7 +174,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -213,4 +216,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_rtp_headers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_stream_encoder_create_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_stream_encoder_create_gn/moz.build
--- third_party/libwebrtc/api/video/video_stream_encoder_create_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_stream_encoder_create_gn/moz.build	2022-06-12 05:56:24.329940316 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_stream_encoder_create_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build
--- third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video/video_stream_encoder_gn/moz.build	2022-06-12 05:56:24.338534262 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_stream_encoder_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build
--- third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video_codecs/bitstream_parser_api_gn/moz.build	2022-06-12 05:56:24.372953201 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bitstream_parser_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build
--- third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video_codecs/builtin_video_decoder_factory_gn/moz.build	2022-06-12 05:56:24.371532528 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("builtin_video_decoder_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video_codecs/builtin_video_encoder_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video_codecs/builtin_video_encoder_factory_gn/moz.build
--- third_party/libwebrtc/api/video_codecs/builtin_video_encoder_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video_codecs/builtin_video_encoder_factory_gn/moz.build	2022-06-12 05:56:24.368651338 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("builtin_video_encoder_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build
--- third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video_codecs/rtc_software_fallback_wrappers_gn/moz.build	2022-06-12 05:56:24.367217822 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_software_fallback_wrappers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build
--- third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video_codecs/video_codecs_api_gn/moz.build	2022-06-12 05:56:24.365774166 +0900
@@ -75,14 +75,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_codecs_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build
--- third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory_gn/moz.build	2022-06-12 05:56:24.370090916 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("vp8_temporal_layers_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/audio/audio_gn/moz.build firefox-101.0.1/third_party/libwebrtc/audio/audio_gn/moz.build
--- third_party/libwebrtc/audio/audio_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/audio/audio_gn/moz.build	2022-06-12 05:56:24.753035305 +0900
@@ -81,14 +81,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -174,7 +177,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -190,7 +193,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -232,4 +235,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build firefox-101.0.1/third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build
--- third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/audio/utility/audio_frame_operations_gn/moz.build	2022-06-12 05:56:24.751573635 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_frame_operations_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build
--- third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/adaptation/resource_adaptation_gn/moz.build	2022-06-12 05:56:24.757398202 +0900
@@ -77,14 +77,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -170,7 +173,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -186,7 +189,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -228,4 +231,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("resource_adaptation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/audio_sender_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/audio_sender_interface_gn/moz.build
--- third_party/libwebrtc/call/audio_sender_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/audio_sender_interface_gn/moz.build	2022-06-12 05:56:24.764602654 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_sender_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/bitrate_allocator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/bitrate_allocator_gn/moz.build
--- third_party/libwebrtc/call/bitrate_allocator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/bitrate_allocator_gn/moz.build	2022-06-12 05:56:24.766051430 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bitrate_allocator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/bitrate_configurator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/bitrate_configurator_gn/moz.build
--- third_party/libwebrtc/call/bitrate_configurator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/bitrate_configurator_gn/moz.build	2022-06-12 05:56:24.771828497 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bitrate_configurator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/call_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/call_gn/moz.build
--- third_party/libwebrtc/call/call_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/call_gn/moz.build	2022-06-12 05:56:24.754490632 +0900
@@ -72,14 +72,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -165,7 +168,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -181,7 +184,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -223,4 +226,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("call_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/call_interfaces_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/call_interfaces_gn/moz.build
--- third_party/libwebrtc/call/call_interfaces_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/call_interfaces_gn/moz.build	2022-06-12 05:56:24.760296233 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("call_interfaces_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/fake_network_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/fake_network_gn/moz.build
--- third_party/libwebrtc/call/fake_network_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/fake_network_gn/moz.build	2022-06-12 05:56:24.768941176 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fake_network_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/rtp_interfaces_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/rtp_interfaces_gn/moz.build
--- third_party/libwebrtc/call/rtp_interfaces_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/rtp_interfaces_gn/moz.build	2022-06-12 05:56:24.767498882 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_interfaces_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/rtp_receiver_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/rtp_receiver_gn/moz.build
--- third_party/libwebrtc/call/rtp_receiver_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/rtp_receiver_gn/moz.build	2022-06-12 05:56:24.770383168 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_receiver_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/rtp_sender_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/rtp_sender_gn/moz.build
--- third_party/libwebrtc/call/rtp_sender_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/rtp_sender_gn/moz.build	2022-06-12 05:56:24.755935951 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_sender_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/simulated_network_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/simulated_network_gn/moz.build
--- third_party/libwebrtc/call/simulated_network_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/simulated_network_gn/moz.build	2022-06-12 05:56:24.758846085 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("simulated_network_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/simulated_packet_receiver_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/simulated_packet_receiver_gn/moz.build
--- third_party/libwebrtc/call/simulated_packet_receiver_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/simulated_packet_receiver_gn/moz.build	2022-06-12 05:56:24.761726855 +0900
@@ -64,14 +64,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("simulated_packet_receiver_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/call/video_stream_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/call/video_stream_api_gn/moz.build
--- third_party/libwebrtc/call/video_stream_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/call/video_stream_api_gn/moz.build	2022-06-12 05:56:24.763173887 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_stream_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_avx2_gn/moz.build	2022-06-12 05:56:24.523281678 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -145,7 +148,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -161,7 +164,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -199,4 +202,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_avx2_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_c_arm_asm_gn/moz.build	2022-06-12 05:56:24.521866275 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -141,7 +144,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -157,7 +160,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -191,4 +194,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_c_arm_asm_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_c_gn/moz.build	2022-06-12 05:56:24.514798359 +0900
@@ -110,14 +110,17 @@
         "/third_party/libwebrtc/common_audio/signal_processing/filter_ar_fast_q12.c"
     ]
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -217,7 +220,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -233,7 +236,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -294,4 +297,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_cc_gn/moz.build	2022-06-12 05:56:24.504589184 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_cc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_gn/moz.build	2022-06-12 05:56:24.507501182 +0900
@@ -80,14 +80,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -172,7 +175,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -188,7 +191,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -230,4 +233,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_neon_c_gn/moz.build	2022-06-12 05:56:24.516206838 +0900
@@ -71,7 +71,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["CR_SYSROOT_HASH"] = "ef67b6ca8fd6e2e51515a243d043d1ea4caf45e6"
     DEFINES["USE_AURA"] = "1"
@@ -80,7 +80,10 @@
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
     DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -149,7 +152,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -161,7 +164,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -177,4 +180,13 @@
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_neon_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_neon_gn/moz.build	2022-06-12 05:56:24.513264854 +0900
@@ -70,7 +70,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["CR_SYSROOT_HASH"] = "ef67b6ca8fd6e2e51515a243d043d1ea4caf45e6"
     DEFINES["USE_AURA"] = "1"
@@ -79,7 +79,10 @@
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
     DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -176,4 +179,13 @@
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_neon_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build
--- third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/common_audio_sse2_gn/moz.build	2022-06-12 05:56:24.520455261 +0900
@@ -72,14 +72,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -214,4 +217,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_audio_sse2_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build
--- third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/fir_filter_factory_gn/moz.build	2022-06-12 05:56:24.506040845 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fir_filter_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/fir_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/fir_filter_gn/moz.build
--- third_party/libwebrtc/common_audio/fir_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/fir_filter_gn/moz.build	2022-06-12 05:56:24.517618935 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fir_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build
--- third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/sinc_resampler_gn/moz.build	2022-06-12 05:56:24.519035630 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -151,7 +154,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -167,7 +170,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -201,4 +204,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("sinc_resampler_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build
--- third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128_gn/moz.build	2022-06-12 22:12:37.444626968 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -181,7 +184,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -197,7 +200,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -209,7 +212,7 @@
 
     DEFINES["_HAS_ITERATOR_DEBUGGING"] = "0"
 
-if CONFIG["MOZ_X11"] == "1" and CONFIG["OS_TARGET"] == "Linux":
+if CONFIG["MOZ_X11"] == "1" and (CONFIG["OS_TARGET"] == "Linux" or CONFIG["OS_TARGET"] == "NetBSD" or CONFIG["OS_TARGET"] == "OpenBSD" or CONFIG["OS_TARGET"] == "FreeBSD"):
 
     DEFINES["USE_X11"] = "1"
 
@@ -244,11 +247,11 @@
         "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_sse2.cc"
     ]
 
-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"):
 
     DEFINES["CR_SYSROOT_HASH"] = "ef67b6ca8fd6e2e51515a243d043d1ea4caf45e6"
 
-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"):
 
     CXXFLAGS += [
         "-msse2",
@@ -257,7 +260,7 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "d967bcef40477dbc39acef141ff22bf73f3e7cdb"
 
-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"):
 
     CXXFLAGS += [
         "-msse2"
@@ -275,4 +278,13 @@
         "/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_128/ooura_fft_sse2.cc"
     ]
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fft_size_128_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build
--- third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/third_party/ooura/fft_size_256_gn/moz.build	2022-06-12 05:56:24.511867445 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fft_size_256_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build
--- third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor_gn/moz.build	2022-06-12 05:56:24.508956309 +0900
@@ -63,14 +63,17 @@
         "/third_party/libwebrtc/common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
     ]
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -156,7 +159,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -172,7 +175,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -230,4 +233,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("spl_sqrt_floor_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_video/common_video_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_video/common_video_gn/moz.build
--- third_party/libwebrtc/common_video/common_video_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_video/common_video_gn/moz.build	2022-06-12 05:56:24.469543111 +0900
@@ -81,14 +81,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -174,7 +177,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -190,7 +193,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -232,4 +235,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_video_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_video/frame_counts_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_video/frame_counts_gn/moz.build
--- third_party/libwebrtc/common_video/frame_counts_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_video/frame_counts_gn/moz.build	2022-06-12 05:56:24.466650229 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frame_counts_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build firefox-101.0.1/third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build
--- third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/common_video/generic_frame_descriptor/generic_frame_descriptor_gn/moz.build	2022-06-12 05:56:24.468088114 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("generic_frame_descriptor_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build firefox-101.0.1/third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build
--- third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/logging/rtc_event_audio_gn/moz.build	2022-06-12 05:56:24.738530389 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -155,7 +158,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -171,7 +174,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -213,4 +216,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_audio_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build firefox-101.0.1/third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build
--- third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/logging/rtc_event_bwe_gn/moz.build	2022-06-12 05:56:24.739985977 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_bwe_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build firefox-101.0.1/third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build
--- third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/logging/rtc_event_pacing_gn/moz.build	2022-06-12 05:56:24.744323838 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_pacing_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build firefox-101.0.1/third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build
--- third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/logging/rtc_event_rtp_rtcp_gn/moz.build	2022-06-12 05:56:24.742880322 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -164,7 +167,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -180,7 +183,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -222,4 +225,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_rtp_rtcp_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/logging/rtc_event_video_gn/moz.build firefox-101.0.1/third_party/libwebrtc/logging/rtc_event_video_gn/moz.build
--- third_party/libwebrtc/logging/rtc_event_video_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/logging/rtc_event_video_gn/moz.build	2022-06-12 05:56:24.741430705 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_video_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build
--- third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/logging/rtc_stream_config_gn/moz.build	2022-06-12 05:56:24.737092294 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_stream_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_constants_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_constants_gn/moz.build
--- third_party/libwebrtc/media/rtc_constants_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_constants_gn/moz.build	2022-06-12 05:56:24.530410269 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_constants_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_encoder_simulcast_proxy_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_encoder_simulcast_proxy_gn/moz.build
--- third_party/libwebrtc/media/rtc_encoder_simulcast_proxy_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_encoder_simulcast_proxy_gn/moz.build	2022-06-12 05:56:24.528981661 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_encoder_simulcast_proxy_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_h264_profile_id_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_h264_profile_id_gn/moz.build
--- third_party/libwebrtc/media/rtc_h264_profile_id_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_h264_profile_id_gn/moz.build	2022-06-12 05:56:24.533285387 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_h264_profile_id_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build
--- third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_internal_video_codecs_gn/moz.build	2022-06-12 05:56:24.527548445 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_internal_video_codecs_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_media_base_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_media_base_gn/moz.build
--- third_party/libwebrtc/media/rtc_media_base_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_media_base_gn/moz.build	2022-06-12 05:56:24.534722991 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_media_base_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_media_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_media_config_gn/moz.build
--- third_party/libwebrtc/media/rtc_media_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_media_config_gn/moz.build	2022-06-12 05:56:24.526119326 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_media_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build
--- third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_simulcast_encoder_adapter_gn/moz.build	2022-06-12 05:56:24.531848334 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_simulcast_encoder_adapter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/media/rtc_vp9_profile_gn/moz.build firefox-101.0.1/third_party/libwebrtc/media/rtc_vp9_profile_gn/moz.build
--- third_party/libwebrtc/media/rtc_vp9_profile_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/media/rtc_vp9_profile_gn/moz.build	2022-06-12 05:56:24.524708612 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_vp9_profile_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/audio_coding_gn/moz.build	2022-06-12 05:56:24.664154684 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_coding_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/audio_coding_module_typedefs_gn/moz.build	2022-06-12 05:56:24.661248757 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_coding_module_typedefs_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/audio_coding_opus_common_gn/moz.build	2022-06-12 05:56:24.651286516 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_coding_opus_common_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/audio_encoder_cng_gn/moz.build	2022-06-12 05:56:24.678561515 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_encoder_cng_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_config_gn/moz.build	2022-06-12 05:56:24.689573674 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_network_adaptor_config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/audio_network_adaptor_gn/moz.build	2022-06-12 05:56:24.677119462 +0900
@@ -77,14 +77,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -169,7 +172,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -185,7 +188,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -227,4 +230,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_network_adaptor_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/default_neteq_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/default_neteq_factory_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/default_neteq_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/default_neteq_factory_gn/moz.build	2022-06-12 05:56:24.649716654 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("default_neteq_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/g711_c_gn/moz.build	2022-06-12 05:56:24.683828887 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("g711_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/g711_gn/moz.build	2022-06-12 05:56:24.658364221 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("g711_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/g722_c_gn/moz.build	2022-06-12 05:56:24.674229246 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("g722_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/g722_gn/moz.build	2022-06-12 05:56:24.648278468 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -211,4 +214,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("g722_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/ilbc_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/ilbc_c_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/ilbc_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/ilbc_c_gn/moz.build	2022-06-12 05:56:24.665706021 +0900
@@ -135,14 +135,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -227,7 +230,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -243,7 +246,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -285,4 +288,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("ilbc_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/ilbc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/ilbc_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/ilbc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/ilbc_gn/moz.build	2022-06-12 05:56:24.672795328 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("ilbc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_bwinfo_gn/moz.build	2022-06-12 05:56:24.685250411 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_bwinfo_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_c_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_c_gn/moz.build	2022-06-12 05:56:24.654243899 +0900
@@ -89,14 +89,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -167,7 +170,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -183,7 +186,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -225,4 +228,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_common_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_common_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_common_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_common_gn/moz.build	2022-06-12 05:56:24.662692153 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_common_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_fix_c_arm_asm_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_fix_c_arm_asm_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_fix_c_arm_asm_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_fix_c_arm_asm_gn/moz.build	2022-06-12 05:56:24.682398647 +0900
@@ -63,4 +63,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_fix_c_arm_asm_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_fix_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_fix_c_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_fix_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_fix_c_gn/moz.build	2022-06-12 05:56:24.666954381 +0900
@@ -92,4 +92,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_fix_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_fix_common_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_fix_common_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_fix_common_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_fix_common_gn/moz.build	2022-06-12 05:56:24.681215449 +0900
@@ -67,4 +67,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_fix_common_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_fix_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_fix_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_fix_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_fix_gn/moz.build	2022-06-12 05:56:24.646852746 +0900
@@ -67,4 +67,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_fix_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_gn/moz.build	2022-06-12 05:56:24.691008373 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -146,7 +149,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -162,7 +165,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -204,4 +207,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_neon_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_neon_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_neon_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_neon_gn/moz.build	2022-06-12 05:56:24.656910697 +0900
@@ -70,4 +70,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_neon_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/isac_vad_gn/moz.build	2022-06-12 05:56:24.675665227 +0900
@@ -66,14 +66,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -147,7 +150,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -163,7 +166,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -205,4 +208,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("isac_vad_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/legacy_encoded_audio_frame_gn/moz.build	2022-06-12 05:56:24.652754046 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("legacy_encoded_audio_frame_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/neteq_gn/moz.build	2022-06-12 05:56:24.671358044 +0900
@@ -99,14 +99,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -191,7 +194,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -207,7 +210,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -249,4 +252,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("neteq_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/pcm16b_c_gn/moz.build	2022-06-12 05:56:24.659809630 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pcm16b_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/pcm16b_gn/moz.build	2022-06-12 05:56:24.688139717 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -154,7 +157,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -170,7 +173,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -212,4 +215,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pcm16b_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/red_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/red_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/red_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/red_gn/moz.build	2022-06-12 05:56:24.655699477 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("red_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/webrtc_cng_gn/moz.build	2022-06-12 05:56:24.686698626 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_cng_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/webrtc_multiopus_gn/moz.build	2022-06-12 05:56:24.680015831 +0900
@@ -73,7 +73,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -81,7 +81,10 @@
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
     DEFINES["WEBRTC_CODEC_ISAC"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -230,4 +233,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_multiopus_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/webrtc_opus_gn/moz.build	2022-06-12 05:56:24.668411582 +0900
@@ -73,7 +73,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -81,7 +81,10 @@
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
     DEFINES["WEBRTC_CODEC_ISAC"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -169,7 +172,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -185,7 +188,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -237,4 +240,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_opus_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build
--- third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_coding/webrtc_opus_wrapper_gn/moz.build	2022-06-12 05:56:24.669867932 +0900
@@ -72,7 +72,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -80,7 +80,10 @@
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
     DEFINES["WEBRTC_CODEC_ISAC"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -229,4 +232,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_opus_wrapper_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_device/audio_device_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_device/audio_device_api_gn/moz.build
--- third_party/libwebrtc/modules/audio_device/audio_device_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_device/audio_device_api_gn/moz.build	2022-06-12 05:56:24.607922473 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_device_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_device/audio_device_buffer_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_device/audio_device_buffer_gn/moz.build
--- third_party/libwebrtc/modules/audio_device/audio_device_buffer_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_device/audio_device_buffer_gn/moz.build	2022-06-12 05:56:24.615136383 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_device_buffer_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_device/audio_device_default_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_device/audio_device_default_gn/moz.build
--- third_party/libwebrtc/modules/audio_device/audio_device_default_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_device/audio_device_default_gn/moz.build	2022-06-12 05:56:24.610771823 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_device_default_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_device/audio_device_generic_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_device/audio_device_generic_gn/moz.build
--- third_party/libwebrtc/modules/audio_device/audio_device_generic_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_device/audio_device_generic_gn/moz.build	2022-06-12 05:56:24.613658313 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_device_generic_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build
--- third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_device/audio_device_gn/moz.build	2022-06-12 05:56:24.609353204 +0900
@@ -64,14 +64,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -153,7 +156,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -169,7 +172,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_device_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build
--- third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_device/audio_device_impl_gn/moz.build	2022-06-12 05:56:24.612215379 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -164,7 +167,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -180,7 +183,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -222,4 +225,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_device_impl_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build
--- third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_mixer/audio_frame_manipulator_gn/moz.build	2022-06-12 05:56:24.693910382 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_frame_manipulator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build
--- third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_mixer/audio_mixer_impl_gn/moz.build	2022-06-12 05:56:24.692463390 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_mixer_impl_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_erl_gn/moz.build	2022-06-12 05:56:24.573414207 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("adaptive_fir_filter_erl_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/adaptive_fir_filter_gn/moz.build	2022-06-12 05:56:24.580630442 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -151,7 +154,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -167,7 +170,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -201,4 +204,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("adaptive_fir_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_avx2_gn/moz.build	2022-06-12 05:56:24.584886168 +0900
@@ -77,14 +77,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -149,7 +152,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -165,7 +168,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -203,4 +206,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec3_avx2_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_common_gn/moz.build	2022-06-12 05:56:24.576260181 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec3_common_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_fft_gn/moz.build	2022-06-12 05:56:24.572000608 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -151,7 +154,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -167,7 +170,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -201,4 +204,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec3_fft_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/aec3_gn/moz.build	2022-06-12 05:56:24.577786451 +0900
@@ -121,14 +121,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -213,7 +216,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -229,7 +232,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -271,4 +274,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec3_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/fft_data_gn/moz.build	2022-06-12 05:56:24.579211162 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fft_data_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/matched_filter_gn/moz.build	2022-06-12 05:56:24.583459534 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("matched_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/render_buffer_gn/moz.build	2022-06-12 05:56:24.582048119 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("render_buffer_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec3/vector_math_gn/moz.build	2022-06-12 05:56:24.574837855 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("vector_math_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec_dump/aec_dump_gn/moz.build	2022-06-12 05:56:24.569162017 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec_dump_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec_dump/null_aec_dump_factory_gn/moz.build	2022-06-12 05:56:24.567741766 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("null_aec_dump_factory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aec_dump_interface_gn/moz.build	2022-06-12 05:56:24.605055570 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aec_dump_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/aecm/aecm_core_gn/moz.build	2022-06-12 05:56:24.603613447 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -169,7 +172,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -185,7 +188,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -227,4 +230,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aecm_core_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc/agc_gn/moz.build	2022-06-12 05:56:24.557698002 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("agc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc/gain_control_interface_gn/moz.build	2022-06-12 05:56:24.553385118 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("gain_control_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc/gain_map_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc/gain_map_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc/gain_map_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc/gain_map_gn/moz.build	2022-06-12 05:56:24.559120147 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("gain_map_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc/legacy_agc_gn/moz.build	2022-06-12 05:56:24.554817222 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("legacy_agc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc/level_estimation_gn/moz.build	2022-06-12 05:56:24.556253114 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("level_estimation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/adaptive_digital_gn/moz.build	2022-06-12 05:56:24.589208439 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("adaptive_digital_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/biquad_filter_gn/moz.build	2022-06-12 05:56:24.594990325 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("biquad_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/common_gn/moz.build	2022-06-12 05:56:24.597852169 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("common_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/fixed_digital_gn/moz.build	2022-06-12 05:56:24.593556358 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fixed_digital_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/gain_applier_gn/moz.build	2022-06-12 05:56:24.587758521 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("gain_applier_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/level_estimation_agc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/level_estimation_agc_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/level_estimation_agc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/level_estimation_agc_gn/moz.build	2022-06-12 05:56:24.586328401 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("level_estimation_agc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/noise_level_estimator_gn/moz.build	2022-06-12 05:56:24.592112592 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("noise_level_estimator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_gn/moz.build	2022-06-12 05:56:24.590664919 +0900
@@ -75,14 +75,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -167,7 +170,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -183,7 +186,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -225,4 +228,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rnn_vad_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad_with_level_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad_with_level_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad_with_level_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/agc2/rnn_vad_with_level_gn/moz.build	2022-06-12 05:56:24.596425856 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rnn_vad_with_level_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/api_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/api_gn/moz.build	2022-06-12 05:56:24.550547730 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/apm_logging_gn/moz.build	2022-06-12 05:56:24.560566818 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("apm_logging_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/audio_buffer_gn/moz.build	2022-06-12 05:56:24.540516861 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_buffer_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/audio_frame_proxies_gn/moz.build	2022-06-12 05:56:24.561998281 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_frame_proxies_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/audio_frame_view_gn/moz.build	2022-06-12 05:56:24.599268664 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_frame_view_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/audio_processing_gn/moz.build	2022-06-12 05:56:24.600728860 +0900
@@ -82,14 +82,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -174,7 +177,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -190,7 +193,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -232,4 +235,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_processing_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/audio_processing_statistics_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/audio_processing_statistics_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/audio_processing_statistics_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/audio_processing_statistics_gn/moz.build	2022-06-12 05:56:24.551976138 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_processing_statistics_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/config_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/config_gn/moz.build	2022-06-12 05:56:24.570584173 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/high_pass_filter_gn/moz.build	2022-06-12 05:56:24.563439432 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("high_pass_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/ns/ns_gn/moz.build	2022-06-12 05:56:24.539078986 +0900
@@ -80,14 +80,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -172,7 +175,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -188,7 +191,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -230,4 +233,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("ns_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/optionally_built_submodule_creators_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/optionally_built_submodule_creators_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/optionally_built_submodule_creators_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/optionally_built_submodule_creators_gn/moz.build	2022-06-12 05:56:24.566308269 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("optionally_built_submodule_creators_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/rms_level_gn/moz.build	2022-06-12 05:56:24.564869913 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rms_level_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_api_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_api_gn/moz.build	2022-06-12 05:56:24.544814986 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("transient_suppressor_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_impl_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_impl_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_impl_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/transient/transient_suppressor_impl_gn/moz.build	2022-06-12 05:56:24.543394333 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("transient_suppressor_impl_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/utility/cascaded_biquad_filter_gn/moz.build	2022-06-12 05:56:24.549113913 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("cascaded_biquad_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/utility/legacy_delay_estimator_gn/moz.build	2022-06-12 05:56:24.546244104 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -149,7 +152,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -165,7 +168,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -207,4 +210,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("legacy_delay_estimator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/utility/pffft_wrapper_gn/moz.build	2022-06-12 05:56:24.547680897 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pffft_wrapper_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/vad/vad_gn/moz.build	2022-06-12 05:56:24.541957050 +0900
@@ -74,14 +74,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("vad_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/audio_processing/voice_detection_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/audio_processing/voice_detection_gn/moz.build
--- third_party/libwebrtc/modules/audio_processing/voice_detection_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/audio_processing/voice_detection_gn/moz.build	2022-06-12 05:56:24.602163038 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("voice_detection_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/congestion_controller_gn/moz.build	2022-06-12 05:56:24.626650082 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("congestion_controller_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/alr_detector_gn/moz.build	2022-06-12 05:56:24.639709007 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("alr_detector_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/delay_based_bwe_gn/moz.build	2022-06-12 05:56:24.632431788 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("delay_based_bwe_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/estimators_gn/moz.build	2022-06-12 05:56:24.641166379 +0900
@@ -74,14 +74,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -167,7 +170,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -183,7 +186,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -225,4 +228,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("estimators_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/goog_cc_gn/moz.build	2022-06-12 05:56:24.636838417 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("goog_cc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/link_capacity_estimator_gn/moz.build	2022-06-12 05:56:24.635393620 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("link_capacity_estimator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_controller_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_controller_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_controller_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/loss_based_controller_gn/moz.build	2022-06-12 05:56:24.633873701 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("loss_based_controller_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/probe_controller_gn/moz.build	2022-06-12 05:56:24.630988914 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("probe_controller_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/goog_cc/pushback_controller_gn/moz.build	2022-06-12 05:56:24.638274749 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pushback_controller_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/rtp/control_handler_gn/moz.build	2022-06-12 05:56:24.628090352 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("control_handler_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build
--- third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/congestion_controller/rtp/transport_feedback_gn/moz.build	2022-06-12 05:56:24.629535430 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("transport_feedback_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_differ_sse2_gn/moz.build	2022-06-12 05:56:24.728553461 +0900
@@ -54,14 +54,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -115,7 +118,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -127,7 +130,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -160,4 +163,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("desktop_capture_differ_sse2_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build	2022-06-12 05:56:24.731574943 +0900
@@ -85,14 +85,17 @@
         "/third_party/libwebrtc/modules/desktop_capture/mac/window_list_utils.cc"
     ]
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["WEBRTC_USE_PIPEWIRE"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
@@ -261,7 +264,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -273,7 +276,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -330,4 +333,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("desktop_capture_generic_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn/moz.build	2022-06-12 05:56:24.732999103 +0900
@@ -46,14 +46,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -134,7 +137,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -146,7 +149,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("desktop_capture_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build
--- third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/desktop_capture/desktop_capture_objc_gn/moz.build	2022-06-12 05:56:24.734207658 +0900
@@ -64,4 +64,13 @@
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("desktop_capture_objc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build
--- third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/desktop_capture/primitives_gn/moz.build	2022-06-12 05:56:24.729958123 +0900
@@ -54,14 +54,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -116,7 +119,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -128,7 +131,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -160,4 +163,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("primitives_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/module_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/module_api_gn/moz.build
--- third_party/libwebrtc/modules/module_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/module_api_gn/moz.build	2022-06-12 05:56:24.725738244 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("module_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/module_api_public_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/module_api_public_gn/moz.build
--- third_party/libwebrtc/modules/module_api_public_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/module_api_public_gn/moz.build	2022-06-12 05:56:24.727155300 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("module_api_public_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/module_fec_api_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/module_fec_api_gn/moz.build
--- third_party/libwebrtc/modules/module_fec_api_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/module_fec_api_gn/moz.build	2022-06-12 05:56:24.724319004 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("module_fec_api_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build
--- third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/pacing/interval_budget_gn/moz.build	2022-06-12 05:56:24.698269532 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("interval_budget_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/pacing/pacing_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/pacing/pacing_gn/moz.build
--- third_party/libwebrtc/modules/pacing/pacing_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/pacing/pacing_gn/moz.build	2022-06-12 05:56:24.696830665 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pacing_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build
--- third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_gn/moz.build	2022-06-12 05:56:24.695373464 +0900
@@ -79,14 +79,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -172,7 +175,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -188,7 +191,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -230,4 +233,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("remote_bitrate_estimator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_format_gn/moz.build	2022-06-12 05:56:24.642672522 +0900
@@ -109,14 +109,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -202,7 +205,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -218,7 +221,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -260,4 +263,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_rtcp_format_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_rtcp_gn/moz.build	2022-06-12 05:56:24.644206617 +0900
@@ -121,14 +121,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -214,7 +217,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -230,7 +233,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -272,4 +275,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_rtcp_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build
--- third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/rtp_rtcp/rtp_video_header_gn/moz.build	2022-06-12 05:56:24.645656494 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_video_header_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build
--- third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/third_party/fft/fft_gn/moz.build	2022-06-12 05:56:24.625203561 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("fft_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build
--- third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/third_party/g711/g711_3p_gn/moz.build	2022-06-12 05:56:24.623762921 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("g711_3p_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build
--- third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/third_party/g722/g722_3p_gn/moz.build	2022-06-12 05:56:24.622329024 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("g722_3p_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/utility/utility_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/utility/utility_gn/moz.build
--- third_party/libwebrtc/modules/utility/utility_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/utility/utility_gn/moz.build	2022-06-12 05:56:24.606497772 +0900
@@ -72,14 +72,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -164,7 +167,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -180,7 +183,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -222,4 +225,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("utility_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build
--- third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_capture/video_capture_internal_impl_gn/moz.build	2022-06-12 05:56:24.537622275 +0900
@@ -64,14 +64,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -178,7 +181,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -194,7 +197,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -232,4 +235,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_capture_internal_impl_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build
--- third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_capture/video_capture_module_gn/moz.build	2022-06-12 05:56:24.536161728 +0900
@@ -72,14 +72,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -165,7 +168,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -181,7 +184,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -223,4 +226,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_capture_module_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/chain_diff_calculator_gn/moz.build	2022-06-12 05:56:24.721438065 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("chain_diff_calculator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/codec_globals_headers_gn/moz.build	2022-06-12 05:56:24.715644987 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("codec_globals_headers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_decoder_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_decoder_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_decoder_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_decoder_gn/moz.build	2022-06-12 05:56:24.714217873 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aom_av1_decoder_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/codecs/av1/libaom_av1_encoder_gn/moz.build	2022-06-12 05:56:24.712778815 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aom_av1_encoder_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/deprecated/nack_module_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/deprecated/nack_module_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/deprecated/nack_module_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/deprecated/nack_module_gn/moz.build	2022-06-12 05:56:24.706999965 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("nack_module_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/encoded_frame_gn/moz.build	2022-06-12 05:56:24.702647848 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("encoded_frame_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/frame_dependencies_calculator_gn/moz.build	2022-06-12 05:56:24.711342624 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frame_dependencies_calculator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/nack_module_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/nack_module_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/nack_module_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/nack_module_gn/moz.build	2022-06-12 05:56:24.718540825 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -160,7 +163,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -176,7 +179,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -218,4 +221,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("nack_module_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/video_codec_interface_gn/moz.build	2022-06-12 05:56:24.708447818 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_codec_interface_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/video_coding_gn/moz.build	2022-06-12 05:56:24.701198221 +0900
@@ -88,14 +88,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -181,7 +184,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -197,7 +200,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -239,4 +242,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_coding_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/video_coding_utility_gn/moz.build	2022-06-12 05:56:24.705559755 +0900
@@ -77,14 +77,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -170,7 +173,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -186,7 +189,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -228,4 +231,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_coding_utility_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/webrtc_h264_gn/moz.build	2022-06-12 05:56:24.709901713 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_h264_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/webrtc_multiplex_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/webrtc_multiplex_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/webrtc_multiplex_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/webrtc_multiplex_gn/moz.build	2022-06-12 05:56:24.722892300 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -164,7 +167,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -180,7 +183,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -222,4 +225,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_multiplex_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/webrtc_vp8_gn/moz.build	2022-06-12 05:56:24.719996904 +0900
@@ -72,14 +72,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -165,7 +168,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -181,7 +184,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -223,4 +226,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_vp8_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/webrtc_vp8_temporal_layers_gn/moz.build	2022-06-12 05:56:24.704101412 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_vp8_temporal_layers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/webrtc_vp9_gn/moz.build	2022-06-12 05:56:24.699721644 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -163,7 +166,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -179,7 +182,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -221,4 +224,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_vp9_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build
--- third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_coding/webrtc_vp9_helpers_gn/moz.build	2022-06-12 05:56:24.717092450 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -162,7 +165,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -178,7 +181,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -220,4 +223,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_vp9_helpers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_processing/denoiser_filter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_processing/denoiser_filter_gn/moz.build
--- third_party/libwebrtc/modules/video_processing/denoiser_filter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_processing/denoiser_filter_gn/moz.build	2022-06-12 05:56:24.618022172 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("denoiser_filter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_processing/video_processing_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_processing/video_processing_gn/moz.build
--- third_party/libwebrtc/modules/video_processing/video_processing_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_processing/video_processing_gn/moz.build	2022-06-12 05:56:24.619481347 +0900
@@ -74,14 +74,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -167,7 +170,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -183,7 +186,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -225,4 +228,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_processing_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_processing/video_processing_neon_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_processing/video_processing_neon_gn/moz.build
--- third_party/libwebrtc/modules/video_processing/video_processing_neon_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_processing/video_processing_neon_gn/moz.build	2022-06-12 05:56:24.620885548 +0900
@@ -65,7 +65,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["CR_SYSROOT_HASH"] = "ef67b6ca8fd6e2e51515a243d043d1ea4caf45e6"
     DEFINES["USE_AURA"] = "1"
@@ -74,7 +74,10 @@
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
     DEFINES["WEBRTC_ARCH_ARM64"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -132,7 +135,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -144,7 +147,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -160,4 +163,13 @@
 
     DEFINES["WEBRTC_ARCH_ARM64"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_processing_neon_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/modules/video_processing/video_processing_sse2_gn/moz.build firefox-101.0.1/third_party/libwebrtc/modules/video_processing/video_processing_sse2_gn/moz.build
--- third_party/libwebrtc/modules/video_processing/video_processing_sse2_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/modules/video_processing/video_processing_sse2_gn/moz.build	2022-06-12 05:56:24.616589807 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -147,7 +150,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -163,7 +166,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -213,4 +216,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_processing_sse2_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/moz.build firefox-101.0.1/third_party/libwebrtc/moz.build
--- third_party/libwebrtc/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/moz.build	2022-06-12 20:47:14.467085525 +0900
@@ -384,7 +384,7 @@
         "/third_party/libwebrtc/sdk/helpers_objc_gn"
     ]
 
-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":
 
     DIRS += [
         "/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_float_gn",
@@ -497,7 +497,7 @@
         "/third_party/libwebrtc/modules/video_processing/video_processing_sse2_gn"
     ]
 
-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"):
 
     DIRS += [
         "/third_party/libwebrtc/common_audio/common_audio_neon_c_gn",
@@ -505,7 +505,7 @@
         "/third_party/libwebrtc/modules/video_processing/video_processing_neon_gn"
     ]
 
-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"):
 
     DIRS += [
         "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
@@ -515,7 +515,7 @@
         "/third_party/libwebrtc/modules/video_processing/video_processing_sse2_gn"
     ]
 
-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"):
 
     DIRS += [
         "/third_party/libwebrtc/common_audio/common_audio_avx2_gn",
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/atomicops_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/atomicops_gn/moz.build
--- third_party/libwebrtc/rtc_base/atomicops_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/atomicops_gn/moz.build	2022-06-12 05:56:24.809029971 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("atomicops_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build
--- third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/audio_format_to_string_gn/moz.build	2022-06-12 05:56:24.847149454 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("audio_format_to_string_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/checks_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/checks_gn/moz.build
--- third_party/libwebrtc/rtc_base/checks_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/checks_gn/moz.build	2022-06-12 05:56:24.841406431 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("checks_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build
--- third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/compile_assert_c_gn/moz.build	2022-06-12 05:56:24.780445197 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("compile_assert_c_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build
--- third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/criticalsection_gn/moz.build	2022-06-12 05:56:24.837107423 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("criticalsection_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/deprecation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/deprecation_gn/moz.build
--- third_party/libwebrtc/rtc_base/deprecation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/deprecation_gn/moz.build	2022-06-12 05:56:24.811874873 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("deprecation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/divide_round_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/divide_round_gn/moz.build
--- third_party/libwebrtc/rtc_base/divide_round_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/divide_round_gn/moz.build	2022-06-12 05:56:24.838530871 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("divide_round_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/alr_experiment_gn/moz.build	2022-06-12 05:56:24.857180565 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("alr_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/balanced_degradation_settings_gn/moz.build	2022-06-12 05:56:24.854314894 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("balanced_degradation_settings_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/cpu_speed_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/cpu_speed_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/cpu_speed_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/cpu_speed_experiment_gn/moz.build	2022-06-12 05:56:24.851457318 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("cpu_speed_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/field_trial_parser_gn/moz.build	2022-06-12 05:56:24.858617598 +0900
@@ -70,14 +70,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -155,7 +158,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -171,7 +174,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -213,4 +216,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("field_trial_parser_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/jitter_upper_bound_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/jitter_upper_bound_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/jitter_upper_bound_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/jitter_upper_bound_experiment_gn/moz.build	2022-06-12 05:56:24.865783378 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("jitter_upper_bound_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/keyframe_interval_settings_experiment_gn/moz.build	2022-06-12 05:56:24.855743672 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("keyframe_interval_settings_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/min_video_bitrate_experiment_gn/moz.build	2022-06-12 05:56:24.848586808 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("min_video_bitrate_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/quality_rampup_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/quality_rampup_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/quality_rampup_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/quality_rampup_experiment_gn/moz.build	2022-06-12 05:56:24.864348419 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("quality_rampup_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/quality_scaler_settings_gn/moz.build	2022-06-12 05:56:24.861480524 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("quality_scaler_settings_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/quality_scaling_experiment_gn/moz.build	2022-06-12 05:56:24.862913720 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("quality_scaling_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/rate_control_settings_gn/moz.build	2022-06-12 05:56:24.850026396 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rate_control_settings_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/rtt_mult_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/rtt_mult_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/rtt_mult_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/rtt_mult_experiment_gn/moz.build	2022-06-12 05:56:24.860046165 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtt_mult_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build
--- third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/experiments/stable_target_rate_experiment_gn/moz.build	2022-06-12 05:56:24.852886547 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("stable_target_rate_experiment_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build
--- third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/gtest_prod_gn/moz.build	2022-06-12 05:56:24.794779302 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("gtest_prod_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build
--- third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/ignore_wundef_gn/moz.build	2022-06-12 05:56:24.776137794 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("ignore_wundef_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/logging_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/logging_gn/moz.build
--- third_party/libwebrtc/rtc_base/logging_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/logging_gn/moz.build	2022-06-12 05:56:24.810456053 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("logging_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/macromagic_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/macromagic_gn/moz.build
--- third_party/libwebrtc/rtc_base/macromagic_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/macromagic_gn/moz.build	2022-06-12 05:56:24.799070444 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("macromagic_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build
--- third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/memory/aligned_malloc_gn/moz.build	2022-06-12 05:56:24.781880877 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("aligned_malloc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build
--- third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/network/sent_packet_gn/moz.build	2022-06-12 05:56:24.803348643 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("sent_packet_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build
--- third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/platform_thread_gn/moz.build	2022-06-12 05:56:24.839971501 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("platform_thread_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build
--- third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/platform_thread_types_gn/moz.build	2022-06-12 05:56:24.821929316 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("platform_thread_types_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build
--- third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/protobuf_utils_gn/moz.build	2022-06-12 05:56:24.801918983 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("protobuf_utils_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build
--- third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/rate_limiter_gn/moz.build	2022-06-12 05:56:24.774711510 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rate_limiter_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/refcount_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/refcount_gn/moz.build
--- third_party/libwebrtc/rtc_base/refcount_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/refcount_gn/moz.build	2022-06-12 05:56:24.804769536 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("refcount_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/rtc_base_approved_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/rtc_base_approved_gn/moz.build
--- third_party/libwebrtc/rtc_base/rtc_base_approved_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/rtc_base_approved_gn/moz.build	2022-06-12 05:56:24.783339742 +0900
@@ -80,14 +80,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -169,7 +172,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -185,7 +188,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -227,4 +230,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_base_approved_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/rtc_base_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/rtc_base_gn/moz.build
--- third_party/libwebrtc/rtc_base/rtc_base_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/rtc_base_gn/moz.build	2022-06-12 05:56:24.844306406 +0900
@@ -94,14 +94,17 @@
         "/third_party/libwebrtc/rtc_base/mac_ifaddrs_converter.cc"
     ]
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -202,7 +205,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -218,7 +221,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -260,4 +263,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_base_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build
--- third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/rtc_event_gn/moz.build	2022-06-12 05:56:24.867217466 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_event_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build
--- third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/rtc_numerics_gn/moz.build	2022-06-12 05:56:24.820498745 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -154,7 +157,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -170,7 +173,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -212,4 +215,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_numerics_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build
--- third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/rtc_task_queue_gn/moz.build	2022-06-12 05:56:24.797650483 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_task_queue_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build
--- third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/safe_compare_gn/moz.build	2022-06-12 05:56:24.800493401 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("safe_compare_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build
--- third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/safe_conversions_gn/moz.build	2022-06-12 05:56:24.842827875 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("safe_conversions_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build
--- third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/safe_minmax_gn/moz.build	2022-06-12 05:56:24.791922668 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("safe_minmax_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build
--- third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/sanitizer_gn/moz.build	2022-06-12 05:56:24.807610360 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("sanitizer_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/stringutils_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/stringutils_gn/moz.build
--- third_party/libwebrtc/rtc_base/stringutils_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/stringutils_gn/moz.build	2022-06-12 05:56:24.796219691 +0900
@@ -71,14 +71,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("stringutils_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build
--- third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/synchronization/mutex_gn/moz.build	2022-06-12 05:56:24.814760290 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("mutex_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/synchronization/rw_lock_wrapper_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/synchronization/rw_lock_wrapper_gn/moz.build
--- third_party/libwebrtc/rtc_base/synchronization/rw_lock_wrapper_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/synchronization/rw_lock_wrapper_gn/moz.build	2022-06-12 05:56:24.813323838 +0900
@@ -71,14 +71,17 @@
         "/third_party/libwebrtc/rtc_base/synchronization/rw_lock_posix.cc"
     ]
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -168,7 +171,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -184,7 +187,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -226,4 +229,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rw_lock_wrapper_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/synchronization/sequence_checker_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/synchronization/sequence_checker_gn/moz.build
--- third_party/libwebrtc/rtc_base/synchronization/sequence_checker_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/synchronization/sequence_checker_gn/moz.build	2022-06-12 05:56:24.819059668 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("sequence_checker_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build
--- third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/synchronization/yield_gn/moz.build	2022-06-12 05:56:24.817627514 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("yield_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build
--- third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/synchronization/yield_policy_gn/moz.build	2022-06-12 05:56:24.816191142 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("yield_policy_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/arch_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/arch_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/arch_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/arch_gn/moz.build	2022-06-12 05:56:24.835672895 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("arch_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/asm_defines_gn/moz.build	2022-06-12 05:56:24.823116271 +0900
@@ -57,4 +57,13 @@
     DEFINES["DYNAMIC_ANNOTATIONS_ENABLED"] = "1"
     DEFINES["_DEBUG"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("asm_defines_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/cocoa_threading_gn/moz.build	2022-06-12 05:56:24.831403503 +0900
@@ -54,4 +54,13 @@
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("cocoa_threading_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/file_wrapper_gn/moz.build	2022-06-12 05:56:24.832830057 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("file_wrapper_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/ignore_warnings_gn/moz.build	2022-06-12 05:56:24.828794684 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("ignore_warnings_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/inline_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/inline_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/inline_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/inline_gn/moz.build	2022-06-12 05:56:24.827375654 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("inline_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/rtc_export_gn/moz.build	2022-06-12 05:56:24.834255929 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtc_export_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/thread_registry_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/thread_registry_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/thread_registry_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/thread_registry_gn/moz.build	2022-06-12 05:56:24.825954110 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -194,4 +197,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("thread_registry_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/unused_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/unused_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/unused_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/unused_gn/moz.build	2022-06-12 05:56:24.830212020 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("unused_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build
--- third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/system/warn_current_thread_is_deadlocked_gn/moz.build	2022-06-12 05:56:24.824530201 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("warn_current_thread_is_deadlocked_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/task_utils/pending_task_safety_flag_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/task_utils/pending_task_safety_flag_gn/moz.build
--- third_party/libwebrtc/rtc_base/task_utils/pending_task_safety_flag_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/task_utils/pending_task_safety_flag_gn/moz.build	2022-06-12 05:56:24.789076864 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pending_task_safety_flag_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build
--- third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/task_utils/repeating_task_gn/moz.build	2022-06-12 05:56:24.787644319 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -159,7 +162,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -175,7 +178,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -217,4 +220,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("repeating_task_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/task_utils/to_queued_task_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/task_utils/to_queued_task_gn/moz.build
--- third_party/libwebrtc/rtc_base/task_utils/to_queued_task_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/task_utils/to_queued_task_gn/moz.build	2022-06-12 05:56:24.790502987 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("to_queued_task_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build
--- third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/third_party/base64/base64_gn/moz.build	2022-06-12 05:56:24.786204861 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("base64_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build
--- third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/third_party/sigslot/sigslot_gn/moz.build	2022-06-12 05:56:24.784774911 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -144,7 +147,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -160,7 +163,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -202,4 +205,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("sigslot_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/thread_checker_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/thread_checker_gn/moz.build
--- third_party/libwebrtc/rtc_base/thread_checker_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/thread_checker_gn/moz.build	2022-06-12 05:56:24.806190539 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("thread_checker_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/time/timestamp_extrapolator_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/time/timestamp_extrapolator_gn/moz.build
--- third_party/libwebrtc/rtc_base/time/timestamp_extrapolator_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/time/timestamp_extrapolator_gn/moz.build	2022-06-12 05:56:24.793360062 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("timestamp_extrapolator_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/timeutils_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/timeutils_gn/moz.build
--- third_party/libwebrtc/rtc_base/timeutils_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/timeutils_gn/moz.build	2022-06-12 05:56:24.777591368 +0900
@@ -69,14 +69,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -154,7 +157,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -170,7 +173,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -212,4 +215,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("timeutils_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/type_traits_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/type_traits_gn/moz.build
--- third_party/libwebrtc/rtc_base/type_traits_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/type_traits_gn/moz.build	2022-06-12 05:56:24.845723512 +0900
@@ -59,14 +59,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -136,7 +139,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -152,7 +155,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -186,4 +189,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("type_traits_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build
--- third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/units/unit_base_gn/moz.build	2022-06-12 05:56:24.779023282 +0900
@@ -63,14 +63,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -140,7 +143,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -156,7 +159,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -190,4 +193,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("unit_base_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build firefox-101.0.1/third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build
--- third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/rtc_base/weak_ptr_gn/moz.build	2022-06-12 05:56:24.773261333 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -148,7 +151,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -164,7 +167,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -206,4 +209,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("weak_ptr_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/sdk/base_objc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/sdk/base_objc_gn/moz.build
--- third_party/libwebrtc/sdk/base_objc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/sdk/base_objc_gn/moz.build	2022-06-12 05:56:24.746742411 +0900
@@ -72,4 +72,13 @@
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("base_objc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/sdk/helpers_objc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/sdk/helpers_objc_gn/moz.build
--- third_party/libwebrtc/sdk/helpers_objc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/sdk/helpers_objc_gn/moz.build	2022-06-12 05:56:24.745536030 +0900
@@ -67,4 +67,13 @@
     DEFINES["WEBRTC_ARCH_ARM64"] = True
     DEFINES["WEBRTC_HAS_NEON"] = True
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("helpers_objc_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build firefox-101.0.1/third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build
--- third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/system_wrappers/field_trial_gn/moz.build	2022-06-12 05:56:24.458001419 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("field_trial_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/system_wrappers/metrics_gn/moz.build firefox-101.0.1/third_party/libwebrtc/system_wrappers/metrics_gn/moz.build
--- third_party/libwebrtc/system_wrappers/metrics_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/system_wrappers/metrics_gn/moz.build	2022-06-12 05:56:24.456564436 +0900
@@ -67,14 +67,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -152,7 +155,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -168,7 +171,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -210,4 +213,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("metrics_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build
--- third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/system_wrappers/system_wrappers_gn/moz.build	2022-06-12 05:56:24.459441368 +0900
@@ -77,14 +77,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -173,7 +176,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -189,7 +192,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -231,4 +234,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("system_wrappers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/test/rtp_test_utils_gn/moz.build firefox-101.0.1/third_party/libwebrtc/test/rtp_test_utils_gn/moz.build
--- third_party/libwebrtc/test/rtp_test_utils_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/test/rtp_test_utils_gn/moz.build	2022-06-12 05:56:24.735653077 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rtp_test_utils_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/algorithm_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/algorithm_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/algorithm_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/algorithm_gn/moz.build	2022-06-12 05:56:24.484321739 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("algorithm_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/container_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/container_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/container_gn/moz.build	2022-06-08 23:10:32.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/algorithm/container_gn/moz.build	2022-06-12 05:56:24.485649678 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("container_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/base/atomic_hook_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/base/atomic_hook_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/base/atomic_hook_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/base/atomic_hook_gn/moz.build	2022-06-12 05:56:24.489671155 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("atomic_hook_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/base/base_internal_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/base/base_internal_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/base/base_internal_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/base/base_internal_gn/moz.build	2022-06-12 05:56:24.495038524 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("base_internal_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/base/config_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/base/config_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/base/config_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/base/config_gn/moz.build	2022-06-12 05:56:24.493695387 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("config_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/base/core_headers_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/base/core_headers_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/base/core_headers_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/base/core_headers_gn/moz.build	2022-06-12 05:56:24.491005335 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("core_headers_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/base/log_severity_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/base/log_severity_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/base/log_severity_gn/moz.build	2022-06-08 23:10:32.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/base/log_severity_gn/moz.build	2022-06-12 05:56:24.488340290 +0900
@@ -48,7 +48,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -112,7 +112,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -154,4 +154,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("log_severity_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/base/raw_logging_internal_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/base/raw_logging_internal_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/base/raw_logging_internal_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/base/raw_logging_internal_gn/moz.build	2022-06-12 05:56:24.492349755 +0900
@@ -48,7 +48,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -112,7 +112,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -154,4 +154,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("raw_logging_internal_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/container/compressed_tuple_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/container/compressed_tuple_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/container/compressed_tuple_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/container/compressed_tuple_gn/moz.build	2022-06-12 05:56:24.496374288 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("compressed_tuple_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/container/flat_hash_map_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/container/flat_hash_map_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/container/flat_hash_map_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/container/flat_hash_map_gn/moz.build	2022-06-12 05:56:24.500382530 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("flat_hash_map_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_gn/moz.build	2022-06-12 05:56:24.497706054 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("inlined_vector_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_internal_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_internal_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_internal_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/container/inlined_vector_internal_gn/moz.build	2022-06-12 05:56:24.499046376 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("inlined_vector_internal_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/memory/memory_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/memory/memory_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/memory/memory_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/memory/memory_gn/moz.build	2022-06-12 05:56:24.472221450 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("memory_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/meta/type_traits_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/meta/type_traits_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/meta/type_traits_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/meta/type_traits_gn/moz.build	2022-06-12 05:56:24.476275308 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("type_traits_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/numeric/int128_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/numeric/int128_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/numeric/int128_gn/moz.build	2022-06-08 23:10:32.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/numeric/int128_gn/moz.build	2022-06-12 05:56:24.486998546 +0900
@@ -48,7 +48,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -112,7 +112,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -154,4 +154,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("int128_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/strings/internal_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/strings/internal_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/strings/internal_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/strings/internal_gn/moz.build	2022-06-12 05:56:24.474936750 +0900
@@ -50,7 +50,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -114,7 +114,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -156,4 +156,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("internal_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/strings/strings_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/strings/strings_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/strings/strings_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/strings/strings_gn/moz.build	2022-06-12 05:56:24.473586168 +0900
@@ -63,7 +63,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -127,7 +127,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -169,4 +169,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("strings_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_optional_access_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_optional_access_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_optional_access_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_optional_access_gn/moz.build	2022-06-12 05:56:24.478960391 +0900
@@ -48,7 +48,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -112,7 +112,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -154,4 +154,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bad_optional_access_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_variant_access_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_variant_access_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_variant_access_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/types/bad_variant_access_gn/moz.build	2022-06-12 05:56:24.480314679 +0900
@@ -48,7 +48,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -112,7 +112,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -154,4 +154,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("bad_variant_access_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/types/optional_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/types/optional_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/types/optional_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/types/optional_gn/moz.build	2022-06-12 05:56:24.482986035 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("optional_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/types/span_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/types/span_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/types/span_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/types/span_gn/moz.build	2022-06-12 05:56:24.481648599 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("span_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/types/variant_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/types/variant_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/types/variant_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/types/variant_gn/moz.build	2022-06-12 05:56:24.477608377 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("variant_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/abseil-cpp/absl/utility/utility_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/abseil-cpp/absl/utility/utility_gn/moz.build
--- third_party/libwebrtc/third_party/abseil-cpp/absl/utility/utility_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/abseil-cpp/absl/utility/utility_gn/moz.build	2022-06-12 05:56:24.470883924 +0900
@@ -44,7 +44,7 @@
     DEFINES["_LIBCPP_HAS_NO_ALIGNED_ALLOCATION"] = True
     DEFINES["__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES"] = "0"
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -104,7 +104,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -138,4 +138,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("utility_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build
--- third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/pffft/pffft_gn/moz.build	2022-06-12 05:56:24.501769359 +0900
@@ -49,7 +49,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -116,7 +116,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -132,7 +132,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -174,4 +174,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("pffft_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build firefox-101.0.1/third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build
--- third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/third_party/rnnoise/rnn_vad_gn/moz.build	2022-06-12 05:56:24.503156990 +0900
@@ -49,7 +49,7 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
@@ -115,7 +115,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -131,7 +131,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -173,4 +173,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("rnn_vad_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build firefox-101.0.1/third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build
--- third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/video/adaptation/video_adaptation_gn/moz.build	2022-06-12 05:56:24.460885214 +0900
@@ -75,14 +75,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -168,7 +171,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -184,7 +187,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -226,4 +229,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_adaptation_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build firefox-101.0.1/third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build
--- third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/video/frame_dumping_decoder_gn/moz.build	2022-06-12 05:56:24.465240707 +0900
@@ -68,14 +68,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -161,7 +164,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -177,7 +180,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -219,4 +222,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("frame_dumping_decoder_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/video/video_gn/moz.build firefox-101.0.1/third_party/libwebrtc/video/video_gn/moz.build
--- third_party/libwebrtc/video/video_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/video/video_gn/moz.build	2022-06-12 05:56:24.462364426 +0900
@@ -97,14 +97,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -190,7 +193,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -206,7 +209,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -248,4 +251,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build firefox-101.0.1/third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build
--- third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/video/video_stream_encoder_impl_gn/moz.build	2022-06-12 05:56:24.463804525 +0900
@@ -73,14 +73,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -166,7 +169,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -182,7 +185,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -224,4 +227,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("video_stream_encoder_impl_gn")
diff -ur firefox-101.0.1.orig/third_party/libwebrtc/webrtc_gn/moz.build firefox-101.0.1/third_party/libwebrtc/webrtc_gn/moz.build
--- third_party/libwebrtc/webrtc_gn/moz.build	2022-06-08 23:10:31.000000000 +0900
_+++ third_party/libwebrtc/webrtc_gn/moz.build	2022-06-12 05:56:24.750125411 +0900
@@ -64,14 +64,17 @@
     DEFINES["__STDC_CONSTANT_MACROS"] = True
     DEFINES["__STDC_FORMAT_MACROS"] = True
 
-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":
 
     DEFINES["USE_AURA"] = "1"
     DEFINES["USE_GLIB"] = "1"
     DEFINES["USE_NSS_CERTS"] = "1"
     DEFINES["USE_OZONE"] = "1"
     DEFINES["USE_UDEV"] = True
-    DEFINES["WEBRTC_LINUX"] = True
+    if CONFIG["OS_TARGET"] == "Linux":
+        DEFINES["WEBRTC_LINUX"] = True
+    else:
+        DEFINES["WEBRTC_BSD"] = True
     DEFINES["WEBRTC_POSIX"] = True
     DEFINES["_FILE_OFFSET_BITS"] = "64"
     DEFINES["_GNU_SOURCE"] = True
@@ -171,7 +174,7 @@
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
-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"):
 
     DEFINES["_FORTIFY_SOURCE"] = "2"
 
@@ -187,7 +190,7 @@
 
     DEFINES["_DEBUG"] = True
 
-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"):
 
     DEFINES["_DEBUG"] = True
 
@@ -232,4 +235,13 @@
 
     DEFINES["CR_SYSROOT_HASH"] = "5f64b417e1018dcf8fcc81dc2714e0f264b9b911"
 
+if CONFIG["CPU_ARCH"] == "x86":
+    CFLAGS += [
+        "-msse2"
+    ]
+
+    CXXFLAGS += [
+        "-msse2"
+    ]
+
 Library("webrtc_gn")
