This is as stupid as making OpenCV recognize OpenBSD like it does FreeBSD.

Without this patch, gmic camera support doesn't work.

With this patch (and something else in gstreamer-plugins), it works.


Okay ?

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/opencv/Makefile,v
retrieving revision 1.69
diff -u -p -r1.69 Makefile
--- Makefile    24 Apr 2021 05:22:56 -0000      1.69
+++ Makefile    14 May 2021 16:40:26 -0000
@@ -13,6 +13,8 @@ GH_TAGNAME =          ${V}
 
 PKGNAME-main =         opencv-${V}
 PKGNAME-java =         opencv-java-${V}
+REVISION-java =                0
+REVISION-main =                0
 
 HOMEPAGE =             https://www.opencv.org/
 
@@ -22,7 +24,7 @@ MAINTAINER =          Rafael Sadowski <rsadowski
   opencv_flann opencv_highgui opencv_imgproc opencv_ml opencv_objdetect \
   opencv_photo opencv_stitching opencv_video opencv_imgcodecs \
   opencv_videoio opencv_dnn
-SHARED_LIBS += $i 9.0
+SHARED_LIBS += $i 9.1
 .endfor
 
 WANTLIB-main += ${COMPILER_LIBCXX} IlmImf-2_5 avcodec avformat avutil
Index: 
patches/patch-modules_core_include_opencv2_core_utils_filesystem_private_hpp
===================================================================
RCS file: 
patches/patch-modules_core_include_opencv2_core_utils_filesystem_private_hpp
diff -N 
patches/patch-modules_core_include_opencv2_core_utils_filesystem_private_hpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-modules_core_include_opencv2_core_utils_filesystem_private_hpp    
    14 May 2021 16:40:26 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Index: modules/core/include/opencv2/core/utils/filesystem.private.hpp
+--- modules/core/include/opencv2/core/utils/filesystem.private.hpp.orig
++++ modules/core/include/opencv2/core/utils/filesystem.private.hpp
+@@ -12,7 +12,8 @@
+ #  elif defined WINRT || defined _WIN32_WCE
+      /* not supported */
+ #  elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
+-        defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__
++        defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__ || \
++      defined __OpenBSD__
+ #      define OPENCV_HAVE_FILESYSTEM_SUPPORT 1
+ #  elif defined(__APPLE__)
+ #    include <TargetConditionals.h>
Index: patches/patch-modules_core_src_utils_filesystem_cpp
===================================================================
RCS file: patches/patch-modules_core_src_utils_filesystem_cpp
diff -N patches/patch-modules_core_src_utils_filesystem_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-modules_core_src_utils_filesystem_cpp 14 May 2021 16:40:26 
-0000
@@ -0,0 +1,50 @@
+$OpenBSD$
+
+Index: modules/core/src/utils/filesystem.cpp
+--- modules/core/src/utils/filesystem.cpp.orig
++++ modules/core/src/utils/filesystem.cpp
+@@ -34,7 +34,7 @@
+ #include <errno.h>
+ #include <io.h>
+ #include <stdio.h>
+-#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__
++#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__ || defined __OpenBSD__
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+@@ -194,7 +194,7 @@ cv::String getcwd()
+     sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
+     return cv::String(buf.data(), (size_t)sz);
+ #endif
+-#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__
++#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__ || defined __OpenBSD__
+     for(;;)
+     {
+         char* p = ::getcwd(buf.data(), buf.size());
+@@ -228,7 +228,7 @@ bool createDirectory(const cv::String& path)
+ #else
+     int result = _mkdir(path.c_str());
+ #endif
+-#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__
++#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__ || defined __OpenBSD__
+     int result = mkdir(path.c_str(), 0777);
+ #else
+     int result = -1;
+@@ -343,7 +343,7 @@ struct FileLock::Impl (private)
+     Impl& operator=(const Impl&); // disabled
+ };
+ 
+-#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__
++#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined 
__FreeBSD__ || defined __OpenBSD__
+ 
+ struct FileLock::Impl
+ {
+@@ -457,7 +457,7 @@ cv::String getCacheDirectory(const char* sub_directory
+             default_cache_path = "/tmp/";
+             CV_LOG_WARNING(NULL, "Using world accessible cache directory. 
This may be not secure: " << default_cache_path);
+         }
+-#elif defined __linux__ || defined __HAIKU__ || defined __FreeBSD__
++#elif defined __linux__ || defined __HAIKU__ || defined __FreeBSD__ || 
defined __OpenBSD__
+         // 
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+         if (default_cache_path.empty())
+         {

Reply via email to