summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/firefox/Makefile14
-rw-r--r--www/firefox/distinfo16
-rw-r--r--www/firefox/files/replace-moz.build.awk24
-rw-r--r--www/firefox/mozilla-common.mk4
-rw-r--r--www/firefox/patches/patch-js_src_jit_GenerateAtomicOperations.py16
-rw-r--r--www/firefox/patches/patch-modules_fdlibm_src_math__private.h9
-rw-r--r--www/firefox/patches/patch-mozglue_misc_SIMD.cpp54
-rw-r--r--www/firefox/patches/patch-mozglue_misc_SIMD__avx2.cpp19
-rw-r--r--www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc63
-rw-r--r--www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__v4l2.cc67
-rw-r--r--www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_video__capture__v4l2.cc23
11 files changed, 135 insertions, 174 deletions
diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index 3fe621e2da0..0b452c1944e 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -1,12 +1,11 @@
-# $NetBSD: Makefile,v 1.541 2022/11/23 16:21:19 adam Exp $
+# $NetBSD: Makefile,v 1.542 2022/12/11 13:49:09 ryoon Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
-MOZ_BRANCH= 105.0
-MOZ_BRANCH_MINOR= .3
+MOZ_BRANCH= 107.0
+MOZ_BRANCH_MINOR= .1
DISTNAME= firefox-${FIREFOX_VER}.source
PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//}
-PKGREVISION= 1
CATEGORIES= www
MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
EXTRACT_SUFX= .tar.xz
@@ -59,6 +58,8 @@ CONFIGURE_ARGS+= --enable-application=browser
# for lang/gcc6
CFLAGS+= -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS
CFLAGS.SunOS+= -D_POSIX_PTHREAD_SEMANTICS
+# Do not use uselocale() in third_party/pipewire.
+CFLAGS.NetBSD+= -D__LOCALE_C_ONLY
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/${PKGBASE}
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib
@@ -105,8 +106,9 @@ MOZILLA_BRANDING= unofficial
.endif
pre-configure:
- cd ${WRKSRC} && autoconf
- cd ${WRKSRC}/js/src && autoconf
+# As of 106.0, .in template files are not patched.
+# cd ${WRKSRC} && autoconf
+# cd ${WRKSRC}/js/src && autoconf
cd ${WRKSRC} && mkdir ${OBJDIR}
cd ${WRKSRC}/${OBJDIR} && touch old-configure.vars
# Do not fetch Rust Cargo file via network during build
diff --git a/www/firefox/distinfo b/www/firefox/distinfo
index f8603957567..cf62143aaf6 100644
--- a/www/firefox/distinfo
+++ b/www/firefox/distinfo
@@ -1,8 +1,8 @@
-$NetBSD: distinfo,v 1.484 2022/10/08 21:18:55 ryoon Exp $
+$NetBSD: distinfo,v 1.485 2022/12/11 13:49:09 ryoon Exp $
-BLAKE2s (firefox-105.0.3.source.tar.xz) = 64757132ada61d6a258bfa43c121884181be4702d064b10e5ca40f6666d096e8
-SHA512 (firefox-105.0.3.source.tar.xz) = 8a60ed26f3a6e3fafb1eb13a8daf067056d011a17835310f8ce814b86121014796e790f611058aea75334428529028a2e29ba81d9d2653e09517dc7c3cf48e76
-Size (firefox-105.0.3.source.tar.xz) = 484942048 bytes
+BLAKE2s (firefox-107.0.1.source.tar.xz) = b2c7102eacf1f3aa7b3919f2af5511e3a5da245a81a8d26437dc39951d4336d3
+SHA512 (firefox-107.0.1.source.tar.xz) = e57e4bfcecbcc6dbe73f23577a14a2998c8c3f3d602f85ea06f99e0974e78481b9f7bdb019cb4e9733e59f56be1407edd64a2adb7b284bb4a87b46b1e2295dea
+Size (firefox-107.0.1.source.tar.xz) = 508678860 bytes
BLAKE2s (nodejs-output-95.0.tgz) = c44b37d3605524a49157002f01c29f568f04194b0e635bc312de7ffdeb9a74c9
SHA512 (nodejs-output-95.0.tgz) = 2faf326f4e100b66f8597c365cc2eb5d0eee26aae92a7e2446891f2178041aa71ba16eae37000acacd43a657025ec11c18db73b112f5c49cc21cdb882da6d798
Size (nodejs-output-95.0.tgz) = 200627 bytes
@@ -20,7 +20,6 @@ SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 298642a352780411
SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 35d20981d33ccdb1d8ffb8039e48798777f11658
SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 6cdd0fe60455eab8f9846257c2bfea207f19478b
SHA1 (patch-js_src_jit_FlushICache.cpp) = b7536050d06e87612fbedc7ce269b5f120eb0ce9
-SHA1 (patch-js_src_jit_GenerateAtomicOperations.py) = ef01ad195ca50b41936f90492ee440ada9e5cafa
SHA1 (patch-js_src_jit_ProcessExecutableMemory.cpp) = fad103cc698f9828ad58f742231984ec2bc27605
SHA1 (patch-js_src_util_NativeStack.cpp) = a0a16d8d8d78d3cc3f4d2a508586f1a7821f7dba
SHA1 (patch-js_src_vm_ArrayBufferObject.cpp) = 0501fdcae11568ae4ea78e0d2f6b3750b7a67d47
@@ -30,14 +29,13 @@ SHA1 (patch-media_libcubeb_src_cubeb__jack.cpp) = fc546c5e6582fd5eda64ba83287dfb
SHA1 (patch-media_libcubeb_src_moz.build) = e027285ea24f2626b1328d4c6e9a31ed55445f99
SHA1 (patch-media_libpng_pngpriv.h) = c8084332560017cd7c9b519b61d125fa28af0dbc
SHA1 (patch-media_libtheora_lib_info.c) = f6dbf536d73859a1ff78304c2e9f6a6f74dac01f
-SHA1 (patch-modules_fdlibm_src_math__private.h) = 61a54ae2deda36d66b6d9515471ecc7980d3b574
-SHA1 (patch-mozglue_misc_SIMD.cpp) = 2ab2e32c46c22deae29c346ad6eac2fb1bfa8065
-SHA1 (patch-mozglue_misc_SIMD__avx2.cpp) = d5bd662b620d981a6288f89026339f24c809e56d
+SHA1 (patch-modules_fdlibm_src_math__private.h) = e20b6c23011d7123cbbd64a500eb8ce8c426620e
SHA1 (patch-mozglue_misc_Uptime.cpp) = daefe25ef1ebc8e4d3735017b9e8ac68c4710a00
SHA1 (patch-nsprpub_pr_src_pthreads_ptsynch.c) = 13e512c7ee9fa1e14ba415d62fa853e5fbfc91c0
SHA1 (patch-security_nss_lib_freebl_mpi_mpi.c) = a7cd867916524770609d1c307a65b315b88456f4
SHA1 (patch-third__party_js_cfworker_build.sh) = 46cdf97b99cf01080f290ae8d9a33b5f869fc3e4
-SHA1 (patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc) = 2e951d7d91934751608e99628fc144632d8a3b5c
+SHA1 (patch-third__party_libwebrtc_modules_video__capture_linux_device__info__v4l2.cc) = a38d6a7acbc8ba8060f2cf3c8325f7d96902b3f0
+SHA1 (patch-third__party_libwebrtc_modules_video__capture_linux_video__capture__v4l2.cc) = 28b9bb8b078b479d9cc0f8ccdc4d04e5a281c1b9
SHA1 (patch-third__party_libwebrtc_system__wrappers_source_cpu__features__linux.cc) = b90e22b50879f7adcc1da3a993f52c0701b720f8
SHA1 (patch-third__party_wasm2c_wasm2c_wasm-rt-os-unix.c) = 9b8ce4b823fd06951aac59bdb4a5642f256b8e3f
SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = bd7b2a0f2407c3ab95515b2f143c41c3ca6fb0c4
diff --git a/www/firefox/files/replace-moz.build.awk b/www/firefox/files/replace-moz.build.awk
index f9420142a94..dc85437dbe6 100644
--- a/www/firefox/files/replace-moz.build.awk
+++ b/www/firefox/files/replace-moz.build.awk
@@ -9,6 +9,30 @@
print $0;
next;
}
+/^if CONFIG\[\"CPU_ARCH\"\] == \"arm\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/{
+ flag = 0;
+ sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"arm\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG\[\"CPU_ARCH\"\] == \"arm\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+ print $0;
+ next;
+}
+/^if CONFIG\[\"CPU_ARCH\"\] == \"aarch64\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/{
+ flag = 0;
+ sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"aarch64\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG\[\"CPU_ARCH\"\] == \"aarch64\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+ print $0;
+ next;
+}
+/^if CONFIG\[\"CPU_ARCH\"\] == \"x86\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/{
+ flag = 0;
+ sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"x86\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG\[\"CPU_ARCH\"\] == \"x86\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+ print $0;
+ next;
+}
+/^if CONFIG\[\"CPU_ARCH\"\] == \"x86_64\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/{
+ flag = 0;
+ sub(/^if CONFIG\[\"CPU_ARCH\"\] == \"x86_64\" and CONFIG\[\"OS_TARGET\"\] == \"Linux\":/, "if CONFIG\[\"CPU_ARCH\"\] == \"x86_64\" and (CONFIG[\"OS_TARGET\"] == \"Linux\" or CONFIG[\"OS_TARGET\"] == \"NetBSD\" or CONFIG[\"OS_TARGET\"] == \"OpenBSD\" or CONFIG[\"OS_TARGET\"] == \"FreeBSD\"):");
+ print $0;
+ next;
+}
{
if (flag != 1) {
sub(/^ DEFINES\[\"WEBRTC_LINUX\"\] = True/, " if CONFIG\[\"OS_TARGET\"\] == \"Linux\":\n DEFINES\[\"WEBRTC_LINUX\"\] = True\n else:\n DEFINES\[\"WEBRTC_BSD\"\] = True");
diff --git a/www/firefox/mozilla-common.mk b/www/firefox/mozilla-common.mk
index 6cb2856f961..0fc09653954 100644
--- a/www/firefox/mozilla-common.mk
+++ b/www/firefox/mozilla-common.mk
@@ -1,4 +1,4 @@
-# $NetBSD: mozilla-common.mk,v 1.242 2022/12/04 10:34:07 wiz Exp $
+# $NetBSD: mozilla-common.mk,v 1.243 2022/12/11 13:49:09 ryoon Exp $
#
# common Makefile fragment for mozilla packages based on gecko 2.0.
#
@@ -18,7 +18,7 @@ ALL_ENV+= PYTHON3=${PYTHONBIN}
HAS_CONFIGURE= yes
CONFIGURE_ARGS+= --prefix=${PREFIX}
-USE_TOOLS+= pkg-config perl gmake autoconf213 gm4 unzip zip
+USE_TOOLS+= pkg-config perl gmake gm4 unzip zip # autoconf213
UNLIMIT_RESOURCES+= datasize virtualsize
USE_LANGUAGES+= c c++
diff --git a/www/firefox/patches/patch-js_src_jit_GenerateAtomicOperations.py b/www/firefox/patches/patch-js_src_jit_GenerateAtomicOperations.py
deleted file mode 100644
index 7ab3565cd83..00000000000
--- a/www/firefox/patches/patch-js_src_jit_GenerateAtomicOperations.py
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-js_src_jit_GenerateAtomicOperations.py,v 1.3 2022/10/08 21:18:55 ryoon Exp $
-
-Fix build under NetBSD/i386 9 with GCC.
-From: https://bugzilla.mozilla.org/show_bug.cgi?id=1792159
-
---- js/src/jit/GenerateAtomicOperations.py.orig 2022-10-07 15:25:40.000000000 +0000
-+++ js/src/jit/GenerateAtomicOperations.py
-@@ -707,6 +707,8 @@ HEADER_TEMPLATE = """\
-
- /* This file is generated by jit/GenerateAtomicOperations.py. Do not edit! */
-
-+#include "mozilla/Attributes.h"
-+
- namespace js {
- namespace jit {
-
diff --git a/www/firefox/patches/patch-modules_fdlibm_src_math__private.h b/www/firefox/patches/patch-modules_fdlibm_src_math__private.h
index 8ab0e780374..06fcc7bbf35 100644
--- a/www/firefox/patches/patch-modules_fdlibm_src_math__private.h
+++ b/www/firefox/patches/patch-modules_fdlibm_src_math__private.h
@@ -1,21 +1,20 @@
-$NetBSD: patch-modules_fdlibm_src_math__private.h,v 1.2 2022/10/08 21:18:55 ryoon Exp $
+$NetBSD: patch-modules_fdlibm_src_math__private.h,v 1.3 2022/12/11 13:49:09 ryoon Exp $
* Fix PR pkg/56457, build failure on NetBSD/i386.
Do not use FreeBSD-specific definition.
---- modules/fdlibm/src/math_private.h.orig 2022-10-07 15:25:41.000000000 +0000
+--- modules/fdlibm/src/math_private.h.orig 2022-11-03 21:19:39.000000000 +0000
+++ modules/fdlibm/src/math_private.h
-@@ -30,10 +30,9 @@
+@@ -30,9 +30,9 @@
* Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
*/
-typedef double __double_t;
-typedef __double_t double_t;
-typedef float __float_t;
--typedef __float_t float_t;
+#include <math.h>
+typedef double_t __double_t;
-+typedef float_t __float_t;
++typedef float_t __float_t;
/*
* The original fdlibm code used statements like:
diff --git a/www/firefox/patches/patch-mozglue_misc_SIMD.cpp b/www/firefox/patches/patch-mozglue_misc_SIMD.cpp
deleted file mode 100644
index 042fc351576..00000000000
--- a/www/firefox/patches/patch-mozglue_misc_SIMD.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-$NetBSD: patch-mozglue_misc_SIMD.cpp,v 1.1 2022/10/08 21:18:55 ryoon Exp $
-
-Fix build under NetBSD/i386 9 with GCC.
-From: https://bugzilla.mozilla.org/show_bug.cgi?id=1792158
-
---- mozglue/misc/SIMD.cpp.orig 2022-10-07 15:25:41.000000000 +0000
-+++ mozglue/misc/SIMD.cpp
-@@ -439,8 +439,27 @@ const char* SIMD::memchr8SSE2(const char
- return reinterpret_cast<const char*>(uresult);
- }
-
-+// So, this is a bit awkward. It generally simplifies things if we can just
-+// assume all the AVX2 code is 64-bit, so we have this preprocessor guard
-+// in SIMD_avx2 over all of its actual code, and it also defines versions
-+// of its endpoints that just assert false if the guard is not satisfied.
-+// A 32 bit processor could implement the AVX2 instruction set though, which
-+// would result in it passing the supports_avx2() check and landing in an
-+// assertion failure. Accordingly, we just don't allow that to happen. We
-+// are not particularly concerned about ensuring that newer 32 bit processors
-+// get access to the AVX2 functions exposed here.
-+# if defined(MOZILLA_MAY_SUPPORT_AVX2) && defined(__x86_64__)
-+
-+bool SupportsAVX2() { return supports_avx2(); }
-+
-+# else
-+
-+bool SupportsAVX2() { return false; }
-+
-+# endif
-+
- const char* SIMD::memchr8(const char* ptr, char value, size_t length) {
-- if (supports_avx2()) {
-+ if (SupportsAVX2()) {
- return memchr8AVX2(ptr, value, length);
- }
- return memchr8SSE2(ptr, value, length);
-@@ -453,7 +472,7 @@ const char16_t* SIMD::memchr16SSE2(const
-
- const char16_t* SIMD::memchr16(const char16_t* ptr, char16_t value,
- size_t length) {
-- if (supports_avx2()) {
-+ if (SupportsAVX2()) {
- return memchr16AVX2(ptr, value, length);
- }
- return memchr16SSE2(ptr, value, length);
-@@ -461,7 +480,7 @@ const char16_t* SIMD::memchr16(const cha
-
- const uint64_t* SIMD::memchr64(const uint64_t* ptr, uint64_t value,
- size_t length) {
-- if (supports_avx2()) {
-+ if (SupportsAVX2()) {
- return memchr64AVX2(ptr, value, length);
- }
- return FindInBufferNaive<uint64_t>(ptr, value, length);
diff --git a/www/firefox/patches/patch-mozglue_misc_SIMD__avx2.cpp b/www/firefox/patches/patch-mozglue_misc_SIMD__avx2.cpp
deleted file mode 100644
index 86a94f5f44e..00000000000
--- a/www/firefox/patches/patch-mozglue_misc_SIMD__avx2.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD: patch-mozglue_misc_SIMD__avx2.cpp,v 1.1 2022/10/08 21:18:55 ryoon Exp $
-
-Fix build under NetBSD/i386 9 with GCC.
-From: https://bugzilla.mozilla.org/show_bug.cgi?id=1792158
-
---- mozglue/misc/SIMD_avx2.cpp.orig 2022-10-07 15:25:41.000000000 +0000
-+++ mozglue/misc/SIMD_avx2.cpp
-@@ -8,7 +8,10 @@
- #include "mozilla/SSE.h"
- #include "mozilla/Assertions.h"
-
--#ifdef MOZILLA_MAY_SUPPORT_AVX2
-+// Restricting to x86_64 simplifies things, and we're not particularly
-+// worried about slightly degraded performance on 32 bit processors which
-+// support AVX2, as this should be quite a minority.
-+#if defined(MOZILLA_MAY_SUPPORT_AVX2) && defined(__x86_64__)
-
- # include <cstring>
- # include <immintrin.h>
diff --git a/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc b/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc
deleted file mode 100644
index 5490bfcb6b8..00000000000
--- a/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-$NetBSD: patch-third__party_libwebrtc_modules_video__capture_linux_device__info__linux.cc,v 1.1 2022/07/17 08:08:56 wiz Exp $
-
-* Fix buiuld under NetBSD.
- NetBSD's sys/videoio.h does not have v4l2_capability.device_caps
- and video capture does not work for me anyway.
-
---- third_party/libwebrtc/modules/video_capture/linux/device_info_linux.cc.orig 2021-05-20 21:30:20.000000000 +0000
-+++ third_party/libwebrtc/modules/video_capture/linux/device_info_linux.cc
-@@ -207,10 +207,12 @@ uint32_t DeviceInfoLinux::NumberOfDevice
- sprintf(device, "/dev/video%d", n);
- if ((fd = open(device, O_RDONLY)) != -1) {
- // query device capabilities and make sure this is a video capture device
-+#if !defined(__NetBSD__)
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
- close(fd);
- continue;
- }
-+#endif
-
- close(fd);
- count++;
-@@ -241,10 +243,12 @@ int32_t DeviceInfoLinux::GetDeviceName(u
- sprintf(device, "/dev/video%d", device_index);
- if ((fd = open(device, O_RDONLY)) != -1) {
- // query device capabilities and make sure this is a video capture device
-+#if !defined(__NetBSD__)
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
- close(fd);
- continue;
- }
-+#endif
- if (count == deviceNumber) {
- // Found the device
- found = true;
-@@ -328,10 +332,12 @@ int32_t DeviceInfoLinux::CreateCapabilit
- struct v4l2_capability cap;
- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
- // skip devices without video capture capability
-+#if !defined(__NetBSD__)
- if (!IsVideoCaptureDevice(&cap)) {
- close(fd);
- continue;
- }
-+#endif
-
- if (cap.bus_info[0] != 0) {
- if (strncmp((const char*)cap.bus_info, (const char*)deviceUniqueIdUTF8,
-@@ -384,6 +390,7 @@ bool DeviceInfoLinux::IsDeviceNameMatche
- return false;
- }
-
-+#ifndef __NetBSD__
- bool DeviceInfoLinux::IsVideoCaptureDevice(struct v4l2_capability* cap)
- {
- if (cap->capabilities & V4L2_CAP_DEVICE_CAPS) {
-@@ -392,6 +399,7 @@ bool DeviceInfoLinux::IsVideoCaptureDevi
- return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
- }
- }
-+#endif
-
- int32_t DeviceInfoLinux::FillCapabilities(int fd) {
- // set image format
diff --git a/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__v4l2.cc b/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__v4l2.cc
new file mode 100644
index 00000000000..3d22e990cf8
--- /dev/null
+++ b/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_device__info__v4l2.cc
@@ -0,0 +1,67 @@
+$NetBSD: patch-third__party_libwebrtc_modules_video__capture_linux_device__info__v4l2.cc,v 1.1 2022/12/11 13:49:09 ryoon Exp $
+
+* Fix buiuld under older NetBSD.
+ The older NetBSD's sys/videoio.h does not have v4l2_capability.device_caps.
+
+--- third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc.orig 2022-10-19 18:00:20.000000000 +0000
++++ third_party/libwebrtc/modules/video_capture/linux/device_info_v4l2.cc
+@@ -193,11 +193,13 @@ uint32_t DeviceInfoV4l2::NumberOfDevices
+ for (int n = 0; n < 64; n++) {
+ snprintf(device, sizeof(device), "/dev/video%d", n);
+ if ((fd = open(device, O_RDONLY)) != -1) {
++#if defined(VIDIOC_QUERYCAP)
+ // query device capabilities and make sure this is a video capture device
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
+ close(fd);
+ continue;
+ }
++#endif
+
+ close(fd);
+ count++;
+@@ -225,11 +227,13 @@ int32_t DeviceInfoV4l2::GetDeviceName(ui
+ for (device_index = 0; device_index < 64; device_index++) {
+ sprintf(device, "/dev/video%d", device_index);
+ if ((fd = open(device, O_RDONLY)) != -1) {
++#if defined(VIDIOC_QUERYCAP)
+ // query device capabilities and make sure this is a video capture device
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0 || !IsVideoCaptureDevice(&cap)) {
+ close(fd);
+ continue;
+ }
++#endif
+ if (count == deviceNumber) {
+ // Found the device
+ found = true;
+@@ -307,6 +311,7 @@ int32_t DeviceInfoV4l2::CreateCapability
+ if (fd == -1)
+ continue;
+
++#if defined(VIDIOC_QUERYCAP)
+ // query device capabilities
+ struct v4l2_capability cap;
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
+@@ -331,6 +336,7 @@ int32_t DeviceInfoV4l2::CreateCapability
+ }
+ }
+ }
++#endif
+ close(fd); // close since this is not the matching device
+ }
+
+@@ -376,11 +382,15 @@ bool DeviceInfoV4l2::IsDeviceNameMatches
+
+ bool DeviceInfoV4l2::IsVideoCaptureDevice(struct v4l2_capability* cap)
+ {
++#if defined(V4L2_CAP_DEVICE_CAPS)
+ if (cap->capabilities & V4L2_CAP_DEVICE_CAPS) {
+ return cap->device_caps & V4L2_CAP_VIDEO_CAPTURE;
+ } else {
+ return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
+ }
++#else
++ return cap->capabilities & V4L2_CAP_VIDEO_CAPTURE;
++#endif
+ }
+
+ int32_t DeviceInfoV4l2::FillCapabilities(int fd) {
diff --git a/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_video__capture__v4l2.cc b/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_video__capture__v4l2.cc
new file mode 100644
index 00000000000..55ce0ef72cc
--- /dev/null
+++ b/www/firefox/patches/patch-third__party_libwebrtc_modules_video__capture_linux_video__capture__v4l2.cc
@@ -0,0 +1,23 @@
+$NetBSD: patch-third__party_libwebrtc_modules_video__capture_linux_video__capture__v4l2.cc,v 1.1 2022/12/11 13:49:09 ryoon Exp $
+
+* Fix buiuld under older NetBSD.
+ The older NetBSD's sys/videoio.h does not have v4l2_capability.device_caps.
+
+--- third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc.orig 2022-10-06 21:19:29.000000000 +0000
++++ third_party/libwebrtc/modules/video_capture/linux/video_capture_v4l2.cc
+@@ -77,6 +77,7 @@ int32_t VideoCaptureModuleV4L2::Init(con
+ if ((fd = open(device, O_RDONLY)) != -1) {
+ // query device capabilities
+ struct v4l2_capability cap;
++#if defined(VIDIOC_QUERYCAP)
+ if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0) {
+ if (cap.bus_info[0] != 0) {
+ if (strncmp((const char*)cap.bus_info,
+@@ -89,6 +90,7 @@ int32_t VideoCaptureModuleV4L2::Init(con
+ }
+ }
+ }
++#endif
+ close(fd); // close since this is not the matching device
+ }
+ }