Gentoo Archives: gentoo-commits

From: Amy Winston <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: Tue, 27 Sep 2016 14:22:56
Message-Id: 1474986151.366480ac81d84673ffbbfcfff277a91d6c6041df.amynka@gentoo
1 commit: 366480ac81d84673ffbbfcfff277a91d6c6041df
2 Author: Jonathan Scruggs <j.scruggs <AT> gmail <DOT> com>
3 AuthorDate: Thu Sep 22 17:08:23 2016 +0000
4 Commit: Amy Winston <amynka <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 27 14:22:31 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=366480ac
7
8 media-libs/opencv: revision bump to 3.1.0-r5
9
10 - Feature: added in support for installing the Python module for each
11 implementation selected
12 Gentoo-Bug: 593504
13
14 - Bug fix: under certain conditions the HDF5 library isn't found
15 Gentoo-Bug: 588850
16
17 - Bug fix: OpenGL needs Qt or Gtk+ otherwise it's disabled
18
19 - Misc: cleaned up usex expressions
20 added qtwidgets depend
21 moved openmp detection to pkg_pretend as per Gentoo style guidelines
22
23 Signed off by Jonathan Scruggs (j.scruggs <AT> gmail.com, irc: Dracwyrm)
24
25 .../files/opencv-contrib-find-hdf5-fix.patch | 392 +++++++++++++++++++++
26 media-libs/opencv/opencv-3.1.0-r5.ebuild | 300 ++++++++++++++++
27 2 files changed, 692 insertions(+)
28
29 diff --git a/media-libs/opencv/files/opencv-contrib-find-hdf5-fix.patch b/media-libs/opencv/files/opencv-contrib-find-hdf5-fix.patch
30 new file mode 100644
31 index 00000000..af86cf98
32 --- /dev/null
33 +++ b/media-libs/opencv/files/opencv-contrib-find-hdf5-fix.patch
34 @@ -0,0 +1,392 @@
35 +diff -purN a/modules/hdf/cmake/FindHDF5.cmake b/modules/hdf/cmake/FindHDF5.cmake
36 +--- a/modules/hdf/cmake/FindHDF5.cmake 1970-01-01 01:00:00.000000000 +0100
37 ++++ b/modules/hdf/cmake/FindHDF5.cmake 2015-09-16 17:53:05.000000000 +0100
38 +@@ -0,0 +1,379 @@
39 ++#.rst:
40 ++# FindHDF5
41 ++# --------
42 ++#
43 ++# Find HDF5, a library for reading and writing self describing array data.
44 ++#
45 ++#
46 ++#
47 ++# This module invokes the HDF5 wrapper compiler that should be installed
48 ++# alongside HDF5. Depending upon the HDF5 Configuration, the wrapper
49 ++# compiler is called either h5cc or h5pcc. If this succeeds, the module
50 ++# will then call the compiler with the -show argument to see what flags
51 ++# are used when compiling an HDF5 client application.
52 ++#
53 ++# The module will optionally accept the COMPONENTS argument. If no
54 ++# COMPONENTS are specified, then the find module will default to finding
55 ++# only the HDF5 C library. If one or more COMPONENTS are specified, the
56 ++# module will attempt to find the language bindings for the specified
57 ++# components. The only valid components are C, CXX, Fortran, HL, and
58 ++# Fortran_HL. If the COMPONENTS argument is not given, the module will
59 ++# attempt to find only the C bindings.
60 ++#
61 ++# On UNIX systems, this module will read the variable
62 ++# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a
63 ++# static link to a dynamic link for HDF5 and all of it's dependencies.
64 ++# To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES
65 ++# variable is set before the call to find_package.
66 ++#
67 ++# To provide the module with a hint about where to find your HDF5
68 ++# installation, you can set the environment variable HDF5_ROOT. The
69 ++# Find module will then look in this path when searching for HDF5
70 ++# executables, paths, and libraries.
71 ++#
72 ++# In addition to finding the includes and libraries required to compile
73 ++# an HDF5 client application, this module also makes an effort to find
74 ++# tools that come with the HDF5 distribution that may be useful for
75 ++# regression testing.
76 ++#
77 ++# This module will define the following variables:
78 ++#
79 ++# ::
80 ++#
81 ++# HDF5_INCLUDE_DIRS - Location of the hdf5 includes
82 ++# HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
83 ++# HDF5_DEFINITIONS - Required compiler definitions for HDF5
84 ++# HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings.
85 ++# HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings
86 ++# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
87 ++# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API
88 ++# HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
89 ++# bindings.
90 ++# HDF5_LIBRARIES - Required libraries for all requested bindings
91 ++# HDF5_FOUND - true if HDF5 was found on the system
92 ++# HDF5_VERSION - HDF5 version in format Major.Minor.Release
93 ++# HDF5_LIBRARY_DIRS - the full set of library directories
94 ++# HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support
95 ++# HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler
96 ++# HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler
97 ++# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler
98 ++# HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
99 ++
100 ++#=============================================================================
101 ++# Copyright 2015 Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
102 ++# Copyright 2009 Kitware, Inc.
103 ++#
104 ++# Distributed under the OSI-approved BSD License (the "License");
105 ++# see accompanying file Copyright.txt for details.
106 ++#
107 ++# This software is distributed WITHOUT ANY WARRANTY; without even the
108 ++# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
109 ++# See the License for more information.
110 ++#=============================================================================
111 ++# (To distribute this file outside of CMake, substitute the full
112 ++# License text for the above reference.)
113 ++
114 ++# This module is maintained by Will Dicharry <wdicharry@××××××××××××××.com>.
115 ++
116 ++include(SelectLibraryConfigurations)
117 ++include(FindPackageHandleStandardArgs)
118 ++
119 ++# List of the valid HDF5 components
120 ++set( HDF5_VALID_COMPONENTS
121 ++ C
122 ++ CXX
123 ++ Fortran
124 ++ HL
125 ++ Fortran_HL
126 ++)
127 ++
128 ++# Validate the list of find components.
129 ++if( NOT HDF5_FIND_COMPONENTS )
130 ++ set( HDF5_LANGUAGE_BINDINGS "C" )
131 ++else()
132 ++ # add the extra specified components, ensuring that they are valid.
133 ++ foreach( component ${HDF5_FIND_COMPONENTS} )
134 ++ list( FIND HDF5_VALID_COMPONENTS ${component} component_location )
135 ++ if( ${component_location} EQUAL -1 )
136 ++ message( FATAL_ERROR
137 ++ "\"${component}\" is not a valid HDF5 component." )
138 ++ else()
139 ++ list( APPEND HDF5_LANGUAGE_BINDINGS ${component} )
140 ++ endif()
141 ++ endforeach()
142 ++endif()
143 ++
144 ++# try to find the HDF5 wrapper compilers
145 ++find_program( HDF5_C_COMPILER_EXECUTABLE
146 ++ NAMES h5cc h5pcc
147 ++ HINTS ENV HDF5_ROOT
148 ++ PATH_SUFFIXES bin Bin
149 ++ DOC "HDF5 Wrapper compiler. Used only to detect HDF5 compile flags." )
150 ++mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE )
151 ++
152 ++find_program( HDF5_CXX_COMPILER_EXECUTABLE
153 ++ NAMES h5c++ h5pc++
154 ++ HINTS ENV HDF5_ROOT
155 ++ PATH_SUFFIXES bin Bin
156 ++ DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." )
157 ++mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE )
158 ++
159 ++find_program( HDF5_Fortran_COMPILER_EXECUTABLE
160 ++ NAMES h5fc h5pfc
161 ++ HINTS ENV HDF5_ROOT
162 ++ PATH_SUFFIXES bin Bin
163 ++ DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." )
164 ++mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE )
165 ++
166 ++find_program( HDF5_DIFF_EXECUTABLE
167 ++ NAMES h5diff
168 ++ HINTS ENV HDF5_ROOT
169 ++ PATH_SUFFIXES bin Bin
170 ++ DOC "HDF5 file differencing tool." )
171 ++mark_as_advanced( HDF5_DIFF_EXECUTABLE )
172 ++
173 ++# Invoke the HDF5 wrapper compiler. The compiler return value is stored to the
174 ++# return_value argument, the text output is stored to the output variable.
175 ++macro( _HDF5_invoke_compiler language output return_value )
176 ++ if( HDF5_${language}_COMPILER_EXECUTABLE )
177 ++ exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
178 ++ ARGS -show
179 ++ OUTPUT_VARIABLE ${output}
180 ++ RETURN_VALUE ${return_value}
181 ++ )
182 ++ if( ${${return_value}} EQUAL 0 )
183 ++ # do nothing
184 ++ else()
185 ++ message( STATUS
186 ++ "Unable to determine HDF5 ${language} flags from HDF5 wrapper." )
187 ++ endif()
188 ++ endif()
189 ++endmacro()
190 ++
191 ++# Parse a compile line for definitions, includes, library paths, and libraries.
192 ++macro( _HDF5_parse_compile_line
193 ++ compile_line_var
194 ++ include_paths
195 ++ definitions
196 ++ library_paths
197 ++ libraries )
198 ++
199 ++ # Match the include paths
200 ++ string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags
201 ++ "${${compile_line_var}}"
202 ++ )
203 ++ foreach( IPATH ${include_path_flags} )
204 ++ string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
205 ++ string( REPLACE "//" "/" IPATH ${IPATH} )
206 ++ list( APPEND ${include_paths} ${IPATH} )
207 ++ endforeach()
208 ++
209 ++ # Match the definitions
210 ++ string( REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}" )
211 ++ foreach( DEF ${definition_flags} )
212 ++ list( APPEND ${definitions} ${DEF} )
213 ++ endforeach()
214 ++
215 ++ # Match the library paths
216 ++ string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags
217 ++ "${${compile_line_var}}"
218 ++ )
219 ++
220 ++ foreach( LPATH ${library_path_flags} )
221 ++ string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
222 ++ string( REPLACE "//" "/" LPATH ${LPATH} )
223 ++ list( APPEND ${library_paths} ${LPATH} )
224 ++ endforeach()
225 ++
226 ++ # now search for the library names specified in the compile line (match -l...)
227 ++ # match only -l's preceded by a space or comma
228 ++ # this is to exclude directory names like xxx-linux/
229 ++ string( REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags
230 ++ "${${compile_line_var}}" )
231 ++ # strip the -l from all of the library flags and add to the search list
232 ++ foreach( LIB ${library_name_flags} )
233 ++ string( REGEX REPLACE "^[, ]-l" "" LIB ${LIB} )
234 ++ list( APPEND ${libraries} ${LIB} )
235 ++ endforeach()
236 ++endmacro()
237 ++
238 ++# Try to find HDF5 using an installed hdf5-config.cmake
239 ++if( NOT HDF5_FOUND )
240 ++ find_package( HDF5 QUIET NO_MODULE )
241 ++ if( HDF5_FOUND )
242 ++ set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} )
243 ++ set( HDF5_LIBRARIES )
244 ++ set( HDF5_C_TARGET hdf5 )
245 ++ set( HDF5_CXX_TARGET hdf5_cpp )
246 ++ set( HDF5_HL_TARGET hdf5_hl )
247 ++ set( HDF5_Fortran_TARGET hdf5_fortran )
248 ++ set( HDF5_Fortran_HL_TARGET hdf5_hl_fortran )
249 ++ foreach( _component ${HDF5_LANGUAGE_BINDINGS} )
250 ++ list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location )
251 ++ get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION )
252 ++ if( _comp_location )
253 ++ set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH
254 ++ "HDF5 ${_component} library" )
255 ++ mark_as_advanced( HDF5_${_component}_LIBRARY )
256 ++ list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} )
257 ++ endif()
258 ++ endforeach()
259 ++ endif()
260 ++endif()
261 ++
262 ++if( NOT HDF5_FOUND )
263 ++ _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
264 ++ _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
265 ++ _HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
266 ++
267 ++ # seed the initial lists of libraries to find with items we know we need
268 ++ set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
269 ++ set( HDF5_HL_LIBRARY_NAMES_INIT hdf5_hl ${HDF5_C_LIBRARY_NAMES_INIT} )
270 ++ set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} )
271 ++ set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran
272 ++ ${HDF5_C_LIBRARY_NAMES_INIT} )
273 ++ set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran
274 ++ ${HDF5_Fortran_LIBRARY_NAMES_INIT} )
275 ++
276 ++ foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
277 ++ if( HDF5_${LANGUAGE}_COMPILE_LINE )
278 ++ _HDF5_parse_compile_line( HDF5_${LANGUAGE}_COMPILE_LINE
279 ++ HDF5_${LANGUAGE}_INCLUDE_FLAGS
280 ++ HDF5_${LANGUAGE}_DEFINITIONS
281 ++ HDF5_${LANGUAGE}_LIBRARY_DIRS
282 ++ HDF5_${LANGUAGE}_LIBRARY_NAMES
283 ++ )
284 ++
285 ++ # take a guess that the includes may be in the 'include' sibling
286 ++ # directory of a library directory.
287 ++ foreach( dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
288 ++ list( APPEND HDF5_${LANGUAGE}_INCLUDE_FLAGS ${dir}/../include )
289 ++ endforeach()
290 ++ endif()
291 ++
292 ++ # set the definitions for the language bindings.
293 ++ list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
294 ++
295 ++ # find the HDF5 include directories
296 ++ if(${LANGUAGE} MATCHES "Fortran")
297 ++ set(HDF5_INCLUDE_FILENAME hdf5.mod)
298 ++ else()
299 ++ set(HDF5_INCLUDE_FILENAME hdf5.h)
300 ++ endif()
301 ++
302 ++ find_path( HDF5_${LANGUAGE}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
303 ++ HINTS
304 ++ ${HDF5_${LANGUAGE}_INCLUDE_FLAGS}
305 ++ ENV
306 ++ HDF5_ROOT
307 ++ PATHS
308 ++ $ENV{HOME}/.local/include
309 ++ PATH_SUFFIXES
310 ++ include
311 ++ Include
312 ++ )
313 ++ mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR )
314 ++ list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} )
315 ++
316 ++ set( HDF5_${LANGUAGE}_LIBRARY_NAMES
317 ++ ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT}
318 ++ ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
319 ++
320 ++ # find the HDF5 libraries
321 ++ foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
322 ++ if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
323 ++ # According to bug 1643 on the CMake bug tracker, this is the
324 ++ # preferred method for searching for a static library.
325 ++ # See http://www.cmake.org/Bug/view.php?id=1643. We search
326 ++ # first for the full static library name, but fall back to a
327 ++ # generic search on the name if the static search fails.
328 ++ set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d )
329 ++ set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} )
330 ++ else()
331 ++ set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d )
332 ++ set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} )
333 ++ endif()
334 ++ find_library( HDF5_${LIB}_LIBRARY_DEBUG
335 ++ NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
336 ++ HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
337 ++ ENV HDF5_ROOT
338 ++ PATH_SUFFIXES lib Lib )
339 ++ find_library( HDF5_${LIB}_LIBRARY_RELEASE
340 ++ NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
341 ++ HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
342 ++ ENV HDF5_ROOT
343 ++ PATH_SUFFIXES lib Lib )
344 ++ select_library_configurations( HDF5_${LIB} )
345 ++ list(APPEND HDF5_${LANGUAGE}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
346 ++ endforeach()
347 ++ list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
348 ++
349 ++ # Append the libraries for this language binding to the list of all
350 ++ # required libraries.
351 ++ list(APPEND HDF5_LIBRARIES ${HDF5_${LANGUAGE}_LIBRARIES})
352 ++ endforeach()
353 ++
354 ++ # We may have picked up some duplicates in various lists during the above
355 ++ # process for the language bindings (both the C and C++ bindings depend on
356 ++ # libz for example). Remove the duplicates. It appears that the default
357 ++ # CMake behavior is to remove duplicates from the end of a list. However,
358 ++ # for link lines, this is incorrect since unresolved symbols are searched
359 ++ # for down the link line. Therefore, we reverse the list, remove the
360 ++ # duplicates, and then reverse it again to get the duplicates removed from
361 ++ # the beginning.
362 ++ macro( _remove_duplicates_from_beginning _list_name )
363 ++ list( REVERSE ${_list_name} )
364 ++ list( REMOVE_DUPLICATES ${_list_name} )
365 ++ list( REVERSE ${_list_name} )
366 ++ endmacro()
367 ++
368 ++ if( HDF5_INCLUDE_DIRS )
369 ++ _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS )
370 ++ endif()
371 ++ if( HDF5_LIBRARY_DIRS )
372 ++ _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS )
373 ++ endif()
374 ++
375 ++ # If the HDF5 include directory was found, open H5pubconf.h to determine if
376 ++ # HDF5 was compiled with parallel IO support
377 ++ set( HDF5_IS_PARALLEL FALSE )
378 ++ set( HDF5_VERSION "" )
379 ++ foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
380 ++ foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h")
381 ++ if( EXISTS "${_hdr}" )
382 ++ file( STRINGS "${_hdr}"
383 ++ HDF5_HAVE_PARALLEL_DEFINE
384 ++ REGEX "HAVE_PARALLEL 1" )
385 ++ if( HDF5_HAVE_PARALLEL_DEFINE )
386 ++ set( HDF5_IS_PARALLEL TRUE )
387 ++ endif()
388 ++ unset(HDF5_HAVE_PARALLEL_DEFINE)
389 ++
390 ++ file( STRINGS "${_hdr}"
391 ++ HDF5_VERSION_DEFINE
392 ++ REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" )
393 ++ if( "${HDF5_VERSION_DEFINE}" MATCHES
394 ++ "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"" )
395 ++ set( HDF5_VERSION "${CMAKE_MATCH_1}" )
396 ++ endif()
397 ++ unset(HDF5_VERSION_DEFINE)
398 ++ endif()
399 ++ endforeach()
400 ++ endforeach()
401 ++ set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
402 ++ "HDF5 library compiled with parallel IO support" )
403 ++ mark_as_advanced( HDF5_IS_PARALLEL )
404 ++
405 ++ # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
406 ++ # HDF5_INCLUDE_DIRS
407 ++ if( HDF5_INCLUDE_DIRS )
408 ++ set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
409 ++ endif()
410 ++
411 ++endif()
412 ++
413 ++find_package_handle_standard_args( HDF5
414 ++ REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS
415 ++ VERSION_VAR HDF5_VERSION
416 ++)
417 ++
418 +diff -purN a/modules/hdf/CMakeLists.txt b/modules/hdf/CMakeLists.txt
419 +--- a/modules/hdf/CMakeLists.txt 2015-12-17 17:11:31.000000000 +0000
420 ++++ b/modules/hdf/CMakeLists.txt 2016-09-19 15:24:47.958650311 +0100
421 +@@ -1,4 +1,4 @@
422 +-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
423 ++set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR}/cmake)
424 +
425 + find_package(HDF5)
426 + if(HDF5_FOUND)
427
428 diff --git a/media-libs/opencv/opencv-3.1.0-r5.ebuild b/media-libs/opencv/opencv-3.1.0-r5.ebuild
429 new file mode 100644
430 index 00000000..581b725
431 --- /dev/null
432 +++ b/media-libs/opencv/opencv-3.1.0-r5.ebuild
433 @@ -0,0 +1,300 @@
434 +# Copyright 1999-2016 Gentoo Foundation
435 +# Distributed under the terms of the GNU General Public License v2
436 +# $Id$
437 +
438 +EAPI=6
439 +PYTHON_COMPAT=( python{2_7,3_4,3_5} )
440 +
441 +inherit toolchain-funcs cmake-utils python-r1 java-pkg-opt-2 java-ant-2
442 +
443 +DESCRIPTION="A collection of algorithms and sample code for
444 + various computer vision problems"
445 +HOMEPAGE="http://opencv.org"
446 +
447 +SRC_URI="
448 + mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip
449 + https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip
450 + contrib? (
451 + https://github.com/Itseez/${PN}_contrib/archive/cd5993c6576267875adac300b9ddd1f881bb1766.zip -> ${P}_contrib.zip )" #commit from Sun, 27 Mar 2016 17:31:51
452 +
453 +LICENSE="BSD"
454 +SLOT="0/3.1" # subslot = libopencv* soname version
455 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
456 +IUSE="contrib cuda +eigen examples ffmpeg gdal gphoto2 gstreamer gtk \
457 + ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png \
458 + +python qt4 qt5 testprograms threads tiff vaapi v4l vtk webp xine"
459 +
460 +# OpenGL needs gtk or Qt installed to activate, otherwise build system
461 +# will silently disable it without the user knowing, which defeats the
462 +# purpose of the opengl use flag.
463 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
464 + ?? ( qt4 qt5 )
465 + opengl? ( || ( gtk qt4 qt5 ) )"
466 +
467 +# The following logic is intrinsic in the build system, but we do not enforce
468 +# it on the useflags since this just blocks emerging pointlessly:
469 +# gtk? ( !qt4 )
470 +# openmp? ( !threads )
471 +
472 +RDEPEND="
473 + app-arch/bzip2
474 + sys-libs/zlib
475 + cuda? ( dev-util/nvidia-cuda-toolkit:0= )
476 + ffmpeg? (
477 + libav? ( media-video/libav:0= )
478 + !libav? ( media-video/ffmpeg:0= )
479 + )
480 + gdal? ( sci-libs/gdal )
481 + gphoto2? ( media-libs/libgphoto2 )
482 + gstreamer? (
483 + media-libs/gstreamer:1.0
484 + media-libs/gst-plugins-base:1.0
485 + )
486 + gtk? (
487 + dev-libs/glib:2
488 + x11-libs/gtk+:2
489 + opengl? ( x11-libs/gtkglext )
490 + )
491 + java? ( >=virtual/jre-1.6:* )
492 + jpeg? ( virtual/jpeg:0 )
493 + jpeg2k? ( media-libs/jasper )
494 + ieee1394? (
495 + media-libs/libdc1394
496 + sys-libs/libraw1394
497 + )
498 + ipp? ( sci-libs/ipp )
499 + opencl? ( virtual/opencl )
500 + openexr? ( media-libs/openexr )
501 + opengl? ( virtual/opengl virtual/glu )
502 + png? ( media-libs/libpng:0= )
503 + python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
504 + qt4? (
505 + dev-qt/qtgui:4
506 + dev-qt/qttest:4
507 + opengl? ( dev-qt/qtopengl:4 )
508 + )
509 + qt5? (
510 + dev-qt/qtgui:5
511 + dev-qt/qtwidgets:5
512 + dev-qt/qttest:5
513 + dev-qt/qtconcurrent:5
514 + opengl? ( dev-qt/qtopengl:5 )
515 + )
516 + threads? ( dev-cpp/tbb )
517 + tiff? ( media-libs/tiff:0 )
518 + v4l? ( >=media-libs/libv4l-0.8.3 )
519 + vtk? ( sci-libs/vtk[rendering] )
520 + webp? ( media-libs/libwebp )
521 + xine? ( media-libs/xine-lib )
522 +"
523 +DEPEND="${RDEPEND}
524 + virtual/pkgconfig
525 + eigen? ( dev-cpp/eigen:3 )
526 + java? ( >=virtual/jdk-1.6 )
527 +"
528 +
529 +PATCHES=(
530 + "${FILESDIR}"/${PN}-3.0.0-gles.patch
531 + "${FILESDIR}"/${PN}-3.1.0-cmake-no-opengl.patch
532 + "${FILESDIR}"/${P}-git-autodetect.patch
533 + "${FILESDIR}"/${P}-java-magic.patch
534 + "${FILESDIR}"/${P}-gentooify-python.patch
535 +)
536 +
537 +GLOBALCMAKEARGS=()
538 +
539 +pkg_pretend() {
540 + if use openmp; then
541 + tc-has-openmp || die "Please switch to an openmp compatible compiler"
542 + fi
543 +}
544 +
545 +pkg_setup() {
546 + java-pkg-opt-2_pkg_setup
547 +}
548 +
549 +src_prepare() {
550 + default
551 +
552 + # remove bundled stuff
553 + rm -rf 3rdparty || die "Removing 3rd party components failed"
554 + sed -i \
555 + -e '/add_subdirectory(.*3rdparty.*)/ d' \
556 + CMakeLists.txt cmake/*cmake || die
557 +
558 + java-pkg-opt-2_src_prepare
559 +
560 + # Out-of-$S patching
561 + if use contrib; then
562 + cd "${WORKDIR}"/opencv_contrib-${PV} || die "cd failed"
563 + epatch "${FILESDIR}"/${PN}-contrib-find-hdf5-fix.patch
564 + fi
565 +}
566 +
567 +src_configure() {
568 + JAVA_ANT_ENCODING="iso-8859-1"
569 + # set encoding so even this cmake build will pick it up.
570 + export ANT_OPTS+=" -Dfile.encoding=iso-8859-1"
571 + java-ant-2_src_configure
572 +
573 + # please dont sort here, order is the same as in CMakeLists.txt
574 + GLOBALCMAKEARGS=(
575 + # Optional 3rd party components
576 + # ===================================================
577 + -DWITH_1394=$(usex ieee1394)
578 + -DWITH_AVFOUNDATION=OFF # IOS
579 + -DWITH_VTK=$(usex vtk)
580 + -DWITH_EIGEN=$(usex eigen)
581 + -DWITH_VFW=OFF # Video windows support
582 + -DWITH_FFMPEG=$(usex ffmpeg)
583 + -DWITH_GSTREAMER=$(usex gstreamer)
584 + -DWITH_GSTREAMER_0_10=OFF # Don't want this
585 + -DWITH_GTK=$(usex gtk)
586 + -DWITH_GTK_2_X=OFF
587 + -DWITH_IPP=$(usex ipp)
588 + -DWITH_JASPER=$(usex jpeg2k)
589 + -DWITH_JPEG=$(usex jpeg)
590 + -DWITH_WEBP=$(usex webp)
591 + -DWITH_OPENEXR=$(usex openexr)
592 + -DWITH_OPENGL=$(usex opengl)
593 + -DWITH_OPENNI=OFF # Not packaged
594 + -DWITH_OPENNI2=OFF # Not packaged
595 + -DWITH_PNG=$(usex png)
596 + -DWITH_PVAPI=OFF # Not packaged
597 + -DWITH_GIGEAPI=OFF
598 + # Qt in CMakeList.txt here: See below
599 + -DWITH_WIN32UI=OFF # Windows only
600 + -DWITH_QUICKTIME=OFF
601 + -DWITH_TBB=$(usex threads)
602 + -DWITH_OPENMP=$(usex openmp)
603 + -DWITH_CSTRIPES=OFF
604 + -DWITH_PTHREADS_PF=ON
605 + -DWITH_TIFF=$(usex tiff)
606 + -DWITH_UNICAP=OFF # Not packaged
607 + -DWITH_V4L=$(usex v4l)
608 + -DWITH_LIBV4L=$(usex v4l)
609 + -DWITH_DSHOW=ON # direct show supp
610 + -DWITH_MSMF=OFF
611 + -DWITH_XIMEA=OFF # Windows only
612 + -DWITH_XINE=$(usex xine)
613 + -DWITH_CLP=OFF
614 + -DWITH_OPENCL=$(usex opencl)
615 + -DWITH_OPENCL_SVM=OFF
616 + -DWITH_OPENCLAMDFFT=$(usex opencl)
617 + -DWITH_OPENCLAMDBLAS=$(usex opencl)
618 + -DWITH_DIRECTX=OFF
619 + -DWITH_INTELPERC=OFF
620 + -DWITH_JAVA=$(usex java) # Ant needed, no compile flag
621 + -DWITH_IPP_A=OFF
622 + -DWITH_MATLAB=ON
623 + -DWITH_VA=$(usex vaapi)
624 + -DWITH_VA_INTEL=$(usex vaapi)
625 + -DWITH_GDAL=$(usex gdal)
626 + -DWITH_GPHOTO2=$(usex gphoto2)
627 + # ===================================================
628 + # CUDA build components: nvidia-cuda-toolkit takes care of GCC version
629 + # ===================================================
630 + -DWITH_CUDA=$(usex cuda)
631 + -DWITH_CUBLAS=$(usex cuda)
632 + -DWITH_CUFFT=$(usex cuda)
633 + -DCUDA_NPP_LIBRARY_ROOT_DIR=$(usex cuda "${EPREFIX}/opt/cuda" "")
634 + # ===================================================
635 + # OpenCV build components
636 + # ===================================================
637 + -DBUILD_SHARED_LIBS=ON
638 + -DBUILD_ANDROID_EXAMPLES=OFF
639 + -DBUILD_DOCS=OFF # Doesn't install anyways.
640 + -DBUILD_EXAMPLES=$(usex examples)
641 + -DBUILD_PERF_TESTS=OFF
642 + -DBUILD_TESTS=$(usex testprograms)
643 + # ===================================================
644 + # OpenCV installation options
645 + # ===================================================
646 + -DINSTALL_C_EXAMPLES=$(usex examples)
647 + -DINSTALL_TESTS=$(usex testprograms)
648 + # ===================================================
649 + # OpenCV build options
650 + # ===================================================
651 + -DENABLE_PRECOMPILED_HEADERS=$(usex pch)
652 + -DHAVE_opencv_java=$(usex java YES NO)
653 + # ===================================================
654 + # things we want to be hard off or not yet figured out
655 + # ===================================================
656 + -DBUILD_PACKAGE=OFF
657 + -DENABLE_PROFILING=OFF
658 + # ===================================================
659 + # things we want to be hard enabled not worth useflag
660 + # ===================================================
661 + -DCMAKE_SKIP_RPATH=ON
662 + -DOPENCV_DOC_INSTALL_PATH=
663 + )
664 +
665 + if use qt4; then
666 + GLOBALCMAKEARGS+=( -DWITH_QT=4 )
667 + elif use qt5; then
668 + GLOBALCMAKEARGS+=( -DWITH_QT=5 )
669 + else
670 + GLOBALCMAKEARGS+=( -DWITH_QT=OFF )
671 + fi
672 +
673 + use contrib && GLOBALCMAKEARGS+=(
674 + -DOPENCV_EXTRA_MODULES_PATH="${WORKDIR}/opencv_contrib-${PV}/modules"
675 + )
676 +
677 + # workaround for bug 413429
678 + tc-export CC CXX
679 +
680 + local mycmakeargs=( ${GLOBALCMAKEARGS[@]}
681 + -DWITH_PYTHON=OFF
682 + -DINSTALL_PYTHON_EXAMPLES=OFF
683 + )
684 +
685 + cmake-utils_src_configure
686 +}
687 +
688 +python_module_compile() {
689 + local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
690 +
691 + # Set all python variables to load the correct Gentoo paths
692 + mycmakeargs+=(
693 + -DWITH_PYTHON=ON
694 + -DGENTOO_PYTHON_EXECUTABLE=${EPYTHON}
695 + -DGENTOO_PYTHON_INCLUDE_PATH="$(python_get_includedir)"
696 + -DGENTOO_PYTHON_LIBRARIES="$(python_get_library_path)"
697 + -DGENTOO_PYTHON_PACKAGES_PATH="$(python_get_sitedir)"
698 + -DGENTOO_PYTHON_MAJOR=${EPYTHON:6:1}
699 + -DGENTOO_PYTHON_MINOR=${EPYTHON:8:1}
700 + -DGENTOO_PYTHON_DEBUG_LIBRARIES="" # Absolutely no clue what this is
701 + )
702 +
703 + if use examples; then
704 + mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=ON )
705 + else
706 + mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=OFF )
707 + fi
708 +
709 + # Compile and install all at once because configuration will be wiped
710 + # for each impl of Python
711 + BUILD_DIR="${WORKDIR}"/${P}_build
712 + cd "${BUILD_DIR}" || die "cd failed"
713 +
714 + # Regenerate cache file. Can't use rebuild_cache as it won't
715 + # have the Gentoo specific options.
716 + rm -rf CMakeCache.txt || die "rm failed"
717 + cmake-utils_src_configure
718 + cmake-utils_src_compile opencv_${EPYTHON:0:7}
719 + cmake-utils_src_install install/fast
720 +
721 + # Remove compiled binary so new version compiles
722 + # Avoid conflicts with new module builds as build system doesn't
723 + # really support it.
724 + emake -C modules/${EPYTHON:0:7} clean
725 + rm -rf modules/${EPYTHON:0:7} || die "rm failed"
726 +}
727 +
728 +src_install() {
729 + cmake-utils_src_install
730 +
731 + # Build and install the python modules for all targets
732 + use python && python_foreach_impl python_module_compile
733 +}