git: 5f4b643338ae - main - graphics/opencv: use multimedia/v4l_compat on non-CURRENT

Charlie Li <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch main has been updated by vishwin:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5f4b643338ae0277647c5d85f89f74d223b4632a

commit 5f4b643338ae0277647c5d85f89f74d223b4632a
Author:     Charlie Li <[email protected]>
AuthorDate: 2026-08-18 02:45:24 +0000
Commit:     Charlie Li <[email protected]>
CommitDate: 2026-08-18 02:45:24 +0000

    graphics/opencv: use multimedia/v4l_compat on non-CURRENT
    
    Since video(4) et al landed in -CURRENT, the multimedia/v4l_compat
    headers conflict with <sys/videoio.h> when both are present. Support
    for <sys/videoio.h> is already included for NetBSD so ensure that
    this path is taken during configure on -CURRENT. Also ensure that
    the Linux-style unsigned int shorthand is defined for us in addition
    to OpenBSD.
    
    PR: 297454
---
 graphics/opencv/Makefile                                  |  5 ++++-
 .../opencv/files/patch-modules_videoio_src_cap__v4l.cpp   | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/graphics/opencv/Makefile b/graphics/opencv/Makefile
index 4ef6ee93312e..506e3280ce9d 100644
--- a/graphics/opencv/Makefile
+++ b/graphics/opencv/Makefile
@@ -168,7 +168,6 @@ OBSENSOR_IMPLIES=	V4L
 
 V4L_DESC=		Enable support for Video for Linux
 V4L_CMAKE_BOOL=		WITH_LIBV4L WITH_V4L
-V4L_BUILD_DEPENDS=	${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat
 V4L_LIB_DEPENDS=	libv4l2.so:multimedia/libv4l
 
 VULKAN_DESC=		Add Vulkan Support
@@ -219,6 +218,10 @@ _IPPICV_i386=	ippicv/ippicv_2021.12.0_lnx_ia32_20240425_general.tgz
 CMAKE_ARGS+=	-DCPU_BASELINE:STRING="VSX;VSX3;"
 .endif
 
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1600020 && ${PORT_OPTIONS:MV4L}
+BUILD_DEPENDS+=	${LOCALBASE}/include/linux/videodev2.h:multimedia/v4l_compat
+.endif
+
 post-extract:
 # Handle contrib
 	${MV} ${WRKSRC_contrib} \
diff --git a/graphics/opencv/files/patch-modules_videoio_src_cap__v4l.cpp b/graphics/opencv/files/patch-modules_videoio_src_cap__v4l.cpp
index 7b3e102cf34e..017cd888149b 100644
--- a/graphics/opencv/files/patch-modules_videoio_src_cap__v4l.cpp
+++ b/graphics/opencv/files/patch-modules_videoio_src_cap__v4l.cpp
@@ -1,6 +1,6 @@
---- modules/videoio/src/cap_v4l.cpp.orig	2021-04-02 11:23:54 UTC
+--- modules/videoio/src/cap_v4l.cpp.orig	2025-12-30 07:52:05 UTC
 +++ modules/videoio/src/cap_v4l.cpp
-@@ -228,7 +228,9 @@ make & enjoy!
+@@ -227,16 +227,18 @@ make & enjoy!
  #include <poll.h>
  
  #ifdef HAVE_CAMV4L2
@@ -10,3 +10,14 @@
  #include <linux/videodev2.h>
  #endif
  
+ #ifdef HAVE_VIDEOIO
+-// NetBSD compatibility layer with V4L2
++// NetBSD and FreeBSD compatibility layer with V4L2
+ #include <sys/videoio.h>
+ #endif
+ 
+-#ifdef __OpenBSD__
++#if defined(__OpenBSD__) || defined(__FreeBSD__)
+ typedef uint32_t __u32;
+ #endif
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.