Gentoo Archives: gentoo-commits

From: Amy Liffey <amynka@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/files/, media-libs/opencv/
Date: Thu, 31 May 2018 17:25:01
Message-Id: 1527787472.fbadf5fc3cdc26df32995e2e1cad1ed47f40efad.amynka@gentoo
1 commit: fbadf5fc3cdc26df32995e2e1cad1ed47f40efad
2 Author: Amy Liffey <amynka <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 31 17:15:58 2018 +0000
4 Commit: Amy Liffey <amynka <AT> gentoo <DOT> org>
5 CommitDate: Thu May 31 17:24:32 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fbadf5fc
7
8 media-libs/opencv: workaround C compilation mode
9
10 - Add nvcc flags to fix compilation with cuda
11 - Fix issue with C compilation mode for vlc
12 - Fix python installation path
13
14 Closes: https://bugs.gentoo.org/656530
15 Closes: https://bugs.gentoo.org/656580
16 Package-Manager: Portage-2.3.24, Repoman-2.3.6
17
18 .../files/opencv-3.4.1-compilation-C-mode.patch | 56 ++++++++++++++++++++++
19 .../opencv-3.4.1-cuda-add-relaxed-constexpr.patch | 14 ++++++
20 .../opencv-3.4.1-python-lib-suffix-hack.patch | 13 +++++
21 ...encv-3.4.1-r1.ebuild => opencv-3.4.1-r2.ebuild} | 6 ++-
22 4 files changed, 88 insertions(+), 1 deletion(-)
23
24 diff --git a/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch b/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch
25 new file mode 100644
26 index 00000000000..c94f206ed4f
27 --- /dev/null
28 +++ b/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch
29 @@ -0,0 +1,56 @@
30 +From 549b5df22520b60b91dd77096434d79425b31ac2 Mon Sep 17 00:00:00 2001
31 +From: Alexander Alekhin <alexander.alekhin@×××××.com>
32 +Date: Mon, 28 May 2018 18:07:23 +0300
33 +Subject: [PATCH] build: workaround issues with C compilation mode
34 +
35 +- cvdef.h + cvRound (double only)
36 +- highgui_c.h
37 +---
38 + modules/core/include/opencv2/core/cvdef.h | 8 +++++++-
39 + modules/highgui/include/opencv2/highgui/highgui_c.h | 2 ++
40 + 2 files changed, 9 insertions(+), 1 deletion(-)
41 +
42 +diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h
43 +index a87ced09d78..4ab72b34cc1 100644
44 +--- a/modules/core/include/opencv2/core/cvdef.h
45 ++++ b/modules/core/include/opencv2/core/cvdef.h
46 +@@ -480,7 +480,7 @@ Cv64suf;
47 + // Integer types portatibility
48 + #ifdef OPENCV_STDINT_HEADER
49 + #include OPENCV_STDINT_HEADER
50 +-#else
51 ++#elif defined(__cplusplus)
52 + #if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */
53 + namespace cv {
54 + typedef signed char int8_t;
55 +@@ -517,9 +517,15 @@ typedef ::int64_t int64_t;
56 + typedef ::uint64_t uint64_t;
57 + }
58 + #endif
59 ++#else // pure C
60 ++#include <stdint.h>
61 + #endif
62 +
63 +
64 + //! @}
65 +
66 ++#ifndef __cplusplus
67 ++#include "opencv2/core/fast_math.hpp" // define cvRound(double)
68 ++#endif
69 ++
70 + #endif // OPENCV_CORE_CVDEF_H
71 +diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h
72 +index 1eb414a76ca..35413139c79 100644
73 +--- a/modules/highgui/include/opencv2/highgui/highgui_c.h
74 ++++ b/modules/highgui/include/opencv2/highgui/highgui_c.h
75 +@@ -135,8 +135,10 @@ CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOS
76 + CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
77 + CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
78 +
79 ++#ifdef __cplusplus // FIXIT remove in OpenCV 4.0
80 + /* Get window image rectangle coordinates, width and height */
81 + CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
82 ++#endif
83 +
84 + /* display image within window (highgui windows remember their content) */
85 + CVAPI(void) cvShowImage( const char* name, const CvArr* image );
86
87 diff --git a/media-libs/opencv/files/opencv-3.4.1-cuda-add-relaxed-constexpr.patch b/media-libs/opencv/files/opencv-3.4.1-cuda-add-relaxed-constexpr.patch
88 new file mode 100644
89 index 00000000000..11ca6aa861e
90 --- /dev/null
91 +++ b/media-libs/opencv/files/opencv-3.4.1-cuda-add-relaxed-constexpr.patch
92 @@ -0,0 +1,14 @@
93 +diff -Naur a/cmake/FindCUDA.cmake b/cmake/FindCUDA.cmake
94 +--- a/cmake/FindCUDA.cmake 2018-05-26 12:57:45.698858052 +0100
95 ++++ b/cmake/FindCUDA.cmake 2018-05-26 16:49:01.196390803 +0100
96 +@@ -447,8 +447,8 @@
97 + # Parse HOST_COMPILATION mode.
98 + option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
99 +
100 +-# Extra user settable flags
101 +-set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
102 ++ #Extra user settable flags
103 ++set(CUDA_NVCC_FLAGS "--expt-relaxed-constexpr;" CACHE STRING "Semi-colon delimit multiple arguments.")
104 +
105 + if(CMAKE_GENERATOR MATCHES "Visual Studio")
106 + set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)")
107
108 diff --git a/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch b/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch
109 new file mode 100644
110 index 00000000000..248e5034a21
111 --- /dev/null
112 +++ b/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch
113 @@ -0,0 +1,13 @@
114 +--- a/cmake/OpenCVDetectPython.cmake 2018-05-31 09:14:42.998873104 +0200
115 ++++ b/cmake/OpenCVDetectPython.cmake 2018-05-31 09:26:08.444914001 +0200
116 +@@ -140,8 +140,8 @@
117 + else() #debian based assumed, install to the dist-packages.
118 + set(_packages_path "python${_version_major_minor}/dist-packages")
119 + endif()
120 +- if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}")
121 +- set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}")
122 ++ if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIBPY_SUFFIX}/${${packages_path}}")
123 ++ set(_packages_path "lib${LIBPY_SUFFIX}/${_packages_path}")
124 + else()
125 + set(_packages_path "lib/${_packages_path}")
126 + endif()
127
128 diff --git a/media-libs/opencv/opencv-3.4.1-r1.ebuild b/media-libs/opencv/opencv-3.4.1-r2.ebuild
129 similarity index 98%
130 rename from media-libs/opencv/opencv-3.4.1-r1.ebuild
131 rename to media-libs/opencv/opencv-3.4.1-r2.ebuild
132 index 578d147619a..34085a8db24 100644
133 --- a/media-libs/opencv/opencv-3.4.1-r1.ebuild
134 +++ b/media-libs/opencv/opencv-3.4.1-r2.ebuild
135 @@ -226,6 +226,9 @@ MULTILIB_WRAPPED_HEADERS=(
136 PATCHES=(
137 "${FILESDIR}/${PN}-3.0.0-gles.patch"
138 "${FILESDIR}/${PN}-3.4.0-disable-download.patch"
139 + "${FILESDIR}/${P}-compilation-C-mode.patch" # https://bugs.gentoo.org/656530
140 + "${FILESDIR}/${P}-python-lib-suffix-hack.patch"
141 + "${FILESDIR}/${P}-cuda-add-relaxed-constexpr.patch"
142 )
143
144 pkg_pretend() {
145 @@ -400,7 +403,7 @@ multilib_src_configure() {
146 # ==================================================
147 # cpu flags, should solve 633900
148 #===================================================
149 - -DCPU_DISPATCH=OFF
150 + -DCPU_DISPATCH=
151 -DENABLE_SSE=$(usex cpu_flags_x86_sse)
152 -DENABLE_SSE2=$(usex cpu_flags_x86_sse2)
153 -DENABLE_SSE3=$(usex cpu_flags_x86_sse3)
154 @@ -468,6 +471,7 @@ python_module_compile() {
155 -DPYTHON2_EXECUTABLE=$(type -P python2)
156 -DPYTHON3_EXECUTABLE=$(type -P python3)
157 -DINSTALL_PYTHON_EXAMPLES=$(usex examples)
158 + -DLIBPY_SUFFIX=64
159 )
160
161 # Regenerate cache file. Can't use rebuild_cache as it won't