commit:     8a750e536aaf075b59661f151574326d80c13a01
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Nov  4 13:56:11 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov  5 02:02:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a750e53

media-libs/opencv: fix broken include paths #927081

`ocv_check_modules` discarded all INCLUDE_DIRECTORIES that containted
`/usr/include`.

Closes: https://bugs.gentoo.org/927081
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-libs/opencv/files/opencv-4.10.0-26234.patch | 73 +++++++++++++++++++++++
 media-libs/opencv/opencv-4.10.0.ebuild            |  1 +
 2 files changed, 74 insertions(+)

diff --git a/media-libs/opencv/files/opencv-4.10.0-26234.patch 
b/media-libs/opencv/files/opencv-4.10.0-26234.patch
new file mode 100644
index 000000000000..fb155302af28
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.10.0-26234.patch
@@ -0,0 +1,73 @@
+https://github.com/opencv/opencv/pull/26234
+From 6a4be763b2db5f26684204ddc7d06c02325c3917 Mon Sep 17 00:00:00 2001
+From: Zach Lowry <[email protected]>
+Date: Tue, 1 Oct 2024 14:16:54 -0500
+Subject: [PATCH 1/2] move the gcc6 compatibility check to occur on a
+ per-directory basis, rather than exclude all include paths when the list of
+ paths contains /usr/include
+
+---
+ cmake/OpenCVUtils.cmake | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
+index 94f87d9a1200..bb20a22f0606 100644
+--- a/cmake/OpenCVUtils.cmake
++++ b/cmake/OpenCVUtils.cmake
+@@ -353,23 +353,23 @@ function(ocv_target_include_directories target)
+   #ocv_debug_message("ocv_target_include_directories(${target} ${ARGN})")
+   _ocv_fix_target(target)
+   set(__params "")
+-  if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
+-      ";${ARGN};" MATCHES "/usr/include;")
+-    return() # workaround for GCC 6.x bug
+-  endif()
+-  set(__params "")
+   set(__system_params "")
+   set(__var_name __params)
+   foreach(dir ${ARGN})
+     if("${dir}" STREQUAL "SYSTEM")
+       set(__var_name __system_params)
+     else()
+-      get_filename_component(__abs_dir "${dir}" ABSOLUTE)
+-      ocv_is_opencv_directory(__is_opencv_dir "${dir}")
+-      if(__is_opencv_dir)
+-        list(APPEND ${__var_name} "${__abs_dir}")
++      if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
++          "${dir}" MATCHES "/usr/include$")
++         # workaround for GCC 6.x bug
+       else()
+-        list(APPEND ${__var_name} "${dir}")
++        get_filename_component(__abs_dir "${dir}" ABSOLUTE)
++        ocv_is_opencv_directory(__is_opencv_dir "${dir}")
++        if(__is_opencv_dir)
++          list(APPEND ${__var_name} "${__abs_dir}")
++        else()
++          list(APPEND ${__var_name} "${dir}")
++        endif()
+       endif()
+     endif()
+   endforeach()
+
+From fc01b270ee657e7afc2657b7a9e15766aa36faf0 Mon Sep 17 00:00:00 2001
+From: Zach Lowry <[email protected]>
+Date: Wed, 2 Oct 2024 13:28:57 -0500
+Subject: [PATCH 2/2] use `dir MATCHES ...` without variable unpacking
+
+---
+ cmake/OpenCVUtils.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake
+index bb20a22f0606..5886f4f3cb33 100644
+--- a/cmake/OpenCVUtils.cmake
++++ b/cmake/OpenCVUtils.cmake
+@@ -360,7 +360,7 @@ function(ocv_target_include_directories target)
+       set(__var_name __system_params)
+     else()
+       if(CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
+-          "${dir}" MATCHES "/usr/include$")
++          dir MATCHES "/usr/include$")
+          # workaround for GCC 6.x bug
+       else()
+         get_filename_component(__abs_dir "${dir}" ABSOLUTE)

diff --git a/media-libs/opencv/opencv-4.10.0.ebuild 
b/media-libs/opencv/opencv-4.10.0.ebuild
index 27c7ce81d7cb..070727815ba8 100644
--- a/media-libs/opencv/opencv-4.10.0.ebuild
+++ b/media-libs/opencv/opencv-4.10.0.ebuild
@@ -310,6 +310,7 @@ PATCHES=(
        "${FILESDIR}/${PN}-4.10.0-dnn-explicitly-include-abseil-cpp.patch"
        "${FILESDIR}/${PN}-4.10.0-cudnn-9.patch" # 25841
        "${FILESDIR}/${PN}-4.10.0-cuda-fp16.patch" # 25880
+       "${FILESDIR}/${PN}-4.10.0-26234.patch" # 26234
        "${FILESDIR}/${PN}-4.10.0-tbb-detection.patch"
 
        # TODO applied in src_prepare

Reply via email to