diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-01-21 19:03:35 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-01-21 19:03:35 +0000 |
commit | 0ebf740b9c9bc7c10ac41bea315ecc6c01c79166 (patch) | |
tree | 15bb76d57cfb8652fd2627a24007e0bb92ec4a99 /media-libs/opencv | |
parent | 5b5df25227111ef465caf5c52bcfb66dac3219cd (diff) |
gentoo resync : 21.01.2018
Diffstat (limited to 'media-libs/opencv')
-rw-r--r-- | media-libs/opencv/Manifest | 7 | ||||
-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, 622 insertions, 1 deletions
diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest index 716683edf473..4e8039bc6a54 100644 --- a/media-libs/opencv/Manifest +++ b/media-libs/opencv/Manifest @@ -17,6 +17,9 @@ AUX opencv-3.2.0-fix_ussage_cpu_instructions.patch 1931 BLAKE2B 7a4764d8b0a6d5f5 AUX opencv-3.2.0-gcc-6.0.patch 407 BLAKE2B 41f4f6416f1cf8418a397dd37ba489780ba9488365837a0cc3df945b0392b00ddf3295208d79a413d27ee76a846ffcea1e5f11bb1a46d46c05d2cffd78bd5ee9 SHA512 2615d79b237df196425628838bbfeead2a9410e3c05d83f134e2f5a1ed6d1225236ad7e2e5797e96d4a0d28743e2ac5a441e385461c3b872c726a6a37bedb4b1 AUX opencv-3.2.0-vtk.patch 857 BLAKE2B 4fcf3ed98bbf1a566d1af1f16e7dd8eef7734ee9dcb33323ae6c1849313df6c7ad404f93bee7d53906ded46d35ac8d90e25297fc9a4abb361f8e9da52b41c09d SHA512 c4c1f232b1814e7bcd93980a886b9c40b84c3ed41864e102f3a13c2272ab45bda8e488f21f5b1e25137a70533c0c24c83a3cb6355285bab5234ee083ff412d5b AUX opencv-3.3.0-contrib-xfeatures2d.patch 1038 BLAKE2B 19b304148474a5baab14c23148ef28e7eccfccf524ef5649d6a03452d02647413b681e095d21dc4c010c3aac12f93e67aacf36a78705fecac47b0d9bf081dcbf SHA512 fbcd3fd68203d9bf865528c97aa69d69e41645d3549e6202d369047840d024aec1cf229f0dfb10e71d78b9433014611bf53673d6f36d60c02a643454955a9e8c +AUX opencv-3.3.0-cuda9-cmake.patch 4676 BLAKE2B 9de3c4b988720a0b5fad1674d3967271def339c9fe45bd733b0843bede6da9ecc24b6f58b41a8f329f7f97a11e6c9ce6eacb33d9819d046d16acf257486fd4c2 SHA512 a526c9b0b248dac465da67adfd2260c9edd24ad3c335e060af134fa8700c7fb4e4a0ca0450b666966f917fb73ef2f168254a31488ce2bb74262f915d67225f90 +AUX opencv-3.3.0-cuda9-compute20.patch 775 BLAKE2B 7a818042ba9c75fd835b7fc8f6c0793aab8fef6f72964e9b57738e164c67ca16f885a8ad362360065b13bd35d4045e9c1a2683b59cc5d2b4162dc7794558a542 SHA512 00468ac115865acaba15efcf3791a927d6434ee54e37af3dd78bae3485868108ce4d1068ce94739a4d92b1673dd2111ebc30831446d69db4c999b95c5454c9cf +AUX opencv-3.3.0-cuda9-saturate.patch 1075 BLAKE2B 9e7af021924e84d0f12e8f9b764630dbd35e8d732550f2c16d7f812e9cbd4d4a1499182d7239b266985d39061a8a3f3e95b65e876c8dd339de9f1b764e769089 SHA512 e19b95957c282af846d08d2d6a7d8290c32692af165bc9c627a3d2e42319775d5128a832a4f639915b1331f8db979f2b88c1528e6059aeb78159a8f5409e1644 DIST imgcodecs-opencv-3.3.0.tar.gz 7724 BLAKE2B 0e1c931a6dd796a7fa8e4a958f9a959d3bbba9bfa636a74a22d839b2919a8e1d0843765bcb69c5fbff7156efad0db2e5b3b70a2fc6e1911c0317ba46142cc130 SHA512 9c6fc31830e299e3d15da1cfc3468fe23eecda970a02e5826e0a7cfba34200c557c0e46f940154a26e9916da05859a83376217cbe7452ec8d14e99bc76f63d37 DIST opencv-2.4.13.tar.gz 91669572 BLAKE2B 7f6be39e29c0db5d005cb14215fdf5955fa69c34d72c4f1e1fa8bf8de1e748a0d2fe5febb43296ef529c57e4dec8d1b6739c0c4df9e64657b9550ed382fbc4b9 SHA512 efdc4340fdf557dae44ac604c8c20f61ced89f99274264b61c2640f28741504462c6b57076e207040ca2513e3921275bdfbe6c22fc123bd50df78745e6b7bcd6 DIST opencv-3.1.0.tar.gz 76135587 BLAKE2B 59d0facba6573ae7b6ec8b4d8097693181244988c8c460a738004b975a65442230f387eef172920cd56682a4fa19f28368262ad85b7c79f243e2063c56275755 SHA512 57e0fe41e3d5d1dc036e7fc5673523e53d54f5f62e4d3bcb95238a9cd53e79da7c1704dc136ce632f7cfce369ebf5eb27f629a9b6ac4f7fa34120b80b5c7438f @@ -25,6 +28,7 @@ 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 EBUILD opencv-2.4.13-r3.ebuild 6007 BLAKE2B 1b78cbb84733a057876a8e0a942c753786ac0b836b4e1116b9225b46cb36c37deca4c53d5df78784b99ce628e15010bf60ee750691c657d935ffa75733f54cdf SHA512 eb633e9f6e19de369a8bfcc75ca644a47cb2ca2fb2ccc8a91703e1c964d952dbdbcbae635163014839d62a647b0fa9a6c6ad8ae20c9d72fa87b270de55a57a44 EBUILD opencv-3.1.0-r8.ebuild 10666 BLAKE2B cb0777a26f6258df80001bedb0705bd1804d1bc3a01592eba66c9d52d0d93b1538697e41ceeef7ca90ef57c7d7e6a834450cfb463bdb5b0a4614dae1f662a0aa SHA512 a8c40927311623d1b40f96c4a49bf7f135c74e7956246ea0b8f817a49faeaf694216afae498786fb4d46bfefa9222bab25fc01e4f544f521fc4d19b1db14c3ff @@ -32,4 +36,5 @@ EBUILD opencv-3.2.0-r2.ebuild 10387 BLAKE2B d9b6b704e465ee03862a2b264af592025197 EBUILD opencv-3.2.0-r3.ebuild 12171 BLAKE2B f5fdc59285166a2a4e2e31901eef8d66cf0bfa948ce4b06ee9f80c91f2acceeefccc6fa4a03cbf05f609d1d51ebe58f9b192df071a016d157f921b738d00ef13 SHA512 b4dc53882ea13aeb90454dd54818d5d7ea3f0d00425c2f3eaea9ee493f84dd0956115bf2289e58b36b5de35dff455a86e24df0a804faf0f53db490030e99affb EBUILD opencv-3.3.0-r2.ebuild 12169 BLAKE2B a6ed4ce0fc0f3a2bd432979c2caa88f8e27ad2dfe2b94e8c871d394496b7443452323463e7cbc47b52a8bdfaf02d9573d146746bd38248e26da05bcf36d0203e SHA512 d56942b7173929b842e068fcc83dceba38c9cad6e48dfc745438d2bd007a1db604e312034a423e299fd082a3d22ae0cbe52ad82219ffe8a228fb3a8e3ecc80f6 EBUILD opencv-3.3.0-r4.ebuild 16525 BLAKE2B 053b335e77f6a85ccc3d31de2e0ab7211fff0ef93d37d43f659161581d130c2fd64d9e5558e4f3c0fb2628dee01e37093782ed05e57c74a1eff74064d4c194bd SHA512 4b2a62017bc97ea01c08e56fb33a55f48abebea743cb6d6b9be15cc42c7fbc26707bc016b4f27f39c183abbeca1c4666e7c98844413e2495ebd6a93cf85d42ba -MISC metadata.xml 2478 BLAKE2B b0d6572ef8991fe4df9e63f43a736eae0ec84091d31193081f7c844f0f9743631da78275fae2c2ef0570f8581abf713cc4e467a42f6c0d0afa3b5540e26c2e6f SHA512 865176271b361efedc54ca6f64c6b1810430cad04bef2d6351304c88c4212549700724b1475356d73a84d324be675ba0bb4c06e3b67639385b39e61e1922e92f +EBUILD opencv-3.3.0-r5.ebuild 17096 BLAKE2B b831fe5601493b228023ee9f2d86d265b3841375beec391c1c2622df8c7b673c239086d249470a98b09aade2be3c7f983e7748b386f385d23dd2762ccd8cfa0e SHA512 9f8b51d1adaae620133c144ca3f4c1ad6d249a4bc77db883a7318eb3d80034978e371852d003866de5376824e1808fc2644da2308365920842f4c3590b0b452f +MISC metadata.xml 2589 BLAKE2B 461791c4838078ef4a73add8fe730195ffc941e535e63a2d23603a0229e345071d08bf040cf86a17453239e5a7419fd8ccb1c78abfbf6b656b807ea766385913 SHA512 4db9642180623f050783e7d6018c5e0d8455791efe9fd23d329400af30dda7e2266f6b05a886b3cc327bf53b6c40027e77339636bc805e326db0fbf4d84381c9 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 +} |