diff options
author | Amy Liffey <amynka@gentoo.org> | 2018-01-21 09:35:52 +0100 |
---|---|---|
committer | Amy Liffey <amynka@gentoo.org> | 2018-01-21 09:36:21 +0100 |
commit | b311829f28929c5dd15402b395365ccffb85ecd1 (patch) | |
tree | 2131a081ee92fb941a96e4db87cbc88a9b6c6b08 | |
parent | profiles: mask contrib_dnn useflag ppc/arm (diff) | |
download | gentoo-b311829f28929c5dd15402b395365ccffb85ecd1.tar.gz gentoo-b311829f28929c5dd15402b395365ccffb85ecd1.tar.bz2 gentoo-b311829f28929c5dd15402b395365ccffb85ecd1.zip |
media-libs/opencv: fix cuda9 and autodownload
- Fix cuda 9 compatibility
Submitted-by: Todd Walter <twalter@rogers.com>
- Remove autodownload tiny_dnn from contrib
Submitted-by: Jonathan Scruggs <j.scruggs@gmail.com>
- Add PYTHON_COMPAT 3_6
Closes: https://bugs.gentoo.org/637078
Closes: https://bugs.gentoo.org/633844
Closes: https://bugs.gentoo.org/632116
Package-Manager: Portage-2.3.13, Repoman-2.3.3
-rw-r--r-- | media-libs/opencv/Manifest | 1 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-3.3.0-cuda9-cmake.patch | 87 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-3.3.0-cuda9-compute20.patch | 21 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-3.3.0-cuda9-saturate.patch | 41 | ||||
-rw-r--r-- | media-libs/opencv/metadata.xml | 1 | ||||
-rw-r--r-- | media-libs/opencv/opencv-3.3.0-r5.ebuild | 466 |
6 files changed, 617 insertions, 0 deletions
diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest index 84e8300ba035..b193d22127ad 100644 --- a/media-libs/opencv/Manifest +++ b/media-libs/opencv/Manifest @@ -6,4 +6,5 @@ DIST opencv-3.2.0.tar.gz 78861546 BLAKE2B 6d44263792b9cd2d009c7eeaddc2ef87acb014 DIST opencv-3.2.0_contrib.tar.gz 54765210 BLAKE2B 6c5bcb1c18da937751f234cc1edaae58416ab9ab5a3407a2ab2c22f4e174ffeb800396d34fe489f424b288fbd608e106cd5f5b458a06a509cea5f7d8e23a67a7 SHA512 eadb6a8a3625235b0c71e29c36d15d9342278aaf9148ef6a7e1aa80f4db0491aaf30b6df16bfd0cd358402b2a3059b6acbce23fb5fe2c0c57150a733ffbbff5a DIST opencv-3.3.0.tar.gz 81238534 BLAKE2B 9eac7de8eefbcc9981a249343052c2dcada4e73c3406d545a89b9e6a054a7c7153933537d123f227caf51f23196fcaaed4135229db195e9c4139f2977e034e34 SHA512 13dee5c1c5fec1dccdbb05879d299b93ef8ddeb87f561a6c4178e33a4cf5ae919765119068d0387a3efea0e09a625ca993cffac60a772159690fcbee4e8d70fb DIST opencv-3.3.0_contrib.tar.gz 54848519 BLAKE2B 53615af19426bf7a1540a6f23c7803276d6de594260b0d87b06b6b12c9e20326925a275e31e017784e8e876e30df7b8f326e192a75c5300252ae09f50d0d9a8b SHA512 ebe3dbe6c754c6fbaabbf6b0d2a4209964e625fd68e593f30ce043792740c8c1d4440d7870949b5b33f488fd7e2e05f3752287b7f50dd24c29202e268776520e +DIST tiny-dnn-1.0.0a3.tar.gz 12885646 BLAKE2B 85c0715ab6c692b77522487775e70b0db645528baed1830c83c9f44d2b67a5207e4f7ea1709b35c6a4217d287199549304e9be19f4a5cec9a1183b0b5dccc562 SHA512 5f2c1a161771efa67e85b1fea395953b7744e29f61187ac5a6c54c912fb195b3aef9a5827135c3668bd0eeea5ae04a33cc433e1f6683e2b7955010a2632d168b DIST vgg_boostdesc-3.2.0.tar.gz 1867770 BLAKE2B 1fa5b58e73b6fa56ecf8d19af22298f729942ee1369082e173445d09d3de767bf844bad3d2b462efc1199c392f37c88ba49a9996ba8bfd84b4abeba7de94db63 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44 diff --git a/media-libs/opencv/files/opencv-3.3.0-cuda9-cmake.patch b/media-libs/opencv/files/opencv-3.3.0-cuda9-cmake.patch new file mode 100644 index 000000000000..270c599d708c --- /dev/null +++ b/media-libs/opencv/files/opencv-3.3.0-cuda9-cmake.patch @@ -0,0 +1,87 @@ +diff --git a/cmake/FindCUDA.cmake b/cmake/FindCUDA.cmake +index 678b450ab..c2a58bd00 100644 +--- a/cmake/FindCUDA.cmake ++++ b/cmake/FindCUDA.cmake +@@ -283,7 +283,38 @@ + # CUDA_nppc_LIBRARY -- NVIDIA Performance Primitives lib (core). + # Only available for CUDA version 5.5+. + # CUDA_nppi_LIBRARY -- NVIDIA Performance Primitives lib (image processing). +-# Only available for CUDA version 5.5+. ++# Only available for CUDA version 5.5+ and was split up ++# in CUDA version 8.0+ and doesn't exist in combined ++# form in CUDA version 9.0+. ++# CUDA_nppial_LIBRARY -- NVIDIA Performance Primatives library (arithmetic and ++# logical operation functions). Only available for CUDA ++# version 8.0+. ++# CUDA_nppicc_LIBRARY -- NVIDIA Performance Primatives library (color conversion ++# and sampling functions). Only available for CUDA version ++# 8.0+. ++# CUDA_nppicom_LIBRARY -- NVIDIA Performance Primatives library (JPEG compression ++# and decompression functions). Only available for CUDA ++# version 8.0+. ++# CUDA_nppidei_LIBRARY -- NVIDIA Performance Primatives library (data exchange and ++# initialization functions). Only available for CUDA ++# version 8.0+. ++# CUDA_nppif_LIBRARY -- NVIDIA Performance Primatives library (filtering and ++# computer vision functions). Only available for CUDA ++# version 8.0+. ++# CUDA_nppig_LIBRARY -- NVIDIA Performance Primatives library (geometry ++# transformation functions). Only available for CUDA ++# version 8.0+. ++# CUDA_nppim_LIBRARY -- NVIDIA Performance Primatives library (morphological ++# operation functions). Only available for CUDA version ++# 8.0+. ++# CUDA_nppist_LIBRARY -- NVIDIA Performance Primatives library (statistics and ++# linear transform). Only available for CUDA version ++# 8.0+. ++# CUDA_nppisu_LIBRARY -- NVIDIA Performance Primatives library (memory support ++# functions). Only available for CUDA version 8.0+. ++# CUDA_nppitc_LIBRARY -- NVIDIA Performance Primatives library (threshold and ++# compare operation functions). Only available for CUDA ++# version 8.0+. + # CUDA_npps_LIBRARY -- NVIDIA Performance Primitives lib (signal processing). + # Only available for CUDA version 5.5+. + # CUDA_nvcuvenc_LIBRARY -- CUDA Video Encoder library. +@@ -522,6 +553,16 @@ macro(cuda_unset_include_and_libraries) + unset(CUDA_npp_LIBRARY CACHE) + unset(CUDA_nppc_LIBRARY CACHE) + unset(CUDA_nppi_LIBRARY CACHE) ++ unset(CUDA_nppial_LIBRARY CACHE) ++ unset(CUDA_nppicc_LIBRARY CACHE) ++ unset(CUDA_nppicom_LIBRARY CACHE) ++ unset(CUDA_nppidei_LIBRARY CACHE) ++ unset(CUDA_nppif_LIBRARY CACHE) ++ unset(CUDA_nppig_LIBRARY CACHE) ++ unset(CUDA_nppim_LIBRARY CACHE) ++ unset(CUDA_nppist_LIBRARY CACHE) ++ unset(CUDA_nppisu_LIBRARY CACHE) ++ unset(CUDA_nppitc_LIBRARY CACHE) + unset(CUDA_npps_LIBRARY CACHE) + unset(CUDA_nvcuvenc_LIBRARY CACHE) + unset(CUDA_nvcuvid_LIBRARY CACHE) +@@ -787,7 +828,22 @@ if(NOT CUDA_VERSION VERSION_LESS "3.2") + find_cuda_helper_libs(nvcuvid) + endif() + endif() +-if(CUDA_VERSION VERSION_GREATER "5.0") ++if(CUDA_VERSION VERSION_GREATER "7.5") ++ # In CUDA 8.0 NPP was splitted onto 12 separate libraries. ++ find_cuda_helper_libs(nppc) ++ find_cuda_helper_libs(nppial) ++ find_cuda_helper_libs(nppicc) ++ find_cuda_helper_libs(nppicom) ++ find_cuda_helper_libs(nppidei) ++ find_cuda_helper_libs(nppif) ++ find_cuda_helper_libs(nppig) ++ find_cuda_helper_libs(nppim) ++ find_cuda_helper_libs(nppist) ++ find_cuda_helper_libs(nppisu) ++ find_cuda_helper_libs(nppitc) ++ find_cuda_helper_libs(npps) ++ set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}") ++elseif(CUDA_VERSION VERSION_GREATER "5.0") + # In CUDA 5.5 NPP was splitted onto 3 separate libraries. + find_cuda_helper_libs(nppc) + find_cuda_helper_libs(nppi) + + diff --git a/media-libs/opencv/files/opencv-3.3.0-cuda9-compute20.patch b/media-libs/opencv/files/opencv-3.3.0-cuda9-compute20.patch new file mode 100644 index 000000000000..384630002d98 --- /dev/null +++ b/media-libs/opencv/files/opencv-3.3.0-cuda9-compute20.patch @@ -0,0 +1,21 @@ +--- a/cmake/OpenCVDetectCUDA.cmake 2018-01-02 11:57:50.358147518 -0500 ++++ b/cmake/OpenCVDetectCUDA.cmake 2018-01-02 12:48:44.108965500 -0500 +@@ -104,7 +104,7 @@ + if(${CUDA_VERSION} VERSION_LESS "8.0") + set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2") + else() +- set(__cuda_arch_bin "2.0 3.0 3.5 3.7 5.0 5.2 6.0 6.1") ++ set(__cuda_arch_bin "3.0 3.5 3.7 5.0 5.2 6.0 6.1") + endif() + endif() + endif() +@@ -209,7 +209,7 @@ if(CUDA_FOUND) + endif() + + if(UNIX OR APPLE) +- set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC) ++ set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC --expt-relaxed-constexpr) + endif() + if(APPLE) + set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only) + diff --git a/media-libs/opencv/files/opencv-3.3.0-cuda9-saturate.patch b/media-libs/opencv/files/opencv-3.3.0-cuda9-saturate.patch new file mode 100644 index 000000000000..43e2a0833cae --- /dev/null +++ b/media-libs/opencv/files/opencv-3.3.0-cuda9-saturate.patch @@ -0,0 +1,41 @@ +diff --git a/var/tmp/portage/media-libs/opencv-3.3.0-r4/work/opencv-3.3.0/modules/cudev/include/opencv2/cudev/util/saturate_cast.hpp b/./saturate_cast.hpp +index ec9804c..4359d18 100644 +--- a/modules/cudev/include/opencv2/cudev/util/saturate_cast.hpp ++++ b/modules/cudev/include/opencv2/cudev/util/saturate_cast.hpp +@@ -47,6 +47,9 @@ + #define OPENCV_CUDEV_UTIL_SATURATE_CAST_HPP + + #include "../common.hpp" ++#if __CUDACC_VER_MAJOR__ >= 9 ++#include <cuda_fp16.h> ++#endif + + namespace cv { namespace cudev { + +@@ -274,15 +277,25 @@ template <typename T, typename D> __device__ __forceinline__ D cast_fp16(T v); + + template <> __device__ __forceinline__ float cast_fp16<short, float>(short v) + { ++#if __CUDACC_VER_MAJOR__ >= 9 ++ return float(*(__half*)&v); ++#else + return __half2float(v); ++#endif + } + + template <> __device__ __forceinline__ short cast_fp16<float, short>(float v) + { +- return (short)__float2half_rn(v); ++#if __CUDACC_VER_MAJOR__ >= 9 ++ __half h(v); ++ return *(short*)&v; ++#else ++ return (short)__float2half_rn(v); ++#endif + } + //! @} + + }} + + #endif ++ diff --git a/media-libs/opencv/metadata.xml b/media-libs/opencv/metadata.xml index 271e88041349..a557fc060986 100644 --- a/media-libs/opencv/metadata.xml +++ b/media-libs/opencv/metadata.xml @@ -25,6 +25,7 @@ Face Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion Under <flag name="ipp">Enable Intel Integrated Primitive support</flag> <flag restrict=">=media-libs/opencv-3.1.0" name="contrib_xfeatures2d">Enables xfeatures2d and autodownload of samples in contrib</flag> <flag restrict=">=media-libs/opencv-3.1.0" name="contrib_cvv">CVV module requires Qt5</flag> + <flag restrict=">=media-libs/opencv-3.3.0" name="contrib_dnn">DNN module contrib requires tiny dnn</flag> <flag restrict=">=media-libs/opencv-3.1.0" name="contrib_hdf">HDF module requires <pkg>sci-libs/hdf5</pkg></flag> <flag restrict=">=media-libs/opencv-3.1.0" name="contrib_sfm">SFM module requires eigen, gflags, and glog</flag> <flag name="opencl">Add support for OpenCL</flag> diff --git a/media-libs/opencv/opencv-3.3.0-r5.ebuild b/media-libs/opencv/opencv-3.3.0-r5.ebuild new file mode 100644 index 000000000000..8b76d7910413 --- /dev/null +++ b/media-libs/opencv/opencv-3.3.0-r5.ebuild @@ -0,0 +1,466 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} ) + +inherit toolchain-funcs python-r1 java-pkg-opt-2 java-ant-2 cmake-multilib + +DESCRIPTION="A collection of algorithms and sample code for various computer vision problems" +HOMEPAGE="https://opencv.org" +TINY_DNN_PV="1.0.0a3" +SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~amynka/snap/imgcodecs-${P}.tar.gz + contrib? ( https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz + contrib_dnn? ( https://github.com/tiny-dnn/tiny-dnn/archive/v${TINY_DNN_PV}.tar.gz -> tiny-dnn-${TINY_DNN_PV}.tar.gz ) + contrib_xfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz ) ) " +LICENSE="BSD" +SLOT="0/3.3" # subslot = libopencv* soname version +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux" +IUSE="contrib cuda debug +eigen examples ffmpeg gdal gflags glog gphoto2 gstreamer gtk ieee1394 ipp jpeg jpeg2k lapack libav opencl openexr opengl openmp pch png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine contrib_cvv contrib_dnn contrib_hdf contrib_sfm contrib_xfeatures2d" + +# OpenGL needs gtk or Qt installed to activate, otherwise build system +# will silently disable it without the user knowing, which defeats the +# purpose of the opengl use flag. +REQUIRED_USE=" + cuda? ( tesseract? ( opencl ) ) + gflags? ( contrib ) + glog? ( contrib ) + contrib_cvv? ( contrib qt5 ) + contrib_dnn? ( contrib ) + contrib_hdf? ( contrib ) + contrib_sfm? ( contrib eigen gflags glog ) + contrib_xfeatures2d? ( contrib cuda ) + java? ( python ) + opengl? ( || ( gtk qt5 ) ) + python? ( ${PYTHON_REQUIRED_USE} ) + tesseract? ( contrib )" + +# The following logic is intrinsic in the build system, but we do not enforce +# it on the useflags since this just blocks emerging pointlessly: +# gtk? ( !qt5 ) +# openmp? ( !threads ) + +RDEPEND=" + app-arch/bzip2[${MULTILIB_USEDEP}] + dev-libs/protobuf:=[${MULTILIB_USEDEP}] + sys-libs/zlib[${MULTILIB_USEDEP}] + cuda? ( dev-util/nvidia-cuda-toolkit:0= ) + contrib_hdf? ( sci-libs/hdf5 ) + ffmpeg? ( + libav? ( media-video/libav:0=[${MULTILIB_USEDEP}] ) + !libav? ( media-video/ffmpeg:0=[${MULTILIB_USEDEP}] ) + ) + gdal? ( sci-libs/gdal:= ) + gflags? ( dev-cpp/gflags[${MULTILIB_USEDEP}] ) + glog? ( dev-cpp/glog[${MULTILIB_USEDEP}] ) + gphoto2? ( media-libs/libgphoto2[${MULTILIB_USEDEP}] ) + gstreamer? ( + media-libs/gstreamer:1.0[${MULTILIB_USEDEP}] + media-libs/gst-plugins-base:1.0[${MULTILIB_USEDEP}] + ) + gtk? ( + dev-libs/glib:2[${MULTILIB_USEDEP}] + x11-libs/gtk+:2[${MULTILIB_USEDEP}] + opengl? ( x11-libs/gtkglext[${MULTILIB_USEDEP}] ) + ) + ieee1394? ( + media-libs/libdc1394[${MULTILIB_USEDEP}] + sys-libs/libraw1394[${MULTILIB_USEDEP}] + ) + ipp? ( sci-libs/ipp ) + java? ( >=virtual/jre-1.6:* ) + jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] ) + jpeg2k? ( media-libs/jasper:=[${MULTILIB_USEDEP}] ) + lapack? ( virtual/lapack ) + opencl? ( virtual/opencl[${MULTILIB_USEDEP}] ) + openexr? ( media-libs/openexr[${MULTILIB_USEDEP}] ) + opengl? ( + virtual/opengl[${MULTILIB_USEDEP}] + virtual/glu[${MULTILIB_USEDEP}] + ) + png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] ) + python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] ) + qt5? ( + dev-qt/qtgui:5 + dev-qt/qtwidgets:5 + dev-qt/qttest:5 + dev-qt/qtconcurrent:5 + opengl? ( dev-qt/qtopengl:5 ) + ) + tesseract? ( app-text/tesseract[opencl=] ) + threads? ( dev-cpp/tbb[${MULTILIB_USEDEP}] ) + tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] ) + v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] ) + vtk? ( sci-libs/vtk[rendering] ) + webp? ( media-libs/libwebp[${MULTILIB_USEDEP}] ) + xine? ( media-libs/xine-lib )" +DEPEND="${RDEPEND} + virtual/pkgconfig[${MULTILIB_USEDEP}] + contrib_dnn? ( dev-libs/cereal ) + eigen? ( dev-cpp/eigen:3 ) + java? ( >=virtual/jdk-1.6 )" + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/opencv2/cvconfig.h + /usr/include/opencv2/opencv_modules.hpp + # [contrib_cvv] + /usr/include/opencv2/cvv.hpp + /usr/include/opencv2/cvv/call_meta_data.hpp + /usr/include/opencv2/cvv/cvv.hpp + /usr/include/opencv2/cvv/debug_mode.hpp + /usr/include/opencv2/cvv/dmatch.hpp + /usr/include/opencv2/cvv/filter.hpp + /usr/include/opencv2/cvv/final_show.hpp + /usr/include/opencv2/cvv/show_image.hpp + # [contrib_hdf] + /usr/include/opencv2/hdf.hpp + /usr/include/opencv2/hdf/hdf5.hpp + # [vtk] + /usr/include/opencv2/viz.hpp + /usr/include/opencv2/viz/types.hpp + /usr/include/opencv2/viz/viz3d.hpp + /usr/include/opencv2/viz/vizcore.hpp + /usr/include/opencv2/viz/widget_accessor.hpp + /usr/include/opencv2/viz/widgets.hpp + # [cudev] + /usr/include/opencv2/cudaarithm.hpp + /usr/include/opencv2/cudabgsegm.hpp + /usr/include/opencv2/cudacodec.hpp + /usr/include/opencv2/cudafeatures2d.hpp + /usr/include/opencv2/cudafilters.hpp + /usr/include/opencv2/cudaimgproc.hpp + /usr/include/opencv2/cudalegacy.hpp + /usr/include/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp + /usr/include/opencv2/cudalegacy/NCVHaarObjectDetection.hpp + /usr/include/opencv2/cudalegacy/NCV.hpp + /usr/include/opencv2/cudalegacy/NCVPyramid.hpp + /usr/include/opencv2/cudalegacy/NPP_staging.hpp + /usr/include/opencv2/cudaobjdetect.hpp + /usr/include/opencv2/cudaoptflow.hpp + /usr/include/opencv2/cudastereo.hpp + /usr/include/opencv2/cudawarping.hpp + /usr/include/opencv2/cudev/block/block.hpp + /usr/include/opencv2/cudev/block/detail/reduce.hpp + /usr/include/opencv2/cudev/block/detail/reduce_key_val.hpp + /usr/include/opencv2/cudev/block/dynamic_smem.hpp + /usr/include/opencv2/cudev/block/reduce.hpp + /usr/include/opencv2/cudev/block/scan.hpp + /usr/include/opencv2/cudev/block/vec_distance.hpp + /usr/include/opencv2/cudev/common.hpp + /usr/include/opencv2/cudev/expr/binary_func.hpp + /usr/include/opencv2/cudev/expr/binary_op.hpp + /usr/include/opencv2/cudev/expr/color.hpp + /usr/include/opencv2/cudev/expr/deriv.hpp + /usr/include/opencv2/cudev/expr/expr.hpp + /usr/include/opencv2/cudev/expr/per_element_func.hpp + /usr/include/opencv2/cudev/expr/reduction.hpp + /usr/include/opencv2/cudev/expr/unary_func.hpp + /usr/include/opencv2/cudev/expr/unary_op.hpp + /usr/include/opencv2/cudev/expr/warping.hpp + /usr/include/opencv2/cudev/functional/color_cvt.hpp + /usr/include/opencv2/cudev/functional/detail/color_cvt.hpp + /usr/include/opencv2/cudev/functional/functional.hpp + /usr/include/opencv2/cudev/functional/tuple_adapter.hpp + /usr/include/opencv2/cudev/grid/copy.hpp + /usr/include/opencv2/cudev/grid/detail/copy.hpp + /usr/include/opencv2/cudev/grid/detail/histogram.hpp + /usr/include/opencv2/cudev/grid/detail/integral.hpp + /usr/include/opencv2/cudev/grid/detail/minmaxloc.hpp + /usr/include/opencv2/cudev/grid/detail/pyr_down.hpp + /usr/include/opencv2/cudev/grid/detail/pyr_up.hpp + /usr/include/opencv2/cudev/grid/detail/reduce.hpp + /usr/include/opencv2/cudev/grid/detail/reduce_to_column.hpp + /usr/include/opencv2/cudev/grid/detail/reduce_to_row.hpp + /usr/include/opencv2/cudev/grid/detail/split_merge.hpp + /usr/include/opencv2/cudev/grid/detail/transform.hpp + /usr/include/opencv2/cudev/grid/detail/transpose.hpp + /usr/include/opencv2/cudev/grid/histogram.hpp + /usr/include/opencv2/cudev/grid/integral.hpp + /usr/include/opencv2/cudev/grid/pyramids.hpp + /usr/include/opencv2/cudev/grid/reduce.hpp + /usr/include/opencv2/cudev/grid/reduce_to_vec.hpp + /usr/include/opencv2/cudev/grid/split_merge.hpp + /usr/include/opencv2/cudev/grid/transform.hpp + /usr/include/opencv2/cudev/grid/transpose.hpp + /usr/include/opencv2/cudev.hpp + /usr/include/opencv2/cudev/ptr2d/constant.hpp + /usr/include/opencv2/cudev/ptr2d/deriv.hpp + /usr/include/opencv2/cudev/ptr2d/detail/gpumat.hpp + /usr/include/opencv2/cudev/ptr2d/extrapolation.hpp + /usr/include/opencv2/cudev/ptr2d/glob.hpp + /usr/include/opencv2/cudev/ptr2d/gpumat.hpp + /usr/include/opencv2/cudev/ptr2d/interpolation.hpp + /usr/include/opencv2/cudev/ptr2d/lut.hpp + /usr/include/opencv2/cudev/ptr2d/mask.hpp + /usr/include/opencv2/cudev/ptr2d/remap.hpp + /usr/include/opencv2/cudev/ptr2d/resize.hpp + /usr/include/opencv2/cudev/ptr2d/texture.hpp + /usr/include/opencv2/cudev/ptr2d/traits.hpp + /usr/include/opencv2/cudev/ptr2d/transform.hpp + /usr/include/opencv2/cudev/ptr2d/warping.hpp + /usr/include/opencv2/cudev/ptr2d/zip.hpp + /usr/include/opencv2/cudev/util/atomic.hpp + /usr/include/opencv2/cudev/util/detail/tuple.hpp + /usr/include/opencv2/cudev/util/detail/type_traits.hpp + /usr/include/opencv2/cudev/util/limits.hpp + /usr/include/opencv2/cudev/util/saturate_cast.hpp + /usr/include/opencv2/cudev/util/simd_functions.hpp + /usr/include/opencv2/cudev/util/tuple.hpp + /usr/include/opencv2/cudev/util/type_traits.hpp + /usr/include/opencv2/cudev/util/vec_math.hpp + /usr/include/opencv2/cudev/util/vec_traits.hpp + /usr/include/opencv2/cudev/warp/detail/reduce.hpp + /usr/include/opencv2/cudev/warp/detail/reduce_key_val.hpp + /usr/include/opencv2/cudev/warp/reduce.hpp + /usr/include/opencv2/cudev/warp/scan.hpp + /usr/include/opencv2/cudev/warp/shuffle.hpp + /usr/include/opencv2/cudev/warp/warp.hpp +) + +PATCHES=( + "${FILESDIR}/${PN}-3.0.0-gles.patch" + "${FILESDIR}/${PN}-3.1.0-java-magic.patch" + "${FILESDIR}/${PN}-3.1.0-find-libraries-fix.patch" + "${WORKDIR}/${P}-imgcodecs-gcc.patch" # bug 627958 and https://github.com/opencv/opencv/pull/9376 + "${FILESDIR}/${P}-cuda9-cmake.patch" + "${FILESDIR}/${P}-cuda9-saturate.patch" + "${FILESDIR}/${P}-cuda9-compute20.patch" +) + +pkg_pretend() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp +} + +pkg_setup() { + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + cmake-utils_src_prepare + + # remove bundled stuff + rm -rf 3rdparty || die "Removing 3rd party components failed" + sed -e '/add_subdirectory(.*3rdparty.*)/ d' \ + -i CMakeLists.txt cmake/*cmake || die + + if use contrib && use contrib_dnn; then + cd "${WORKDIR}/${PN}_contrib-${PV}" || die + eapply "${FILESDIR}/${P}-remove-tiny-dnn-autodownload.patch" + fi + + if use contrib && use contrib_xfeatures2d; then + cd "${WORKDIR}/${PN}_contrib-${PV}" || die + eapply "${FILESDIR}/${P}-contrib-xfeatures2d.patch" + mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die + fi + + java-pkg-opt-2_src_prepare + + # this really belongs in src_prepare() too + JAVA_ANT_ENCODING="iso-8859-1" + # set encoding so even this cmake build will pick it up. + export ANT_OPTS+=" -Dfile.encoding=iso-8859-1" + java-ant-2_src_configure +} + +multilib_src_configure() { + # please dont sort here, order is the same as in CMakeLists.txt + GLOBALCMAKEARGS=( + # Optional 3rd party components + # =================================================== + -DWITH_1394=$(usex ieee1394) + # -DWITH_AVFOUNDATION=OFF # IOS + -DWITH_VTK=$(multilib_native_usex vtk) + -DWITH_EIGEN=$(usex eigen) + -DWITH_VFW=OFF # Video windows support + -DWITH_FFMPEG=$(usex ffmpeg) + -DWITH_GSTREAMER=$(usex gstreamer) + -DWITH_GSTREAMER_0_10=OFF # Don't want this + -DWITH_GTK=$(usex gtk) + -DWITH_GTK_2_X=$(usex gtk) + -DWITH_IPP=$(multilib_native_usex ipp) + -DWITH_JASPER=$(usex jpeg2k) + -DWITH_JPEG=$(usex jpeg) + -DWITH_WEBP=$(usex webp) + -DWITH_OPENEXR=$(usex openexr) + -DWITH_OPENGL=$(usex opengl) + -DWITH_OPENVX=OFF + -DWITH_OPENNI=OFF # Not packaged + -DWITH_OPENNI2=OFF # Not packaged + -DWITH_PNG=$(usex png) + -DWITH_GDCM=OFF + -DWITH_PVAPI=OFF + -DWITH_GIGEAPI=OFF + -DWITH_ARAVIS=OFF + -DWITH_QT=$(multilib_native_usex qt5 5 OFF) + -DWITH_WIN32UI=OFF # Windows only + # -DWITH_QUICKTIME=OFF + # -DWITH_QTKIT=OFF + -DWITH_TBB=$(usex threads) + -DWITH_OPENMP=$(usex openmp) + -DWITH_CSTRIPES=OFF + -DWITH_PTHREADS_PF=ON + -DWITH_TIFF=$(usex tiff) + -DWITH_UNICAP=OFF # Not packaged + -DWITH_V4L=$(usex v4l) + -DWITH_LIBV4L=$(usex v4l) + -DWITH_DSHOW=ON # direct show supp + -DWITH_MSMF=OFF + -DWITH_XIMEA=OFF # Windows only + -DWITH_XINE=$(multilib_native_usex xine) + -DWITH_CLP=OFF + -DWITH_OPENCL=$(usex opencl) + -DWITH_OPENCL_SVM=OFF + -DWITH_OPENCLAMDFFT=$(usex opencl) + -DWITH_OPENCLAMDBLAS=$(usex opencl) + -DWITH_DIRECTX=OFF + -DWITH_INTELPERC=OFF + -DWITH_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag + -DWITH_IPP_A=OFF + -DWITH_MATLAB=OFF + -DWITH_VA=$(usex vaapi) + -DWITH_VA_INTEL=$(usex vaapi) + -DWITH_GDAL=$(multilib_native_usex gdal) + -DWITH_GPHOTO2=$(usex gphoto2) + -DWITH_LAPACK=$(multilib_native_usex lapack) + -DWITH_ITT=OFF # 3dparty libs itt_notify + # =================================================== + # CUDA build components: nvidia-cuda-toolkit takes care of GCC version + # =================================================== + -DWITH_CUDA=$(multilib_native_usex cuda) + -DWITH_CUBLAS=$(multilib_native_usex cuda) + -DWITH_CUFFT=$(multilib_native_usex cuda) + -DWITH_NVCUVID=OFF +# -DWITH_NVCUVID=$(usex cuda) + -DCUDA_NPP_LIBRARY_ROOT_DIR=$(usex cuda "${EPREFIX}/opt/cuda" "") + # =================================================== + # OpenCV build components + # =================================================== + -DBUILD_SHARED_LIBS=ON + -DBUILD_ANDROID_EXAMPLES=OFF + -BUILD_opencv_apps= + -DBUILD_DOCS=OFF # Doesn't install anyways. + -DBUILD_EXAMPLES=$(multilib_native_usex examples) + -DBUILD_PERF_TESTS=OFF + -DBUILD_TESTS=$(multilib_native_usex testprograms) + -DBUILD_WITH_DEBUG_INFO=$(usex debug) + # -DBUILD_WITH_STATIC_CRT=OFF + -DBUILD_WITH_DYNAMIC_IPP=OFF + -DBUILD_FAT_JAVA_LIB=$(multilib_native_usex java) + # -DBUILD_ANDROID_SERVICE=OFF + -DBUILD_CUDA_STUBS=$(multilib_native_usex cuda) + -DOPENCV_EXTRA_MODULES_PATH=$(usex contrib "${WORKDIR}/opencv_contrib-${PV}/modules" "") + # =================================================== + # OpenCV installation options + # =================================================== + -DINSTALL_CREATE_DISTRIB=OFF + -DINSTALL_C_EXAMPLES=$(multilib_native_usex examples) + -DINSTALL_TESTS=$(multilib_native_usex testprograms) + -DINSTALL_PYTHON_EXAMPLES=$(multilib_native_usex examples) + # -DINSTALL_ANDROID_EXAMPLES=OFF + -DINSTALL_TO_MANGLED_PATHS=OFF + # =================================================== + # OpenCV build options + # =================================================== + -DENABLE_CCACHE=OFF + -DENABLE_PRECOMPILED_HEADERS=$(usex pch) + -DENABLE_SOLUTION_FOLDERS=OFF + -DENABLE_PROFILING=OFF + -DENABLE_COVERAGE=OFF + + -DHAVE_opencv_java=$(multilib_native_usex java YES NO) + -DENABLE_NOISY_WARNINGS=OFF + -DOPENCV_WARNINGS_ARE_ERRORS=OFF + -DENABLE_IMPL_COLLECTION=OFF + -DENABLE_INSTRUMENTATION=OFF + -DGENERATE_ABI_DESCRIPTOR=OFF + -DDOWNLOAD_EXTERNAL_TEST_DATA=OFF + # =================================================== + # things we want to be hard off or not yet figured out + # =================================================== + -DBUILD_PACKAGE=OFF + # =================================================== + # Not building protobuf but update files bug #631418 + # =================================================== + -DBUILD_PROTOBUF=OFF + -DPROTOBUF_UPDATE_FILES=ON + # =================================================== + # things we want to be hard enabled not worth useflag + # =================================================== + -DCMAKE_SKIP_RPATH=ON + -DOPENCV_DOC_INSTALL_PATH= + ) + + # =================================================== + # OpenCV Contrib Modules + # =================================================== + if use contrib; then + GLOBALCMAKEARGS+=( + -DBUILD_opencv_dnn=$(usex contrib_dnn ON OFF) + -DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}" + -DBUILD_opencv_dnns_easily_fooled=OFF + -DBUILD_opencv_xfeatures2d=$(usex contrib_xfeatures2d ON OFF) + -DBUILD_opencv_cvv=$(usex contrib_cvv ON OFF) + -DBUILD_opencv_hdf=$(multilib_native_usex contrib_hdf ON OFF) + -DBUILD_opencv_sfm=$(usex contrib_sfm ON OFF) + ) + + if multilib_is_native_abi; then + GLOBALCMAKEARGS+=( + -DCMAKE_DISABLE_FIND_PACKAGE_Tesseract=$(usex !tesseract) + ) + else + GLOBALCMAKEARGS+=( + -DCMAKE_DISABLE_FIND_PACKAGE_Tesseract=ON + ) + fi + fi + + # workaround for bug 413429 + tc-export CC CXX + + local mycmakeargs=( ${GLOBALCMAKEARGS[@]} + -DPYTHON_EXECUTABLE=OFF + -DINSTALL_PYTHON_EXAMPLES=OFF + ) + + cmake-utils_src_configure +} + +python_module_compile() { + local BUILD_DIR=${orig_BUILD_DIR} + local mycmakeargs=( ${GLOBALCMAKEARGS[@]} ) + + # Set all python variables to load the correct Gentoo paths + mycmakeargs+=( + # cheap trick: python_setup sets one of them as a symlink + # to the correct interpreter, and the other to fail-wrapper + -DPYTHON2_EXECUTABLE=$(type -P python2) + -DPYTHON3_EXECUTABLE=$(type -P python3) + -DINSTALL_PYTHON_EXAMPLES=$(usex examples) + ) + + # Regenerate cache file. Can't use rebuild_cache as it won't + # have the Gentoo specific options. + rm -rf CMakeCache.txt || die "rm failed" + cmake-utils_src_configure + cmake-utils_src_compile + cmake-utils_src_install + + # Remove compiled binary so new version compiles + # Avoid conflicts with new module builds as build system doesn't + # really support it. + rm -rf modules/python2 || die "rm failed" +} + +multilib_src_install() { + cmake-utils_src_install + + # Build and install the python modules for all targets + if multilib_is_native_abi && use python; then + local orig_BUILD_DIR=${BUILD_DIR} + python_foreach_impl python_module_compile + fi +} |