public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2016-01-23 17:51 Amy Winston
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Winston @ 2016-01-23 17:51 UTC (permalink / raw
  To: gentoo-commits

commit:     f753262e119064afbaf11b171be9c33aff217557
Author:     Amy Winston <amynka <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 23 17:48:16 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 17:51:07 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f753262e

media-libs/opencv: 3.1.0 version bump bug #571496

Package-Manager: portage-2.2.24

 media-libs/opencv/Manifest                         |   1 +
 .../files/opencv-3.1.0-cmake-no-opengl.patch       |  22 ++
 .../files/opencv-3.1.0-fix-hal-headers.patch       |  91 ++++++++
 .../files/opencv-3.1.0-fix-ocl-declaration.patch   | 214 +++++++++++++++++
 .../files/opencv-3.1.0-invalid-string-usage.patch  |  75 ++++++
 media-libs/opencv/metadata.xml                     |   2 +
 media-libs/opencv/opencv-3.1.0.ebuild              | 252 +++++++++++++++++++++
 7 files changed, 657 insertions(+)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 57bffd8..86ee2a5 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -2,4 +2,5 @@ DIST opencv-2.4.10.zip 91692581 SHA256 1bf4cb87283797fd91669d4f90b622a677a903c20
 DIST opencv-2.4.11.zip 91671436 SHA256 af1952fd40fb0dc5e369725e073ac4650847e956fbf77c5f206b6da8ce2b1fea SHA512 748f6b939200a7ad2c2ae2531bf9bf38b82a576530f10691c13a0ad52568a7eb8b9d312e946ba8e78f592ef05ae389ecb982544f0c00cb83a2d87ae4b4da61b0 WHIRLPOOL 1c621b835fb144997ecbabddaa1b9a0cd0653e27c5a4f2abc43f3c6152a0b98eb0941d59263be33f69a6f3bccdffa484455c2ddaa747ed4a2bd2cd3192956d29
 DIST opencv-2.4.9.zip 91684751 SHA256 803010848154988e9cbda8b3fa857fcbb27382c2946ed729e1a7e40600bb4c71 SHA512 8eb6ee11d8260428ae461e06348ce037979efc29b7e33d59c3d348a6b4bae95b7004df4527aba7c634e7356f7b5635c98493dc15a0b43479e8f10f7258540c62 WHIRLPOOL 5bb5e39678b3072b2e8b923216529c84982559dd69d5ec51b8703e65af3401f3a8ff31e4e3bfc076480d0605e333df0b03a61713a927ec058bfaf25b4fa8fd5e
 DIST opencv-3.0.0.zip 100980799 SHA256 07094ea2f996f2622d572f0f3a162d698c8a547520341ca9109fbaf9363fb001 SHA512 108d0fdcc60b5688ebf61c930fb965ec81f0d3c36bb1797f6cc571fac35331f540773207fd1cb81b12c05c8f4d1af20c4a2452d9f75cd0cae4acd8131be92375 WHIRLPOOL 61cbbf5201b1dea75ffa998d1f55ee35f098bb8f76591cc9705de13b9f05eaefd19dcc74e93d2643d9b721e62483a36547617ec2e3d14fa6a2522e18ccf06747
+DIST opencv-3.1.0.zip 79186131 SHA256 1f6990249fdb82804fff40e96fa6d99949023ab0e3277eae4bd459b374e622a4 SHA512 b4915e8838fce8ba9e1af8b11e46678624435e9a41592e645413dfdc830993eaa017d337fe4c212a49f096421a6317a1892546087fbc3cfdab554522336c0f1a WHIRLPOOL 3c38715e2abc431781b724199c2cf06f844c7a889c51a06ecb64889a8ca36d9fd370a0738deec2995e24e453cb64f5db228238681714f62daf6eac50d95a4914
 DIST opencv_contrib.zip 76144299 SHA256 ba780e61e9659aac299055d68c9fe40258e3fab7cb167892163eb5732387c4bb SHA512 9253a9d209368da5bea5f0138c55379132467b840d25fc5eaa1bc0103e6da61d6facf206456ff3f4bb68482d9c6381e23a566cb4dd155ac9ff9a259e54f7ffbf WHIRLPOOL 411febd3d5912ea28b570b217e3af41bee2d48daf5f47b0de6125b40cfbf435216c668545b3e0dfa48e4eef8d4a86135058ee72dc7b5a4244b661130a6916843

diff --git a/media-libs/opencv/files/opencv-3.1.0-cmake-no-opengl.patch b/media-libs/opencv/files/opencv-3.1.0-cmake-no-opengl.patch
new file mode 100644
index 0000000..d6d70d71
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-cmake-no-opengl.patch
@@ -0,0 +1,22 @@
+From cdb9c60dcb65e04e7c0bd6bef9b86841191c785a Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@itseez.com>
+Date: Thu, 31 Dec 2015 02:24:54 +0300
+Subject: [PATCH] gpu samples: fix REMOVE_ITEM error
+
+---
+ samples/gpu/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/samples/gpu/CMakeLists.txt b/samples/gpu/CMakeLists.txt
+index 6085cac..852a8c2 100644
+--- a/samples/gpu/CMakeLists.txt
++++ b/samples/gpu/CMakeLists.txt
+@@ -97,7 +97,7 @@ endif()
+ if(INSTALL_C_EXAMPLES AND NOT WIN32)
+   file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
+   if(NOT WITH_OPENGL)
+-    list(REMOVE_ITEM all_samples "opengl.cpp")
++    list(REMOVE_ITEM install_list "opengl.cpp")
+   endif(NOT WITH_OPENGL)
+   install(FILES ${install_list}
+           DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu

diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
new file mode 100644
index 0000000..dd77571
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
@@ -0,0 +1,91 @@
+From f529a1df2b17bcada1179ddcaf1352e3a5ba97b8 Mon Sep 17 00:00:00 2001
+From: Maksim Shabunin <maksim.shabunin@itseez.com>
+Date: Tue, 15 Dec 2015 17:51:08 +0300
+Subject: [PATCH] Fixed HAL headers location
+
+diff --git opencv_contrib-master/modules/xfeatures2d/src/sift.cpp opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
+index fc67c4d..9634fbb 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
++++ opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
+@@ -105,6 +105,7 @@
+ #include "precomp.hpp"
+ #include <iostream>
+ #include <stdarg.h>
++#include <opencv2/core/hal/hal.hpp>
+ 
+ namespace cv
+ {
+@@ -337,9 +338,9 @@ static float calcOrientationHist( const Mat& img, Point pt, int radius,
+     len = k;
+ 
+     // compute gradient values, orientations and the weights over the pixel neighborhood
+-    hal::exp(W, W, len);
+-    hal::fastAtan2(Y, X, Ori, len, true);
+-    hal::magnitude(X, Y, Mag, len);
++    cv::hal::exp32f(W, W, len);
++    cv::hal::fastAtan2(Y, X, Ori, len, true);
++    cv::hal::magnitude32f(X, Y, Mag, len);
+ 
+     for( k = 0; k < len; k++ )
+     {
+@@ -620,9 +621,9 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
+         }
+ 
+     len = k;
+-    hal::fastAtan2(Y, X, Ori, len, true);
+-    hal::magnitude(X, Y, Mag, len);
+-    hal::exp(W, W, len);
++    cv::hal::fastAtan2(Y, X, Ori, len, true);
++    cv::hal::magnitude32f(X, Y, Mag, len);
++    cv::hal::exp32f(W, W, len);
+ 
+     for( k = 0; k < len; k++ )
+     {
+
+diff --git opencv_contrib-master/modules/optflow/src/motempl.cpp opencv_contrib-master/modules/optflow/src/motempl.cpp
+index ec18013..452ad63 100644
+--- opencv_contrib-master/modules/optflow/src/motempl.cpp
++++ opencv_contrib-master/modules/optflow/src/motempl.cpp
+@@ -41,6 +41,7 @@
+ 
+ #include "precomp.hpp"
+ #include "opencv2/core/utility.hpp"
++#include "opencv2/core/hal/hal.hpp"
+ #include "opencl_kernels_optflow.hpp"
+ 
+ namespace  cv {
+@@ -212,7 +213,7 @@ void calcMotionGradient( InputArray _mhi, OutputArray _mask,
+         float* orient_row = orient.ptr<float>(y);
+         uchar* mask_row = mask.ptr<uchar>(y);
+ 
+-        hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
++        cv::hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
+ 
+         // make orientation zero where the gradient is very small
+         for( x = 0; x < size.width; x++ )
+diff --git opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
+index e89eb8f..39307e5 100644
+--- opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
++++ opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
+@@ -35,7 +35,7 @@
+  */
+ 
+ #include "precomp.hpp"
+-#include "opencv2/hal/intrin.hpp"
++#include "opencv2/core/hal/intrin.hpp"
+ #include <vector>
+ 
+ namespace cv {
+diff --git opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
+index 4780497..15530d3 100644
+--- opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
++++ opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
+@@ -40,7 +40,7 @@
+ #include "opencv2/xphoto.hpp"
+ 
+ #include "opencv2/core.hpp"
+-#include "opencv2/hal/intrin.hpp"
++#include "opencv2/core/hal/intrin.hpp"
+ 
+ namespace cv { namespace xphoto {
+ 

diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
new file mode 100644
index 0000000..e9a190c
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
@@ -0,0 +1,214 @@
+From ac8dd366e4a1877e0af16961a4094496bed955f7 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@itseez.com>
+Date: Sun, 13 Sep 2015 21:18:47 +0300
+Subject: [PATCH] ocl: fix "off" mode
+
+diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+index cbb783e..d61444b 100644
+--- opencv_contrib-master/modules/tracking/src/tldDetector.cpp
++++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+@@ -104,6 +104,7 @@ namespace cv
+ 			return splus / (sminus + splus);
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		double TLDDetector::ocl_Sr(const Mat_<uchar>& patch)
+ 		{
+ 			//int64 e1, e2, e3, e4;
+@@ -283,6 +284,7 @@ namespace cv
+ 			//t = (e2 - e1) / getTickFrequency()*1000.0;
+ 			//printf("Sr GPU: %f\n\n", t);
+ 		}
++#endif
+ 
+ 		// Calculate Conservative similarity of the patch (NN-Model)
+ 		double TLDDetector::Sc(const Mat_<uchar>& patch)
+@@ -337,6 +339,7 @@ namespace cv
+ 			return splus / (sminus + splus);
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		double TLDDetector::ocl_Sc(const Mat_<uchar>& patch)
+ 		{
+ 			//int64 e1, e2, e3, e4;
+@@ -415,6 +418,7 @@ namespace cv
+ 				return 0.0;
+ 			return splus / (sminus + splus);
+ 		}
++#endif // HAVE_OPENCL
+ 
+ 		// Generate Search Windows for detector from aspect ratio of initial BBs
+ 		void TLDDetector::generateScanGrid(int rows, int cols, Size initBox, std::vector<Rect2d>& res, bool withScaling)
+@@ -565,6 +569,7 @@ namespace cv
+ 			return true;
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		bool TLDDetector::ocl_detect(const Mat& img, const Mat& imgBlurred, Rect2d& res, std::vector<LabeledPatch>& patches, Size initSize)
+ 		{
+ 			patches.clear();
+@@ -696,6 +701,7 @@ namespace cv
+ 			res = maxScRect;
+ 			return true;
+ 		}
++#endif // HAVE_OPENCL
+ 
+ 		// Computes the variance of subimage given by box, with the help of two integral
+ 		// images intImgP and intImgP2 (sum of squares), which should be also provided.
+diff --git opencv_contrib-master/modules/tracking/src/tldDetector.hpp opencv_contrib-master/modules/tracking/src/tldDetector.hpp
+index 3e11895..1caff57 100644
+--- opencv_contrib-master/modules/tracking/src/tldDetector.hpp
++++ opencv_contrib-master/modules/tracking/src/tldDetector.hpp
+@@ -74,10 +74,12 @@ namespace cv
+ 			inline double ensembleClassifierNum(const uchar* data);
+ 			inline void prepareClassifiers(int rowstep);
+ 			double Sr(const Mat_<uchar>& patch);
+-			double ocl_Sr(const Mat_<uchar>& patch);
+ 			double Sc(const Mat_<uchar>& patch);
++#ifdef HAVE_OPENCL
++			double ocl_Sr(const Mat_<uchar>& patch);
+ 			double ocl_Sc(const Mat_<uchar>& patch);
+ 			void ocl_batchSrSc(const Mat_<uchar>& patches, double *resultSr, double *resultSc, int numOfPatches);
++#endif
+ 
+ 			std::vector<TLDEnsembleClassifier> classifiers;
+ 			Mat *posExp, *negExp;
+diff --git opencv_contrib-master/modules/tracking/src/tldModel.cpp opencv_contrib-master/modules/tracking/src/tldModel.cpp
+index 0854022..47fc32a 100644
+--- opencv_contrib-master/modules/tracking/src/tldModel.cpp
++++ opencv_contrib-master/modules/tracking/src/tldModel.cpp
+@@ -246,6 +246,7 @@ namespace cv
+ 			dfprintf((stdout, "\n"));*/
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		void TrackerTLDModel::ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive)
+ 		{
+ 			int positiveIntoModel = 0, negativeIntoModel = 0, positiveIntoEnsemble = 0, negativeIntoEnsemble = 0;
+@@ -315,6 +316,7 @@ namespace cv
+ 			dfprintf((stdout, "positiveIntoEnsemble = %d ", positiveIntoEnsemble));
+ 			dfprintf((stdout, "\n"));*/
+ 		}
++#endif // HAVE_OPENCL
+ 
+ 		//Push the patch to the model
+ 		void TrackerTLDModel::pushIntoModel(const Mat_<uchar>& example, bool positive)
+diff --git opencv_contrib-master/modules/tracking/src/tldModel.hpp opencv_contrib-master/modules/tracking/src/tldModel.hpp
+index be9141a..ba7c926 100644
+--- opencv_contrib-master/modules/tracking/src/tldModel.hpp
++++ opencv_contrib-master/modules/tracking/src/tldModel.hpp
+@@ -58,7 +58,9 @@ namespace cv
+ 			void setBoudingBox(Rect2d boundingBox){ boundingBox_ = boundingBox; }
+ 			void integrateRelabeled(Mat& img, Mat& imgBlurred, const std::vector<TLDDetector::LabeledPatch>& patches);
+ 			void integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive);
++#ifdef HAVE_OPENCL
+ 			void ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive);
++#endif
+ 			Size getMinSize(){ return minSize_; }
+ 			void printme(FILE* port = stdout);
+ 			Ptr<TLDDetector> detector;
+diff --git opencv_contrib-master/modules/tracking/src/tldTracker.cpp opencv_contrib-master/modules/tracking/src/tldTracker.cpp
+index 0f1e2f7..a5190f5 100644
+--- opencv_contrib-master/modules/tracking/src/tldTracker.cpp
++++ opencv_contrib-master/modules/tracking/src/tldTracker.cpp
+@@ -123,9 +123,11 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
+ 
+ 		if (i == 1)
+ 		{
++#ifdef HAVE_OPENCL
+ 			if (ocl::haveOpenCL())
+ 				DETECT_FLG = tldModel->detector->ocl_detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize());
+ 			else
++#endif
+ 				DETECT_FLG = tldModel->detector->detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize());
+ 		}
+ 
+@@ -211,17 +213,21 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
+         tldModel->integrateRelabeled(imageForDetector, image_blurred, detectorResults);
+         //dprintf(("%d relabeled by nExpert\n", negRelabeled));
+         pExpert.additionalExamples(examplesForModel, examplesForEnsemble);
+-		if (ocl::haveOpenCL())
+-			tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true);
+-		else
+-			tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true);
++#ifdef HAVE_OPENCL
++        if (ocl::haveOpenCL())
++            tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true);
++        else
++#endif
++        tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true);
+         examplesForModel.clear(); examplesForEnsemble.clear();
+         nExpert.additionalExamples(examplesForModel, examplesForEnsemble);
+ 
+-		if (ocl::haveOpenCL())
+-			tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false);
+-		else
+-			tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false);
++#ifdef HAVE_OPENCL
++        if (ocl::haveOpenCL())
++            tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false);
++        else
++#endif
++            tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false);
+     }
+     else
+     {
+diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
+index 673817e..af5ceaf6 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
++++ opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
+@@ -892,6 +892,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
+     CV_Assert(!_img.empty() && CV_MAT_DEPTH(imgtype) == CV_8U && (imgcn == 1 || imgcn == 3 || imgcn == 4));
+     CV_Assert(_descriptors.needed() || !useProvidedKeypoints);
+ 
++#ifdef HAVE_OPENCL
+     if( ocl::useOpenCL() )
+     {
+         SURF_OCL ocl_surf;
+@@ -918,6 +919,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
+             return;
+         }
+     }
++#endif // HAVE_OPENCL
+ 
+     Mat img = _img.getMat(), mask = _mask.getMat(), mask1, sum, msum;
+ 
+diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.hpp opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
+index 2c4e271..cf3fda1 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
++++ opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
+@@ -64,6 +64,7 @@ class SURF_Impl : public SURF
+     bool upright;
+ };
+ 
++#ifdef HAVE_OPENCL
+ class SURF_OCL
+ {
+ public:
+@@ -145,6 +146,7 @@ class SURF_OCL
+ 
+     int status;
+ };
++#endif // HAVE_OPENCL
+ 
+ /*
+ template<typename _Tp> void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um)
+diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
+index b12ebd3..3d9845d 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
++++ opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
+@@ -43,6 +43,9 @@
+ //
+ //M*/
+ #include "precomp.hpp"
++
++#ifdef HAVE_OPENCL
++
+ #include "surf.hpp"
+ 
+ #include <cstdio>
+@@ -461,3 +464,4 @@ bool SURF_OCL::calcOrientation(UMat &keypoints)
+ }
+ }
+ 
++#endif // HAVE_OPENCL

diff --git a/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
new file mode 100644
index 0000000..c9f85a7
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
@@ -0,0 +1,75 @@
+From 9862a8bac536981c1c1a74710741fb40db4beac7 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@itseez.com>
+Date: Wed, 23 Sep 2015 12:44:26 +0300
+Subject: [PATCH] fix invalid String usage
+
+---
+ modules/tracking/src/tldDetector.cpp   |  6 +++---
+ modules/ximgproc/samples/live_demo.cpp | 12 ++++++------
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+index cbb783e..0916092 100644
+--- opencv_contrib-master/modules/tracking/src/tldDetector.cpp
++++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+@@ -122,7 +122,7 @@ namespace cv
+ 			ocl::Kernel k;
+ 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
+ 			String error;
+-			ocl::Program prog(src, NULL, error);
++			ocl::Program prog(src, String(), error);
+ 			k.create("NCC", prog);
+ 			if (k.empty())
+ 				printf("Kernel create failed!!!\n");
+@@ -198,7 +198,7 @@ namespace cv
+ 			ocl::Kernel k;
+ 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
+ 			String error;
+-			ocl::Program prog(src, NULL, error);
++			ocl::Program prog(src, String(), error);
+ 			k.create("batchNCC", prog);
+ 			if (k.empty())
+ 				printf("Kernel create failed!!!\n");
+@@ -355,7 +355,7 @@ namespace cv
+ 			ocl::Kernel k;
+ 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
+ 			String error;
+-			ocl::Program prog(src, NULL, error);
++			ocl::Program prog(src, String(), error);
+ 			k.create("NCC", prog);
+ 			if (k.empty())
+ 				printf("Kernel create failed!!!\n");
+diff --git opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
+index dd5dc1b..8e16de3 100644
+--- opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
++++ opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
+@@ -189,7 +189,7 @@ int main()
+     
+     //Thread trackbar
+     cv::setNumThreads(g_numberOfCPUs); //speedup filtering
+-    createTrackbar("Threads", NULL, &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback);
++    createTrackbar("Threads", String(), &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback);
+ 
+     //Buttons to choose different modes
+     createButton("Mode Details Enhancement", changeModeCallback, (void*)filterDetailEnhancement, QT_RADIOBOX, true);
+@@ -199,15 +199,15 @@ int main()
+ 
+     //sliders for Details Enhancement mode
+     g_filterOp = filterDetailEnhancement; //set Details Enhancement as default filter
+-    createTrackbar("Detail contrast", NULL, &g_contrastBase, 200);
+-    createTrackbar("Detail level" , NULL, &g_detailsLevel, 200);
++    createTrackbar("Detail contrast", String(), &g_contrastBase, 200);
++    createTrackbar("Detail level" , String(), &g_detailsLevel, 200);
+     
+     //sliders for Stylizing mode
+-    createTrackbar("Style gamma", NULL, &g_edgesGamma, 300);
++    createTrackbar("Style gamma", String(), &g_edgesGamma, 300);
+ 
+     //sliders for every mode
+-    createTrackbar("Sigma Spatial", NULL, &g_sigmaSpatial, 200);
+-    createTrackbar("Sigma Color"  , NULL, &g_sigmaColor, 200);
++    createTrackbar("Sigma Spatial", String(), &g_sigmaSpatial, 200);
++    createTrackbar("Sigma Color"  , String(), &g_sigmaColor, 200);
+ 
+     Mat rawFrame, outputFrame;
+     Mat srcFrame, processedFrame;

diff --git a/media-libs/opencv/metadata.xml b/media-libs/opencv/metadata.xml
index 12a445a..eb2d81e 100644
--- a/media-libs/opencv/metadata.xml
+++ b/media-libs/opencv/metadata.xml
@@ -20,10 +20,12 @@ Face Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion Under
 		<flag name="contrib">Install user contributed scripts from opencv_contrib</flag>
 		<flag name="cuda">Enable NVIDIA Cuda computations support</flag>
 		<flag name="eigen">Enable usage of <pkg>dev-cpp/eigen</pkg> for computations</flag>
+		<flag name="gdal">Enable support for sci-libs/gdal library</flag>
 		<flag name="ipp">Enable Intel Integrated Primitive support</flag>
 		<flag name="opencl">Add support for OpenCL</flag>
 		<flag name="testprograms">Build and install programs for testing OpenCV (performance)</flag>
 		<flag name="vtk">Build new 3D visualization module viz based on sci-libs/vtk</flag>
+		<flag name="webp">Enable support for webp image format</flag>
 	</use>
 	<upstream>
 		<remote-id type="sourceforge">opencvlibrary</remote-id>

diff --git a/media-libs/opencv/opencv-3.1.0.ebuild b/media-libs/opencv/opencv-3.1.0.ebuild
new file mode 100644
index 0000000..1477ef3
--- /dev/null
+++ b/media-libs/opencv/opencv-3.1.0.ebuild
@@ -0,0 +1,252 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python{2_7,3_2,3_3,3_4} )
+
+inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+SRC_URI="
+	mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip
+	https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip
+	contrib? ( https://github.com/Itseez/${PN}_contrib/archive/${PV}.zip -> ${PN}_contrib.zip )"
+
+LICENSE="BSD"
+SLOT="0/3.0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
+IUSE="contrib cuda doc +eigen examples ffmpeg gdal gphoto2 gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 qt5 testprograms threads tiff vaapi v4l vtk webp xine"
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	?? ( qt4 qt5 )
+"
+
+# 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? ( !qt4 )
+#	opengl? ( || ( gtk qt4 ) )
+#	openmp? ( !threads )
+
+RDEPEND="
+	app-arch/bzip2
+	sys-libs/zlib
+	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gdal? ( sci-libs/gdal )
+	gphoto2? ( media-libs/libgphoto2 )
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper )
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+	)
+	ipp? ( sci-libs/ipp )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
+	qt4? (
+		dev-qt/qtgui:4
+		dev-qt/qttest:4
+		opengl? ( dev-qt/qtopengl:4 )
+	)
+	qt5? (
+		dev-qt/qtgui:5
+		dev-qt/qttest:5
+		dev-qt/qtconcurrent:5
+		opengl? ( dev-qt/qtopengl:5 )
+	)
+	threads? ( dev-cpp/tbb )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	webp? ( media-libs/libwebp )
+	xine? ( media-libs/xine-lib )
+"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java? ( >=virtual/jdk-1.6 )
+"
+
+pkg_setup() {
+	use python && python-single-r1_pkg_setup
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+
+	epatch "${FILESDIR}/${PN}-3.0.0-gles.patch" \
+        	"${FILESDIR}/${PN}-3.1.0-cmake-no-opengl.patch"
+
+	# remove bundled stuff
+	rm -rf 3rdparty
+	sed -i \
+		-e '/add_subdirectory(.*3rdparty.*)/ d' \
+		CMakeLists.txt cmake/*cmake || die
+
+	if use contrib; then
+
+		cd "${WORKDIR}"
+		epatch "${FILESDIR}/${PN}-3.1.0-fix-hal-headers.patch" \
+	       		"${FILESDIR}/${PN}-3.1.0-fix-ocl-declaration.patch" \
+	       		"${FILESDIR}/${PN}-3.1.0-invalid-string-usage.patch"
+	fi
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+	if use openmp; then
+		tc-has-openmp || die "Please switch to an openmp compatible compiler"
+	fi
+
+	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
+
+	# please dont sort here, order is the same as in CMakeLists.txt
+	local mycmakeargs=(
+	# the optinal dependency libraries
+		$(cmake-utils_use_with ieee1394 1394)
+		-DWITH_AVFOUNDATION=OFF # IOS
+		-DWITH_CARBON=OFF # APPLE
+		$(cmake-utils_use_with eigen)
+		$(cmake-utils_use_with ffmpeg)
+		-DWITH_VFW=OFF     # video windows support
+		$(cmake-utils_use_with gstreamer)
+		-DWITH_GSTREAMER_0_10=OFF
+		$(cmake-utils_use_with gtk)
+		-DWITH_GTK_2_X=OFF
+		$(cmake-utils_use_with ipp)
+		$(cmake-utils_use_with java)
+		$(cmake-utils_use_with jpeg2k JASPER)
+		$(cmake-utils_use_with jpeg)
+		$(cmake-utils_use_with webp)
+		$(cmake-utils_use_with opencl)
+		$(cmake-utils_use_with gphoto2)
+		$(cmake-utils_use_with openexr)
+		$(cmake-utils_use_with opengl)
+		$(cmake-utils_use_with openmp)
+		-DWITH_OPENNI=OFF 	#not packaged
+		-DWITH_OPENNI2=OFF	#not packaged
+		$(cmake-utils_use_with png)
+		$(cmake-utils_use_build python opencv_python)
+		-DWITH_PVAPI=OFF					# not packaged
+		-DWITH_GIGEAPI=OFF
+		-DWITH_QUICKTIME=OFF
+		-DWITH_WIN32UI=OFF
+		$(cmake-utils_use_with threads TBB)
+		-DWITH_CSTRIPES=OFF
+		-DWITH_PTHREADS_PF=ON
+		$(cmake-utils_use_with tiff)
+		-DWITH_UNICAP=OFF					# not packaged
+		$(cmake-utils_use_with v4l V4L)
+		$(cmake-utils_use_with vtk VTK)
+		-DWITH_LIBV4L=ON
+		-DWITH_DSHOW=ON               # direct show supp
+		-DWITH_MSMF=OFF
+		-DWITH_VIDEOINPUT=OFF					# windows only
+		-DWITH_XIMEA=OFF # windows only
+		$(cmake-utils_use_with xine)
+		-DWITH_CLP=OFF
+		$(cmake-utils_use_with opencl)
+		-DWITH_OPENCL_SVM=OFF
+		$(cmake-utils_use_with opencl OPENCLAMDFFT)
+		$(cmake-utils_use_with opencl OPENCLAMDBLAS)
+		-DWITH_DIRECTX=OFF
+		-DWITH_INTELPERC=OFF
+		-DWITH_IPP_A=OFF
+		-DWITH_MATLAB=ON #default
+		$(cmake-utils_use_with vaapi VA)
+		$(cmake-utils_use_with vaapi VA_INTEL)
+		$(cmake-utils_use_with gdal gdal)
+		#
+		# OpenCV build components
+		-DBUILD_SHARED_LIBS=ON
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		$(cmake-utils_use_build doc DOCS)
+		$(cmake-utils_use_build examples)
+		$(cmake-utils_use_build java opencv_java)		#for -java bug #555650
+		-DBUILD_PERF_TESTS=OFF
+		$(cmake-utils_use_build testprograms TESTS)
+	# install examples, tests etc
+		$(cmake-utils_use examples INSTALL_C_EXAMPLES)
+		$(cmake-utils_use testprograms INSTALL_TESTS)
+	# build options
+		$(cmake-utils_use_enable pch PRECOMPILED_HEADERS)
+		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
+	)
+
+	if use qt4; then
+		mycmakeargs+=( "-DWITH_QT=4" )
+	elif use qt5; then
+		mycmakeargs+=( "-DWITH_QT=5" )
+	else
+		mycmakeargs+=( "-DWITH_QT=OFF" )
+	fi
+
+	if use contrib; then
+		mycmakeargs+=( "-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules" )
+	fi
+
+	if use cuda; then
+		mycmakeargs+=( "-DWITH_CUDA=ON" )
+		mycmakeargs+=( "-DWITH_CUBLAS=ON" )
+		mycmakeargs+=( "-DWITH_CUFFT=ON" )
+		mycmakeargs+=( "-DWITH_NVCUVID=ON" ) #Nvidia video decoding library supp
+	else
+		mycmakeargs+=( "-DWITH_CUDA=OFF" )
+		mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
+		mycmakeargs+=( "-DWITH_CUFFT=OFF" )
+		mycmakeargs+=( "-DWITH_NVCUVID=OFF" )
+	fi
+
+	if use examples && use python; then
+		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" )
+	else
+		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" )
+	fi
+
+	# things we want to be hard off or not yet figured out
+	mycmakeargs+=(
+		"-DOPENCV_BUILD_3RDPARTY_LIBS=OFF"
+		"-DBUILD_LATEX_DOCS=OFF"
+		"-DBUILD_PACKAGE=OFF"
+		"-DENABLE_PROFILING=OFF"
+	)
+
+	# things we want to be hard enabled not worth useflag
+	mycmakeargs+=(
+		"-DCMAKE_SKIP_RPATH=ON"
+		"-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}"
+	)
+
+	# hardcode cuda paths
+	mycmakeargs+=(
+		"-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda"
+	)
+
+	# workaround for bug 413429
+	tc-export CC CXX
+
+	cmake-utils_src_configure
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2016-03-02 12:14 Amy Winston
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Winston @ 2016-03-02 12:14 UTC (permalink / raw
  To: gentoo-commits

commit:     5dfc738e3025c2559923c8bb72d7c4399aaec89b
Author:     Amy Winston <amynka <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  2 12:10:06 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Wed Mar  2 12:10:06 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5dfc738e

media-libs/opencv: revert drop old 3.1.0-r1 and patches

This reverts commit 48656e3b700cf6d771db428bc6dde322753839d3.

 .../files/opencv-3.1.0-fix-hal-headers.patch       |  91 ++++++++
 .../files/opencv-3.1.0-fix-ocl-declaration.patch   | 214 +++++++++++++++++
 .../files/opencv-3.1.0-invalid-string-usage.patch  |  75 ++++++
 media-libs/opencv/opencv-3.1.0-r1.ebuild           | 252 +++++++++++++++++++++
 4 files changed, 632 insertions(+)

diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
new file mode 100644
index 0000000..dd77571
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
@@ -0,0 +1,91 @@
+From f529a1df2b17bcada1179ddcaf1352e3a5ba97b8 Mon Sep 17 00:00:00 2001
+From: Maksim Shabunin <maksim.shabunin@itseez.com>
+Date: Tue, 15 Dec 2015 17:51:08 +0300
+Subject: [PATCH] Fixed HAL headers location
+
+diff --git opencv_contrib-master/modules/xfeatures2d/src/sift.cpp opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
+index fc67c4d..9634fbb 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
++++ opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
+@@ -105,6 +105,7 @@
+ #include "precomp.hpp"
+ #include <iostream>
+ #include <stdarg.h>
++#include <opencv2/core/hal/hal.hpp>
+ 
+ namespace cv
+ {
+@@ -337,9 +338,9 @@ static float calcOrientationHist( const Mat& img, Point pt, int radius,
+     len = k;
+ 
+     // compute gradient values, orientations and the weights over the pixel neighborhood
+-    hal::exp(W, W, len);
+-    hal::fastAtan2(Y, X, Ori, len, true);
+-    hal::magnitude(X, Y, Mag, len);
++    cv::hal::exp32f(W, W, len);
++    cv::hal::fastAtan2(Y, X, Ori, len, true);
++    cv::hal::magnitude32f(X, Y, Mag, len);
+ 
+     for( k = 0; k < len; k++ )
+     {
+@@ -620,9 +621,9 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
+         }
+ 
+     len = k;
+-    hal::fastAtan2(Y, X, Ori, len, true);
+-    hal::magnitude(X, Y, Mag, len);
+-    hal::exp(W, W, len);
++    cv::hal::fastAtan2(Y, X, Ori, len, true);
++    cv::hal::magnitude32f(X, Y, Mag, len);
++    cv::hal::exp32f(W, W, len);
+ 
+     for( k = 0; k < len; k++ )
+     {
+
+diff --git opencv_contrib-master/modules/optflow/src/motempl.cpp opencv_contrib-master/modules/optflow/src/motempl.cpp
+index ec18013..452ad63 100644
+--- opencv_contrib-master/modules/optflow/src/motempl.cpp
++++ opencv_contrib-master/modules/optflow/src/motempl.cpp
+@@ -41,6 +41,7 @@
+ 
+ #include "precomp.hpp"
+ #include "opencv2/core/utility.hpp"
++#include "opencv2/core/hal/hal.hpp"
+ #include "opencl_kernels_optflow.hpp"
+ 
+ namespace  cv {
+@@ -212,7 +213,7 @@ void calcMotionGradient( InputArray _mhi, OutputArray _mask,
+         float* orient_row = orient.ptr<float>(y);
+         uchar* mask_row = mask.ptr<uchar>(y);
+ 
+-        hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
++        cv::hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
+ 
+         // make orientation zero where the gradient is very small
+         for( x = 0; x < size.width; x++ )
+diff --git opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
+index e89eb8f..39307e5 100644
+--- opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
++++ opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
+@@ -35,7 +35,7 @@
+  */
+ 
+ #include "precomp.hpp"
+-#include "opencv2/hal/intrin.hpp"
++#include "opencv2/core/hal/intrin.hpp"
+ #include <vector>
+ 
+ namespace cv {
+diff --git opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
+index 4780497..15530d3 100644
+--- opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
++++ opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
+@@ -40,7 +40,7 @@
+ #include "opencv2/xphoto.hpp"
+ 
+ #include "opencv2/core.hpp"
+-#include "opencv2/hal/intrin.hpp"
++#include "opencv2/core/hal/intrin.hpp"
+ 
+ namespace cv { namespace xphoto {
+ 

diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
new file mode 100644
index 0000000..e9a190c
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
@@ -0,0 +1,214 @@
+From ac8dd366e4a1877e0af16961a4094496bed955f7 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@itseez.com>
+Date: Sun, 13 Sep 2015 21:18:47 +0300
+Subject: [PATCH] ocl: fix "off" mode
+
+diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+index cbb783e..d61444b 100644
+--- opencv_contrib-master/modules/tracking/src/tldDetector.cpp
++++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+@@ -104,6 +104,7 @@ namespace cv
+ 			return splus / (sminus + splus);
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		double TLDDetector::ocl_Sr(const Mat_<uchar>& patch)
+ 		{
+ 			//int64 e1, e2, e3, e4;
+@@ -283,6 +284,7 @@ namespace cv
+ 			//t = (e2 - e1) / getTickFrequency()*1000.0;
+ 			//printf("Sr GPU: %f\n\n", t);
+ 		}
++#endif
+ 
+ 		// Calculate Conservative similarity of the patch (NN-Model)
+ 		double TLDDetector::Sc(const Mat_<uchar>& patch)
+@@ -337,6 +339,7 @@ namespace cv
+ 			return splus / (sminus + splus);
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		double TLDDetector::ocl_Sc(const Mat_<uchar>& patch)
+ 		{
+ 			//int64 e1, e2, e3, e4;
+@@ -415,6 +418,7 @@ namespace cv
+ 				return 0.0;
+ 			return splus / (sminus + splus);
+ 		}
++#endif // HAVE_OPENCL
+ 
+ 		// Generate Search Windows for detector from aspect ratio of initial BBs
+ 		void TLDDetector::generateScanGrid(int rows, int cols, Size initBox, std::vector<Rect2d>& res, bool withScaling)
+@@ -565,6 +569,7 @@ namespace cv
+ 			return true;
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		bool TLDDetector::ocl_detect(const Mat& img, const Mat& imgBlurred, Rect2d& res, std::vector<LabeledPatch>& patches, Size initSize)
+ 		{
+ 			patches.clear();
+@@ -696,6 +701,7 @@ namespace cv
+ 			res = maxScRect;
+ 			return true;
+ 		}
++#endif // HAVE_OPENCL
+ 
+ 		// Computes the variance of subimage given by box, with the help of two integral
+ 		// images intImgP and intImgP2 (sum of squares), which should be also provided.
+diff --git opencv_contrib-master/modules/tracking/src/tldDetector.hpp opencv_contrib-master/modules/tracking/src/tldDetector.hpp
+index 3e11895..1caff57 100644
+--- opencv_contrib-master/modules/tracking/src/tldDetector.hpp
++++ opencv_contrib-master/modules/tracking/src/tldDetector.hpp
+@@ -74,10 +74,12 @@ namespace cv
+ 			inline double ensembleClassifierNum(const uchar* data);
+ 			inline void prepareClassifiers(int rowstep);
+ 			double Sr(const Mat_<uchar>& patch);
+-			double ocl_Sr(const Mat_<uchar>& patch);
+ 			double Sc(const Mat_<uchar>& patch);
++#ifdef HAVE_OPENCL
++			double ocl_Sr(const Mat_<uchar>& patch);
+ 			double ocl_Sc(const Mat_<uchar>& patch);
+ 			void ocl_batchSrSc(const Mat_<uchar>& patches, double *resultSr, double *resultSc, int numOfPatches);
++#endif
+ 
+ 			std::vector<TLDEnsembleClassifier> classifiers;
+ 			Mat *posExp, *negExp;
+diff --git opencv_contrib-master/modules/tracking/src/tldModel.cpp opencv_contrib-master/modules/tracking/src/tldModel.cpp
+index 0854022..47fc32a 100644
+--- opencv_contrib-master/modules/tracking/src/tldModel.cpp
++++ opencv_contrib-master/modules/tracking/src/tldModel.cpp
+@@ -246,6 +246,7 @@ namespace cv
+ 			dfprintf((stdout, "\n"));*/
+ 		}
+ 
++#ifdef HAVE_OPENCL
+ 		void TrackerTLDModel::ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive)
+ 		{
+ 			int positiveIntoModel = 0, negativeIntoModel = 0, positiveIntoEnsemble = 0, negativeIntoEnsemble = 0;
+@@ -315,6 +316,7 @@ namespace cv
+ 			dfprintf((stdout, "positiveIntoEnsemble = %d ", positiveIntoEnsemble));
+ 			dfprintf((stdout, "\n"));*/
+ 		}
++#endif // HAVE_OPENCL
+ 
+ 		//Push the patch to the model
+ 		void TrackerTLDModel::pushIntoModel(const Mat_<uchar>& example, bool positive)
+diff --git opencv_contrib-master/modules/tracking/src/tldModel.hpp opencv_contrib-master/modules/tracking/src/tldModel.hpp
+index be9141a..ba7c926 100644
+--- opencv_contrib-master/modules/tracking/src/tldModel.hpp
++++ opencv_contrib-master/modules/tracking/src/tldModel.hpp
+@@ -58,7 +58,9 @@ namespace cv
+ 			void setBoudingBox(Rect2d boundingBox){ boundingBox_ = boundingBox; }
+ 			void integrateRelabeled(Mat& img, Mat& imgBlurred, const std::vector<TLDDetector::LabeledPatch>& patches);
+ 			void integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive);
++#ifdef HAVE_OPENCL
+ 			void ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive);
++#endif
+ 			Size getMinSize(){ return minSize_; }
+ 			void printme(FILE* port = stdout);
+ 			Ptr<TLDDetector> detector;
+diff --git opencv_contrib-master/modules/tracking/src/tldTracker.cpp opencv_contrib-master/modules/tracking/src/tldTracker.cpp
+index 0f1e2f7..a5190f5 100644
+--- opencv_contrib-master/modules/tracking/src/tldTracker.cpp
++++ opencv_contrib-master/modules/tracking/src/tldTracker.cpp
+@@ -123,9 +123,11 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
+ 
+ 		if (i == 1)
+ 		{
++#ifdef HAVE_OPENCL
+ 			if (ocl::haveOpenCL())
+ 				DETECT_FLG = tldModel->detector->ocl_detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize());
+ 			else
++#endif
+ 				DETECT_FLG = tldModel->detector->detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize());
+ 		}
+ 
+@@ -211,17 +213,21 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
+         tldModel->integrateRelabeled(imageForDetector, image_blurred, detectorResults);
+         //dprintf(("%d relabeled by nExpert\n", negRelabeled));
+         pExpert.additionalExamples(examplesForModel, examplesForEnsemble);
+-		if (ocl::haveOpenCL())
+-			tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true);
+-		else
+-			tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true);
++#ifdef HAVE_OPENCL
++        if (ocl::haveOpenCL())
++            tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true);
++        else
++#endif
++        tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true);
+         examplesForModel.clear(); examplesForEnsemble.clear();
+         nExpert.additionalExamples(examplesForModel, examplesForEnsemble);
+ 
+-		if (ocl::haveOpenCL())
+-			tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false);
+-		else
+-			tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false);
++#ifdef HAVE_OPENCL
++        if (ocl::haveOpenCL())
++            tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false);
++        else
++#endif
++            tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false);
+     }
+     else
+     {
+diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
+index 673817e..af5ceaf6 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
++++ opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
+@@ -892,6 +892,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
+     CV_Assert(!_img.empty() && CV_MAT_DEPTH(imgtype) == CV_8U && (imgcn == 1 || imgcn == 3 || imgcn == 4));
+     CV_Assert(_descriptors.needed() || !useProvidedKeypoints);
+ 
++#ifdef HAVE_OPENCL
+     if( ocl::useOpenCL() )
+     {
+         SURF_OCL ocl_surf;
+@@ -918,6 +919,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
+             return;
+         }
+     }
++#endif // HAVE_OPENCL
+ 
+     Mat img = _img.getMat(), mask = _mask.getMat(), mask1, sum, msum;
+ 
+diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.hpp opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
+index 2c4e271..cf3fda1 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
++++ opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
+@@ -64,6 +64,7 @@ class SURF_Impl : public SURF
+     bool upright;
+ };
+ 
++#ifdef HAVE_OPENCL
+ class SURF_OCL
+ {
+ public:
+@@ -145,6 +146,7 @@ class SURF_OCL
+ 
+     int status;
+ };
++#endif // HAVE_OPENCL
+ 
+ /*
+ template<typename _Tp> void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um)
+diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
+index b12ebd3..3d9845d 100644
+--- opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
++++ opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
+@@ -43,6 +43,9 @@
+ //
+ //M*/
+ #include "precomp.hpp"
++
++#ifdef HAVE_OPENCL
++
+ #include "surf.hpp"
+ 
+ #include <cstdio>
+@@ -461,3 +464,4 @@ bool SURF_OCL::calcOrientation(UMat &keypoints)
+ }
+ }
+ 
++#endif // HAVE_OPENCL

diff --git a/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
new file mode 100644
index 0000000..c9f85a7
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
@@ -0,0 +1,75 @@
+From 9862a8bac536981c1c1a74710741fb40db4beac7 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@itseez.com>
+Date: Wed, 23 Sep 2015 12:44:26 +0300
+Subject: [PATCH] fix invalid String usage
+
+---
+ modules/tracking/src/tldDetector.cpp   |  6 +++---
+ modules/ximgproc/samples/live_demo.cpp | 12 ++++++------
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+index cbb783e..0916092 100644
+--- opencv_contrib-master/modules/tracking/src/tldDetector.cpp
++++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp
+@@ -122,7 +122,7 @@ namespace cv
+ 			ocl::Kernel k;
+ 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
+ 			String error;
+-			ocl::Program prog(src, NULL, error);
++			ocl::Program prog(src, String(), error);
+ 			k.create("NCC", prog);
+ 			if (k.empty())
+ 				printf("Kernel create failed!!!\n");
+@@ -198,7 +198,7 @@ namespace cv
+ 			ocl::Kernel k;
+ 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
+ 			String error;
+-			ocl::Program prog(src, NULL, error);
++			ocl::Program prog(src, String(), error);
+ 			k.create("batchNCC", prog);
+ 			if (k.empty())
+ 				printf("Kernel create failed!!!\n");
+@@ -355,7 +355,7 @@ namespace cv
+ 			ocl::Kernel k;
+ 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
+ 			String error;
+-			ocl::Program prog(src, NULL, error);
++			ocl::Program prog(src, String(), error);
+ 			k.create("NCC", prog);
+ 			if (k.empty())
+ 				printf("Kernel create failed!!!\n");
+diff --git opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
+index dd5dc1b..8e16de3 100644
+--- opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
++++ opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
+@@ -189,7 +189,7 @@ int main()
+     
+     //Thread trackbar
+     cv::setNumThreads(g_numberOfCPUs); //speedup filtering
+-    createTrackbar("Threads", NULL, &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback);
++    createTrackbar("Threads", String(), &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback);
+ 
+     //Buttons to choose different modes
+     createButton("Mode Details Enhancement", changeModeCallback, (void*)filterDetailEnhancement, QT_RADIOBOX, true);
+@@ -199,15 +199,15 @@ int main()
+ 
+     //sliders for Details Enhancement mode
+     g_filterOp = filterDetailEnhancement; //set Details Enhancement as default filter
+-    createTrackbar("Detail contrast", NULL, &g_contrastBase, 200);
+-    createTrackbar("Detail level" , NULL, &g_detailsLevel, 200);
++    createTrackbar("Detail contrast", String(), &g_contrastBase, 200);
++    createTrackbar("Detail level" , String(), &g_detailsLevel, 200);
+     
+     //sliders for Stylizing mode
+-    createTrackbar("Style gamma", NULL, &g_edgesGamma, 300);
++    createTrackbar("Style gamma", String(), &g_edgesGamma, 300);
+ 
+     //sliders for every mode
+-    createTrackbar("Sigma Spatial", NULL, &g_sigmaSpatial, 200);
+-    createTrackbar("Sigma Color"  , NULL, &g_sigmaColor, 200);
++    createTrackbar("Sigma Spatial", String(), &g_sigmaSpatial, 200);
++    createTrackbar("Sigma Color"  , String(), &g_sigmaColor, 200);
+ 
+     Mat rawFrame, outputFrame;
+     Mat srcFrame, processedFrame;

diff --git a/media-libs/opencv/opencv-3.1.0-r1.ebuild b/media-libs/opencv/opencv-3.1.0-r1.ebuild
new file mode 100644
index 0000000..bbbcde9
--- /dev/null
+++ b/media-libs/opencv/opencv-3.1.0-r1.ebuild
@@ -0,0 +1,252 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python{2_7,3_2,3_3,3_4,3_5} )
+
+inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+SRC_URI="
+	mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip
+	https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip
+	contrib? ( https://github.com/Itseez/${PN}_contrib/archive/${PV}.zip -> ${PN}_contrib.zip )"
+
+LICENSE="BSD"
+SLOT="0/3.1" # subslot = libopencv* soname version
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
+IUSE="contrib cuda doc +eigen examples ffmpeg gdal gphoto2 gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 qt5 testprograms threads tiff vaapi v4l vtk webp xine"
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	?? ( qt4 qt5 )
+"
+
+# 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? ( !qt4 )
+#	opengl? ( || ( gtk qt4 ) )
+#	openmp? ( !threads )
+
+RDEPEND="
+	app-arch/bzip2
+	sys-libs/zlib
+	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gdal? ( sci-libs/gdal )
+	gphoto2? ( media-libs/libgphoto2 )
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper )
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+	)
+	ipp? ( sci-libs/ipp )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
+	qt4? (
+		dev-qt/qtgui:4
+		dev-qt/qttest:4
+		opengl? ( dev-qt/qtopengl:4 )
+	)
+	qt5? (
+		dev-qt/qtgui:5
+		dev-qt/qttest:5
+		dev-qt/qtconcurrent:5
+		opengl? ( dev-qt/qtopengl:5 )
+	)
+	threads? ( dev-cpp/tbb )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	webp? ( media-libs/libwebp )
+	xine? ( media-libs/xine-lib )
+"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java? ( >=virtual/jdk-1.6 )
+"
+
+pkg_setup() {
+	use python && python-single-r1_pkg_setup
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+
+	epatch "${FILESDIR}/${PN}-3.0.0-gles.patch" \
+        	"${FILESDIR}/${PN}-3.1.0-cmake-no-opengl.patch"
+
+	# remove bundled stuff
+	rm -rf 3rdparty
+	sed -i \
+		-e '/add_subdirectory(.*3rdparty.*)/ d' \
+		CMakeLists.txt cmake/*cmake || die
+
+	if use contrib; then
+
+		cd "${WORKDIR}"
+		epatch "${FILESDIR}/${PN}-3.1.0-fix-hal-headers.patch" \
+	       		"${FILESDIR}/${PN}-3.1.0-fix-ocl-declaration.patch" \
+	       		"${FILESDIR}/${PN}-3.1.0-invalid-string-usage.patch"
+	fi
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+	if use openmp; then
+		tc-has-openmp || die "Please switch to an openmp compatible compiler"
+	fi
+
+	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
+
+	# please dont sort here, order is the same as in CMakeLists.txt
+	local mycmakeargs=(
+	# the optinal dependency libraries
+		$(cmake-utils_use_with ieee1394 1394)
+		-DWITH_AVFOUNDATION=OFF # IOS
+		-DWITH_CARBON=OFF # APPLE
+		$(cmake-utils_use_with eigen)
+		$(cmake-utils_use_with ffmpeg)
+		-DWITH_VFW=OFF     # video windows support
+		$(cmake-utils_use_with gstreamer)
+		-DWITH_GSTREAMER_0_10=OFF
+		$(cmake-utils_use_with gtk)
+		-DWITH_GTK_2_X=OFF
+		$(cmake-utils_use_with ipp)
+		$(cmake-utils_use_with java)
+		$(cmake-utils_use_with jpeg2k JASPER)
+		$(cmake-utils_use_with jpeg)
+		$(cmake-utils_use_with webp)
+		$(cmake-utils_use_with opencl)
+		$(cmake-utils_use_with gphoto2)
+		$(cmake-utils_use_with openexr)
+		$(cmake-utils_use_with opengl)
+		$(cmake-utils_use_with openmp)
+		-DWITH_OPENNI=OFF 	#not packaged
+		-DWITH_OPENNI2=OFF	#not packaged
+		$(cmake-utils_use_with png)
+		$(cmake-utils_use_build python opencv_python)
+		-DWITH_PVAPI=OFF					# not packaged
+		-DWITH_GIGEAPI=OFF
+		-DWITH_QUICKTIME=OFF
+		-DWITH_WIN32UI=OFF
+		$(cmake-utils_use_with threads TBB)
+		-DWITH_CSTRIPES=OFF
+		-DWITH_PTHREADS_PF=ON
+		$(cmake-utils_use_with tiff)
+		-DWITH_UNICAP=OFF					# not packaged
+		$(cmake-utils_use_with v4l V4L)
+		$(cmake-utils_use_with vtk VTK)
+		-DWITH_LIBV4L=ON
+		-DWITH_DSHOW=ON               # direct show supp
+		-DWITH_MSMF=OFF
+		-DWITH_VIDEOINPUT=OFF					# windows only
+		-DWITH_XIMEA=OFF # windows only
+		$(cmake-utils_use_with xine)
+		-DWITH_CLP=OFF
+		$(cmake-utils_use_with opencl)
+		-DWITH_OPENCL_SVM=OFF
+		$(cmake-utils_use_with opencl OPENCLAMDFFT)
+		$(cmake-utils_use_with opencl OPENCLAMDBLAS)
+		-DWITH_DIRECTX=OFF
+		-DWITH_INTELPERC=OFF
+		-DWITH_IPP_A=OFF
+		-DWITH_MATLAB=ON #default
+		$(cmake-utils_use_with vaapi VA)
+		$(cmake-utils_use_with vaapi VA_INTEL)
+		$(cmake-utils_use_with gdal gdal)
+		#
+		# OpenCV build components
+		-DBUILD_SHARED_LIBS=ON
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		$(cmake-utils_use_build doc DOCS)
+		$(cmake-utils_use_build examples)
+		$(cmake-utils_use_build java opencv_java)		#for -java bug #555650
+		-DBUILD_PERF_TESTS=OFF
+		$(cmake-utils_use_build testprograms TESTS)
+	# install examples, tests etc
+		$(cmake-utils_use examples INSTALL_C_EXAMPLES)
+		$(cmake-utils_use testprograms INSTALL_TESTS)
+	# build options
+		$(cmake-utils_use_enable pch PRECOMPILED_HEADERS)
+		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
+	)
+
+	if use qt4; then
+		mycmakeargs+=( "-DWITH_QT=4" )
+	elif use qt5; then
+		mycmakeargs+=( "-DWITH_QT=5" )
+	else
+		mycmakeargs+=( "-DWITH_QT=OFF" )
+	fi
+
+	if use contrib; then
+		mycmakeargs+=( "-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules" )
+	fi
+
+	if use cuda; then
+		mycmakeargs+=( "-DWITH_CUDA=ON" )
+		mycmakeargs+=( "-DWITH_CUBLAS=ON" )
+		mycmakeargs+=( "-DWITH_CUFFT=ON" )
+		mycmakeargs+=( "-DWITH_NVCUVID=ON" ) #Nvidia video decoding library supp
+	else
+		mycmakeargs+=( "-DWITH_CUDA=OFF" )
+		mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
+		mycmakeargs+=( "-DWITH_CUFFT=OFF" )
+		mycmakeargs+=( "-DWITH_NVCUVID=OFF" )
+	fi
+
+	if use examples && use python; then
+		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" )
+	else
+		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" )
+	fi
+
+	# things we want to be hard off or not yet figured out
+	mycmakeargs+=(
+		"-DOPENCV_BUILD_3RDPARTY_LIBS=OFF"
+		"-DBUILD_LATEX_DOCS=OFF"
+		"-DBUILD_PACKAGE=OFF"
+		"-DENABLE_PROFILING=OFF"
+	)
+
+	# things we want to be hard enabled not worth useflag
+	mycmakeargs+=(
+		"-DCMAKE_SKIP_RPATH=ON"
+		"-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}"
+	)
+
+	# hardcode cuda paths
+	mycmakeargs+=(
+		"-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda"
+	)
+
+	# workaround for bug 413429
+	tc-export CC CXX
+
+	cmake-utils_src_configure
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2016-05-15 13:52 Amy Winston
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Winston @ 2016-05-15 13:52 UTC (permalink / raw
  To: gentoo-commits

commit:     d110a79b0ff04ac125b2b1339606fe2e8dbcae7f
Author:     Amy Winston <amynka <AT> gentoo <DOT> org>
AuthorDate: Sun May 15 13:48:35 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Sun May 15 13:51:02 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d110a79b

media-libs/opencv: remove old 2.4.9 and 2.4.10

Package-Manager: portage-2.2.26

 media-libs/opencv/Manifest                         |   2 -
 .../files/opencv-2.4.10-git-autodetect.patch       |  57 --
 .../opencv/files/opencv-2.4.10-pic-x86.patch       |  49 --
 media-libs/opencv/files/opencv-2.4.9-cuda.patch    |  89 ---
 .../opencv/files/opencv-2.4.9-git-autodetect.patch |  59 --
 media-libs/opencv/files/opencv-2.4.9-libav10.patch | 748 ---------------------
 media-libs/opencv/opencv-2.4.10.ebuild             | 219 ------
 media-libs/opencv/opencv-2.4.9.ebuild              | 220 ------
 8 files changed, 1443 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 800ac58..485d82b 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,7 +1,5 @@
-DIST opencv-2.4.10.zip 91692581 SHA256 1bf4cb87283797fd91669d4f90b622a677a903c20b4a577b7958a2164f7596c6 SHA512 545345f2984bda9ec5e5f0947077c5f40028ea018cbb21362f33615e5a02d5ed19a51c77a9b183086534e6496509dd008f9d7d40c2efc46bf2a942c710b4424c WHIRLPOOL 3231c1f6b766b39a44b10354532037f5f9f856bd1533c205cc39a1a3758aa53dd4d15595127fd6d1c1d2b6b7bdafe64521ca833c036a5075de4b298218d4bf0c
 DIST opencv-2.4.11.zip 91671436 SHA256 af1952fd40fb0dc5e369725e073ac4650847e956fbf77c5f206b6da8ce2b1fea SHA512 748f6b939200a7ad2c2ae2531bf9bf38b82a576530f10691c13a0ad52568a7eb8b9d312e946ba8e78f592ef05ae389ecb982544f0c00cb83a2d87ae4b4da61b0 WHIRLPOOL 1c621b835fb144997ecbabddaa1b9a0cd0653e27c5a4f2abc43f3c6152a0b98eb0941d59263be33f69a6f3bccdffa484455c2ddaa747ed4a2bd2cd3192956d29
 DIST opencv-2.4.12.zip 93261101 SHA256 2a7e47da87b9119be922f010a1059539e96130c242f4d38e2dbb445ccbeccbc1 SHA512 3f9142ef23181f93200413b456c11235ecac11c322ccf3f89cc3740bfa9d9228508948cee245583103029e9f6abf1c5d0c5d249eff400e65b3655153bc6dbb05 WHIRLPOOL 86488d91cfac4c980e4f794d6d7e40bf93803f4d79defc991647af742198b845db796b1578b5d79a12a71ecbb04d8430a49c1538d6f86f1288c2a31efefc2548
-DIST opencv-2.4.9.zip 91684751 SHA256 803010848154988e9cbda8b3fa857fcbb27382c2946ed729e1a7e40600bb4c71 SHA512 8eb6ee11d8260428ae461e06348ce037979efc29b7e33d59c3d348a6b4bae95b7004df4527aba7c634e7356f7b5635c98493dc15a0b43479e8f10f7258540c62 WHIRLPOOL 5bb5e39678b3072b2e8b923216529c84982559dd69d5ec51b8703e65af3401f3a8ff31e4e3bfc076480d0605e333df0b03a61713a927ec058bfaf25b4fa8fd5e
 DIST opencv-3.0.0.zip 100980799 SHA256 07094ea2f996f2622d572f0f3a162d698c8a547520341ca9109fbaf9363fb001 SHA512 108d0fdcc60b5688ebf61c930fb965ec81f0d3c36bb1797f6cc571fac35331f540773207fd1cb81b12c05c8f4d1af20c4a2452d9f75cd0cae4acd8131be92375 WHIRLPOOL 61cbbf5201b1dea75ffa998d1f55ee35f098bb8f76591cc9705de13b9f05eaefd19dcc74e93d2643d9b721e62483a36547617ec2e3d14fa6a2522e18ccf06747
 DIST opencv-3.1.0.zip 79186131 SHA256 1f6990249fdb82804fff40e96fa6d99949023ab0e3277eae4bd459b374e622a4 SHA512 b4915e8838fce8ba9e1af8b11e46678624435e9a41592e645413dfdc830993eaa017d337fe4c212a49f096421a6317a1892546087fbc3cfdab554522336c0f1a WHIRLPOOL 3c38715e2abc431781b724199c2cf06f844c7a889c51a06ecb64889a8ca36d9fd370a0738deec2995e24e453cb64f5db228238681714f62daf6eac50d95a4914
 DIST opencv-3.1.0_contrib.zip 55182211 SHA256 5082b5df7179ff71f4681747c482169f0d5d5b77605816cfe5b93c588021fbb4 SHA512 f0ceb8d9ed85efe948a40071793d164a82391a462c52ca71a6029e8b119afdab8b1453baaed2cd7d540001559849a62ec4b745d41345db225acff0531c76e762 WHIRLPOOL 589294c849a00426f4c52d07ab652e71e8bbc74efd0878fbaea2e089051fd118217b1a04f33258fcef2abe1729147282eb17a98c5463691aa3fd56af264ea6a0

diff --git a/media-libs/opencv/files/opencv-2.4.10-git-autodetect.patch b/media-libs/opencv/files/opencv-2.4.10-git-autodetect.patch
deleted file mode 100644
index 9349864..0000000
--- a/media-libs/opencv/files/opencv-2.4.10-git-autodetect.patch
+++ /dev/null
@@ -1,57 +0,0 @@
---- opencv-2.4.10/work/opencv-2.4.10/CMakeLists.txt.old	2016-04-07 14:17:10.524981054 +0200
-+++ opencv-2.4.10/work/opencv-2.4.10/CMakeLists.txt	2016-04-07 14:13:38.726989961 +0200
-@@ -375,32 +375,32 @@
- # ----------------------------------------------------------------------------
- 
- # don't use FindGit because it requires CMake 2.8.2
--set(git_names git eg) # eg = easy git
-+#set(git_names git eg) # eg = easy git
- # Prefer .cmd variants on Windows unless running in a Makefile in the MSYS shell
--if(CMAKE_HOST_WIN32)
--  if(NOT CMAKE_GENERATOR MATCHES "MSYS")
--    set(git_names git.cmd git eg.cmd eg)
--  endif()
--endif()
-+#if(CMAKE_HOST_WIN32)
-+#  if(NOT CMAKE_GENERATOR MATCHES "MSYS")
-+#    set(git_names git.cmd git eg.cmd eg)
-+#  endif()
-+#endif()
- 
--find_host_program(GIT_EXECUTABLE NAMES ${git_names} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client")
--mark_as_advanced(GIT_EXECUTABLE)
-+#find_host_program(GIT_EXECUTABLE NAMES ${git_names} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client")
-+#mark_as_advanced(GIT_EXECUTABLE)
- 
--if(GIT_EXECUTABLE)
--  execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty --match "2.[0-9].[0-9]*"
--    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
--    OUTPUT_VARIABLE OPENCV_VCSVERSION
--    RESULT_VARIABLE GIT_RESULT
--    ERROR_QUIET
--    OUTPUT_STRIP_TRAILING_WHITESPACE
--  )
--  if(NOT GIT_RESULT EQUAL 0)
--    set(OPENCV_VCSVERSION "unknown")
--  endif()
--else()
-+#if(GIT_EXECUTABLE)
-+#  execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty --match "2.[0-9].[0-9]*"
-+#    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-+#    OUTPUT_VARIABLE OPENCV_VCSVERSION
-+#    RESULT_VARIABLE GIT_RESULT
-+#    ERROR_QUIET
-+#    OUTPUT_STRIP_TRAILING_WHITESPACE
-+#  )
-+#  if(NOT GIT_RESULT EQUAL 0)
-+#    set(OPENCV_VCSVERSION "unknown")
-+#  endif()
-+#else()
-   # We don't have git:
--  set(OPENCV_VCSVERSION "unknown")
--endif()
-+#  set(OPENCV_VCSVERSION "unknown")
-+#endif()
- 
- 
- # ----------------------------------------------------------------------------

diff --git a/media-libs/opencv/files/opencv-2.4.10-pic-x86.patch b/media-libs/opencv/files/opencv-2.4.10-pic-x86.patch
deleted file mode 100644
index 74b7501..0000000
--- a/media-libs/opencv/files/opencv-2.4.10-pic-x86.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From ea50be0529c248961e1b66293f8a9e4b807294a6 Mon Sep 17 00:00:00 2001
-From: Samuel Martin <s.martin49@gmail.com>
-Date: Sun, 12 Oct 2014 10:17:23 +0200
-Subject: [PATCH] core: fix x86 PIC code compilation
-
-This bug was triggered by Buildroot autobuilders [1,2], causing this
-kind of failures [3,4]:
-
-  [ 14%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o
-  /home/test/autobuild/instance-0/output/build/opencv-2.4.10/modules/core/src/system.cpp: In function '(static initializers for /home/test/autobuild/instance-0/output/build/opencv-2.4.10/modules/core/src/system.cpp)':
-  /home/test/autobuild/instance-0/output/build/opencv-2.4.10/modules/core/src/system.cpp:280:10: error: inconsistent operand constraints in an 'asm'
-  make[3]: *** [modules/core/CMakeFiles/opencv_core.dir/src/system.cpp.o] Error 1
-
-[1] http://buildroot.org/
-[2] http://autobuild.buildroot.org/
-[3] http://autobuild.buildroot.org/?reason=opencv-2.4.10
-[4] http://autobuild.buildroot.org/results/483/4838285b25d6293a5cf0bb9eadd5040a7c75d766/build-end.log
-
-Signed-off-by: Samuel Martin <s.martin49@gmail.com>
----
- modules/core/src/system.cpp | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp
-index 5a970d5..e9ffdc7 100644
---- a/modules/core/src/system.cpp
-+++ b/modules/core/src/system.cpp
-@@ -267,14 +267,17 @@ struct HWFeatures
-          : "cc"
-         );
-         #else
-+        // We need to preserve ebx since we are compiling PIC code.
-+        // This means we cannot use "=b" for the 2nd output register.
-         asm volatile
-         (
-          "pushl %%ebx\n\t"
-          "movl $7,%%eax\n\t"
-          "movl $0,%%ecx\n\t"
-          "cpuid\n\t"
-+         "movl %%ebx,%1\n\t"
-          "popl %%ebx\n\t"
--         : "=a"(cpuid_data[0]), "=b"(cpuid_data[1]), "=c"(cpuid_data[2]), "=d"(cpuid_data[3])
-+         : "=a"(cpuid_data[0]), "=r"(cpuid_data[1]), "=c"(cpuid_data[2]), "=d"(cpuid_data[3])
-          :
-          : "cc"
-         );
--- 
-2.4.1
-

diff --git a/media-libs/opencv/files/opencv-2.4.9-cuda.patch b/media-libs/opencv/files/opencv-2.4.9-cuda.patch
deleted file mode 100644
index 2cb8416..0000000
--- a/media-libs/opencv/files/opencv-2.4.9-cuda.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-commit feb74b125d7923c0bc11054b66863e1e9f753141
-Author: Alexander Smorkalov <alexander.smorkalov@itseez.com>
-Date:   Mon Jul 14 14:26:50 2014 +0400
-
-    Build fixes for CUDA 6.5
-    (cherry picked from commit 60a5ada4541e777bd2ad3fe0322180706351e58b)
-
-diff --git a/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp b/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp
-index c1e06b4..1c95414 100644
---- a/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp
-+++ b/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp
-@@ -48,24 +48,24 @@
- #include "NCV.hpp"
- 
- template<typename TBase> inline __host__ __device__ TBase _pixMaxVal();
--template<> static inline __host__ __device__ Ncv8u  _pixMaxVal<Ncv8u>()  {return UCHAR_MAX;}
--template<> static inline __host__ __device__ Ncv16u _pixMaxVal<Ncv16u>() {return USHRT_MAX;}
--template<> static inline __host__ __device__ Ncv32u _pixMaxVal<Ncv32u>() {return  UINT_MAX;}
--template<> static inline __host__ __device__ Ncv8s  _pixMaxVal<Ncv8s>()  {return  SCHAR_MAX;}
--template<> static inline __host__ __device__ Ncv16s _pixMaxVal<Ncv16s>() {return  SHRT_MAX;}
--template<> static inline __host__ __device__ Ncv32s _pixMaxVal<Ncv32s>() {return   INT_MAX;}
--template<> static inline __host__ __device__ Ncv32f _pixMaxVal<Ncv32f>() {return   FLT_MAX;}
--template<> static inline __host__ __device__ Ncv64f _pixMaxVal<Ncv64f>() {return   DBL_MAX;}
-+template<>  inline __host__ __device__ Ncv8u  _pixMaxVal<Ncv8u>()  {return UCHAR_MAX;}
-+template<>  inline __host__ __device__ Ncv16u _pixMaxVal<Ncv16u>() {return USHRT_MAX;}
-+template<>  inline __host__ __device__ Ncv32u _pixMaxVal<Ncv32u>() {return  UINT_MAX;}
-+template<>  inline __host__ __device__ Ncv8s  _pixMaxVal<Ncv8s>()  {return  SCHAR_MAX;}
-+template<>  inline __host__ __device__ Ncv16s _pixMaxVal<Ncv16s>() {return  SHRT_MAX;}
-+template<>  inline __host__ __device__ Ncv32s _pixMaxVal<Ncv32s>() {return   INT_MAX;}
-+template<>  inline __host__ __device__ Ncv32f _pixMaxVal<Ncv32f>() {return   FLT_MAX;}
-+template<>  inline __host__ __device__ Ncv64f _pixMaxVal<Ncv64f>() {return   DBL_MAX;}
- 
- template<typename TBase> inline __host__ __device__ TBase _pixMinVal();
--template<> static inline __host__ __device__ Ncv8u  _pixMinVal<Ncv8u>()  {return 0;}
--template<> static inline __host__ __device__ Ncv16u _pixMinVal<Ncv16u>() {return 0;}
--template<> static inline __host__ __device__ Ncv32u _pixMinVal<Ncv32u>() {return 0;}
--template<> static inline __host__ __device__ Ncv8s  _pixMinVal<Ncv8s>()  {return SCHAR_MIN;}
--template<> static inline __host__ __device__ Ncv16s _pixMinVal<Ncv16s>() {return SHRT_MIN;}
--template<> static inline __host__ __device__ Ncv32s _pixMinVal<Ncv32s>() {return INT_MIN;}
--template<> static inline __host__ __device__ Ncv32f _pixMinVal<Ncv32f>() {return FLT_MIN;}
--template<> static inline __host__ __device__ Ncv64f _pixMinVal<Ncv64f>() {return DBL_MIN;}
-+template<>  inline __host__ __device__ Ncv8u  _pixMinVal<Ncv8u>()  {return 0;}
-+template<>  inline __host__ __device__ Ncv16u _pixMinVal<Ncv16u>() {return 0;}
-+template<>  inline __host__ __device__ Ncv32u _pixMinVal<Ncv32u>() {return 0;}
-+template<>  inline __host__ __device__ Ncv8s  _pixMinVal<Ncv8s>()  {return SCHAR_MIN;}
-+template<>  inline __host__ __device__ Ncv16s _pixMinVal<Ncv16s>() {return SHRT_MIN;}
-+template<>  inline __host__ __device__ Ncv32s _pixMinVal<Ncv32s>() {return INT_MIN;}
-+template<>  inline __host__ __device__ Ncv32f _pixMinVal<Ncv32f>() {return FLT_MIN;}
-+template<>  inline __host__ __device__ Ncv64f _pixMinVal<Ncv64f>() {return DBL_MIN;}
- 
- template<typename Tvec> struct TConvVec2Base;
- template<> struct TConvVec2Base<uchar1>  {typedef Ncv8u TBase;};
-@@ -116,21 +116,21 @@ template<typename Tin> static inline __host__ __device__ void _TDemoteClampNN(Ti
- template<typename Tin> static inline __host__ __device__ void _TDemoteClampNN(Tin &a, Ncv32f &out) {out = (Ncv32f)a;}
- 
- template<typename Tout> inline Tout _pixMakeZero();
--template<> static inline __host__ __device__ uchar1 _pixMakeZero<uchar1>() {return make_uchar1(0);}
--template<> static inline __host__ __device__ uchar3 _pixMakeZero<uchar3>() {return make_uchar3(0,0,0);}
--template<> static inline __host__ __device__ uchar4 _pixMakeZero<uchar4>() {return make_uchar4(0,0,0,0);}
--template<> static inline __host__ __device__ ushort1 _pixMakeZero<ushort1>() {return make_ushort1(0);}
--template<> static inline __host__ __device__ ushort3 _pixMakeZero<ushort3>() {return make_ushort3(0,0,0);}
--template<> static inline __host__ __device__ ushort4 _pixMakeZero<ushort4>() {return make_ushort4(0,0,0,0);}
--template<> static inline __host__ __device__ uint1 _pixMakeZero<uint1>() {return make_uint1(0);}
--template<> static inline __host__ __device__ uint3 _pixMakeZero<uint3>() {return make_uint3(0,0,0);}
--template<> static inline __host__ __device__ uint4 _pixMakeZero<uint4>() {return make_uint4(0,0,0,0);}
--template<> static inline __host__ __device__ float1 _pixMakeZero<float1>() {return make_float1(0.f);}
--template<> static inline __host__ __device__ float3 _pixMakeZero<float3>() {return make_float3(0.f,0.f,0.f);}
--template<> static inline __host__ __device__ float4 _pixMakeZero<float4>() {return make_float4(0.f,0.f,0.f,0.f);}
--template<> static inline __host__ __device__ double1 _pixMakeZero<double1>() {return make_double1(0.);}
--template<> static inline __host__ __device__ double3 _pixMakeZero<double3>() {return make_double3(0.,0.,0.);}
--template<> static inline __host__ __device__ double4 _pixMakeZero<double4>() {return make_double4(0.,0.,0.,0.);}
-+template<>  inline __host__ __device__ uchar1 _pixMakeZero<uchar1>() {return make_uchar1(0);}
-+template<>  inline __host__ __device__ uchar3 _pixMakeZero<uchar3>() {return make_uchar3(0,0,0);}
-+template<>  inline __host__ __device__ uchar4 _pixMakeZero<uchar4>() {return make_uchar4(0,0,0,0);}
-+template<>  inline __host__ __device__ ushort1 _pixMakeZero<ushort1>() {return make_ushort1(0);}
-+template<>  inline __host__ __device__ ushort3 _pixMakeZero<ushort3>() {return make_ushort3(0,0,0);}
-+template<>  inline __host__ __device__ ushort4 _pixMakeZero<ushort4>() {return make_ushort4(0,0,0,0);}
-+template<>  inline __host__ __device__ uint1 _pixMakeZero<uint1>() {return make_uint1(0);}
-+template<>  inline __host__ __device__ uint3 _pixMakeZero<uint3>() {return make_uint3(0,0,0);}
-+template<>  inline __host__ __device__ uint4 _pixMakeZero<uint4>() {return make_uint4(0,0,0,0);}
-+template<>  inline __host__ __device__ float1 _pixMakeZero<float1>() {return make_float1(0.f);}
-+template<>  inline __host__ __device__ float3 _pixMakeZero<float3>() {return make_float3(0.f,0.f,0.f);}
-+template<>  inline __host__ __device__ float4 _pixMakeZero<float4>() {return make_float4(0.f,0.f,0.f,0.f);}
-+template<>  inline __host__ __device__ double1 _pixMakeZero<double1>() {return make_double1(0.);}
-+template<>  inline __host__ __device__ double3 _pixMakeZero<double3>() {return make_double3(0.,0.,0.);}
-+template<>  inline __host__ __device__ double4 _pixMakeZero<double4>() {return make_double4(0.,0.,0.,0.);}
- 
- static inline __host__ __device__ uchar1 _pixMake(Ncv8u x) {return make_uchar1(x);}
- static inline __host__ __device__ uchar3 _pixMake(Ncv8u x, Ncv8u y, Ncv8u z) {return make_uchar3(x,y,z);}

diff --git a/media-libs/opencv/files/opencv-2.4.9-git-autodetect.patch b/media-libs/opencv/files/opencv-2.4.9-git-autodetect.patch
deleted file mode 100644
index 7c45857..0000000
--- a/media-libs/opencv/files/opencv-2.4.9-git-autodetect.patch
+++ /dev/null
@@ -1,59 +0,0 @@
---- CMakeLists.txt.old	2016-04-07 13:07:18.177841867 +0200
-+++ CMakeLists.txt	2016-04-07 13:09:39.449835926 +0200
-@@ -369,32 +369,32 @@
- # ----------------------------------------------------------------------------
- 
- # don't use FindGit because it requires CMake 2.8.2
--set(git_names git eg) # eg = easy git
-+#set(git_names git eg) # eg = easy git
- # Prefer .cmd variants on Windows unless running in a Makefile in the MSYS shell
--if(CMAKE_HOST_WIN32)
--  if(NOT CMAKE_GENERATOR MATCHES "MSYS")
--    set(git_names git.cmd git eg.cmd eg)
--  endif()
--endif()
--
--find_host_program(GIT_EXECUTABLE NAMES ${git_names} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client")
--mark_as_advanced(GIT_EXECUTABLE)
--
--if(GIT_EXECUTABLE)
--  execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty --match "2.[0-9].[0-9]*"
--    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
--    OUTPUT_VARIABLE OPENCV_VCSVERSION
--    RESULT_VARIABLE GIT_RESULT
--    ERROR_QUIET
--    OUTPUT_STRIP_TRAILING_WHITESPACE
--  )
--  if(NOT GIT_RESULT EQUAL 0)
--    set(OPENCV_VCSVERSION "unknown")
--  endif()
--else()
-+#if(CMAKE_HOST_WIN32)
-+#  if(NOT CMAKE_GENERATOR MATCHES "MSYS")
-+#    set(git_names git.cmd git eg.cmd eg)
-+#  endif()
-+#endif()
-+
-+#find_host_program(GIT_EXECUTABLE NAMES ${git_names} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client")
-+#mark_as_advanced(GIT_EXECUTABLE)
-+
-+#if(GIT_EXECUTABLE)
-+#  execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty --match "2.[0-9].[0-9]*"
-+#    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-+#    OUTPUT_VARIABLE OPENCV_VCSVERSION
-+#    RESULT_VARIABLE GIT_RESULT
-+#    ERROR_QUIET
-+#    OUTPUT_STRIP_TRAILING_WHITESPACE
-+#  )
-+#  if(NOT GIT_RESULT EQUAL 0)
-+#    set(OPENCV_VCSVERSION "unknown")
-+#  endif()
-+#else()
-   # We don't have git:
--  set(OPENCV_VCSVERSION "unknown")
--endif()
-+#  set(OPENCV_VCSVERSION "unknown")
-+#endif()
- 
- 
- # ----------------------------------------------------------------------------

diff --git a/media-libs/opencv/files/opencv-2.4.9-libav10.patch b/media-libs/opencv/files/opencv-2.4.9-libav10.patch
deleted file mode 100644
index df51728..0000000
--- a/media-libs/opencv/files/opencv-2.4.9-libav10.patch
+++ /dev/null
@@ -1,748 +0,0 @@
-From: anton@khirnov.net
-Description: Support building with the upcoming Libav 10 release
-Origin: upstream, https://github.com/Itseez/opencv/pull/2293
-
---- a/modules/highgui/src/cap_ffmpeg_impl.hpp
-+++ b/modules/highgui/src/cap_ffmpeg_impl.hpp
-@@ -57,10 +57,28 @@
- extern "C" {
- #endif
- 
--#include "ffmpeg_codecs.hpp"
-+#if !defined(WIN32) || defined(__MINGW32__)
- 
-+#include <stdint.h>
-+
-+// some versions of FFMPEG assume a C99 compiler, and don't define INT64_C
-+#ifndef INT64_C
-+#define INT64_C(c) (c##LL)
-+#endif
-+
-+#ifndef UINT64_C
-+#define UINT64_C(c) (c##ULL)
-+#endif
-+
-+#include <errno.h>
-+
-+#endif
-+
-+#include <libavformat/avformat.h>
- #include <libavutil/mathematics.h>
- 
-+#include <libavutil/opt.h>
-+
- #ifdef WIN32
-   #define HAVE_FFMPEG_SWSCALE 1
-   #include <libavcodec/avcodec.h>
-@@ -144,10 +162,6 @@ extern "C" {
- #define AV_NOPTS_VALUE_ ((int64_t)AV_NOPTS_VALUE)
- #endif
- 
--#ifndef AVERROR_EOF
--#define AVERROR_EOF (-MKTAG( 'E','O','F',' '))
--#endif
--
- #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
- #  define CV_CODEC_ID AVCodecID
- #  define CV_CODEC(name) AV_##name
-@@ -158,9 +172,7 @@ extern "C" {
- 
- static int get_number_of_cpus(void)
- {
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(52, 111, 0)
--    return 1;
--#elif defined WIN32 || defined _WIN32
-+#if defined WIN32 || defined _WIN32
-     SYSTEM_INFO sysinfo;
-     GetSystemInfo( &sysinfo );
- 
-@@ -296,25 +308,13 @@ void CvCapture_FFMPEG::close()
- 
-     if( video_st )
-     {
--#if LIBAVFORMAT_BUILD > 4628
-         avcodec_close( video_st->codec );
--
--#else
--        avcodec_close( &(video_st->codec) );
--
--#endif
-         video_st = NULL;
-     }
- 
-     if( ic )
-     {
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 24, 2)
--        av_close_input_file(ic);
--#else
-         avformat_close_input(&ic);
--#endif
--
--        ic = NULL;
-     }
- 
-     if( rgb_picture.data[0] )
-@@ -501,9 +501,7 @@ public:
-         _mutex.lock();
-         if (!_initialized)
-         {
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
-             avformat_network_init();
--    #endif
- 
-             /* register all codecs, demux and protocols */
-             av_register_all();
-@@ -534,11 +532,7 @@ bool CvCapture_FFMPEG::open( const char*
- 
-     close();
- 
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
-     int err = avformat_open_input(&ic, _filename, NULL, NULL);
--#else
--    int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
--#endif
- 
-     if (err < 0)
-     {
-@@ -546,11 +540,7 @@ bool CvCapture_FFMPEG::open( const char*
-         goto exit_func;
-     }
-     err =
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
-     avformat_find_stream_info(ic, NULL);
--#else
--    av_find_stream_info(ic);
--#endif
-     if (err < 0)
-     {
-         CV_WARN("Could not find codec parameters");
-@@ -558,11 +548,7 @@ bool CvCapture_FFMPEG::open( const char*
-     }
-     for(i = 0; i < ic->nb_streams; i++)
-     {
--#if LIBAVFORMAT_BUILD > 4628
-         AVCodecContext *enc = ic->streams[i]->codec;
--#else
--        AVCodecContext *enc = &ic->streams[i]->codec;
--#endif
- 
- //#ifdef FF_API_THREAD_INIT
- //        avcodec_thread_init(enc, get_number_of_cpus());
-@@ -570,10 +556,6 @@ bool CvCapture_FFMPEG::open( const char*
-         enc->thread_count = get_number_of_cpus();
- //#endif
- 
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
--#endif
--
-         if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0)
-         {
-             // backup encoder' width/height
-@@ -581,13 +563,7 @@ bool CvCapture_FFMPEG::open( const char*
-             int enc_height = enc->height;
- 
-             AVCodec *codec = avcodec_find_decoder(enc->codec_id);
--            if (!codec ||
--#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
--                avcodec_open2(enc, codec, NULL)
--#else
--                avcodec_open(enc, codec)
--#endif
--                < 0)
-+            if (!codec || avcodec_open2(enc, codec, NULL) < 0)
-                 goto exit_func;
- 
-             // checking width/height (since decoder can sometimes alter it, eg. vp6f)
-@@ -660,17 +636,7 @@ bool CvCapture_FFMPEG::grabFrame()
-         }
- 
-         // Decode video frame
--        #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-             avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet);
--        #elif LIBAVFORMAT_BUILD > 4628
--                avcodec_decode_video(video_st->codec,
--                                     picture, &got_picture,
--                                     packet.data, packet.size);
--        #else
--                avcodec_decode_video(&video_st->codec,
--                                     picture, &got_picture,
--                                     packet.data, packet.size);
--        #endif
- 
-         // Did we get a video frame?
-         if(got_picture)
-@@ -769,18 +735,9 @@ double CvCapture_FFMPEG::getProperty( in
-     case CV_FFMPEG_CAP_PROP_FRAME_HEIGHT:
-         return (double)frame.height;
-     case CV_FFMPEG_CAP_PROP_FPS:
--#if LIBAVCODEC_BUILD > 4753
--        return av_q2d(video_st->r_frame_rate);
--#else
--        return (double)video_st->codec.frame_rate
--                / (double)video_st->codec.frame_rate_base;
--#endif
-+        return av_q2d(video_st->avg_frame_rate);
-     case CV_FFMPEG_CAP_PROP_FOURCC:
--#if LIBAVFORMAT_BUILD > 4628
-         return (double)video_st->codec->codec_tag;
--#else
--        return (double)video_st->codec.codec_tag;
--#endif
-     default:
-         break;
-     }
-@@ -817,14 +774,7 @@ int CvCapture_FFMPEG::get_bitrate()
- 
- double CvCapture_FFMPEG::get_fps()
- {
--    double fps = r2d(ic->streams[video_stream]->r_frame_rate);
--
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
--    if (fps < eps_zero)
--    {
--        fps = r2d(ic->streams[video_stream]->avg_frame_rate);
--    }
--#endif
-+    double fps = r2d(ic->streams[video_stream]->avg_frame_rate);
- 
-     if (fps < eps_zero)
-     {
-@@ -984,7 +934,6 @@ struct CvVideoWriter_FFMPEG
- 
- static const char * icvFFMPEGErrStr(int err)
- {
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-     switch(err) {
-     case AVERROR_BSF_NOT_FOUND:
-         return "Bitstream filter not found";
-@@ -1015,22 +964,6 @@ static const char * icvFFMPEGErrStr(int
-     default:
-         break;
-     }
--#else
--    switch(err) {
--    case AVERROR_NUMEXPECTED:
--        return "Incorrect filename syntax";
--    case AVERROR_INVALIDDATA:
--        return "Invalid data in header";
--    case AVERROR_NOFMT:
--        return "Unknown format";
--    case AVERROR_IO:
--        return "I/O error occurred";
--    case AVERROR_NOMEM:
--        return "Memory allocation error";
--    default:
--        break;
--    }
--#endif
- 
-     return "Unspecified error";
- }
-@@ -1098,28 +1031,16 @@ static AVStream *icv_add_video_stream_FF
-     int frame_rate, frame_rate_base;
-     AVCodec *codec;
- 
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
-     st = avformat_new_stream(oc, 0);
--#else
--    st = av_new_stream(oc, 0);
--#endif
- 
-     if (!st) {
-         CV_WARN("Could not allocate stream");
-         return NULL;
-     }
- 
--#if LIBAVFORMAT_BUILD > 4628
-     c = st->codec;
--#else
--    c = &(st->codec);
--#endif
- 
--#if LIBAVFORMAT_BUILD > 4621
-     c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
--#else
--    c->codec_id = oc->oformat->video_codec;
--#endif
- 
-     if(codec_id != CV_CODEC(CODEC_ID_NONE)){
-         c->codec_id = codec_id;
-@@ -1154,7 +1075,6 @@ static AVStream *icv_add_video_stream_FF
-         frame_rate_base*=10;
-         frame_rate=(int)(fps*frame_rate_base + 0.5);
-     }
--#if LIBAVFORMAT_BUILD > 4752
-     c->time_base.den = frame_rate;
-     c->time_base.num = frame_rate_base;
-     /* adjust time base for supported framerates */
-@@ -1174,10 +1094,6 @@ static AVStream *icv_add_video_stream_FF
-         c->time_base.den= best->num;
-         c->time_base.num= best->den;
-     }
--#else
--    c->frame_rate = frame_rate;
--    c->frame_rate_base = frame_rate_base;
--#endif
- 
-     c->gop_size = 12; /* emit one intra frame every twelve frames at most */
-     c->pix_fmt = (PixelFormat) pixel_format;
-@@ -1207,12 +1123,7 @@ static const int OPENCV_NO_FRAMES_WRITTE
- 
- static int icv_av_write_frame_FFMPEG( AVFormatContext * oc, AVStream * video_st, uint8_t * outbuf, uint32_t outbuf_size, AVFrame * picture )
- {
--#if LIBAVFORMAT_BUILD > 4628
-     AVCodecContext * c = video_st->codec;
--#else
--    AVCodecContext * c = &(video_st->codec);
--#endif
--    int out_size;
-     int ret = 0;
- 
-     if (oc->oformat->flags & AVFMT_RAWPICTURE) {
-@@ -1232,24 +1143,39 @@ static int icv_av_write_frame_FFMPEG( AV
- 
-         ret = av_write_frame(oc, &pkt);
-     } else {
-+        AVPacket pkt;
-+        int got_output;
-+
-+        av_init_packet(&pkt);
-+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 1, 0)
-         /* encode the image */
--        out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
--        /* if zero size, it means the image was buffered */
--        if (out_size > 0) {
--            AVPacket pkt;
--            av_init_packet(&pkt);
--
--#if LIBAVFORMAT_BUILD > 4752
--            if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
--                pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_st->time_base);
--#else
-+        int out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
-+        got_output = out_size > 0;
-+        pkt.data   = outbuf;
-+        pkt.size   = out_size;
-+        if(c->coded_frame->pts != (int64_t)AV_NOPTS_VALUE)
-             pkt.pts = c->coded_frame->pts;
-+        pkt.dts = AV_NOPTS_VALUE;
-+        if(c->coded_frame->key_frame)
-+            pkt.flags |= PKT_FLAG_KEY;
-+#else
-+        pkt.data = NULL;
-+        pkt.size = 0;
-+
-+        ret = avcodec_encode_video2(c, &pkt, picture, &got_output);
-+        if (ret < 0)
-+            got_output = 0;
- #endif
--            if(c->coded_frame->key_frame)
--                pkt.flags |= PKT_FLAG_KEY;
-+
-+        if (got_output) {
-+            if (pkt.pts != (int64_t)AV_NOPTS_VALUE)
-+                pkt.pts = av_rescale_q(pkt.pts, c->time_base, video_st->time_base);
-+            if (pkt.dts != (int64_t)AV_NOPTS_VALUE)
-+                pkt.dts = av_rescale_q(pkt.dts, c->time_base, video_st->time_base);
-+            if (pkt.duration)
-+                pkt.duration = av_rescale_q(pkt.duration, c->time_base, video_st->time_base);
-+
-             pkt.stream_index= video_st->index;
--            pkt.data= outbuf;
--            pkt.size= out_size;
- 
-             /* write the compressed frame in the media file */
-             ret = av_write_frame(oc, &pkt);
-@@ -1271,30 +1197,8 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
-     height = frame_height;
- 
-     // typecast from opaque data type to implemented struct
--#if LIBAVFORMAT_BUILD > 4628
-     AVCodecContext *c = video_st->codec;
--#else
--    AVCodecContext *c = &(video_st->codec);
--#endif
- 
--#if LIBAVFORMAT_BUILD < 5231
--    // It is not needed in the latest versions of the ffmpeg
--    if( c->codec_id == CV_CODEC(CODEC_ID_RAWVIDEO) && origin != 1 )
--    {
--        if( !temp_image.data )
--        {
--            temp_image.step = (width*cn + 3) & -4;
--            temp_image.width = width;
--            temp_image.height = height;
--            temp_image.cn = cn;
--            temp_image.data = (unsigned char*)malloc(temp_image.step*temp_image.height);
--        }
--        for( int y = 0; y < height; y++ )
--            memcpy(temp_image.data + y*temp_image.step, data + (height-1-y)*step, width*cn);
--        data = temp_image.data;
--        step = temp_image.step;
--    }
--#else
-     if( width*cn != step )
-     {
-         if( !temp_image.data )
-@@ -1314,7 +1218,6 @@ bool CvVideoWriter_FFMPEG::writeFrame( c
-         data = temp_image.data;
-         step = temp_image.step;
-     }
--#endif
- 
-     // check parameters
-     if (input_pix_fmt == PIX_FMT_BGR24) {
-@@ -1401,11 +1304,7 @@ void CvVideoWriter_FFMPEG::close()
-     }
- 
-     // free pictures
--#if LIBAVFORMAT_BUILD > 4628
-     if( video_st->codec->pix_fmt != input_pix_fmt)
--#else
--    if( video_st->codec.pix_fmt != input_pix_fmt)
--#endif
-     {
-         if(picture->data[0])
-             free(picture->data[0]);
-@@ -1417,11 +1316,7 @@ void CvVideoWriter_FFMPEG::close()
-         av_free(input_picture);
- 
-     /* close codec */
--#if LIBAVFORMAT_BUILD > 4628
-     avcodec_close(video_st->codec);
--#else
--    avcodec_close(&(video_st->codec));
--#endif
- 
-     av_free(outbuf);
- 
-@@ -1429,15 +1324,7 @@ void CvVideoWriter_FFMPEG::close()
-     {
-         /* close the output file */
- 
--#if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0)
--#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0)
--        url_fclose(oc->pb);
--#else
--        url_fclose(&oc->pb);
--#endif
--#else
-         avio_close(oc->pb);
--#endif
- 
-     }
- 
-@@ -1479,11 +1366,7 @@ bool CvVideoWriter_FFMPEG::open( const c
- 
-     /* auto detect the output format from the name and fourcc code. */
- 
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-     fmt = av_guess_format(NULL, filename, NULL);
--#else
--    fmt = guess_format(NULL, filename, NULL);
--#endif
- 
-     if (!fmt)
-         return false;
-@@ -1497,21 +1380,12 @@ bool CvVideoWriter_FFMPEG::open( const c
-     }
- 
-     /* Lookup codec_id for given fourcc */
--#if LIBAVCODEC_VERSION_INT<((51<<16)+(49<<8)+0)
--    if( (codec_id = codec_get_bmp_id( fourcc )) == CV_CODEC(CODEC_ID_NONE) )
--        return false;
--#else
--    const struct AVCodecTag * tags[] = { codec_bmp_tags, NULL};
-+    const struct AVCodecTag * tags[] = { avformat_get_riff_video_tags(), NULL};
-     if( (codec_id = av_codec_get_id(tags, fourcc)) == CV_CODEC(CODEC_ID_NONE) )
-         return false;
--#endif
- 
-     // alloc memory for context
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-     oc = avformat_alloc_context();
--#else
--    oc = av_alloc_format_context();
--#endif
-     assert (oc);
- 
-     /* set file name */
-@@ -1523,12 +1397,10 @@ bool CvVideoWriter_FFMPEG::open( const c
- 
-     // set a few optimal pixel formats for lossless codecs of interest..
-     switch (codec_id) {
--#if LIBAVCODEC_VERSION_INT>((50<<16)+(1<<8)+0)
-     case CV_CODEC(CODEC_ID_JPEGLS):
-         // BGR24 or GRAY8 depending on is_color...
-         codec_pix_fmt = input_pix_fmt;
-         break;
--#endif
-     case CV_CODEC(CODEC_ID_HUFFYUV):
-         codec_pix_fmt = PIX_FMT_YUV422P;
-         break;
-@@ -1555,14 +1427,6 @@ bool CvVideoWriter_FFMPEG::open( const c
-                                            width, height, (int)(bitrate + 0.5),
-                                            fps, codec_pix_fmt);
- 
--    /* set the output parameters (must be done even if no
--   parameters). */
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--    if (av_set_parameters(oc, NULL) < 0) {
--        return false;
--    }
--#endif
--
- #if 0
- #if FF_API_DUMP_FORMAT
-     dump_format(oc, 0, filename, 1);
-@@ -1580,23 +1444,14 @@ bool CvVideoWriter_FFMPEG::open( const c
-     AVCodec *codec;
-     AVCodecContext *c;
- 
--#if LIBAVFORMAT_BUILD > 4628
-     c = (video_st->codec);
--#else
--    c = &(video_st->codec);
--#endif
- 
-     c->codec_tag = fourcc;
-     /* find the video encoder */
-     codec = avcodec_find_encoder(c->codec_id);
-     if (!codec) {
-         fprintf(stderr, "Could not find encoder for codec id %d: %s", c->codec_id, icvFFMPEGErrStr(
--        #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
--                AVERROR_ENCODER_NOT_FOUND
--        #else
--                -1
--        #endif
--                ));
-+                AVERROR_ENCODER_NOT_FOUND));
-         return false;
-     }
- 
-@@ -1607,13 +1462,7 @@ bool CvVideoWriter_FFMPEG::open( const c
-     c->bit_rate = (int)lbit_rate;
- 
-     /* open the codec */
--    if ((err=
--#if LIBAVCODEC_VERSION_INT >= ((53<<16)+(8<<8)+0)
--         avcodec_open2(c, codec, NULL)
--#else
--         avcodec_open(c, codec)
--#endif
--         ) < 0) {
-+    if ((err = avcodec_open2(c, codec, NULL)) < 0) {
-         fprintf(stderr, "Could not open codec '%s': %s", codec->name, icvFFMPEGErrStr(err));
-         return false;
-     }
-@@ -1649,22 +1498,14 @@ bool CvVideoWriter_FFMPEG::open( const c
- 
-     /* open the output file, if needed */
-     if (!(fmt->flags & AVFMT_NOFILE)) {
--#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--        if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0)
--#else
-             if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0)
--#endif
-             {
-             return false;
-         }
-     }
- 
--#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
-     /* write the stream header, if any */
-     err=avformat_write_header(oc, NULL);
--#else
--    err=av_write_header( oc );
--#endif
- 
-     if(err < 0)
-     {
-@@ -1799,15 +1640,7 @@ void OutputMediaStream_FFMPEG::close()
-         {
-             // close the output file
- 
--            #if LIBAVCODEC_VERSION_INT < ((52<<16)+(123<<8)+0)
--                #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(49<<8)+0)
--                    url_fclose(oc_->pb);
--                #else
--                    url_fclose(&oc_->pb);
--                #endif
--            #else
--                avio_close(oc_->pb);
--            #endif
-+            avio_close(oc_->pb);
-         }
- 
-         // free the stream
-@@ -1817,19 +1650,11 @@ void OutputMediaStream_FFMPEG::close()
- 
- AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVFormatContext *oc, CV_CODEC_ID codec_id, int w, int h, int bitrate, double fps, PixelFormat pixel_format)
- {
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 10, 0)
-         AVStream* st = avformat_new_stream(oc, 0);
--    #else
--        AVStream* st = av_new_stream(oc, 0);
--    #endif
-     if (!st)
-         return 0;
- 
--    #if LIBAVFORMAT_BUILD > 4628
-         AVCodecContext* c = st->codec;
--    #else
--        AVCodecContext* c = &(st->codec);
--    #endif
- 
-     c->codec_id = codec_id;
-     c->codec_type = AVMEDIA_TYPE_VIDEO;
-@@ -1865,7 +1690,6 @@ AVStream* OutputMediaStream_FFMPEG::addV
-     c->time_base.den = frame_rate;
-     c->time_base.num = frame_rate_base;
- 
--    #if LIBAVFORMAT_BUILD > 4752
-         // adjust time base for supported framerates
-         if (codec && codec->supported_framerates)
-         {
-@@ -1890,7 +1714,6 @@ AVStream* OutputMediaStream_FFMPEG::addV
-             c->time_base.den= best->num;
-             c->time_base.num= best->den;
-         }
--    #endif
- 
-     c->gop_size = 12; // emit one intra frame every twelve frames at most
-     c->pix_fmt = pixel_format;
-@@ -1909,13 +1732,11 @@ AVStream* OutputMediaStream_FFMPEG::addV
-         c->mb_decision = 2;
-     }
- 
--    #if LIBAVCODEC_VERSION_INT > 0x000409
-         // some formats want stream headers to be seperate
-         if (oc->oformat->flags & AVFMT_GLOBALHEADER)
-         {
-             c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-         }
--    #endif
- 
-     return st;
- }
-@@ -1927,22 +1748,14 @@ bool OutputMediaStream_FFMPEG::open(cons
-     video_st_ = 0;
- 
-     // auto detect the output format from the name and fourcc code
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-         fmt_ = av_guess_format(NULL, fileName, NULL);
--    #else
--        fmt_ = guess_format(NULL, fileName, NULL);
--    #endif
-     if (!fmt_)
-         return false;
- 
-     CV_CODEC_ID codec_id = CV_CODEC(CODEC_ID_H264);
- 
-     // alloc memory for context
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 2, 0)
-         oc_ = avformat_alloc_context();
--    #else
--        oc_ = av_alloc_format_context();
--    #endif
-     if (!oc_)
-         return false;
- 
-@@ -1961,20 +1774,10 @@ bool OutputMediaStream_FFMPEG::open(cons
-     if (!video_st_)
-         return false;
- 
--    // set the output parameters (must be done even if no parameters)
--    #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--        if (av_set_parameters(oc_, NULL) < 0)
--            return false;
--    #endif
--
-     // now that all the parameters are set, we can open the audio and
-     // video codecs and allocate the necessary encode buffers
- 
--    #if LIBAVFORMAT_BUILD > 4628
-         AVCodecContext* c = (video_st_->codec);
--    #else
--        AVCodecContext* c = &(video_st_->codec);
--    #endif
- 
-     c->codec_tag = MKTAG('H', '2', '6', '4');
-     c->bit_rate_tolerance = c->bit_rate;
-@@ -1982,22 +1785,14 @@ bool OutputMediaStream_FFMPEG::open(cons
-     // open the output file, if needed
-     if (!(fmt_->flags & AVFMT_NOFILE))
-     {
--        #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--            int err = url_fopen(&oc_->pb, fileName, URL_WRONLY);
--        #else
--            int err = avio_open(&oc_->pb, fileName, AVIO_FLAG_WRITE);
--        #endif
-+        int err = avio_open(&oc_->pb, fileName, AVIO_FLAG_WRITE);
- 
-         if (err != 0)
-             return false;
-     }
- 
-     // write the stream header, if any
--    #if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 2, 0)
--        av_write_header(oc_);
--    #else
--        avformat_write_header(oc_, NULL);
--    #endif
-+    avformat_write_header(oc_, NULL);
- 
-     return true;
- }
-@@ -2102,33 +1897,19 @@ bool InputMediaStream_FFMPEG::open(const
-     video_stream_id_ = -1;
-     memset(&pkt_, 0, sizeof(AVPacket));
- 
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 13, 0)
--        avformat_network_init();
--    #endif
--
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
--        err = avformat_open_input(&ctx_, fileName, 0, 0);
--    #else
--        err = av_open_input_file(&ctx_, fileName, 0, 0, 0);
--    #endif
-+    avformat_network_init();
-+
-+    err = avformat_open_input(&ctx_, fileName, 0, 0);
-     if (err < 0)
-         return false;
- 
--    #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 6, 0)
--        err = avformat_find_stream_info(ctx_, 0);
--    #else
--        err = av_find_stream_info(ctx_);
--    #endif
-+    err = avformat_find_stream_info(ctx_, 0);
-     if (err < 0)
-         return false;
- 
-     for (unsigned int i = 0; i < ctx_->nb_streams; ++i)
-     {
--        #if LIBAVFORMAT_BUILD > 4628
-             AVCodecContext *enc = ctx_->streams[i]->codec;
--        #else
--            AVCodecContext *enc = &ctx_->streams[i]->codec;
--        #endif
- 
-         if (enc->codec_type == AVMEDIA_TYPE_VIDEO)
-         {
-@@ -2197,11 +1978,7 @@ void InputMediaStream_FFMPEG::close()
- {
-     if (ctx_)
-     {
--        #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(53, 24, 2)
--            avformat_close_input(&ctx_);
--        #else
--            av_close_input_file(ctx_);
--        #endif
-+        avformat_close_input(&ctx_);
-     }
- 
-     // free last packet if exist

diff --git a/media-libs/opencv/opencv-2.4.10.ebuild b/media-libs/opencv/opencv-2.4.10.ebuild
deleted file mode 100644
index 7e0970f..0000000
--- a/media-libs/opencv/opencv-2.4.10.ebuild
+++ /dev/null
@@ -1,219 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-PYTHON_COMPAT=( python2_7 )
-
-inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
-HOMEPAGE="http://opencv.willowgarage.com"
-
-SRC_URI="mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip"
-
-LICENSE="BSD"
-SLOT="0/2.4"
-KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
-IUSE="cuda doc +eigen examples ffmpeg gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 testprograms threads tiff v4l vtk xine"
-REQUIRED_USE="
-	python? ( ${PYTHON_REQUIRED_USE} )
-"
-
-# 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? ( !qt4 )
-#	opengl? ( || ( gtk qt4 ) )
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2
-	sys-libs/zlib
-	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
-	ffmpeg? (
-		libav? ( media-video/libav:0= )
-		!libav? ( media-video/ffmpeg:0= )
-	)
-	gstreamer? (
-		media-libs/gstreamer:1.0
-		media-libs/gst-plugins-base:1.0
-	)
-	gtk? (
-		dev-libs/glib:2
-		x11-libs/gtk+:2
-		opengl? ( x11-libs/gtkglext )
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/jasper )
-	ieee1394? (
-		media-libs/libdc1394
-		sys-libs/libraw1394
-	)
-	ipp? ( sci-libs/ipp )
-	opencl? ( virtual/opencl )
-	openexr? ( media-libs/openexr )
-	opengl? ( virtual/opengl virtual/glu )
-	png? ( media-libs/libpng:0= )
-	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
-	qt4? (
-		dev-qt/qtgui:4
-		dev-qt/qttest:4
-		opengl? ( dev-qt/qtopengl:4 )
-	)
-	threads? ( dev-cpp/tbb )
-	tiff? ( media-libs/tiff:0 )
-	v4l? ( >=media-libs/libv4l-0.8.3 )
-	vtk? ( sci-libs/vtk[rendering] )
-	xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	eigen? ( dev-cpp/eigen:3 )
-	java? ( >=virtual/jdk-1.6 )
-"
-
-pkg_setup() {
-	use python && python-single-r1_pkg_setup
-	java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
-	epatch "${FILESDIR}/${PN}-2.3.1a-libav-0.7.patch" \
-        	"${FILESDIR}/${PN}-2.4.3-gcc47.patch" \
-        	"${FILESDIR}/${PN}-2.4.2-cflags.patch" \
-        	"${FILESDIR}/${PN}-2.4.8-javamagic.patch" \
-        	"${FILESDIR}/${PN}-2.4.9-libav10.patch" \
-        	"${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch" \
-        	"${FILESDIR}/${PN}-2.4.10-pic-x86.patch" \
-		"${FILESDIR}/${P}-git-autodetect.patch"
-
-	# remove bundled stuff
-	rm -rf 3rdparty
-	sed -i \
-		-e '/add_subdirectory(3rdparty)/ d' \
-		CMakeLists.txt || die
-
-	java-pkg-opt-2_src_prepare
-}
-
-src_configure() {
-	if use openmp; then
-		tc-has-openmp || die "Please switch to an openmp compatible compiler"
-	fi
-
-	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
-
-	# please dont sort here, order is the same as in CMakeLists.txt
-	local mycmakeargs=(
-	# the optinal dependency libraries
-		$(cmake-utils_use_with ieee1394 1394)
-		-DWITH_AVFOUNDATION=OFF
-		-DWITH_CARBON=OFF
-		$(cmake-utils_use_with eigen)
-		$(cmake-utils_use_with ffmpeg)
-		$(cmake-utils_use_with gstreamer)
-		$(cmake-utils_use_with gtk)
-		$(cmake-utils_use_with ipp)
-		$(cmake-utils_use_with java)
-		$(cmake-utils_use_with jpeg2k JASPER)
-		$(cmake-utils_use_with jpeg)
-		$(cmake-utils_use_with opencl)
-	#	$(cmake-utils_use_with opencl OPENCLAMDFFT)
-	#	$(cmake-utils_use_with opencl OPENCLAMDBLAS)
-		$(cmake-utils_use_with openexr)
-		$(cmake-utils_use_with opengl)
-		$(cmake-utils_use_with openmp)
-		-DWITH_OPENNI=OFF					# not packaged
-		$(cmake-utils_use_with png)
-		$(cmake-utils_use_build python opencv_python)
-		-DWITH_PVAPI=OFF					# not packaged
-		-DWITH_QUICKTIME=OFF
-		$(cmake-utils_use_with threads TBB)
-		$(cmake-utils_use_with tiff)
-		-DWITH_UNICAP=OFF					# not packaged
-		$(cmake-utils_use_with v4l V4L)
-		$(cmake-utils_use_with vtk VTK)
-		-DWITH_LIBV4L=ON
-		-DWITH_VIDEOINPUT=OFF					# windows only
-		-DWITH_XIMEA=OFF					# windows only
-		$(cmake-utils_use_with xine)
-	# the build components
-		-DBUILD_SHARED_LIBS=ON
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		$(cmake-utils_use_build doc DOCS)
-		$(cmake-utils_use_build examples)
-		-DBUILD_PERF_TESTS=OFF
-		$(cmake-utils_use_build testprograms TESTS)
-	# install examples, tests etc
-		$(cmake-utils_use examples INSTALL_C_EXAMPLES)
-		$(cmake-utils_use testprograms INSTALL_TESTS)
-	# build options
-		$(cmake-utils_use_enable pch PRECOMPILED_HEADERS)
-		-DENABLE_OMIT_FRAME_POINTER=OFF				#
-		-DENABLE_FAST_MATH=OFF					#
-		-DENABLE_SSE=OFF					# these options do nothing but
-		-DENABLE_SSE2=OFF					# add params to CFLAGS
-		-DENABLE_SSE3=OFF
-		-DENABLE_SSSE3=OFF
-		-DENABLE_SSE41=OFF
-		-DENABLE_SSE42=OFF
-		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
-	)
-
-	if use qt4; then
-		mycmakeargs+=( "-DWITH_QT=4" )
-	else
-		mycmakeargs+=( "-DWITH_QT=OFF" )
-	fi
-
-	if use cuda; then
-		if [[ "$(gcc-version)" > "4.7" ]]; then
-			ewarn "CUDA and >=sys-devel/gcc-4.8 do not play well together. Disabling CUDA support."
-			mycmakeargs+=( "-DWITH_CUDA=OFF" )
-			mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-			mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-		else
-			mycmakeargs+=( "-DWITH_CUDA=ON" )
-			mycmakeargs+=( "-DWITH_CUBLAS=ON" )
-			mycmakeargs+=( "-DWITH_CUFFT=ON" )
-		fi
-	else
-		mycmakeargs+=( "-DWITH_CUDA=OFF" )
-		mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-		mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-	fi
-
-	if use examples && use python; then
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" )
-	else
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" )
-	fi
-
-	# things we want to be hard off or not yet figured out
-	mycmakeargs+=(
-		"-DOPENCV_BUILD_3RDPARTY_LIBS=OFF"
-		"-DBUILD_LATEX_DOCS=OFF"
-		"-DBUILD_PACKAGE=OFF"
-		"-DENABLE_PROFILING=OFF"
-	)
-
-	# things we want to be hard enabled not worth useflag
-	mycmakeargs+=(
-		"-DCMAKE_SKIP_RPATH=ON"
-		"-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}"
-	)
-
-	# hardcode cuda paths
-	mycmakeargs+=(
-		"-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda"
-	)
-
-	# workaround for bug 413429
-	tc-export CC CXX
-
-	cmake-utils_src_configure
-}

diff --git a/media-libs/opencv/opencv-2.4.9.ebuild b/media-libs/opencv/opencv-2.4.9.ebuild
deleted file mode 100644
index e192c8d..0000000
--- a/media-libs/opencv/opencv-2.4.9.ebuild
+++ /dev/null
@@ -1,220 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-PYTHON_COMPAT=( python2_7 )
-
-inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
-HOMEPAGE="http://opencv.willowgarage.com"
-
-SRC_URI="mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip"
-
-LICENSE="BSD"
-SLOT="0/2.4"
-KEYWORDS="amd64 ~arm ppc ~ppc64 x86 ~amd64-linux"
-IUSE="cuda doc +eigen examples ffmpeg gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 testprograms threads tiff v4l vtk xine"
-REQUIRED_USE="
-	python? ( ${PYTHON_REQUIRED_USE} )
-"
-
-# 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? ( !qt4 )
-#	opengl? ( || ( gtk qt4 ) )
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2
-	sys-libs/zlib
-	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
-	ffmpeg? (
-		libav? ( media-video/libav:0= )
-		!libav? ( media-video/ffmpeg:0= )
-	)
-	gstreamer? (
-		media-libs/gstreamer:0.10
-		media-libs/gst-plugins-base:0.10
-	)
-	gtk? (
-		dev-libs/glib:2
-		x11-libs/gtk+:2
-		opengl? ( x11-libs/gtkglext )
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/jasper )
-	ieee1394? (
-		media-libs/libdc1394
-		sys-libs/libraw1394
-	)
-	ipp? ( sci-libs/ipp )
-	opencl? ( virtual/opencl )
-	openexr? ( media-libs/openexr )
-	opengl? ( virtual/opengl virtual/glu )
-	png? ( media-libs/libpng:0= )
-	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
-	qt4? (
-		dev-qt/qtgui:4
-		dev-qt/qttest:4
-		opengl? ( dev-qt/qtopengl:4 )
-	)
-	threads? ( dev-cpp/tbb )
-	tiff? ( media-libs/tiff:0 )
-	v4l? ( >=media-libs/libv4l-0.8.3 )
-	vtk? ( sci-libs/vtk[rendering] )
-	xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	eigen? ( dev-cpp/eigen:3 )
-	java? ( >=virtual/jdk-1.6 )
-"
-
-pkg_setup() {
-	use python && python-single-r1_pkg_setup
-	java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
-
-	epatch "${FILESDIR}/${PN}-2.3.1a-libav-0.7.patch" \
-        	"${FILESDIR}/${PN}-2.4.3-gcc47.patch" \
-        	"${FILESDIR}/${PN}-2.4.2-cflags.patch" \
-        	"${FILESDIR}/${PN}-2.4.8-javamagic.patch" \
-        	"${FILESDIR}/${PN}-2.4.9-cuda.patch" \
-        	"${FILESDIR}/${PN}-2.4.9-libav10.patch" \
-        	"${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch" \
-		"${FILESDIR}/${P}-git-autodetect.patch"
-
-	# remove bundled stuff
-	rm -rf 3rdparty
-	sed -i \
-		-e '/add_subdirectory(3rdparty)/ d' \
-		CMakeLists.txt || die
-
-	java-pkg-opt-2_src_prepare
-}
-
-src_configure() {
-	if use openmp; then
-		tc-has-openmp || die "Please switch to an openmp compatible compiler"
-	fi
-
-	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
-
-	# please dont sort here, order is the same as in CMakeLists.txt
-	local mycmakeargs=(
-	# the optinal dependency libraries
-		$(cmake-utils_use_with ieee1394 1394)
-		-DWITH_AVFOUNDATION=OFF
-		-DWITH_CARBON=OFF
-		$(cmake-utils_use_with eigen)
-		$(cmake-utils_use_with ffmpeg)
-		$(cmake-utils_use_with gstreamer)
-		$(cmake-utils_use_with gtk)
-		$(cmake-utils_use_with ipp)
-		$(cmake-utils_use_with java)
-		$(cmake-utils_use_with jpeg2k JASPER)
-		$(cmake-utils_use_with jpeg)
-		$(cmake-utils_use_with opencl)
-	#	$(cmake-utils_use_with opencl OPENCLAMDFFT)
-	#	$(cmake-utils_use_with opencl OPENCLAMDBLAS)
-		$(cmake-utils_use_with openexr)
-		$(cmake-utils_use_with opengl)
-		$(cmake-utils_use_with openmp)
-		-DWITH_OPENNI=OFF					# not packaged
-		$(cmake-utils_use_with png)
-		$(cmake-utils_use_build python opencv_python)
-		-DWITH_PVAPI=OFF					# not packaged
-		-DWITH_QUICKTIME=OFF
-		$(cmake-utils_use_with threads TBB)
-		$(cmake-utils_use_with tiff)
-		-DWITH_UNICAP=OFF					# not packaged
-		$(cmake-utils_use_with v4l V4L)
-		$(cmake-utils_use_with vtk VTK)
-		-DWITH_LIBV4L=ON
-		-DWITH_VIDEOINPUT=OFF					# windows only
-		-DWITH_XIMEA=OFF					# windows only
-		$(cmake-utils_use_with xine)
-	# the build components
-		-DBUILD_SHARED_LIBS=ON
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		$(cmake-utils_use_build doc DOCS)
-		$(cmake-utils_use_build examples)
-		-DBUILD_PERF_TESTS=OFF
-		$(cmake-utils_use_build testprograms TESTS)
-	# install examples, tests etc
-		$(cmake-utils_use examples INSTALL_C_EXAMPLES)
-		$(cmake-utils_use testprograms INSTALL_TESTS)
-	# build options
-		$(cmake-utils_use_enable pch PRECOMPILED_HEADERS)
-		-DENABLE_OMIT_FRAME_POINTER=OFF				#
-		-DENABLE_FAST_MATH=OFF					#
-		-DENABLE_SSE=OFF					# these options do nothing but
-		-DENABLE_SSE2=OFF					# add params to CFLAGS
-		-DENABLE_SSE3=OFF
-		-DENABLE_SSSE3=OFF
-		-DENABLE_SSE41=OFF
-		-DENABLE_SSE42=OFF
-		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
-	)
-
-	if use qt4; then
-		mycmakeargs+=( "-DWITH_QT=4" )
-	else
-		mycmakeargs+=( "-DWITH_QT=OFF" )
-	fi
-
-	if use cuda; then
-		if [[ "$(gcc-version)" > "4.7" ]]; then
-			ewarn "CUDA and >=sys-devel/gcc-4.8 do not play well together. Disabling CUDA support."
-			mycmakeargs+=( "-DWITH_CUDA=OFF" )
-			mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-			mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-		else
-			mycmakeargs+=( "-DWITH_CUDA=ON" )
-			mycmakeargs+=( "-DWITH_CUBLAS=ON" )
-			mycmakeargs+=( "-DWITH_CUFFT=ON" )
-		fi
-	else
-		mycmakeargs+=( "-DWITH_CUDA=OFF" )
-		mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-		mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-	fi
-
-	if use examples && use python; then
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" )
-	else
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" )
-	fi
-
-	# things we want to be hard off or not yet figured out
-	mycmakeargs+=(
-		"-DOPENCV_BUILD_3RDPARTY_LIBS=OFF"
-		"-DBUILD_LATEX_DOCS=OFF"
-		"-DBUILD_PACKAGE=OFF"
-		"-DENABLE_PROFILING=OFF"
-	)
-
-	# things we want to be hard enabled not worth useflag
-	mycmakeargs+=(
-		"-DCMAKE_SKIP_RPATH=ON"
-		"-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}"
-	)
-
-	# hardcode cuda paths
-	mycmakeargs+=(
-		"-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda"
-	)
-
-	# workaround for bug 413429
-	tc-export CC CXX
-
-	cmake-utils_src_configure
-}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2016-06-09 18:27 Amy Winston
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Winston @ 2016-06-09 18:27 UTC (permalink / raw
  To: gentoo-commits

commit:     dbd568dda672d12c7bf7b6a3b4522e3631af1bb3
Author:     Amy Winston <amynka <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  9 18:23:58 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Thu Jun  9 18:25:42 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbd568dd

media-libs/opencv: eapi=6 bump

- Fix cuda bug #577410
- Add qt5 support
- Remove doc useflag bug #556198

Package-Manager: portage-2.2.28

 .../files/opencv-2.4.12-git-autodetect.patch       |   4 +-
 media-libs/opencv/opencv-2.4.12-r1.ebuild          | 241 +++++++++++++++++++++
 2 files changed, 243 insertions(+), 2 deletions(-)

diff --git a/media-libs/opencv/files/opencv-2.4.12-git-autodetect.patch b/media-libs/opencv/files/opencv-2.4.12-git-autodetect.patch
index e981c37..8d6fcaf 100644
--- a/media-libs/opencv/files/opencv-2.4.12-git-autodetect.patch
+++ b/media-libs/opencv/files/opencv-2.4.12-git-autodetect.patch
@@ -1,5 +1,5 @@
---- opencv-2.4.12/work/opencv-2.4.12/CMakeLists.txt.old	2016-04-07 14:44:17.461912634 +0200
-+++ opencv-2.4.12/work/opencv-2.4.12/CMakeLists.txt	2016-04-07 14:45:10.674910396 +0200
+--- a/CMakeLists.txt	2016-04-07 14:44:17.461912634 +0200
++++ b/CMakeLists.txt	2016-04-07 14:45:10.674910396 +0200
 @@ -388,32 +388,32 @@
  # ----------------------------------------------------------------------------
  

diff --git a/media-libs/opencv/opencv-2.4.12-r1.ebuild b/media-libs/opencv/opencv-2.4.12-r1.ebuild
new file mode 100644
index 0000000..16b48f7
--- /dev/null
+++ b/media-libs/opencv/opencv-2.4.12-r1.ebuild
@@ -0,0 +1,241 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+PYTHON_COMPAT=( python2_7 )
+
+inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+SRC_URI="https://github.com/Itseez/opencv/archive/${PV}.zip -> ${P}.zip"
+
+LICENSE="BSD"
+SLOT="0/2.4"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
+IUSE="cuda +eigen examples ffmpeg gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 qt5 testprograms threads tiff v4l vtk xine"
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	?? ( qt4 qt5 )
+"
+
+# 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? ( !qt4 )
+#	opengl? ( || ( gtk qt4 ) )
+#	openmp? ( !threads )
+
+RDEPEND="
+	app-arch/bzip2
+	sys-libs/zlib
+	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper )
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+	)
+	ipp? ( sci-libs/ipp )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
+	qt4? (
+		dev-qt/qtgui:4
+		dev-qt/qttest:4
+		opengl? ( dev-qt/qtopengl:4 )
+	)
+	qt5? (
+		dev-qt/qtgui:5
+		dev-qt/qttest:5
+		dev-qt/qtconcurrent:5
+		opengl? ( dev-qt/qtopengl:5 )
+	)
+	threads? ( dev-cpp/tbb )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	xine? ( media-libs/xine-lib )
+"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java? ( >=virtual/jdk-1.6 )
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.3.1a-libav-0.7.patch"
+	"${FILESDIR}/${PN}-2.4.3-gcc47.patch"
+	"${FILESDIR}/${PN}-2.4.2-cflags.patch"
+	"${FILESDIR}/${PN}-2.4.8-javamagic.patch"
+	"${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch"
+	"${FILESDIR}/${P}-git-autodetect.patch"
+	)
+
+pkg_setup() {
+	use python && python-single-r1_pkg_setup
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	# remove bundled stuff
+	rm -rf 3rdparty || die "Removing 3rd party components failed"
+	sed -i \
+		-e '/add_subdirectory(3rdparty)/ d' \
+		CMakeLists.txt || die
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+	if use openmp; then
+		tc-has-openmp || die "Please switch to an openmp compatible compiler"
+	fi
+
+	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
+
+	# please dont sort here, order is the same as in CMakeLists.txt
+	local mycmakeargs=(
+	# the optinal dependency libraries
+		-DWITH_1394=$(usex ieee1394 ON OFF)
+		-DWITH_AVFOUNDATION=OFF
+		-DWITH_VTK=$(usex vtk ON OFF)
+		-DWITH_EIGEN=$(usex eigen ON OFF)
+		-DWITH_VFW=OFF
+		-DWITH_FFMPEG=$(usex ffmpeg ON OFF)
+		-DWITH_GSTREAMER=$(usex gstreamer ON OFF)
+		-DWITH_GSTREAMER_0_10=OFF
+		-DWITH_GTK=$(usex gtk ON OFF)
+		-DWITH_IMAGEIO=OFF
+		-DWITH_IPP=$(usex ipp ON OFF)
+		-DWITH_JASPER=$(usex jpeg2k ON OFF)
+		-DWITH_JPEG=$(usex jpeg ON OFF)
+		-DWITH_OPENEXR=$(usex openexr ON OFF)
+		-DWITH_OPENGL=$(usex opengl ON OFF)
+		-DWITH_OPENCL=$(usex opencl ON OFF)
+		-DWITH_OPENNI=OFF
+		-DWITH_PNG=$(usex png ON OFF)
+		-DWITH_PVAPI=OFF
+		-DWITH_GIGEAPI=OFF
+		-DWITH_WIN32UI=OFF
+		-DWITH_QUICKTIME=OFF
+		-DWITH_TBB=$(usex threads ON OFF)
+		-DWITH_OPENMP=$(usex openmp ON OFF)
+		-DWITH_CSTRIPES=OFF
+		-DWITH_TIFF=$(usex tiff ON OFF)
+		-DWITH_UNICAP=OFF
+		-DWITH_V4L=$(usex v4l ON OFF)
+		-DWITH_LIBV4L=$(usex v4l ON OFF)
+		-DWITH_DSHOW=ON
+		-DWITH_MSMF=OFF
+		-DWITH_XIMEA=OFF
+		-DWITH_XINE=$(usex xine ON OFF)
+		-DWITH_OPENCL=$(usex opencl ON OFF)
+		-DWITH_OPENCLAMDFFT=$(usex opencl ON OFF)
+		-DWITH_OPENCLAMDBLAS=$(usex opencl ON OFF)
+		-DWITH_INTELPERC=OFF
+		-DWITH_JAVA=$(usex java ON OFF)
+
+		# the build components
+		-DBUILD_SHARED_LIBS=ON
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		-DBUILD_DOCS=OFF #too much dark magic in cmakelists
+		-DBUILD_EXAMPLES=$(usex examples ON OFF)
+		-DBUILD_PERF_TESTS=OFF
+		-DBUILD_TESTS=$(usex testprograms ON OFF)
+
+		# install examples
+		-DINSTALL_C_EXAMPLES=$(usex examples ON OFF)
+		-DINSTALL_TESTS=$(usex testprograms ON OFF)
+
+		# build options
+		-DENABLE_PRECOMPILED_HEADERS=$(usex pch ON OFF)
+		-DENABLE_SOLUTION_FOLDERS=OFF
+		-DENABLE_PROFILING=OFF
+		-DENABLE_COVERAGE=OFF
+		-DENABLE_OMIT_FRAME_POINTER=OFF
+		-DENABLE_FAST_MATH=OFF					#
+		-DENABLE_SSE=OFF					# these options do nothing but
+		-DENABLE_SSE2=OFF					# add params to CFLAGS
+		-DENABLE_SSE3=OFF
+		-DENABLE_SSSE3=OFF
+		-DENABLE_SSE41=OFF
+		-DENABLE_SSE42=OFF
+
+		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
+	)
+
+	if use qt4; then
+		mycmakeargs+=( -DWITH_QT=4 )
+	elif use qt5; then
+		mycmakeargs+=( -DWITH_QT=5 )
+	else
+		mycmakeargs+=( -DWITH_QT=OFF )
+	fi
+
+	if use cuda; then
+		if [[ "$(gcc-version)" > "4.8" ]]; then
+			# bug 577410 
+			# #error -- unsupported GNU version! gcc 4.9 and up are not supported!
+			ewarn "CUDA and >=sys-devel/gcc-4.9 do not play well together. Disabling CUDA support."
+			mycmakeargs+=( -DWITH_CUDA=OFF )
+			mycmakeargs+=( -DWITH_CUBLAS=OFF )
+			mycmakeargs+=( -DWITH_CUFFT=OFF )
+
+		else
+			mycmakeargs+=( -DWITH_CUDA=ON )
+			mycmakeargs+=( -DWITH_CUBLAS=ON )
+			mycmakeargs+=( -DWITH_CUFFT=ON )
+			mycmakeargs+=( -DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda )
+		fi
+	else
+		mycmakeargs+=( -DWITH_CUDA=OFF )
+		mycmakeargs+=( -DWITH_CUBLAS=OFF )
+		mycmakeargs+=( -DWITH_CUFFT=OFF )
+	fi
+
+	if use examples && use python; then
+		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=ON )
+	else
+		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=OFF )
+	fi
+
+	# things we want to be hard off or not yet figured out
+	mycmakeargs+=(
+		-DOPENCV_BUILD_3RDPARTY_LIBS=OFF
+		-DBUILD_PACKAGE=OFF
+	)
+
+	# things we want to be hard enabled not worth useflag
+	mycmakeargs+=(
+		-DCMAKE_SKIP_RPATH=ON
+		-DOPENCV_DOC_INSTALL_PATH=
+	)
+
+	# workaround for bug 413429
+	tc-export CC CXX
+
+	cmake-utils_src_configure
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2016-11-08  7:01 Amy Winston
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Winston @ 2016-11-08  7:01 UTC (permalink / raw
  To: gentoo-commits

commit:     7701033807a21a0c5c52780efa1a1b059e3e9b95
Author:     Jonathan Scruggs <j.scruggs <AT> gmail <DOT> com>
AuthorDate: Mon Nov  7 12:47:07 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Tue Nov  8 06:51:30 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=77010338

media-libs/opencv: revision bump to 3.1.0-r6

* Update SRC_URI to the new URLs
* Switch to downloading the tar.gz instead zip file
* Add git hash to end of contrib download to allow revision bumps
* Updated revision of contrib modules to fix various errors
* Remove Qt 4 support to follow the new Gentoo standard
* Use new OpenMP test logic
* Added patch to build against CUDA v8.
  Patch based on one submitted by Sven Eden
  Gentoo-bug: 598674
  Gentoo-bug: 597754
* Added Tesseract use flag and fixed building against it.
  Gentoo-bug: 572836
  Gentoo-bug: 584428
* Added use flag for the SFM module because of dependencies
  on several Google libraries
  Gentoo-bug: 597166
* Added use flag for the HDF module because of a dependency
  on media-libs/hdaf5
  Gentoo-bug: 596212
* Added use flag for the CVV module because it will silently
  fail if Qt 5 is not installed.
* Added patch to fix the finding of certain libraries
  Gentoo-Bug: 584478

Signed-off by: Jonathan Scruggs (j.scruggs <AT> gmail.com)

 media-libs/opencv/Manifest                         |   2 +
 .../files/opencv-3.1.0-find-libraries-fix.patch    |  48 ++++
 .../opencv-3.1.0-remove-graphcut-for-cuda-8.patch  |  23 ++
 media-libs/opencv/metadata.xml                     |   6 +
 media-libs/opencv/opencv-3.1.0-r6.ebuild           | 296 +++++++++++++++++++++
 5 files changed, 375 insertions(+)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 82a9d48..624ef49 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,5 +1,7 @@
 DIST opencv-2.4.12.zip 93261101 SHA256 2a7e47da87b9119be922f010a1059539e96130c242f4d38e2dbb445ccbeccbc1 SHA512 3f9142ef23181f93200413b456c11235ecac11c322ccf3f89cc3740bfa9d9228508948cee245583103029e9f6abf1c5d0c5d249eff400e65b3655153bc6dbb05 WHIRLPOOL 86488d91cfac4c980e4f794d6d7e40bf93803f4d79defc991647af742198b845db796b1578b5d79a12a71ecbb04d8430a49c1538d6f86f1288c2a31efefc2548
 DIST opencv-3.0.0.zip 100980799 SHA256 07094ea2f996f2622d572f0f3a162d698c8a547520341ca9109fbaf9363fb001 SHA512 108d0fdcc60b5688ebf61c930fb965ec81f0d3c36bb1797f6cc571fac35331f540773207fd1cb81b12c05c8f4d1af20c4a2452d9f75cd0cae4acd8131be92375 WHIRLPOOL 61cbbf5201b1dea75ffa998d1f55ee35f098bb8f76591cc9705de13b9f05eaefd19dcc74e93d2643d9b721e62483a36547617ec2e3d14fa6a2522e18ccf06747
+DIST opencv-3.1.0.tar.gz 76135587 SHA256 f00b3c4f42acda07d89031a2ebb5ebe390764a133502c03a511f67b78bbd4fbf SHA512 57e0fe41e3d5d1dc036e7fc5673523e53d54f5f62e4d3bcb95238a9cd53e79da7c1704dc136ce632f7cfce369ebf5eb27f629a9b6ac4f7fa34120b80b5c7438f WHIRLPOOL b2825d5cafa87e0fe9cacd093ddb969913d916c0370819073b2bde3c598798efcf23c406aae2116f2628c564ca99e5f871a448a3ece97d8d29ec73841ac283b4
 DIST opencv-3.1.0.zip 79186131 SHA256 1f6990249fdb82804fff40e96fa6d99949023ab0e3277eae4bd459b374e622a4 SHA512 b4915e8838fce8ba9e1af8b11e46678624435e9a41592e645413dfdc830993eaa017d337fe4c212a49f096421a6317a1892546087fbc3cfdab554522336c0f1a WHIRLPOOL 3c38715e2abc431781b724199c2cf06f844c7a889c51a06ecb64889a8ca36d9fd370a0738deec2995e24e453cb64f5db228238681714f62daf6eac50d95a4914
+DIST opencv-3.1.0_contrib-75b3ea9.tar.gz 54277105 SHA256 478f742457d3f4e96f857b726e35b28a8d20a1de8e5f51b8671251bc896d443b SHA512 d1d11520b8729fbaf0257c927654251ff9ac1ba5cf937af9dd973ec39f483d1ee08aff7ad3f1a9941fef921a35dc466ac5574918197ddecd3f6c66b682bf671a WHIRLPOOL 18b70014428c4fa532658ca5ac332bffaae049b468f46cb027a6972f21f5b2bd17d02b33d68c43b84f821a77fa09efb9c372499cfa4f645a0516b93acb858353
 DIST opencv-3.1.0_contrib.zip 55182211 SHA256 5082b5df7179ff71f4681747c482169f0d5d5b77605816cfe5b93c588021fbb4 SHA512 f0ceb8d9ed85efe948a40071793d164a82391a462c52ca71a6029e8b119afdab8b1453baaed2cd7d540001559849a62ec4b745d41345db225acff0531c76e762 WHIRLPOOL 589294c849a00426f4c52d07ab652e71e8bbc74efd0878fbaea2e089051fd118217b1a04f33258fcef2abe1729147282eb17a98c5463691aa3fd56af264ea6a0
 DIST opencv_contrib.zip 76144299 SHA256 ba780e61e9659aac299055d68c9fe40258e3fab7cb167892163eb5732387c4bb SHA512 9253a9d209368da5bea5f0138c55379132467b840d25fc5eaa1bc0103e6da61d6facf206456ff3f4bb68482d9c6381e23a566cb4dd155ac9ff9a259e54f7ffbf WHIRLPOOL 411febd3d5912ea28b570b217e3af41bee2d48daf5f47b0de6125b40cfbf435216c668545b3e0dfa48e4eef8d4a86135058ee72dc7b5a4244b661130a6916843

diff --git a/media-libs/opencv/files/opencv-3.1.0-find-libraries-fix.patch b/media-libs/opencv/files/opencv-3.1.0-find-libraries-fix.patch
new file mode 100644
index 00000000..52f4db6
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-find-libraries-fix.patch
@@ -0,0 +1,48 @@
+diff -purN a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
+--- a/cmake/OpenCVFindLibsGrfmt.cmake	2015-12-18 15:02:16.000000000 +0000
++++ b/cmake/OpenCVFindLibsGrfmt.cmake	2016-11-07 13:18:04.567340791 +0000
+@@ -18,7 +18,7 @@ endif()
+ if(NOT ZLIB_FOUND)
+   ocv_clear_vars(ZLIB_LIBRARY ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
+ 
+-  set(ZLIB_LIBRARY zlib)
++  set(ZLIB_LIBRARY z)
+   add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/zlib")
+   set(ZLIB_INCLUDE_DIRS "${${ZLIB_LIBRARY}_SOURCE_DIR}" "${${ZLIB_LIBRARY}_BINARY_DIR}")
+   set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
+@@ -40,7 +40,7 @@ if(WITH_TIFF)
+   if(NOT TIFF_FOUND)
+     ocv_clear_vars(TIFF_LIBRARY TIFF_LIBRARIES TIFF_INCLUDE_DIR)
+ 
+-    set(TIFF_LIBRARY libtiff)
++    set(TIFF_LIBRARY tiff)
+     set(TIFF_LIBRARIES ${TIFF_LIBRARY})
+     add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libtiff")
+     set(TIFF_INCLUDE_DIR "${${TIFF_LIBRARY}_SOURCE_DIR}" "${${TIFF_LIBRARY}_BINARY_DIR}")
+@@ -79,7 +79,7 @@ if(WITH_JPEG)
+   if(NOT JPEG_FOUND)
+     ocv_clear_vars(JPEG_LIBRARY JPEG_LIBRARIES JPEG_INCLUDE_DIR)
+ 
+-    set(JPEG_LIBRARY libjpeg)
++    set(JPEG_LIBRARY jpeg)
+     set(JPEG_LIBRARIES ${JPEG_LIBRARY})
+     add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjpeg")
+     set(JPEG_INCLUDE_DIR "${${JPEG_LIBRARY}_SOURCE_DIR}")
+@@ -136,7 +136,7 @@ if(WITH_JASPER)
+   if(NOT JASPER_FOUND)
+     ocv_clear_vars(JASPER_LIBRARY JASPER_LIBRARIES JASPER_INCLUDE_DIR)
+ 
+-    set(JASPER_LIBRARY libjasper)
++    set(JASPER_LIBRARY jasper)
+     set(JASPER_LIBRARIES ${JASPER_LIBRARY})
+     add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libjasper")
+     set(JASPER_INCLUDE_DIR "${${JASPER_LIBRARY}_SOURCE_DIR}")
+@@ -169,7 +169,7 @@ if(WITH_PNG)
+   if(NOT PNG_FOUND)
+     ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
+ 
+-    set(PNG_LIBRARY libpng)
++    set(PNG_LIBRARY png)
+     set(PNG_LIBRARIES ${PNG_LIBRARY})
+     add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/libpng")
+     set(PNG_INCLUDE_DIR "${${PNG_LIBRARY}_SOURCE_DIR}")

diff --git a/media-libs/opencv/files/opencv-3.1.0-remove-graphcut-for-cuda-8.patch b/media-libs/opencv/files/opencv-3.1.0-remove-graphcut-for-cuda-8.patch
new file mode 100644
index 00000000..64761a2
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.1.0-remove-graphcut-for-cuda-8.patch
@@ -0,0 +1,23 @@
+From 10896129b39655e19e4e7c529153cb5c2191a1db Mon Sep 17 00:00:00 2001
+From: Vladislav Vinogradov <vlad.vinogradov@itseez.com>
+Date: Fri, 6 May 2016 11:37:32 +0300
+Subject: [PATCH] GraphCut deprecated in CUDA 7.5 and removed in 8.0
+
+---
+ modules/cudalegacy/src/graphcuts.cpp | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/modules/cudalegacy/src/graphcuts.cpp b/modules/cudalegacy/src/graphcuts.cpp
+index eb08c3c..1a1eb85 100644
+--- a/modules/cudalegacy/src/graphcuts.cpp
++++ b/modules/cudalegacy/src/graphcuts.cpp
+@@ -42,7 +42,8 @@
+ 
+ #include "precomp.hpp"
+ 
+-#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
++// GraphCut has been removed in NPP 8.0
++#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000)
+ 
+ void cv::cuda::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); }
+ void cv::cuda::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); }

diff --git a/media-libs/opencv/metadata.xml b/media-libs/opencv/metadata.xml
index fe2e2d9..bc331e3 100644
--- a/media-libs/opencv/metadata.xml
+++ b/media-libs/opencv/metadata.xml
@@ -24,8 +24,14 @@ Face Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion Under
 		<flag name="cuda">Enable NVIDIA Cuda computations support</flag>
 		<flag name="eigen">Enable usage of <pkg>dev-cpp/eigen</pkg> for computations</flag>
 		<flag name="gdal">Enable support for sci-libs/gdal library</flag>
+		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="gflags">Use Google's C++ argument parsing library</flag>
+		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="glog">Use Google's C++ loggin library</flag>
 		<flag name="ipp">Enable Intel Integrated Primitive support</flag>
+		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contrib_cvv">CVV module requires Qt5</flag>
+		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contrib_hdf">HDF module requires <pkg>sci-libs/hdf5</pkg></flag>
+		<flag restrict="&gt;=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>
+		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="tesseract">Use Google's OCR Engine</flag>
 		<flag name="testprograms">Build and install programs for testing OpenCV (performance)</flag>
 		<flag name="vtk">Build new 3D visualization module viz based on sci-libs/vtk</flag>
 		<flag name="webp">Enable support for webp image format</flag>

diff --git a/media-libs/opencv/opencv-3.1.0-r6.ebuild b/media-libs/opencv/opencv-3.1.0-r6.ebuild
new file mode 100644
index 00000000..a6adf6f
--- /dev/null
+++ b/media-libs/opencv/opencv-3.1.0-r6.ebuild
@@ -0,0 +1,296 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit toolchain-funcs cmake-utils python-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for
+	various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+BASE_URI="https://github.com/${PN}/${PN}"
+#commit from Thu, 02 Jun 2016
+CONTRIB_URI="75b3ea9f72fdb083140fc63855b7677d67748376"
+CONTRIB_P="${P}_contrib-${CONTRIB_URI:0:7}"
+
+SRC_URI="${BASE_URI}/archive/${PV}.tar.gz -> ${P}.tar.gz
+	contrib? ( ${BASE_URI}_contrib/archive/${CONTRIB_URI}.tar.gz -> ${CONTRIB_P}.tar.gz )"
+LICENSE="BSD"
+SLOT="0/3.1" # subslot = libopencv* soname version
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
+IUSE="contrib cuda +eigen examples ffmpeg gdal gflags glog gphoto2 gstreamer gtk \
+	ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png \
+	+python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine \
+	contrib_cvv contrib_hdf contrib_sfm"
+
+# 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_hdf? ( contrib )
+	contrib_sfm? ( contrib eigen gflags glog )
+	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
+	sys-libs/zlib
+	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gdal? ( sci-libs/gdal )
+	gflags? ( dev-cpp/gflags )
+	glog? ( dev-cpp/glog )
+	gphoto2? ( media-libs/libgphoto2 )
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper )
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+	)
+	ipp? ( sci-libs/ipp )
+	contrib_hdf? ( sci-libs/hdf5 )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	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 )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	webp? ( media-libs/libwebp )
+	xine? ( media-libs/xine-lib )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java?  ( >=virtual/jdk-1.6 )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-3.0.0-gles.patch
+	"${FILESDIR}"/${P}-cmake-no-opengl.patch
+	"${FILESDIR}"/${P}-git-autodetect.patch
+	"${FILESDIR}"/${P}-java-magic.patch
+	"${FILESDIR}"/${P}-gentooify-python.patch
+	"${FILESDIR}"/${P}-remove-graphcut-for-cuda-8.patch
+	"${FILESDIR}"/${P}-find-libraries-fix.patch
+)
+
+GLOBALCMAKEARGS=()
+
+pkg_pretend() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	# remove bundled stuff
+	rm -rf 3rdparty || die "Removing 3rd party components failed"
+	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
+	    -i CMakeLists.txt cmake/*cmake || die
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+	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
+
+	# 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=$(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=OFF
+		-DWITH_IPP=$(usex ipp)
+		-DWITH_JASPER=$(usex jpeg2k)
+		-DWITH_JPEG=$(usex jpeg)
+		-DWITH_WEBP=$(usex webp)
+		-DWITH_OPENEXR=$(usex openexr)
+		-DWITH_OPENGL=$(usex opengl)
+		-DWITH_OPENNI=OFF 		# Not packaged
+		-DWITH_OPENNI2=OFF 		# Not packaged
+		-DWITH_PNG=$(usex png)
+		-DWITH_PVAPI=OFF		# Not packaged
+		-DWITH_GIGEAPI=OFF
+		-DWITH_QT=$(usex qt5 5 OFF)
+		-DWITH_WIN32UI=OFF		# Windows only
+		-DWITH_QUICKTIME=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=$(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=$(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=$(usex gdal)
+		-DWITH_GPHOTO2=$(usex gphoto2)
+	# ===================================================
+	# CUDA build components: nvidia-cuda-toolkit takes care of GCC version
+	# ===================================================
+		-DWITH_CUDA=$(usex cuda)
+		-DWITH_CUBLAS=$(usex cuda)
+		-DWITH_CUFFT=$(usex cuda)
+		-DCUDA_NPP_LIBRARY_ROOT_DIR=$(usex cuda "${EPREFIX}/opt/cuda" "")
+	# ===================================================
+	# OpenCV build components
+	# ===================================================
+		-DBUILD_SHARED_LIBS=ON
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		-DBUILD_DOCS=OFF # Doesn't install anyways.
+		-DBUILD_EXAMPLES=$(usex examples)
+		-DBUILD_PERF_TESTS=OFF
+		-DBUILD_TESTS=$(usex testprograms)
+		-DOPENCV_EXTRA_MODULES_PATH=$(usex contrib "${WORKDIR}/opencv_contrib-${CONTRIB_URI}/modules" "")
+	# ===================================================
+	# OpenCV installation options
+	# ===================================================
+		-DINSTALL_C_EXAMPLES=$(usex examples)
+		-DINSTALL_TESTS=$(usex testprograms)
+	# ===================================================
+	# OpenCV build options
+	# ===================================================
+		-DENABLE_PRECOMPILED_HEADERS=$(usex pch)
+		-DHAVE_opencv_java=$(usex java YES NO)
+	# ===================================================
+	# things we want to be hard off or not yet figured out
+	# ===================================================
+		-DBUILD_PACKAGE=OFF
+		-DENABLE_PROFILING=OFF
+	# ===================================================
+	# 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=OFF
+			-DBUILD_opencv_dnns_easily_fooled=OFF
+			-DBUILD_opencv_cvv=$(usex contrib_cvv ON OFF)
+			-DBUILD_opencv_hdf=$(usex contrib_hdf ON OFF)
+			-DBUILD_opencv_sfm=$(usex contrib_sfm ON OFF)
+		)
+	fi
+
+	# workaround for bug 413429
+	tc-export CC CXX
+
+	local mycmakeargs=( ${GLOBALCMAKEARGS[@]}
+			    -DWITH_PYTHON=OFF
+			    -DINSTALL_PYTHON_EXAMPLES=OFF
+	)
+
+	cmake-utils_src_configure
+}
+
+python_module_compile() {
+	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
+
+	# Set all python variables to load the correct Gentoo paths
+	mycmakeargs+=(
+		-DWITH_PYTHON=ON
+		-DGENTOO_PYTHON_EXECUTABLE=${EPYTHON}
+		-DGENTOO_PYTHON_INCLUDE_PATH="$(python_get_includedir)"
+		-DGENTOO_PYTHON_LIBRARIES="$(python_get_library_path)"
+		-DGENTOO_PYTHON_PACKAGES_PATH="$(python_get_sitedir)"
+		-DGENTOO_PYTHON_MAJOR=${EPYTHON:6:1}
+		-DGENTOO_PYTHON_MINOR=${EPYTHON:8:1}
+		-DGENTOO_PYTHON_DEBUG_LIBRARIES=""
+		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
+	)
+
+	# Compile and install all at once because configuration will be wiped
+	# for each impl of Python
+	BUILD_DIR="${WORKDIR}"/${P}_build
+	cd "${BUILD_DIR}" || die "cd failed"
+
+	# 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.
+	emake -C modules/${EPYTHON:0:7} clean
+	rm -rf modules/${EPYTHON:0:7} || die "rm failed"
+}
+
+src_install() {
+	cmake-utils_src_install
+
+	# Build and install the python modules for all targets
+	use python && python_foreach_impl python_module_compile
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2016-11-08  7:01 Amy Winston
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Winston @ 2016-11-08  7:01 UTC (permalink / raw
  To: gentoo-commits

commit:     a6629e1c0dbbbc67db09b096ca7a2c54eae73dc1
Author:     Jonathan Scruggs <j.scruggs <AT> gmail <DOT> com>
AuthorDate: Mon Nov  7 17:43:43 2016 +0000
Commit:     Amy Winston <amynka <AT> gentoo <DOT> org>
CommitDate: Tue Nov  8 06:52:08 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6629e1c

media-libs/opencv: Remove old ebuilds and patches Some ebuilds don't work, so there's no point in keeping them.

Since OpenCV 3.0.0 is no longer in the tree, the following can
be closed:
Gentoo-bug: 566080
Gentoo-bug: 557328

Signed-off by: Jonathan Scruggs (j.scruggs <AT> gmail.com)

 media-libs/opencv/Manifest                         |   4 -
 .../files/opencv-2.4.11-git-autodetect.patch       |  57 ---
 .../opencv/files/opencv-3.0.0-git-autodetect.patch |  41 ---
 .../files/opencv-3.1.0-fix-hal-headers.patch       |  91 -----
 .../files/opencv-3.1.0-fix-ocl-declaration.patch   | 214 -----------
 .../files/opencv-3.1.0-invalid-string-usage.patch  |  75 ----
 .../files/opencv-contrib-find-hdf5-fix.patch       | 392 ---------------------
 media-libs/opencv/opencv-2.4.12.ebuild             | 217 ------------
 media-libs/opencv/opencv-3.0.0.ebuild              | 221 ------------
 media-libs/opencv/opencv-3.1.0-r4.ebuild           | 268 --------------
 media-libs/opencv/opencv-3.1.0-r5.ebuild           | 300 ----------------
 11 files changed, 1880 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 624ef49..9838733 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,7 +1,3 @@
 DIST opencv-2.4.12.zip 93261101 SHA256 2a7e47da87b9119be922f010a1059539e96130c242f4d38e2dbb445ccbeccbc1 SHA512 3f9142ef23181f93200413b456c11235ecac11c322ccf3f89cc3740bfa9d9228508948cee245583103029e9f6abf1c5d0c5d249eff400e65b3655153bc6dbb05 WHIRLPOOL 86488d91cfac4c980e4f794d6d7e40bf93803f4d79defc991647af742198b845db796b1578b5d79a12a71ecbb04d8430a49c1538d6f86f1288c2a31efefc2548
-DIST opencv-3.0.0.zip 100980799 SHA256 07094ea2f996f2622d572f0f3a162d698c8a547520341ca9109fbaf9363fb001 SHA512 108d0fdcc60b5688ebf61c930fb965ec81f0d3c36bb1797f6cc571fac35331f540773207fd1cb81b12c05c8f4d1af20c4a2452d9f75cd0cae4acd8131be92375 WHIRLPOOL 61cbbf5201b1dea75ffa998d1f55ee35f098bb8f76591cc9705de13b9f05eaefd19dcc74e93d2643d9b721e62483a36547617ec2e3d14fa6a2522e18ccf06747
 DIST opencv-3.1.0.tar.gz 76135587 SHA256 f00b3c4f42acda07d89031a2ebb5ebe390764a133502c03a511f67b78bbd4fbf SHA512 57e0fe41e3d5d1dc036e7fc5673523e53d54f5f62e4d3bcb95238a9cd53e79da7c1704dc136ce632f7cfce369ebf5eb27f629a9b6ac4f7fa34120b80b5c7438f WHIRLPOOL b2825d5cafa87e0fe9cacd093ddb969913d916c0370819073b2bde3c598798efcf23c406aae2116f2628c564ca99e5f871a448a3ece97d8d29ec73841ac283b4
-DIST opencv-3.1.0.zip 79186131 SHA256 1f6990249fdb82804fff40e96fa6d99949023ab0e3277eae4bd459b374e622a4 SHA512 b4915e8838fce8ba9e1af8b11e46678624435e9a41592e645413dfdc830993eaa017d337fe4c212a49f096421a6317a1892546087fbc3cfdab554522336c0f1a WHIRLPOOL 3c38715e2abc431781b724199c2cf06f844c7a889c51a06ecb64889a8ca36d9fd370a0738deec2995e24e453cb64f5db228238681714f62daf6eac50d95a4914
 DIST opencv-3.1.0_contrib-75b3ea9.tar.gz 54277105 SHA256 478f742457d3f4e96f857b726e35b28a8d20a1de8e5f51b8671251bc896d443b SHA512 d1d11520b8729fbaf0257c927654251ff9ac1ba5cf937af9dd973ec39f483d1ee08aff7ad3f1a9941fef921a35dc466ac5574918197ddecd3f6c66b682bf671a WHIRLPOOL 18b70014428c4fa532658ca5ac332bffaae049b468f46cb027a6972f21f5b2bd17d02b33d68c43b84f821a77fa09efb9c372499cfa4f645a0516b93acb858353
-DIST opencv-3.1.0_contrib.zip 55182211 SHA256 5082b5df7179ff71f4681747c482169f0d5d5b77605816cfe5b93c588021fbb4 SHA512 f0ceb8d9ed85efe948a40071793d164a82391a462c52ca71a6029e8b119afdab8b1453baaed2cd7d540001559849a62ec4b745d41345db225acff0531c76e762 WHIRLPOOL 589294c849a00426f4c52d07ab652e71e8bbc74efd0878fbaea2e089051fd118217b1a04f33258fcef2abe1729147282eb17a98c5463691aa3fd56af264ea6a0
-DIST opencv_contrib.zip 76144299 SHA256 ba780e61e9659aac299055d68c9fe40258e3fab7cb167892163eb5732387c4bb SHA512 9253a9d209368da5bea5f0138c55379132467b840d25fc5eaa1bc0103e6da61d6facf206456ff3f4bb68482d9c6381e23a566cb4dd155ac9ff9a259e54f7ffbf WHIRLPOOL 411febd3d5912ea28b570b217e3af41bee2d48daf5f47b0de6125b40cfbf435216c668545b3e0dfa48e4eef8d4a86135058ee72dc7b5a4244b661130a6916843

diff --git a/media-libs/opencv/files/opencv-2.4.11-git-autodetect.patch b/media-libs/opencv/files/opencv-2.4.11-git-autodetect.patch
deleted file mode 100644
index 12a5ca0..00000000
--- a/media-libs/opencv/files/opencv-2.4.11-git-autodetect.patch
+++ /dev/null
@@ -1,57 +0,0 @@
---- opencv-2.4.11/work/opencv-2.4.11/CMakeLists.txt.old	2016-04-07 14:20:23.874972922 +0200
-+++ opencv-2.4.11/work/opencv-2.4.11/CMakeLists.txt	2016-04-07 14:21:15.689970743 +0200
-@@ -382,32 +382,32 @@
- # ----------------------------------------------------------------------------
- 
- # don't use FindGit because it requires CMake 2.8.2
--set(git_names git eg) # eg = easy git
-+#set(git_names git eg) # eg = easy git
- # Prefer .cmd variants on Windows unless running in a Makefile in the MSYS shell
--if(CMAKE_HOST_WIN32)
--  if(NOT CMAKE_GENERATOR MATCHES "MSYS")
--    set(git_names git.cmd git eg.cmd eg)
--  endif()
--endif()
-+#if(CMAKE_HOST_WIN32)
-+#  if(NOT CMAKE_GENERATOR MATCHES "MSYS")
-+#    set(git_names git.cmd git eg.cmd eg)
-+#  endif()
-+#endif()
- 
--find_host_program(GIT_EXECUTABLE NAMES ${git_names} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client")
--mark_as_advanced(GIT_EXECUTABLE)
-+#find_host_program(GIT_EXECUTABLE NAMES ${git_names} PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client")
-+#mark_as_advanced(GIT_EXECUTABLE)
- 
--if(GIT_EXECUTABLE)
--  execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty --match "2.[0-9].[0-9]*"
--    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
--    OUTPUT_VARIABLE OPENCV_VCSVERSION
--    RESULT_VARIABLE GIT_RESULT
--    ERROR_QUIET
--    OUTPUT_STRIP_TRAILING_WHITESPACE
--  )
--  if(NOT GIT_RESULT EQUAL 0)
--    set(OPENCV_VCSVERSION "unknown")
--  endif()
--else()
-+#if(GIT_EXECUTABLE)
-+#  execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty --match "2.[0-9].[0-9]*"
-+#    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-+#    OUTPUT_VARIABLE OPENCV_VCSVERSION
-+#    RESULT_VARIABLE GIT_RESULT
-+#    ERROR_QUIET
-+#    OUTPUT_STRIP_TRAILING_WHITESPACE
-+#  )
-+#  if(NOT GIT_RESULT EQUAL 0)
-+#    set(OPENCV_VCSVERSION "unknown")
-+#  endif()
-+#else()
-   # We don't have git:
--  set(OPENCV_VCSVERSION "unknown")
--endif()
-+#  set(OPENCV_VCSVERSION "unknown")
-+#endif()
- 
- 
- # ----------------------------------------------------------------------------

diff --git a/media-libs/opencv/files/opencv-3.0.0-git-autodetect.patch b/media-libs/opencv/files/opencv-3.0.0-git-autodetect.patch
deleted file mode 100644
index 7413075..00000000
--- a/media-libs/opencv/files/opencv-3.0.0-git-autodetect.patch
+++ /dev/null
@@ -1,41 +0,0 @@
---- opencv-3.0.0/work/opencv-3.0.0/CMakeLists.txt.old	2016-04-07 14:28:07.641953419 +0200
-+++ opencv-3.0.0/work/opencv-3.0.0/CMakeLists.txt	2016-04-07 14:28:47.713951734 +0200
-@@ -433,23 +433,23 @@
- # ----------------------------------------------------------------------------
- #  Autodetect if we are in a GIT repository
- # ----------------------------------------------------------------------------
--find_host_package(Git QUIET)
-+#find_host_package(Git QUIET)
- 
--if(GIT_FOUND)
--  execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
--    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
--    OUTPUT_VARIABLE OPENCV_VCSVERSION
--    RESULT_VARIABLE GIT_RESULT
--    ERROR_QUIET
--    OUTPUT_STRIP_TRAILING_WHITESPACE
--  )
--  if(NOT GIT_RESULT EQUAL 0)
--    set(OPENCV_VCSVERSION "unknown")
--  endif()
--else()
-+#if(GIT_FOUND)
-+#  execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
-+#    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-+#    OUTPUT_VARIABLE OPENCV_VCSVERSION
-+#    RESULT_VARIABLE GIT_RESULT
-+#    ERROR_QUIET
-+#    OUTPUT_STRIP_TRAILING_WHITESPACE
-+#  )
-+#  if(NOT GIT_RESULT EQUAL 0)
-+#    set(OPENCV_VCSVERSION "unknown")
-+#  endif()
-+#else()
-   # We don't have git:
--  set(OPENCV_VCSVERSION "unknown")
--endif()
-+#  set(OPENCV_VCSVERSION "unknown")
-+#endif()
- 
- 
- # ----------------------------------------------------------------------------

diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch b/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
deleted file mode 100644
index dd77571..00000000
--- a/media-libs/opencv/files/opencv-3.1.0-fix-hal-headers.patch
+++ /dev/null
@@ -1,91 +0,0 @@
-From f529a1df2b17bcada1179ddcaf1352e3a5ba97b8 Mon Sep 17 00:00:00 2001
-From: Maksim Shabunin <maksim.shabunin@itseez.com>
-Date: Tue, 15 Dec 2015 17:51:08 +0300
-Subject: [PATCH] Fixed HAL headers location
-
-diff --git opencv_contrib-master/modules/xfeatures2d/src/sift.cpp opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
-index fc67c4d..9634fbb 100644
---- opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
-+++ opencv_contrib-master/modules/xfeatures2d/src/sift.cpp
-@@ -105,6 +105,7 @@
- #include "precomp.hpp"
- #include <iostream>
- #include <stdarg.h>
-+#include <opencv2/core/hal/hal.hpp>
- 
- namespace cv
- {
-@@ -337,9 +338,9 @@ static float calcOrientationHist( const Mat& img, Point pt, int radius,
-     len = k;
- 
-     // compute gradient values, orientations and the weights over the pixel neighborhood
--    hal::exp(W, W, len);
--    hal::fastAtan2(Y, X, Ori, len, true);
--    hal::magnitude(X, Y, Mag, len);
-+    cv::hal::exp32f(W, W, len);
-+    cv::hal::fastAtan2(Y, X, Ori, len, true);
-+    cv::hal::magnitude32f(X, Y, Mag, len);
- 
-     for( k = 0; k < len; k++ )
-     {
-@@ -620,9 +621,9 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
-         }
- 
-     len = k;
--    hal::fastAtan2(Y, X, Ori, len, true);
--    hal::magnitude(X, Y, Mag, len);
--    hal::exp(W, W, len);
-+    cv::hal::fastAtan2(Y, X, Ori, len, true);
-+    cv::hal::magnitude32f(X, Y, Mag, len);
-+    cv::hal::exp32f(W, W, len);
- 
-     for( k = 0; k < len; k++ )
-     {
-
-diff --git opencv_contrib-master/modules/optflow/src/motempl.cpp opencv_contrib-master/modules/optflow/src/motempl.cpp
-index ec18013..452ad63 100644
---- opencv_contrib-master/modules/optflow/src/motempl.cpp
-+++ opencv_contrib-master/modules/optflow/src/motempl.cpp
-@@ -41,6 +41,7 @@
- 
- #include "precomp.hpp"
- #include "opencv2/core/utility.hpp"
-+#include "opencv2/core/hal/hal.hpp"
- #include "opencl_kernels_optflow.hpp"
- 
- namespace  cv {
-@@ -212,7 +213,7 @@ void calcMotionGradient( InputArray _mhi, OutputArray _mask,
-         float* orient_row = orient.ptr<float>(y);
-         uchar* mask_row = mask.ptr<uchar>(y);
- 
--        hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
-+        cv::hal::fastAtan2(dY_max_row, dX_min_row, orient_row, size.width, true);
- 
-         // make orientation zero where the gradient is very small
-         for( x = 0; x < size.width; x++ )
-diff --git opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
-index e89eb8f..39307e5 100644
---- opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
-+++ opencv_contrib-master/modules/ximgproc/src/fgs_filter.cpp
-@@ -35,7 +35,7 @@
-  */
- 
- #include "precomp.hpp"
--#include "opencv2/hal/intrin.hpp"
-+#include "opencv2/core/hal/intrin.hpp"
- #include <vector>
- 
- namespace cv {
-diff --git opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
-index 4780497..15530d3 100644
---- opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
-+++ opencv_contrib-master/modules/xphoto/src/grayworld_white_balance.cpp
-@@ -40,7 +40,7 @@
- #include "opencv2/xphoto.hpp"
- 
- #include "opencv2/core.hpp"
--#include "opencv2/hal/intrin.hpp"
-+#include "opencv2/core/hal/intrin.hpp"
- 
- namespace cv { namespace xphoto {
- 

diff --git a/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch b/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
deleted file mode 100644
index e9a190c..00000000
--- a/media-libs/opencv/files/opencv-3.1.0-fix-ocl-declaration.patch
+++ /dev/null
@@ -1,214 +0,0 @@
-From ac8dd366e4a1877e0af16961a4094496bed955f7 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@itseez.com>
-Date: Sun, 13 Sep 2015 21:18:47 +0300
-Subject: [PATCH] ocl: fix "off" mode
-
-diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp
-index cbb783e..d61444b 100644
---- opencv_contrib-master/modules/tracking/src/tldDetector.cpp
-+++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp
-@@ -104,6 +104,7 @@ namespace cv
- 			return splus / (sminus + splus);
- 		}
- 
-+#ifdef HAVE_OPENCL
- 		double TLDDetector::ocl_Sr(const Mat_<uchar>& patch)
- 		{
- 			//int64 e1, e2, e3, e4;
-@@ -283,6 +284,7 @@ namespace cv
- 			//t = (e2 - e1) / getTickFrequency()*1000.0;
- 			//printf("Sr GPU: %f\n\n", t);
- 		}
-+#endif
- 
- 		// Calculate Conservative similarity of the patch (NN-Model)
- 		double TLDDetector::Sc(const Mat_<uchar>& patch)
-@@ -337,6 +339,7 @@ namespace cv
- 			return splus / (sminus + splus);
- 		}
- 
-+#ifdef HAVE_OPENCL
- 		double TLDDetector::ocl_Sc(const Mat_<uchar>& patch)
- 		{
- 			//int64 e1, e2, e3, e4;
-@@ -415,6 +418,7 @@ namespace cv
- 				return 0.0;
- 			return splus / (sminus + splus);
- 		}
-+#endif // HAVE_OPENCL
- 
- 		// Generate Search Windows for detector from aspect ratio of initial BBs
- 		void TLDDetector::generateScanGrid(int rows, int cols, Size initBox, std::vector<Rect2d>& res, bool withScaling)
-@@ -565,6 +569,7 @@ namespace cv
- 			return true;
- 		}
- 
-+#ifdef HAVE_OPENCL
- 		bool TLDDetector::ocl_detect(const Mat& img, const Mat& imgBlurred, Rect2d& res, std::vector<LabeledPatch>& patches, Size initSize)
- 		{
- 			patches.clear();
-@@ -696,6 +701,7 @@ namespace cv
- 			res = maxScRect;
- 			return true;
- 		}
-+#endif // HAVE_OPENCL
- 
- 		// Computes the variance of subimage given by box, with the help of two integral
- 		// images intImgP and intImgP2 (sum of squares), which should be also provided.
-diff --git opencv_contrib-master/modules/tracking/src/tldDetector.hpp opencv_contrib-master/modules/tracking/src/tldDetector.hpp
-index 3e11895..1caff57 100644
---- opencv_contrib-master/modules/tracking/src/tldDetector.hpp
-+++ opencv_contrib-master/modules/tracking/src/tldDetector.hpp
-@@ -74,10 +74,12 @@ namespace cv
- 			inline double ensembleClassifierNum(const uchar* data);
- 			inline void prepareClassifiers(int rowstep);
- 			double Sr(const Mat_<uchar>& patch);
--			double ocl_Sr(const Mat_<uchar>& patch);
- 			double Sc(const Mat_<uchar>& patch);
-+#ifdef HAVE_OPENCL
-+			double ocl_Sr(const Mat_<uchar>& patch);
- 			double ocl_Sc(const Mat_<uchar>& patch);
- 			void ocl_batchSrSc(const Mat_<uchar>& patches, double *resultSr, double *resultSc, int numOfPatches);
-+#endif
- 
- 			std::vector<TLDEnsembleClassifier> classifiers;
- 			Mat *posExp, *negExp;
-diff --git opencv_contrib-master/modules/tracking/src/tldModel.cpp opencv_contrib-master/modules/tracking/src/tldModel.cpp
-index 0854022..47fc32a 100644
---- opencv_contrib-master/modules/tracking/src/tldModel.cpp
-+++ opencv_contrib-master/modules/tracking/src/tldModel.cpp
-@@ -246,6 +246,7 @@ namespace cv
- 			dfprintf((stdout, "\n"));*/
- 		}
- 
-+#ifdef HAVE_OPENCL
- 		void TrackerTLDModel::ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive)
- 		{
- 			int positiveIntoModel = 0, negativeIntoModel = 0, positiveIntoEnsemble = 0, negativeIntoEnsemble = 0;
-@@ -315,6 +316,7 @@ namespace cv
- 			dfprintf((stdout, "positiveIntoEnsemble = %d ", positiveIntoEnsemble));
- 			dfprintf((stdout, "\n"));*/
- 		}
-+#endif // HAVE_OPENCL
- 
- 		//Push the patch to the model
- 		void TrackerTLDModel::pushIntoModel(const Mat_<uchar>& example, bool positive)
-diff --git opencv_contrib-master/modules/tracking/src/tldModel.hpp opencv_contrib-master/modules/tracking/src/tldModel.hpp
-index be9141a..ba7c926 100644
---- opencv_contrib-master/modules/tracking/src/tldModel.hpp
-+++ opencv_contrib-master/modules/tracking/src/tldModel.hpp
-@@ -58,7 +58,9 @@ namespace cv
- 			void setBoudingBox(Rect2d boundingBox){ boundingBox_ = boundingBox; }
- 			void integrateRelabeled(Mat& img, Mat& imgBlurred, const std::vector<TLDDetector::LabeledPatch>& patches);
- 			void integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive);
-+#ifdef HAVE_OPENCL
- 			void ocl_integrateAdditional(const std::vector<Mat_<uchar> >& eForModel, const std::vector<Mat_<uchar> >& eForEnsemble, bool isPositive);
-+#endif
- 			Size getMinSize(){ return minSize_; }
- 			void printme(FILE* port = stdout);
- 			Ptr<TLDDetector> detector;
-diff --git opencv_contrib-master/modules/tracking/src/tldTracker.cpp opencv_contrib-master/modules/tracking/src/tldTracker.cpp
-index 0f1e2f7..a5190f5 100644
---- opencv_contrib-master/modules/tracking/src/tldTracker.cpp
-+++ opencv_contrib-master/modules/tracking/src/tldTracker.cpp
-@@ -123,9 +123,11 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
- 
- 		if (i == 1)
- 		{
-+#ifdef HAVE_OPENCL
- 			if (ocl::haveOpenCL())
- 				DETECT_FLG = tldModel->detector->ocl_detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize());
- 			else
-+#endif
- 				DETECT_FLG = tldModel->detector->detect(imageForDetector, image_blurred, tmpCandid, detectorResults, tldModel->getMinSize());
- 		}
- 
-@@ -211,17 +213,21 @@ bool TrackerTLDImpl::updateImpl(const Mat& image, Rect2d& boundingBox)
-         tldModel->integrateRelabeled(imageForDetector, image_blurred, detectorResults);
-         //dprintf(("%d relabeled by nExpert\n", negRelabeled));
-         pExpert.additionalExamples(examplesForModel, examplesForEnsemble);
--		if (ocl::haveOpenCL())
--			tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true);
--		else
--			tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true);
-+#ifdef HAVE_OPENCL
-+        if (ocl::haveOpenCL())
-+            tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, true);
-+        else
-+#endif
-+        tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, true);
-         examplesForModel.clear(); examplesForEnsemble.clear();
-         nExpert.additionalExamples(examplesForModel, examplesForEnsemble);
- 
--		if (ocl::haveOpenCL())
--			tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false);
--		else
--			tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false);
-+#ifdef HAVE_OPENCL
-+        if (ocl::haveOpenCL())
-+            tldModel->ocl_integrateAdditional(examplesForModel, examplesForEnsemble, false);
-+        else
-+#endif
-+            tldModel->integrateAdditional(examplesForModel, examplesForEnsemble, false);
-     }
-     else
-     {
-diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
-index 673817e..af5ceaf6 100644
---- opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
-+++ opencv_contrib-master/modules/xfeatures2d/src/surf.cpp
-@@ -892,6 +892,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
-     CV_Assert(!_img.empty() && CV_MAT_DEPTH(imgtype) == CV_8U && (imgcn == 1 || imgcn == 3 || imgcn == 4));
-     CV_Assert(_descriptors.needed() || !useProvidedKeypoints);
- 
-+#ifdef HAVE_OPENCL
-     if( ocl::useOpenCL() )
-     {
-         SURF_OCL ocl_surf;
-@@ -918,6 +919,7 @@ void SURF_Impl::detectAndCompute(InputArray _img, InputArray _mask,
-             return;
-         }
-     }
-+#endif // HAVE_OPENCL
- 
-     Mat img = _img.getMat(), mask = _mask.getMat(), mask1, sum, msum;
- 
-diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.hpp opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
-index 2c4e271..cf3fda1 100644
---- opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
-+++ opencv_contrib-master/modules/xfeatures2d/src/surf.hpp
-@@ -64,6 +64,7 @@ class SURF_Impl : public SURF
-     bool upright;
- };
- 
-+#ifdef HAVE_OPENCL
- class SURF_OCL
- {
- public:
-@@ -145,6 +146,7 @@ class SURF_OCL
- 
-     int status;
- };
-+#endif // HAVE_OPENCL
- 
- /*
- template<typename _Tp> void copyVectorToUMat(const std::vector<_Tp>& v, UMat& um)
-diff --git opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
-index b12ebd3..3d9845d 100644
---- opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
-+++ opencv_contrib-master/modules/xfeatures2d/src/surf.ocl.cpp
-@@ -43,6 +43,9 @@
- //
- //M*/
- #include "precomp.hpp"
-+
-+#ifdef HAVE_OPENCL
-+
- #include "surf.hpp"
- 
- #include <cstdio>
-@@ -461,3 +464,4 @@ bool SURF_OCL::calcOrientation(UMat &keypoints)
- }
- }
- 
-+#endif // HAVE_OPENCL

diff --git a/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch b/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
deleted file mode 100644
index c9f85a7..00000000
--- a/media-libs/opencv/files/opencv-3.1.0-invalid-string-usage.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-From 9862a8bac536981c1c1a74710741fb40db4beac7 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@itseez.com>
-Date: Wed, 23 Sep 2015 12:44:26 +0300
-Subject: [PATCH] fix invalid String usage
-
----
- modules/tracking/src/tldDetector.cpp   |  6 +++---
- modules/ximgproc/samples/live_demo.cpp | 12 ++++++------
- 2 files changed, 9 insertions(+), 9 deletions(-)
-
-diff --git opencv_contrib-master/modules/tracking/src/tldDetector.cpp opencv_contrib-master/modules/tracking/src/tldDetector.cpp
-index cbb783e..0916092 100644
---- opencv_contrib-master/modules/tracking/src/tldDetector.cpp
-+++ opencv_contrib-master/modules/tracking/src/tldDetector.cpp
-@@ -122,7 +122,7 @@ namespace cv
- 			ocl::Kernel k;
- 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
- 			String error;
--			ocl::Program prog(src, NULL, error);
-+			ocl::Program prog(src, String(), error);
- 			k.create("NCC", prog);
- 			if (k.empty())
- 				printf("Kernel create failed!!!\n");
-@@ -198,7 +198,7 @@ namespace cv
- 			ocl::Kernel k;
- 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
- 			String error;
--			ocl::Program prog(src, NULL, error);
-+			ocl::Program prog(src, String(), error);
- 			k.create("batchNCC", prog);
- 			if (k.empty())
- 				printf("Kernel create failed!!!\n");
-@@ -355,7 +355,7 @@ namespace cv
- 			ocl::Kernel k;
- 			ocl::ProgramSource src = ocl::tracking::tldDetector_oclsrc;
- 			String error;
--			ocl::Program prog(src, NULL, error);
-+			ocl::Program prog(src, String(), error);
- 			k.create("NCC", prog);
- 			if (k.empty())
- 				printf("Kernel create failed!!!\n");
-diff --git opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
-index dd5dc1b..8e16de3 100644
---- opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
-+++ opencv_contrib-master/modules/ximgproc/samples/live_demo.cpp
-@@ -189,7 +189,7 @@ int main()
-     
-     //Thread trackbar
-     cv::setNumThreads(g_numberOfCPUs); //speedup filtering
--    createTrackbar("Threads", NULL, &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback);
-+    createTrackbar("Threads", String(), &g_numberOfCPUs, cv::getNumberOfCPUs(), changeNumberOfCpuCallback);
- 
-     //Buttons to choose different modes
-     createButton("Mode Details Enhancement", changeModeCallback, (void*)filterDetailEnhancement, QT_RADIOBOX, true);
-@@ -199,15 +199,15 @@ int main()
- 
-     //sliders for Details Enhancement mode
-     g_filterOp = filterDetailEnhancement; //set Details Enhancement as default filter
--    createTrackbar("Detail contrast", NULL, &g_contrastBase, 200);
--    createTrackbar("Detail level" , NULL, &g_detailsLevel, 200);
-+    createTrackbar("Detail contrast", String(), &g_contrastBase, 200);
-+    createTrackbar("Detail level" , String(), &g_detailsLevel, 200);
-     
-     //sliders for Stylizing mode
--    createTrackbar("Style gamma", NULL, &g_edgesGamma, 300);
-+    createTrackbar("Style gamma", String(), &g_edgesGamma, 300);
- 
-     //sliders for every mode
--    createTrackbar("Sigma Spatial", NULL, &g_sigmaSpatial, 200);
--    createTrackbar("Sigma Color"  , NULL, &g_sigmaColor, 200);
-+    createTrackbar("Sigma Spatial", String(), &g_sigmaSpatial, 200);
-+    createTrackbar("Sigma Color"  , String(), &g_sigmaColor, 200);
- 
-     Mat rawFrame, outputFrame;
-     Mat srcFrame, processedFrame;

diff --git a/media-libs/opencv/files/opencv-contrib-find-hdf5-fix.patch b/media-libs/opencv/files/opencv-contrib-find-hdf5-fix.patch
deleted file mode 100644
index af86cf98..00000000
--- a/media-libs/opencv/files/opencv-contrib-find-hdf5-fix.patch
+++ /dev/null
@@ -1,392 +0,0 @@
-diff -purN a/modules/hdf/cmake/FindHDF5.cmake b/modules/hdf/cmake/FindHDF5.cmake
---- a/modules/hdf/cmake/FindHDF5.cmake	1970-01-01 01:00:00.000000000 +0100
-+++ b/modules/hdf/cmake/FindHDF5.cmake	2015-09-16 17:53:05.000000000 +0100
-@@ -0,0 +1,379 @@
-+#.rst:
-+# FindHDF5
-+# --------
-+#
-+# Find HDF5, a library for reading and writing self describing array data.
-+#
-+#
-+#
-+# This module invokes the HDF5 wrapper compiler that should be installed
-+# alongside HDF5.  Depending upon the HDF5 Configuration, the wrapper
-+# compiler is called either h5cc or h5pcc.  If this succeeds, the module
-+# will then call the compiler with the -show argument to see what flags
-+# are used when compiling an HDF5 client application.
-+#
-+# The module will optionally accept the COMPONENTS argument.  If no
-+# COMPONENTS are specified, then the find module will default to finding
-+# only the HDF5 C library.  If one or more COMPONENTS are specified, the
-+# module will attempt to find the language bindings for the specified
-+# components.  The only valid components are C, CXX, Fortran, HL, and
-+# Fortran_HL.  If the COMPONENTS argument is not given, the module will
-+# attempt to find only the C bindings.
-+#
-+# On UNIX systems, this module will read the variable
-+# HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a
-+# static link to a dynamic link for HDF5 and all of it's dependencies.
-+# To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES
-+# variable is set before the call to find_package.
-+#
-+# To provide the module with a hint about where to find your HDF5
-+# installation, you can set the environment variable HDF5_ROOT.  The
-+# Find module will then look in this path when searching for HDF5
-+# executables, paths, and libraries.
-+#
-+# In addition to finding the includes and libraries required to compile
-+# an HDF5 client application, this module also makes an effort to find
-+# tools that come with the HDF5 distribution that may be useful for
-+# regression testing.
-+#
-+# This module will define the following variables:
-+#
-+# ::
-+#
-+#   HDF5_INCLUDE_DIRS - Location of the hdf5 includes
-+#   HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
-+#   HDF5_DEFINITIONS - Required compiler definitions for HDF5
-+#   HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings.
-+#   HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings
-+#   HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
-+#   HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API
-+#   HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
-+#                               bindings.
-+#   HDF5_LIBRARIES - Required libraries for all requested bindings
-+#   HDF5_FOUND - true if HDF5 was found on the system
-+#   HDF5_VERSION - HDF5 version in format Major.Minor.Release
-+#   HDF5_LIBRARY_DIRS - the full set of library directories
-+#   HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support
-+#   HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler
-+#   HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler
-+#   HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler
-+#   HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
-+
-+#=============================================================================
-+# Copyright 2015 Axel Huebl, Helmholtz-Zentrum Dresden - Rossendorf
-+# Copyright 2009 Kitware, Inc.
-+#
-+# Distributed under the OSI-approved BSD License (the "License");
-+# see accompanying file Copyright.txt for details.
-+#
-+# This software is distributed WITHOUT ANY WARRANTY; without even the
-+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-+# See the License for more information.
-+#=============================================================================
-+# (To distribute this file outside of CMake, substitute the full
-+#  License text for the above reference.)
-+
-+# This module is maintained by Will Dicharry <wdicharry@stellarscience.com>.
-+
-+include(SelectLibraryConfigurations)
-+include(FindPackageHandleStandardArgs)
-+
-+# List of the valid HDF5 components
-+set( HDF5_VALID_COMPONENTS
-+    C
-+    CXX
-+    Fortran
-+    HL
-+    Fortran_HL
-+)
-+
-+# Validate the list of find components.
-+if( NOT HDF5_FIND_COMPONENTS )
-+    set( HDF5_LANGUAGE_BINDINGS "C" )
-+else()
-+    # add the extra specified components, ensuring that they are valid.
-+    foreach( component ${HDF5_FIND_COMPONENTS} )
-+        list( FIND HDF5_VALID_COMPONENTS ${component} component_location )
-+        if( ${component_location} EQUAL -1 )
-+            message( FATAL_ERROR
-+                "\"${component}\" is not a valid HDF5 component." )
-+        else()
-+            list( APPEND HDF5_LANGUAGE_BINDINGS ${component} )
-+        endif()
-+    endforeach()
-+endif()
-+
-+# try to find the HDF5 wrapper compilers
-+find_program( HDF5_C_COMPILER_EXECUTABLE
-+    NAMES h5cc h5pcc
-+    HINTS ENV HDF5_ROOT
-+    PATH_SUFFIXES bin Bin
-+    DOC "HDF5 Wrapper compiler.  Used only to detect HDF5 compile flags." )
-+mark_as_advanced( HDF5_C_COMPILER_EXECUTABLE )
-+
-+find_program( HDF5_CXX_COMPILER_EXECUTABLE
-+    NAMES h5c++ h5pc++
-+    HINTS ENV HDF5_ROOT
-+    PATH_SUFFIXES bin Bin
-+    DOC "HDF5 C++ Wrapper compiler.  Used only to detect HDF5 compile flags." )
-+mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE )
-+
-+find_program( HDF5_Fortran_COMPILER_EXECUTABLE
-+    NAMES h5fc h5pfc
-+    HINTS ENV HDF5_ROOT
-+    PATH_SUFFIXES bin Bin
-+    DOC "HDF5 Fortran Wrapper compiler.  Used only to detect HDF5 compile flags." )
-+mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE )
-+
-+find_program( HDF5_DIFF_EXECUTABLE
-+    NAMES h5diff
-+    HINTS ENV HDF5_ROOT
-+    PATH_SUFFIXES bin Bin
-+    DOC "HDF5 file differencing tool." )
-+mark_as_advanced( HDF5_DIFF_EXECUTABLE )
-+
-+# Invoke the HDF5 wrapper compiler.  The compiler return value is stored to the
-+# return_value argument, the text output is stored to the output variable.
-+macro( _HDF5_invoke_compiler language output return_value )
-+    if( HDF5_${language}_COMPILER_EXECUTABLE )
-+        exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
-+            ARGS -show
-+            OUTPUT_VARIABLE ${output}
-+            RETURN_VALUE ${return_value}
-+        )
-+        if( ${${return_value}} EQUAL 0 )
-+            # do nothing
-+        else()
-+            message( STATUS
-+              "Unable to determine HDF5 ${language} flags from HDF5 wrapper." )
-+        endif()
-+    endif()
-+endmacro()
-+
-+# Parse a compile line for definitions, includes, library paths, and libraries.
-+macro( _HDF5_parse_compile_line
-+    compile_line_var
-+    include_paths
-+    definitions
-+    library_paths
-+    libraries )
-+
-+    # Match the include paths
-+    string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags
-+        "${${compile_line_var}}"
-+    )
-+    foreach( IPATH ${include_path_flags} )
-+        string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
-+        string( REPLACE "//" "/" IPATH ${IPATH} )
-+        list( APPEND ${include_paths} ${IPATH} )
-+    endforeach()
-+
-+    # Match the definitions
-+    string( REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}" )
-+    foreach( DEF ${definition_flags} )
-+        list( APPEND ${definitions} ${DEF} )
-+    endforeach()
-+
-+    # Match the library paths
-+    string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags
-+        "${${compile_line_var}}"
-+    )
-+
-+    foreach( LPATH ${library_path_flags} )
-+        string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
-+        string( REPLACE "//" "/" LPATH ${LPATH} )
-+        list( APPEND ${library_paths} ${LPATH} )
-+    endforeach()
-+
-+    # now search for the library names specified in the compile line (match -l...)
-+    # match only -l's preceded by a space or comma
-+    # this is to exclude directory names like xxx-linux/
-+    string( REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags
-+        "${${compile_line_var}}" )
-+    # strip the -l from all of the library flags and add to the search list
-+    foreach( LIB ${library_name_flags} )
-+        string( REGEX REPLACE "^[, ]-l" "" LIB ${LIB} )
-+        list( APPEND ${libraries} ${LIB} )
-+    endforeach()
-+endmacro()
-+
-+# Try to find HDF5 using an installed hdf5-config.cmake
-+if( NOT HDF5_FOUND )
-+    find_package( HDF5 QUIET NO_MODULE )
-+    if( HDF5_FOUND )
-+        set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} )
-+        set( HDF5_LIBRARIES )
-+        set( HDF5_C_TARGET hdf5 )
-+        set( HDF5_CXX_TARGET hdf5_cpp )
-+        set( HDF5_HL_TARGET hdf5_hl )
-+        set( HDF5_Fortran_TARGET hdf5_fortran )
-+        set( HDF5_Fortran_HL_TARGET hdf5_hl_fortran )
-+        foreach( _component ${HDF5_LANGUAGE_BINDINGS} )
-+            list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location )
-+            get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION )
-+            if( _comp_location )
-+                set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH
-+                    "HDF5 ${_component} library" )
-+                mark_as_advanced( HDF5_${_component}_LIBRARY )
-+                list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} )
-+            endif()
-+        endforeach()
-+    endif()
-+endif()
-+
-+if( NOT HDF5_FOUND )
-+    _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE )
-+    _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE )
-+    _HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE )
-+
-+    # seed the initial lists of libraries to find with items we know we need
-+    set( HDF5_C_LIBRARY_NAMES_INIT hdf5 )
-+    set( HDF5_HL_LIBRARY_NAMES_INIT hdf5_hl ${HDF5_C_LIBRARY_NAMES_INIT} )
-+    set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} )
-+    set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran
-+        ${HDF5_C_LIBRARY_NAMES_INIT} )
-+    set( HDF5_Fortran_HL_LIBRARY_NAMES_INIT hdf5hl_fortran
-+        ${HDF5_Fortran_LIBRARY_NAMES_INIT} )
-+
-+    foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} )
-+        if( HDF5_${LANGUAGE}_COMPILE_LINE )
-+            _HDF5_parse_compile_line( HDF5_${LANGUAGE}_COMPILE_LINE
-+                HDF5_${LANGUAGE}_INCLUDE_FLAGS
-+                HDF5_${LANGUAGE}_DEFINITIONS
-+                HDF5_${LANGUAGE}_LIBRARY_DIRS
-+                HDF5_${LANGUAGE}_LIBRARY_NAMES
-+            )
-+
-+            # take a guess that the includes may be in the 'include' sibling
-+            # directory of a library directory.
-+            foreach( dir ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
-+                list( APPEND HDF5_${LANGUAGE}_INCLUDE_FLAGS ${dir}/../include )
-+            endforeach()
-+        endif()
-+
-+        # set the definitions for the language bindings.
-+        list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} )
-+
-+        # find the HDF5 include directories
-+        if(${LANGUAGE} MATCHES "Fortran")
-+            set(HDF5_INCLUDE_FILENAME hdf5.mod)
-+        else()
-+            set(HDF5_INCLUDE_FILENAME hdf5.h)
-+        endif()
-+
-+        find_path( HDF5_${LANGUAGE}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
-+            HINTS
-+                ${HDF5_${LANGUAGE}_INCLUDE_FLAGS}
-+                ENV
-+                    HDF5_ROOT
-+            PATHS
-+                $ENV{HOME}/.local/include
-+            PATH_SUFFIXES
-+                include
-+                Include
-+        )
-+        mark_as_advanced( HDF5_${LANGUAGE}_INCLUDE_DIR )
-+        list( APPEND HDF5_INCLUDE_DIRS ${HDF5_${LANGUAGE}_INCLUDE_DIR} )
-+
-+        set( HDF5_${LANGUAGE}_LIBRARY_NAMES
-+            ${HDF5_${LANGUAGE}_LIBRARY_NAMES_INIT}
-+            ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
-+
-+        # find the HDF5 libraries
-+        foreach( LIB ${HDF5_${LANGUAGE}_LIBRARY_NAMES} )
-+            if( UNIX AND HDF5_USE_STATIC_LIBRARIES )
-+                # According to bug 1643 on the CMake bug tracker, this is the
-+                # preferred method for searching for a static library.
-+                # See http://www.cmake.org/Bug/view.php?id=1643.  We search
-+                # first for the full static library name, but fall back to a
-+                # generic search on the name if the static search fails.
-+                set( THIS_LIBRARY_SEARCH_DEBUG lib${LIB}d.a ${LIB}d )
-+                set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} )
-+            else()
-+                set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d )
-+                set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} )
-+            endif()
-+            find_library( HDF5_${LIB}_LIBRARY_DEBUG
-+                NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
-+                HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
-+                ENV HDF5_ROOT
-+                PATH_SUFFIXES lib Lib )
-+            find_library( HDF5_${LIB}_LIBRARY_RELEASE
-+                NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
-+                HINTS ${HDF5_${LANGUAGE}_LIBRARY_DIRS}
-+                ENV HDF5_ROOT
-+                PATH_SUFFIXES lib Lib )
-+            select_library_configurations( HDF5_${LIB} )
-+            list(APPEND HDF5_${LANGUAGE}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
-+        endforeach()
-+        list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} )
-+
-+        # Append the libraries for this language binding to the list of all
-+        # required libraries.
-+        list(APPEND HDF5_LIBRARIES ${HDF5_${LANGUAGE}_LIBRARIES})
-+    endforeach()
-+
-+    # We may have picked up some duplicates in various lists during the above
-+    # process for the language bindings (both the C and C++ bindings depend on
-+    # libz for example).  Remove the duplicates. It appears that the default
-+    # CMake behavior is to remove duplicates from the end of a list. However,
-+    # for link lines, this is incorrect since unresolved symbols are searched
-+    # for down the link line. Therefore, we reverse the list, remove the
-+    # duplicates, and then reverse it again to get the duplicates removed from
-+    # the beginning.
-+    macro( _remove_duplicates_from_beginning _list_name )
-+        list( REVERSE ${_list_name} )
-+        list( REMOVE_DUPLICATES ${_list_name} )
-+        list( REVERSE ${_list_name} )
-+    endmacro()
-+
-+    if( HDF5_INCLUDE_DIRS )
-+        _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS )
-+    endif()
-+    if( HDF5_LIBRARY_DIRS )
-+        _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS )
-+    endif()
-+
-+    # If the HDF5 include directory was found, open H5pubconf.h to determine if
-+    # HDF5 was compiled with parallel IO support
-+    set( HDF5_IS_PARALLEL FALSE )
-+    set( HDF5_VERSION "" )
-+    foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
-+      foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h")
-+        if( EXISTS "${_hdr}" )
-+            file( STRINGS "${_hdr}"
-+                HDF5_HAVE_PARALLEL_DEFINE
-+                REGEX "HAVE_PARALLEL 1" )
-+            if( HDF5_HAVE_PARALLEL_DEFINE )
-+                set( HDF5_IS_PARALLEL TRUE )
-+            endif()
-+            unset(HDF5_HAVE_PARALLEL_DEFINE)
-+
-+            file( STRINGS "${_hdr}"
-+                HDF5_VERSION_DEFINE
-+                REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" )
-+            if( "${HDF5_VERSION_DEFINE}" MATCHES
-+                "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"" )
-+                set( HDF5_VERSION "${CMAKE_MATCH_1}" )
-+            endif()
-+            unset(HDF5_VERSION_DEFINE)
-+        endif()
-+      endforeach()
-+    endforeach()
-+    set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
-+        "HDF5 library compiled with parallel IO support" )
-+    mark_as_advanced( HDF5_IS_PARALLEL )
-+
-+    # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
-+    # HDF5_INCLUDE_DIRS
-+    if( HDF5_INCLUDE_DIRS )
-+        set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
-+    endif()
-+
-+endif()
-+
-+find_package_handle_standard_args( HDF5
-+    REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS
-+    VERSION_VAR   HDF5_VERSION
-+)
-+
-diff -purN a/modules/hdf/CMakeLists.txt b/modules/hdf/CMakeLists.txt
---- a/modules/hdf/CMakeLists.txt	2015-12-17 17:11:31.000000000 +0000
-+++ b/modules/hdf/CMakeLists.txt	2016-09-19 15:24:47.958650311 +0100
-@@ -1,4 +1,4 @@
--set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
-+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR}/cmake)
- 
- find_package(HDF5)
- if(HDF5_FOUND)

diff --git a/media-libs/opencv/opencv-2.4.12.ebuild b/media-libs/opencv/opencv-2.4.12.ebuild
deleted file mode 100644
index fdc0f17..00000000
--- a/media-libs/opencv/opencv-2.4.12.ebuild
+++ /dev/null
@@ -1,217 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-PYTHON_COMPAT=( python2_7 )
-
-inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
-HOMEPAGE="http://opencv.willowgarage.com"
-
-SRC_URI="https://github.com/Itseez/opencv/archive/${PV}.zip -> ${P}.zip"
-
-LICENSE="BSD"
-SLOT="0/2.4"
-KEYWORDS="amd64 ~arm ~ppc ~ppc64 x86 ~amd64-linux"
-IUSE="cuda doc +eigen examples ffmpeg gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 testprograms threads tiff v4l vtk xine"
-REQUIRED_USE="
-	python? ( ${PYTHON_REQUIRED_USE} )
-"
-
-# 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? ( !qt4 )
-#	opengl? ( || ( gtk qt4 ) )
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2
-	sys-libs/zlib
-	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
-	ffmpeg? (
-		libav? ( media-video/libav:0= )
-		!libav? ( media-video/ffmpeg:0= )
-	)
-	gstreamer? (
-		media-libs/gstreamer:1.0
-		media-libs/gst-plugins-base:1.0
-	)
-	gtk? (
-		dev-libs/glib:2
-		x11-libs/gtk+:2
-		opengl? ( x11-libs/gtkglext )
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/jasper )
-	ieee1394? (
-		media-libs/libdc1394
-		sys-libs/libraw1394
-	)
-	ipp? ( sci-libs/ipp )
-	opencl? ( virtual/opencl )
-	openexr? ( media-libs/openexr )
-	opengl? ( virtual/opengl virtual/glu )
-	png? ( media-libs/libpng:0= )
-	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
-	qt4? (
-		dev-qt/qtgui:4
-		dev-qt/qttest:4
-		opengl? ( dev-qt/qtopengl:4 )
-	)
-	threads? ( dev-cpp/tbb )
-	tiff? ( media-libs/tiff:0 )
-	v4l? ( >=media-libs/libv4l-0.8.3 )
-	vtk? ( sci-libs/vtk[rendering] )
-	xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	eigen? ( dev-cpp/eigen:3 )
-	java? ( >=virtual/jdk-1.6 )
-"
-
-pkg_setup() {
-	use python && python-single-r1_pkg_setup
-	java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
-	epatch "${FILESDIR}/${PN}-2.3.1a-libav-0.7.patch" \
-		"${FILESDIR}/${PN}-2.4.3-gcc47.patch" \
-		"${FILESDIR}/${PN}-2.4.2-cflags.patch" \
-		"${FILESDIR}/${PN}-2.4.8-javamagic.patch" \
-		"${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch" \
-		"${FILESDIR}/${P}-git-autodetect.patch"
-
-	# remove bundled stuff
-	rm -rf 3rdparty
-	sed -i \
-		-e '/add_subdirectory(3rdparty)/ d' \
-		CMakeLists.txt || die
-
-	java-pkg-opt-2_src_prepare
-}
-
-src_configure() {
-	if use openmp; then
-		tc-has-openmp || die "Please switch to an openmp compatible compiler"
-	fi
-
-	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
-
-	# please dont sort here, order is the same as in CMakeLists.txt
-	local mycmakeargs=(
-	# the optinal dependency libraries
-		$(cmake-utils_use_with ieee1394 1394)
-		-DWITH_AVFOUNDATION=OFF
-		-DWITH_CARBON=OFF
-		$(cmake-utils_use_with eigen)
-		$(cmake-utils_use_with ffmpeg)
-		$(cmake-utils_use_with gstreamer)
-		$(cmake-utils_use_with gtk)
-		$(cmake-utils_use_with ipp)
-		$(cmake-utils_use_with java)
-		$(cmake-utils_use_with jpeg2k JASPER)
-		$(cmake-utils_use_with jpeg)
-		$(cmake-utils_use_with opencl)
-	#	$(cmake-utils_use_with opencl OPENCLAMDFFT)
-	#	$(cmake-utils_use_with opencl OPENCLAMDBLAS)
-		$(cmake-utils_use_with openexr)
-		$(cmake-utils_use_with opengl)
-		$(cmake-utils_use_with openmp)
-		-DWITH_OPENNI=OFF					# not packaged
-		$(cmake-utils_use_with png)
-		$(cmake-utils_use_build python opencv_python)
-		-DWITH_PVAPI=OFF					# not packaged
-		-DWITH_QUICKTIME=OFF
-		$(cmake-utils_use_with threads TBB)
-		$(cmake-utils_use_with tiff)
-		-DWITH_UNICAP=OFF					# not packaged
-		$(cmake-utils_use_with v4l V4L)
-		$(cmake-utils_use_with vtk VTK)
-		-DWITH_LIBV4L=ON
-		-DWITH_VIDEOINPUT=OFF					# windows only
-		-DWITH_XIMEA=OFF					# windows only
-		$(cmake-utils_use_with xine)
-	# the build components
-		-DBUILD_SHARED_LIBS=ON
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		$(cmake-utils_use_build doc DOCS)
-		$(cmake-utils_use_build examples)
-		-DBUILD_PERF_TESTS=OFF
-		$(cmake-utils_use_build testprograms TESTS)
-	# install examples, tests etc
-		$(cmake-utils_use examples INSTALL_C_EXAMPLES)
-		$(cmake-utils_use testprograms INSTALL_TESTS)
-	# build options
-		$(cmake-utils_use_enable pch PRECOMPILED_HEADERS)
-		-DENABLE_OMIT_FRAME_POINTER=OFF				#
-		-DENABLE_FAST_MATH=OFF					#
-		-DENABLE_SSE=OFF					# these options do nothing but
-		-DENABLE_SSE2=OFF					# add params to CFLAGS
-		-DENABLE_SSE3=OFF
-		-DENABLE_SSSE3=OFF
-		-DENABLE_SSE41=OFF
-		-DENABLE_SSE42=OFF
-		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
-	)
-
-	if use qt4; then
-		mycmakeargs+=( "-DWITH_QT=4" )
-	else
-		mycmakeargs+=( "-DWITH_QT=OFF" )
-	fi
-
-	if use cuda; then
-		if [[ "$(gcc-version)" > "4.7" ]]; then
-			ewarn "CUDA and >=sys-devel/gcc-4.8 do not play well together. Disabling CUDA support."
-			mycmakeargs+=( "-DWITH_CUDA=OFF" )
-			mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-			mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-		else
-			mycmakeargs+=( "-DWITH_CUDA=ON" )
-			mycmakeargs+=( "-DWITH_CUBLAS=ON" )
-			mycmakeargs+=( "-DWITH_CUFFT=ON" )
-		fi
-	else
-		mycmakeargs+=( "-DWITH_CUDA=OFF" )
-		mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-		mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-	fi
-
-	if use examples && use python; then
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" )
-	else
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" )
-	fi
-
-	# things we want to be hard off or not yet figured out
-	mycmakeargs+=(
-		"-DOPENCV_BUILD_3RDPARTY_LIBS=OFF"
-		"-DBUILD_LATEX_DOCS=OFF"
-		"-DBUILD_PACKAGE=OFF"
-		"-DENABLE_PROFILING=OFF"
-	)
-
-	# things we want to be hard enabled not worth useflag
-	mycmakeargs+=(
-		"-DCMAKE_SKIP_RPATH=ON"
-		"-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}"
-	)
-
-	# hardcode cuda paths
-	mycmakeargs+=(
-		"-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda"
-	)
-
-	# workaround for bug 413429
-	tc-export CC CXX
-
-	cmake-utils_src_configure
-}

diff --git a/media-libs/opencv/opencv-3.0.0.ebuild b/media-libs/opencv/opencv-3.0.0.ebuild
deleted file mode 100644
index 84aa427..00000000
--- a/media-libs/opencv/opencv-3.0.0.ebuild
+++ /dev/null
@@ -1,221 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-PYTHON_COMPAT=( python{2_7,3_4} )
-
-inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
-HOMEPAGE="http://opencv.org"
-
-SRC_URI="
-	mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip
-	https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip
-	contrib? ( https://github.com/Itseez/opencv_contrib/archive/2d1fc7a6cdccd04435795f68126151a51071a539.zip -> ${PN}_contrib.zip )" # commit from 26.10.2015
-
-LICENSE="BSD"
-SLOT="0/3.0"
-KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
-IUSE="contrib cuda doc +eigen examples ffmpeg gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 qt5 testprograms threads tiff v4l vtk xine"
-REQUIRED_USE="
-	python? ( ${PYTHON_REQUIRED_USE} )
-	?? ( qt4 qt5 )
-"
-
-# 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? ( !qt4 )
-#	opengl? ( || ( gtk qt4 ) )
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2
-	sys-libs/zlib
-	media-libs/libwebp
-	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
-	ffmpeg? (
-		libav? ( media-video/libav:0= )
-		!libav? ( media-video/ffmpeg:0= )
-	)
-	gstreamer? (
-		media-libs/gstreamer:1.0
-		media-libs/gst-plugins-base:1.0
-	)
-	gtk? (
-		dev-libs/glib:2
-		x11-libs/gtk+:2
-		opengl? ( x11-libs/gtkglext )
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/jasper )
-	ieee1394? (
-		media-libs/libdc1394
-		sys-libs/libraw1394
-	)
-	ipp? ( sci-libs/ipp )
-	opencl? ( virtual/opencl )
-	openexr? ( media-libs/openexr )
-	opengl? ( virtual/opengl virtual/glu )
-	png? ( media-libs/libpng:0= )
-	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
-	qt4? (
-		dev-qt/qtgui:4
-		dev-qt/qttest:4
-		opengl? ( dev-qt/qtopengl:4 )
-	)
-	qt5? (
-		dev-qt/qtgui:5
-		dev-qt/qttest:5
-		dev-qt/qtconcurrent:5
-		opengl? ( dev-qt/qtopengl:5 )
-	)
-	threads? ( dev-cpp/tbb )
-	tiff? ( media-libs/tiff:0 )
-	v4l? ( >=media-libs/libv4l-0.8.3 )
-	vtk? ( sci-libs/vtk[rendering] )
-	xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	eigen? ( dev-cpp/eigen:3 )
-	java? ( >=virtual/jdk-1.6 )
-"
-
-pkg_setup() {
-	use python && python-single-r1_pkg_setup
-	java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
-	epatch "${FILESDIR}/${P}-gles.patch" \
-		"${FILESDIR}/${P}-git-autodetect.patch"
-
-	# remove bundled stuff
-	rm -rf 3rdparty
-	sed -i \
-		-e '/add_subdirectory(.*3rdparty.*)/ d' \
-		CMakeLists.txt cmake/*cmake || die
-
-	#removing broken sample bug #558104
-	if use contrib; then
-		rm ../opencv_contrib-master/modules/ximgproc/samples/disparity_filtering.cpp || die
-	fi
-
-	java-pkg-opt-2_src_prepare
-}
-
-src_configure() {
-	if use openmp; then
-		tc-has-openmp || die "Please switch to an openmp compatible compiler"
-	fi
-
-	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
-
-	# please dont sort here, order is the same as in CMakeLists.txt
-	local mycmakeargs=(
-	# the optinal dependency libraries
-		$(cmake-utils_use_with ieee1394 1394)
-		-DWITH_AVFOUNDATION=OFF
-		-DWITH_CARBON=OFF
-		$(cmake-utils_use_with eigen)
-		$(cmake-utils_use_with ffmpeg)
-		$(cmake-utils_use_with gstreamer)
-		$(cmake-utils_use_with gtk)
-		$(cmake-utils_use_with ipp)
-		$(cmake-utils_use_with java)
-		$(cmake-utils_use_with jpeg2k JASPER)
-		$(cmake-utils_use_with jpeg)
-		$(cmake-utils_use_with opencl)
-	#	$(cmake-utils_use_with opencl OPENCLAMDFFT)
-	#	$(cmake-utils_use_with opencl OPENCLAMDBLAS)
-		$(cmake-utils_use_with openexr)
-		$(cmake-utils_use_with opengl)
-		$(cmake-utils_use_with openmp)
-		-DWITH_OPENNI=OFF					# not packaged
-		$(cmake-utils_use_with png)
-		$(cmake-utils_use_build python opencv_python)
-		-DWITH_PVAPI=OFF					# not packaged
-		-DWITH_QUICKTIME=OFF
-		$(cmake-utils_use_with threads TBB)
-		$(cmake-utils_use_with tiff)
-		-DWITH_UNICAP=OFF					# not packaged
-		$(cmake-utils_use_with v4l V4L)
-		$(cmake-utils_use_with vtk VTK)
-		-DWITH_LIBV4L=ON
-		-DWITH_VIDEOINPUT=OFF					# windows only
-		-DWITH_XIMEA=OFF					# windows only
-		$(cmake-utils_use_with xine)
-	# the build components
-		-DBUILD_SHARED_LIBS=ON
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		$(cmake-utils_use_build doc DOCS)
-		$(cmake-utils_use_build examples)
-		$(cmake-utils_use_build java opencv_java)		#for -java bug #555650
-		-DBUILD_PERF_TESTS=OFF
-		$(cmake-utils_use_build testprograms TESTS)
-	# install examples, tests etc
-		$(cmake-utils_use examples INSTALL_C_EXAMPLES)
-		$(cmake-utils_use testprograms INSTALL_TESTS)
-	# build options
-		$(cmake-utils_use_enable pch PRECOMPILED_HEADERS)
-		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
-	)
-
-	if use qt4; then
-		mycmakeargs+=( "-DWITH_QT=4" )
-	elif use qt5; then
-		mycmakeargs+=( "-DWITH_QT=5" )
-	else
-		mycmakeargs+=( "-DWITH_QT=OFF" )
-	fi
-
-	if use contrib; then
-		mycmakeargs+=( "-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules" )
-	fi
-
-	if use cuda; then
-		mycmakeargs+=( "-DWITH_CUDA=ON" )
-		mycmakeargs+=( "-DWITH_CUBLAS=ON" )
-		mycmakeargs+=( "-DWITH_CUFFT=ON" )
-	else
-		mycmakeargs+=( "-DWITH_CUDA=OFF" )
-		mycmakeargs+=( "-DWITH_CUBLAS=OFF" )
-		mycmakeargs+=( "-DWITH_CUFFT=OFF" )
-	fi
-
-	if use examples && use python; then
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=ON" )
-	else
-		mycmakeargs+=( "-DINSTALL_PYTHON_EXAMPLES=OFF" )
-	fi
-
-	# things we want to be hard off or not yet figured out
-	mycmakeargs+=(
-		"-DOPENCV_BUILD_3RDPARTY_LIBS=OFF"
-		"-DBUILD_LATEX_DOCS=OFF"
-		"-DBUILD_PACKAGE=OFF"
-		"-DENABLE_PROFILING=OFF"
-	)
-
-	# things we want to be hard enabled not worth useflag
-	mycmakeargs+=(
-		"-DCMAKE_SKIP_RPATH=ON"
-		"-DOPENCV_DOC_INSTALL_PATH=${EPREFIX}/usr/share/doc/${PF}"
-	)
-
-	# hardcode cuda paths
-	mycmakeargs+=(
-		"-DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda"
-	)
-
-	# workaround for bug 413429
-	tc-export CC CXX
-
-	cmake-utils_src_configure
-}

diff --git a/media-libs/opencv/opencv-3.1.0-r4.ebuild b/media-libs/opencv/opencv-3.1.0-r4.ebuild
deleted file mode 100644
index 5355966..00000000
--- a/media-libs/opencv/opencv-3.1.0-r4.ebuild
+++ /dev/null
@@ -1,268 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=6
-PYTHON_COMPAT=( python{2_7,3_4,3_5} )
-
-inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for
-	various computer vision problems"
-HOMEPAGE="http://opencv.org"
-
-SRC_URI="
-	mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip
-	https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip
-	contrib? (
-		https://github.com/Itseez/${PN}_contrib/archive/cd5993c6576267875adac300b9ddd1f881bb1766.zip -> ${P}_contrib.zip )" #commit from Sun, 27 Mar 2016 17:31:51
-
-LICENSE="BSD"
-SLOT="0/3.1" # subslot = libopencv* soname version
-KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
-IUSE="contrib cuda +eigen examples ffmpeg gdal gphoto2 gstreamer gtk \
-	ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png \
-	+python qt4 qt5 testprograms threads tiff vaapi v4l vtk webp xine"
-
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
-	?? ( qt4 qt5 )"
-
-# 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? ( !qt4 )
-#	opengl? ( || ( gtk qt4 ) )
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2
-	sys-libs/zlib
-	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
-	ffmpeg? (
-		libav? ( media-video/libav:0= )
-		!libav? ( media-video/ffmpeg:0= )
-	)
-	gdal? ( sci-libs/gdal )
-	gphoto2? ( media-libs/libgphoto2 )
-	gstreamer? (
-		media-libs/gstreamer:1.0
-		media-libs/gst-plugins-base:1.0
-	)
-	gtk? (
-		dev-libs/glib:2
-		x11-libs/gtk+:2
-		opengl? ( x11-libs/gtkglext )
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/jasper )
-	ieee1394? (
-		media-libs/libdc1394
-		sys-libs/libraw1394
-	)
-	ipp? ( sci-libs/ipp )
-	opencl? ( virtual/opencl )
-	openexr? ( media-libs/openexr )
-	opengl? ( virtual/opengl virtual/glu )
-	png? ( media-libs/libpng:0= )
-	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
-	qt4? (
-		dev-qt/qtgui:4
-		dev-qt/qttest:4
-		opengl? ( dev-qt/qtopengl:4 )
-	)
-	qt5? (
-		dev-qt/qtgui:5
-		dev-qt/qttest:5
-		dev-qt/qtconcurrent:5
-		opengl? ( dev-qt/qtopengl:5 )
-	)
-	threads? ( dev-cpp/tbb )
-	tiff? ( media-libs/tiff:0 )
-	v4l? ( >=media-libs/libv4l-0.8.3 )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp )
-	xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	eigen? ( dev-cpp/eigen:3 )
-	java?  ( >=virtual/jdk-1.6 )
-"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.0.0-gles.patch
-	"${FILESDIR}"/${PN}-3.1.0-cmake-no-opengl.patch
-	"${FILESDIR}"/${P}-git-autodetect.patch
-	"${FILESDIR}"/${P}-java-magic.patch
-	"${FILESDIR}"/${P}-gentooify-python.patch
-)
-
-pkg_setup() {
-	use python && python-single-r1_pkg_setup
-	java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
-	default
-
-	# remove bundled stuff
-	rm -rf 3rdparty || die "Removing 3rd party components failed"
-	sed -i \
-		-e '/add_subdirectory(.*3rdparty.*)/ d' \
-		CMakeLists.txt cmake/*cmake || die
-
-	java-pkg-opt-2_src_prepare
-}
-
-src_configure() {
-	if use openmp; then
-		tc-has-openmp || die "Please switch to an openmp compatible compiler"
-	fi
-
-	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
-
-	# please dont sort here, order is the same as in CMakeLists.txt
-	local mycmakeargs=(
-	# Optional 3rd party components
-	# ===================================================
-		-DWITH_1394=$(usex ieee1394 ON OFF)
-		-DWITH_AVFOUNDATION=OFF 	# IOS
-		-DWITH_VTK=$(usex vtk ON OFF)
-		-DWITH_EIGEN=$(usex eigen ON OFF)
-		-DWITH_VFW=OFF     		# Video windows support
-		-DWITH_FFMPEG=$(usex ffmpeg ON OFF)
-		-DWITH_GSTREAMER=$(usex gstreamer ON OFF)
-		-DWITH_GSTREAMER_0_10=OFF	# Don't want this
-		-DWITH_GTK=$(usex gtk ON OFF)
-		-DWITH_GTK_2_X=OFF
-		-DWITH_IPP=$(usex ipp ON OFF)
-		-DWITH_JASPER=$(usex jpeg2k ON OFF)
-		-DWITH_JPEG=$(usex jpeg ON OFF)
-		-DWITH_WEBP=$(usex webp ON OFF)
-		-DWITH_OPENEXR=$(usex openexr ON OFF)
-		-DWITH_OPENGL=$(usex opengl ON OFF)
-		-DWITH_OPENNI=OFF 		# Not packaged
-		-DWITH_OPENNI2=OFF 		# Not packaged
-		-DWITH_PNG=$(usex png ON OFF)
-		-DWITH_PVAPI=OFF		# Not packaged
-		-DWITH_GIGEAPI=OFF
-		# Qt in CMakeList.txt here: See below
-		-DWITH_WIN32UI=OFF		# Windows only
-		-DWITH_QUICKTIME=OFF
-		-DWITH_TBB=$(usex threads ON OFF)
-		-DWITH_OPENMP=$(usex openmp ON OFF)
-		-DWITH_CSTRIPES=OFF
-		-DWITH_PTHREADS_PF=ON
-		-DWITH_TIFF=$(usex tiff ON OFF)
-		-DWITH_UNICAP=OFF		# Not packaged
-		-DWITH_V4L=$(usex v4l ON OFF)
-		-DWITH_LIBV4L=$(usex v4l ON OFF)
-		-DWITH_DSHOW=ON			# direct show supp
-		-DWITH_MSMF=OFF
-		-DWITH_XIMEA=OFF 		# Windows only
-		-DWITH_XINE=$(usex xine ON OFF)
-		-DWITH_CLP=OFF
-		-DWITH_OPENCL=$(usex opencl ON OFF)
-		-DWITH_OPENCL_SVM=OFF
-		-DWITH_OPENCLAMDFFT=$(usex opencl ON OFF)
-		-DWITH_OPENCLAMDBLAS=$(usex opencl ON OFF)
-		-DWITH_DIRECTX=OFF
-		-DWITH_INTELPERC=OFF
-		-DWITH_JAVA=$(usex java ON OFF) # Ant needed, no compile flag
-		-DWITH_IPP_A=OFF
-		-DWITH_MATLAB=ON
-		-DWITH_VA=$(usex vaapi ON OFF)
-		-DWITH_VA_INTEL=$(usex vaapi ON OFF)
-		-DWITH_GDAL=$(usex gdal ON OFF)
-		-DWITH_GPHOTO2=$(usex gphoto2 ON OFF)
-	# ===================================================
-	# OpenCV build components
-	# ===================================================
-		-DBUILD_SHARED_LIBS=ON
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_DOCS=OFF # Doesn't install anyways.
-		-DBUILD_EXAMPLES=$(usex examples ON OFF)
-		-DBUILD_PERF_TESTS=OFF
-		-DBUILD_TESTS=$(usex testprograms ON OFF)
-	# ===================================================
-	# OpenCV installation options
-	# ===================================================
-		-DINSTALL_C_EXAMPLES=$(usex examples ON OFF)
-		-DINSTALL_TESTS=$(usex testprograms ON OFF)
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_PRECOMPILED_HEADERS=$(usex pch ON OFF)
-		-DHAVE_opencv_java=$(usex java YES NO)
-	)
-
-	if use qt4; then
-		mycmakeargs+=( -DWITH_QT=4 )
-	elif use qt5; then
-		mycmakeargs+=( -DWITH_QT=5 )
-	else
-		mycmakeargs+=( -DWITH_QT=OFF )
-	fi
-
-	if use cuda; then
-		if [[ "$(gcc-version)" > "4.8" ]]; then
-			# bug 577410
-			# #error -- unsupported GNU version! gcc 4.9 and up are not supported!
-			ewarn "CUDA and >=sys-devel/gcc-4.9 do not play well together. Disabling CUDA support."
-			mycmakeargs+=( -DWITH_CUDA=OFF )
-			mycmakeargs+=( -DWITH_CUBLAS=OFF )
-			mycmakeargs+=( -DWITH_CUFFT=OFF )
-
-		else
-			mycmakeargs+=( -DWITH_CUDA=ON )
-			mycmakeargs+=( -DWITH_CUBLAS=ON )
-			mycmakeargs+=( -DWITH_CUFFT=ON )
-			mycmakeargs+=( -DCUDA_NPP_LIBRARY_ROOT_DIR="/opt/cuda" )
-		fi
-	else
-		mycmakeargs+=( -DWITH_CUDA=OFF )
-		mycmakeargs+=( -DWITH_CUBLAS=OFF )
-		mycmakeargs+=( -DWITH_CUFFT=OFF )
-	fi
-
-	use contrib && mycmakeargs+=(
-		-DOPENCV_EXTRA_MODULES_PATH="${WORKDIR}/opencv_contrib-${PV}/modules"
-	)
-
-	if use python; then
-		# Set all python variables to load the correct Gentoo paths
-		mycmakeargs+=(
-			-DWITH_PYTHON=ON
-			-DGENTOO_PYTHON_EXECUTABLE=${EPYTHON}
-			-DGENTOO_PYTHON_INCLUDE_PATH="$(python_get_includedir)"
-			-DGENTOO_PYTHON_LIBRARIES="$(python_get_library_path)"
-			-DGENTOO_PYTHON_PACKAGES_PATH="$(python_get_sitedir)"
-			-DGENTOO_PYTHON_MAJOR=${EPYTHON:6:1}
-			-DGENTOO_PYTHON_MINOR=${EPYTHON:8:1}
-			-DGENTOO_PYTHON_DEBUG_LIBRARIES="" # Absolutely no clue what this is
-		)
-		use examples && mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=ON )
-	else
-		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=OFF )
-	fi
-
-	# things we want to be hard off or not yet figured out
-	mycmakeargs+=(
-		-DBUILD_PACKAGE=OFF
-		-DENABLE_PROFILING=OFF
-	)
-
-	# things we want to be hard enabled not worth useflag
-	mycmakeargs+=(
-		-DCMAKE_SKIP_RPATH=ON
-		-DOPENCV_DOC_INSTALL_PATH=
-	)
-
-	# workaround for bug 413429
-	tc-export CC CXX
-
-	cmake-utils_src_configure
-}

diff --git a/media-libs/opencv/opencv-3.1.0-r5.ebuild b/media-libs/opencv/opencv-3.1.0-r5.ebuild
deleted file mode 100644
index 581b725..00000000
--- a/media-libs/opencv/opencv-3.1.0-r5.ebuild
+++ /dev/null
@@ -1,300 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=6
-PYTHON_COMPAT=( python{2_7,3_4,3_5} )
-
-inherit toolchain-funcs cmake-utils python-r1 java-pkg-opt-2 java-ant-2
-
-DESCRIPTION="A collection of algorithms and sample code for
-	various computer vision problems"
-HOMEPAGE="http://opencv.org"
-
-SRC_URI="
-	mirror://sourceforge/opencvlibrary/opencv-unix/${PV}/${P}.zip
-	https://github.com/Itseez/${PN}/archive/${PV}.zip -> ${P}.zip
-	contrib? (
-		https://github.com/Itseez/${PN}_contrib/archive/cd5993c6576267875adac300b9ddd1f881bb1766.zip -> ${P}_contrib.zip )" #commit from Sun, 27 Mar 2016 17:31:51
-
-LICENSE="BSD"
-SLOT="0/3.1" # subslot = libopencv* soname version
-KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
-IUSE="contrib cuda +eigen examples ffmpeg gdal gphoto2 gstreamer gtk \
-	ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png \
-	+python qt4 qt5 testprograms threads tiff vaapi v4l vtk webp xine"
-
-# 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="python? ( ${PYTHON_REQUIRED_USE} )
-	?? ( qt4 qt5 )
-	opengl? ( || ( gtk qt4 qt5 ) )"
-
-# 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? ( !qt4 )
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2
-	sys-libs/zlib
-	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
-	ffmpeg? (
-		libav? ( media-video/libav:0= )
-		!libav? ( media-video/ffmpeg:0= )
-	)
-	gdal? ( sci-libs/gdal )
-	gphoto2? ( media-libs/libgphoto2 )
-	gstreamer? (
-		media-libs/gstreamer:1.0
-		media-libs/gst-plugins-base:1.0
-	)
-	gtk? (
-		dev-libs/glib:2
-		x11-libs/gtk+:2
-		opengl? ( x11-libs/gtkglext )
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0 )
-	jpeg2k? ( media-libs/jasper )
-	ieee1394? (
-		media-libs/libdc1394
-		sys-libs/libraw1394
-	)
-	ipp? ( sci-libs/ipp )
-	opencl? ( virtual/opencl )
-	openexr? ( media-libs/openexr )
-	opengl? ( virtual/opengl virtual/glu )
-	png? ( media-libs/libpng:0= )
-	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
-	qt4? (
-		dev-qt/qtgui:4
-		dev-qt/qttest:4
-		opengl? ( dev-qt/qtopengl:4 )
-	)
-	qt5? (
-		dev-qt/qtgui:5
-		dev-qt/qtwidgets:5
-		dev-qt/qttest:5
-		dev-qt/qtconcurrent:5
-		opengl? ( dev-qt/qtopengl:5 )
-	)
-	threads? ( dev-cpp/tbb )
-	tiff? ( media-libs/tiff:0 )
-	v4l? ( >=media-libs/libv4l-0.8.3 )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp )
-	xine? ( media-libs/xine-lib )
-"
-DEPEND="${RDEPEND}
-	virtual/pkgconfig
-	eigen? ( dev-cpp/eigen:3 )
-	java?  ( >=virtual/jdk-1.6 )
-"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.0.0-gles.patch
-	"${FILESDIR}"/${PN}-3.1.0-cmake-no-opengl.patch
-	"${FILESDIR}"/${P}-git-autodetect.patch
-	"${FILESDIR}"/${P}-java-magic.patch
-	"${FILESDIR}"/${P}-gentooify-python.patch
-)
-
-GLOBALCMAKEARGS=()
-
-pkg_pretend() {
-	if use openmp; then
-		tc-has-openmp || die "Please switch to an openmp compatible compiler"
-	fi
-}
-
-pkg_setup() {
-	java-pkg-opt-2_pkg_setup
-}
-
-src_prepare() {
-	default
-
-	# remove bundled stuff
-	rm -rf 3rdparty || die "Removing 3rd party components failed"
-	sed -i \
-		-e '/add_subdirectory(.*3rdparty.*)/ d' \
-		CMakeLists.txt cmake/*cmake || die
-
-	java-pkg-opt-2_src_prepare
-
-	# Out-of-$S patching
-	if use contrib; then
-		cd "${WORKDIR}"/opencv_contrib-${PV} || die "cd failed"
-		epatch "${FILESDIR}"/${PN}-contrib-find-hdf5-fix.patch
-	fi
-}
-
-src_configure() {
-	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
-
-	# 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=$(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=OFF
-		-DWITH_IPP=$(usex ipp)
-		-DWITH_JASPER=$(usex jpeg2k)
-		-DWITH_JPEG=$(usex jpeg)
-		-DWITH_WEBP=$(usex webp)
-		-DWITH_OPENEXR=$(usex openexr)
-		-DWITH_OPENGL=$(usex opengl)
-		-DWITH_OPENNI=OFF 		# Not packaged
-		-DWITH_OPENNI2=OFF 		# Not packaged
-		-DWITH_PNG=$(usex png)
-		-DWITH_PVAPI=OFF		# Not packaged
-		-DWITH_GIGEAPI=OFF
-		# Qt in CMakeList.txt here: See below
-		-DWITH_WIN32UI=OFF		# Windows only
-		-DWITH_QUICKTIME=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=$(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=$(usex java) # Ant needed, no compile flag
-		-DWITH_IPP_A=OFF
-		-DWITH_MATLAB=ON
-		-DWITH_VA=$(usex vaapi)
-		-DWITH_VA_INTEL=$(usex vaapi)
-		-DWITH_GDAL=$(usex gdal)
-		-DWITH_GPHOTO2=$(usex gphoto2)
-	# ===================================================
-	# CUDA build components: nvidia-cuda-toolkit takes care of GCC version
-	# ===================================================
-		-DWITH_CUDA=$(usex cuda)
-		-DWITH_CUBLAS=$(usex cuda)
-		-DWITH_CUFFT=$(usex cuda)
-		-DCUDA_NPP_LIBRARY_ROOT_DIR=$(usex cuda "${EPREFIX}/opt/cuda" "")
-	# ===================================================
-	# OpenCV build components
-	# ===================================================
-		-DBUILD_SHARED_LIBS=ON
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_DOCS=OFF # Doesn't install anyways.
-		-DBUILD_EXAMPLES=$(usex examples)
-		-DBUILD_PERF_TESTS=OFF
-		-DBUILD_TESTS=$(usex testprograms)
-	# ===================================================
-	# OpenCV installation options
-	# ===================================================
-		-DINSTALL_C_EXAMPLES=$(usex examples)
-		-DINSTALL_TESTS=$(usex testprograms)
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_PRECOMPILED_HEADERS=$(usex pch)
-		-DHAVE_opencv_java=$(usex java YES NO)
-	# ===================================================
-	# things we want to be hard off or not yet figured out
-	# ===================================================
-		-DBUILD_PACKAGE=OFF
-		-DENABLE_PROFILING=OFF
-	# ===================================================
-	# things we want to be hard enabled not worth useflag
-	# ===================================================
-		-DCMAKE_SKIP_RPATH=ON
-		-DOPENCV_DOC_INSTALL_PATH=
-	)
-
-	if use qt4; then
-		GLOBALCMAKEARGS+=( -DWITH_QT=4 )
-	elif use qt5; then
-		GLOBALCMAKEARGS+=( -DWITH_QT=5 )
-	else
-		GLOBALCMAKEARGS+=( -DWITH_QT=OFF )
-	fi
-
-	use contrib && GLOBALCMAKEARGS+=(
-		-DOPENCV_EXTRA_MODULES_PATH="${WORKDIR}/opencv_contrib-${PV}/modules"
-	)
-
-	# workaround for bug 413429
-	tc-export CC CXX
-
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]}
-			    -DWITH_PYTHON=OFF
-			    -DINSTALL_PYTHON_EXAMPLES=OFF
-	)
-
-	cmake-utils_src_configure
-}
-
-python_module_compile() {
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		-DWITH_PYTHON=ON
-		-DGENTOO_PYTHON_EXECUTABLE=${EPYTHON}
-		-DGENTOO_PYTHON_INCLUDE_PATH="$(python_get_includedir)"
-		-DGENTOO_PYTHON_LIBRARIES="$(python_get_library_path)"
-		-DGENTOO_PYTHON_PACKAGES_PATH="$(python_get_sitedir)"
-		-DGENTOO_PYTHON_MAJOR=${EPYTHON:6:1}
-		-DGENTOO_PYTHON_MINOR=${EPYTHON:8:1}
-		-DGENTOO_PYTHON_DEBUG_LIBRARIES="" # Absolutely no clue what this is
-	)
-
-	if use examples; then
-		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=ON )
-	else
-		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=OFF )
-	fi
-
-	# Compile and install all at once because configuration will be wiped
-	# for each impl of Python
-	BUILD_DIR="${WORKDIR}"/${P}_build
-	cd "${BUILD_DIR}" || die "cd failed"
-
-	# 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 opencv_${EPYTHON:0:7}
-	cmake-utils_src_install install/fast
-
-	# Remove compiled binary so new version compiles
-	# Avoid conflicts with new module builds as build system doesn't
-	# really support it.
-	emake -C modules/${EPYTHON:0:7} clean
-	rm -rf modules/${EPYTHON:0:7} || die "rm failed"
-}
-
-src_install() {
-	cmake-utils_src_install
-
-	# Build and install the python modules for all targets
-	use python && python_foreach_impl python_module_compile
-}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2017-04-16 14:15 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2017-04-16 14:15 UTC (permalink / raw
  To: gentoo-commits

commit:     07d392554c7c60474bba42bd03cf978572e62976
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 16 14:11:02 2017 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Sun Apr 16 14:15:05 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07d39255

media-libs/opencv: version bump 3.2.0 bug #604982

Package-Manager: portage-2.3.3

 media-libs/opencv/Manifest                         |   3 +
 ...cv-3.2.0-contrib_xfeatures2d-autodownload.patch |  10 +
 media-libs/opencv/files/opencv-3.2.0-vtk.patch     |  11 +
 media-libs/opencv/metadata.xml                     |   5 +-
 media-libs/opencv/opencv-3.2.0.ebuild              | 329 +++++++++++++++++++++
 5 files changed, 356 insertions(+), 2 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 4b12e50eae0..040a0468305 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,3 +1,6 @@
 DIST opencv-2.4.13.zip 94319943 SHA256 fa6a45f635f4e1dbc982b8ccc93206650e7fc584b2f3dd945759ce28b047b94f SHA512 b5ccaa22deabfedd29b697296d265a32c7db959f2e94ca3643c1cde65fb84463809535f2e6bd49c4baa06958fa223a32bbfdd7234b8e160ec333fd9cd7800d3b WHIRLPOOL 86f7690b460dbcf70dec30c29784d96b2bb99e43ba70fe967d18b375fcee4f8934591f0d9fe2ff6717346eb9be8628766658d589eae9943d528352d1ce1df455
 DIST opencv-3.1.0.tar.gz 76135587 SHA256 f00b3c4f42acda07d89031a2ebb5ebe390764a133502c03a511f67b78bbd4fbf SHA512 57e0fe41e3d5d1dc036e7fc5673523e53d54f5f62e4d3bcb95238a9cd53e79da7c1704dc136ce632f7cfce369ebf5eb27f629a9b6ac4f7fa34120b80b5c7438f WHIRLPOOL b2825d5cafa87e0fe9cacd093ddb969913d916c0370819073b2bde3c598798efcf23c406aae2116f2628c564ca99e5f871a448a3ece97d8d29ec73841ac283b4
 DIST opencv-3.1.0_contrib-75b3ea9.tar.gz 54277105 SHA256 478f742457d3f4e96f857b726e35b28a8d20a1de8e5f51b8671251bc896d443b SHA512 d1d11520b8729fbaf0257c927654251ff9ac1ba5cf937af9dd973ec39f483d1ee08aff7ad3f1a9941fef921a35dc466ac5574918197ddecd3f6c66b682bf671a WHIRLPOOL 18b70014428c4fa532658ca5ac332bffaae049b468f46cb027a6972f21f5b2bd17d02b33d68c43b84f821a77fa09efb9c372499cfa4f645a0516b93acb858353
+DIST opencv-3.2.0.tar.gz 78861546 SHA256 b9d62dfffb8130d59d587627703d5f3e6252dce4a94c1955784998da7a39dd35 SHA512 a338f4b4cdebfc2dcd763427b9c9632b3a3b0d072117b8e6367c73ea1ac21f7148553a23c7afbb44b01a48be3be95520789c2de1d6ae230b7b414ee713d3606d WHIRLPOOL 092c0c1195d80f89e0e2fd030a93eb80e7b83ce155fdcd9fa071248be20127a684922c83de73be9bf321d934e14b0b4e60cc78ab272ab9d39d6707da37db30d3
+DIST opencv-3.2.0_contrib.tar.gz 54765210 SHA256 1e2bb6c9a41c602904cc7df3f8fb8f98363a88ea564f2a087240483426bf8cbe SHA512 eadb6a8a3625235b0c71e29c36d15d9342278aaf9148ef6a7e1aa80f4db0491aaf30b6df16bfd0cd358402b2a3059b6acbce23fb5fe2c0c57150a733ffbbff5a WHIRLPOOL eb8f916c19474a58f4c2785e50dc261a31f684a917011473b94a19d26e4e9845c042f77196c000dd97543699b745360114cdd31cad549379b6394e9d727c72a8
+DIST vgg_boostdesc-3.2.0.tar.gz 1867770 SHA256 6da9c2465e2b36330fa5d5c45320a0667da5cb4eafd66a5b1f45feb2af047a27 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44 WHIRLPOOL 5c78e43c95d40d103ac741248deb130bcb49a5b7e2cd012135572630b525b6f15a7f89948170c76545d97eb3815a000a2a1236ad24de2205eeb8938ee8eb0c12

diff --git a/media-libs/opencv/files/opencv-3.2.0-contrib_xfeatures2d-autodownload.patch b/media-libs/opencv/files/opencv-3.2.0-contrib_xfeatures2d-autodownload.patch
new file mode 100644
index 00000000000..f03c57d425c
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.2.0-contrib_xfeatures2d-autodownload.patch
@@ -0,0 +1,10 @@
+--- a/modules/xfeatures2d/CMakeLists.txt	2017-02-28 13:10:56.470000000 +0100
++++ b/modules/xfeatures2d/CMakeLists.txt	2017-02-28 13:11:03.970000000 +0100
+@@ -1,5 +1,5 @@
+ set(the_description "Contributed/Experimental Algorithms for Salient 2D Features Detection")
+ ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d opencv_shape opencv_highgui opencv_videoio opencv_ml
+                   OPTIONAL opencv_cudaarithm WRAP python java)
+-include(cmake/download_vgg.cmake)
+-include(cmake/download_boostdesc.cmake)
++#include(cmake/download_vgg.cmake)
++#include(cmake/download_boostdesc.cmake)

diff --git a/media-libs/opencv/files/opencv-3.2.0-vtk.patch b/media-libs/opencv/files/opencv-3.2.0-vtk.patch
new file mode 100644
index 00000000000..1e3daec8aa3
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.2.0-vtk.patch
@@ -0,0 +1,11 @@
+--- a/cmake/OpenCVDetectVTK.cmake	2017-03-20 10:43:28.401962910 +0100
++++ b/cmake/OpenCVDetectVTK.cmake	2017-03-20 10:43:09.127963906 +0100
+@@ -8,7 +8,7 @@
+   IF(VTK_RENDERING_BACKEND) #in vtk 7, the rendering backend is exported as a var.
+       find_package(VTK QUIET COMPONENTS vtkRendering${VTK_RENDERING_BACKEND} vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport vtkIOGeometry NO_MODULE)
+   ELSE(VTK_RENDERING_BACKEND)
+-      find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
++      find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL2 vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)
+   ENDIF(VTK_RENDERING_BACKEND)
+ ENDIF(VTK_FOUND)
+ 

diff --git a/media-libs/opencv/metadata.xml b/media-libs/opencv/metadata.xml
index d136656a74c..271e8804134 100644
--- a/media-libs/opencv/metadata.xml
+++ b/media-libs/opencv/metadata.xml
@@ -3,7 +3,7 @@
 <pkgmetadata>
 	<maintainer type="person">
 		<email>amynka@gentoo.org</email>
-		<name>Amy Winston</name>
+		<name>Amy Liffey</name>
 		<description>Assign bugs on me.</description>
 	</maintainer>
 	<maintainer type="person">
@@ -17,12 +17,13 @@ Face Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion Under
 </longdescription>
 	<use>
 		<flag name="contrib">Install user contributed scripts from opencv_contrib (Experimental!)</flag>
-		<flag name="cuda">Enable NVIDIA Cuda computations support</flag>
+		<flag name="cuda">Enable NVIDIA Cuda computations support (Experimental!)</flag>
 		<flag name="eigen">Enable usage of <pkg>dev-cpp/eigen</pkg> for computations</flag>
 		<flag name="gdal">Enable support for sci-libs/gdal library</flag>
 		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="gflags">Use Google's C++ argument parsing library</flag>
 		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="glog">Use Google's C++ loggin library</flag>
 		<flag name="ipp">Enable Intel Integrated Primitive support</flag>
+		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contrib_xfeatures2d">Enables xfeatures2d and autodownload of samples in contrib</flag>
 		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contrib_cvv">CVV module requires Qt5</flag>
 		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contrib_hdf">HDF module requires <pkg>sci-libs/hdf5</pkg></flag>
 		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contrib_sfm">SFM module requires eigen, gflags, and glog</flag>

diff --git a/media-libs/opencv/opencv-3.2.0.ebuild b/media-libs/opencv/opencv-3.2.0.ebuild
new file mode 100644
index 00000000000..4f91336a398
--- /dev/null
+++ b/media-libs/opencv/opencv-3.2.0.ebuild
@@ -0,0 +1,329 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit toolchain-funcs cmake-utils python-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+	contrib? ( https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
+		contrib_xfeatures2d? ( http://dev.gentoo.org/~amynka/snap/vgg_boostdesc-${PV}.tar.gz ) )"
+LICENSE="BSD"
+SLOT="0/3.2" # subslot = libopencv* soname version
+KEYWORDS="~amd64 ~arm ~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_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_hdf? ( contrib )
+	contrib_sfm? ( contrib eigen gflags glog )
+	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
+	sys-libs/zlib
+	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
+	contrib_hdf? ( sci-libs/hdf5 )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gdal? ( sci-libs/gdal:= )
+	gflags? ( dev-cpp/gflags )
+	glog? ( dev-cpp/glog )
+	gphoto2? ( media-libs/libgphoto2 )
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+		)
+	ipp? ( sci-libs/ipp )
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper:= )
+	lapack? ( virtual/lapack )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	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 )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	webp? ( media-libs/libwebp )
+	xine? ( media-libs/xine-lib )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java?  ( >=virtual/jdk-1.6 )"
+
+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"
+	"${FILESDIR}/${P}-vtk.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_xfeatures2d; then
+		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
+		eapply "${FILESDIR}/${P}-contrib_xfeatures2d-autodownload.patch"
+		mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
+	fi
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+	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
+
+	# 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=$(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=$(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=$(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=$(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=$(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=$(usex gdal)
+		-DWITH_GPHOTO2=$(usex gphoto2)
+		-DWITH_LAPACK=$(usex lapack)
+	# ===================================================
+	# CUDA build components: nvidia-cuda-toolkit takes care of GCC version
+	# ===================================================
+		-DWITH_CUDA=$(usex cuda)
+		-DWITH_CUBLAS=$(usex cuda)
+		-DWITH_CUFFT=$(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=$(usex examples)
+		-DBUILD_PERF_TESTS=OFF
+		-DBUILD_TESTS=$(usex testprograms)
+		-DBUILD_WITH_DEBUG_INFO=$(usex debug)
+	#	-DBUILD_WITH_STATIC_CRT=OFF
+		-DBUILD_WITH_DYNAMIC_IPP=OFF
+		-DBUILD_FAT_JAVA_LIB=$(usex java)
+	#	-DBUILD_ANDROID_SERVICE=OFF
+		-DBUILD_CUDA_STUBS=$(usex cuda)
+		-DOPENCV_EXTRA_MODULES_PATH=$(usex contrib "${WORKDIR}/opencv_contrib-${PV}/modules" "")
+	# ===================================================
+	# OpenCV installation options
+	# ===================================================
+		-DINSTALL_CREATE_DISTRIB=OFF
+		-DINSTALL_C_EXAMPLES=$(usex examples)
+		-DINSTALL_TESTS=$(usex testprograms)
+		-DINSTALL_PYTHON_EXAMPLES=$(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
+		-DENABLE_OMIT_FRAME_POINTER=OFF
+		-DENABLE_FAST_MATH=OFF
+		-DENABLE_SSE=OFF
+		-DENABLE_SSE2=OFF
+		-DENABLE_SSE3=OFF
+		-DENABLE_SSSE3=OFF
+		-DENABLE_SSE41=OFF
+		-DENABLE_SSE42=OFF
+		-DENABLE_POPCNT=OFF
+		-DENABLE_AVX=OFF
+		-DENABLE_AVX=OFF
+		-DENABLE_AVX2=OFF
+		-DENABLE_FMA3=OFF
+		-DENABLE_NEON=OFF
+
+		-DHAVE_opencv_java=$(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
+		-DENABLE_PROFILING=OFF
+	# ===================================================
+	# 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=OFF
+			-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=$(usex contrib_hdf ON OFF)
+			-DBUILD_opencv_sfm=$(usex contrib_sfm ON OFF)
+		)
+	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 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)
+	)
+
+	# Compile and install all at once because configuration will be wiped
+	# for each impl of Python
+	BUILD_DIR="${WORKDIR}"/${P}_build
+	cd "${BUILD_DIR}" || die "cd failed"
+
+	# 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"
+}
+
+src_install() {
+	cmake-utils_src_install
+
+	# Build and install the python modules for all targets
+	use python && python_foreach_impl python_module_compile
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2017-06-06 14:45 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2017-06-06 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     4f5b990bd068f98184e7ecfabf461a33275569c5
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  6 14:42:31 2017 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Tue Jun  6 14:42:31 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f5b990b

media-libs/opencv: disable pch for gcc-6.0 bug #617654

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 media-libs/opencv/Manifest                         |   1 +
 .../opencv/files/opencv-2.4.13-gcc-6.0.patch       |  23 ++
 media-libs/opencv/files/opencv-3.2.0-gcc-6.0.patch |  11 +
 media-libs/opencv/opencv-2.4.13-r1.ebuild          | 240 +++++++++++++++
 media-libs/opencv/opencv-3.2.0-r1.ebuild           | 330 +++++++++++++++++++++
 5 files changed, 605 insertions(+)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 040a0468305..a529669fefa 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,3 +1,4 @@
+DIST opencv-2.4.13.tar.gz 91669572 SHA256 94ebcca61c30034d5fb16feab8ec12c8a868f5162d20a9f0396f0f5f6d8bbbff SHA512 efdc4340fdf557dae44ac604c8c20f61ced89f99274264b61c2640f28741504462c6b57076e207040ca2513e3921275bdfbe6c22fc123bd50df78745e6b7bcd6 WHIRLPOOL 9fdbf2e47edeb8c177cb03ed5dc129475dd704c022975bc875d444a6e6c3df630f1151e738cf07fbe48343d0eb87723091131063fe776c63a386c46c0153f1d5
 DIST opencv-2.4.13.zip 94319943 SHA256 fa6a45f635f4e1dbc982b8ccc93206650e7fc584b2f3dd945759ce28b047b94f SHA512 b5ccaa22deabfedd29b697296d265a32c7db959f2e94ca3643c1cde65fb84463809535f2e6bd49c4baa06958fa223a32bbfdd7234b8e160ec333fd9cd7800d3b WHIRLPOOL 86f7690b460dbcf70dec30c29784d96b2bb99e43ba70fe967d18b375fcee4f8934591f0d9fe2ff6717346eb9be8628766658d589eae9943d528352d1ce1df455
 DIST opencv-3.1.0.tar.gz 76135587 SHA256 f00b3c4f42acda07d89031a2ebb5ebe390764a133502c03a511f67b78bbd4fbf SHA512 57e0fe41e3d5d1dc036e7fc5673523e53d54f5f62e4d3bcb95238a9cd53e79da7c1704dc136ce632f7cfce369ebf5eb27f629a9b6ac4f7fa34120b80b5c7438f WHIRLPOOL b2825d5cafa87e0fe9cacd093ddb969913d916c0370819073b2bde3c598798efcf23c406aae2116f2628c564ca99e5f871a448a3ece97d8d29ec73841ac283b4
 DIST opencv-3.1.0_contrib-75b3ea9.tar.gz 54277105 SHA256 478f742457d3f4e96f857b726e35b28a8d20a1de8e5f51b8671251bc896d443b SHA512 d1d11520b8729fbaf0257c927654251ff9ac1ba5cf937af9dd973ec39f483d1ee08aff7ad3f1a9941fef921a35dc466ac5574918197ddecd3f6c66b682bf671a WHIRLPOOL 18b70014428c4fa532658ca5ac332bffaae049b468f46cb027a6972f21f5b2bd17d02b33d68c43b84f821a77fa09efb9c372499cfa4f645a0516b93acb858353

diff --git a/media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch b/media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch
new file mode 100644
index 00000000000..b0a5084752c
--- /dev/null
+++ b/media-libs/opencv/files/opencv-2.4.13-gcc-6.0.patch
@@ -0,0 +1,23 @@
+From fb598bb76a0431aa3a880ecfa45054c996a070fb Mon Sep 17 00:00:00 2001
+From: Maksim Shabunin <maksim.shabunin@itseez.com>
+Date: Fri, 13 May 2016 13:28:09 +0300
+Subject: [PATCH] Disabled PCH support for gcc >= 6.0.0
+
+Command line generation routine uses "-isystem" to include headers outside of "<opencv>/modules" folder, but GCC 6 does not work when passed "-isystem /usr/include" option.
+---
+ cmake/OpenCVPCHSupport.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/OpenCVPCHSupport.cmake b/cmake/OpenCVPCHSupport.cmake
+index 13619daf27e..e6585cae020 100644
+--- a/cmake/OpenCVPCHSupport.cmake
++++ b/cmake/OpenCVPCHSupport.cmake
+@@ -19,7 +19,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
+         ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
+         OUTPUT_VARIABLE gcc_compiler_version)
+     #MESSAGE("GCC Version: ${gcc_compiler_version}")
+-    IF(gcc_compiler_version VERSION_GREATER "4.2.-1")
++    IF(gcc_compiler_version VERSION_GREATER "4.2.-1" AND gcc_compiler_version VERSION_LESS "6.0.0")
+         SET(PCHSupport_FOUND TRUE)
+     ENDIF()
+ 

diff --git a/media-libs/opencv/files/opencv-3.2.0-gcc-6.0.patch b/media-libs/opencv/files/opencv-3.2.0-gcc-6.0.patch
new file mode 100644
index 00000000000..457d3595e49
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.2.0-gcc-6.0.patch
@@ -0,0 +1,11 @@
+--- a/cmake/OpenCVPCHSupport.cmake	2017-06-06 15:05:09.180022719 +0200
++++ b/cmake/OpenCVPCHSupport.cmake	2017-06-06 15:05:50.775022684 +0200
+@@ -14,7 +14,7 @@
+ 
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ 
+-    IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2.0")
++    IF(gcc_compiler_version VERSION_GREATER "4.2.-1" AND gcc_compiler_version VERSION_LESS "6.0.0")
+         SET(PCHSupport_FOUND TRUE)
+     ENDIF()
+ 

diff --git a/media-libs/opencv/opencv-2.4.13-r1.ebuild b/media-libs/opencv/opencv-2.4.13-r1.ebuild
new file mode 100644
index 00000000000..b57b2652493
--- /dev/null
+++ b/media-libs/opencv/opencv-2.4.13-r1.ebuild
@@ -0,0 +1,240 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python2_7 )
+
+inherit toolchain-funcs cmake-utils python-single-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+SRC_URI="https://github.com/Itseez/opencv/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/2.4"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~amd64-linux"
+IUSE="cuda +eigen examples ffmpeg gstreamer gtk ieee1394 ipp jpeg jpeg2k libav opencl openexr opengl openmp pch png +python qt4 qt5 testprograms threads tiff v4l vtk xine"
+REQUIRED_USE="
+	python? ( ${PYTHON_REQUIRED_USE} )
+	?? ( qt4 qt5 )
+"
+
+# 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? ( !qt4 )
+#	opengl? ( || ( gtk qt4 ) )
+#	openmp? ( !threads )
+
+RDEPEND="
+	app-arch/bzip2
+	sys-libs/zlib
+	cuda? ( >=dev-util/nvidia-cuda-toolkit-5.5 )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper:= )
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+	)
+	ipp? ( sci-libs/ipp )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	python? ( ${PYTHON_DEPS} dev-python/numpy[${PYTHON_USEDEP}] )
+	qt4? (
+		dev-qt/qtgui:4
+		dev-qt/qttest:4
+		opengl? ( dev-qt/qtopengl:4 )
+	)
+	qt5? (
+		dev-qt/qtgui:5
+		dev-qt/qttest:5
+		dev-qt/qtconcurrent:5
+		opengl? ( dev-qt/qtopengl:5 )
+	)
+	threads? ( dev-cpp/tbb )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	xine? ( media-libs/xine-lib )
+"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java? ( >=virtual/jdk-1.6 )
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.3.1a-libav-0.7.patch"
+	"${FILESDIR}/${PN}-2.4.3-gcc47.patch"
+	"${FILESDIR}/${PN}-2.4.2-cflags.patch"
+	"${FILESDIR}/${PN}-2.4.8-javamagic.patch"
+	"${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch"
+	"${FILESDIR}/${PN}-3.0.0-gles.patch"
+	"${FILESDIR}/${P}-gcc-6.0.patch"
+)
+#"${FILESDIR}/${P}-git-autodetect.patch
+
+pkg_setup() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+	use python && python-single-r1_pkg_setup
+	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 -i \
+		-e '/add_subdirectory(3rdparty)/ d' \
+		CMakeLists.txt || die
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+
+	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
+
+	# please dont sort here, order is the same as in CMakeLists.txt
+	local mycmakeargs=(
+	# the optinal dependency libraries
+		-DWITH_1394=$(usex ieee1394)
+		-DWITH_AVFOUNDATION=OFF
+		-DWITH_VTK=$(usex vtk)
+		-DWITH_EIGEN=$(usex eigen)
+		-DWITH_VFW=OFF
+		-DWITH_FFMPEG=$(usex ffmpeg)
+		-DWITH_GSTREAMER=$(usex gstreamer)
+		-DWITH_GSTREAMER_0_10=OFF
+		-DWITH_GTK=$(usex gtk)
+		-DWITH_IMAGEIO=OFF
+		-DWITH_IPP=$(usex ipp)
+		-DWITH_JASPER=$(usex jpeg2k)
+		-DWITH_JPEG=$(usex jpeg)
+		-DWITH_OPENEXR=$(usex openexr)
+		-DWITH_OPENGL=$(usex opengl)
+		-DWITH_OPENCL=$(usex opencl)
+		-DWITH_OPENNI=OFF
+		-DWITH_PNG=$(usex png)
+		-DWITH_PVAPI=OFF
+		-DWITH_GIGEAPI=OFF
+		-DWITH_WIN32UI=OFF
+		-DWITH_QUICKTIME=OFF
+		-DWITH_TBB=$(usex threads)
+		-DWITH_OPENMP=$(usex openmp)
+		-DWITH_CSTRIPES=OFF
+		-DWITH_TIFF=$(usex tiff)
+		-DWITH_UNICAP=OFF
+		-DWITH_V4L=$(usex v4l)
+		-DWITH_LIBV4L=$(usex v4l)
+		-DWITH_DSHOW=ON
+		-DWITH_MSMF=OFF
+		-DWITH_XIMEA=OFF
+		-DWITH_XINE=$(usex xine)
+		-DWITH_OPENCL=$(usex opencl)
+		-DWITH_OPENCLAMDFFT=$(usex opencl)
+		-DWITH_OPENCLAMDBLAS=$(usex opencl)
+		-DWITH_INTELPERC=OFF
+		-DWITH_JAVA=$(usex java)
+
+		# the build components
+		-DBUILD_SHARED_LIBS=ON
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		-DBUILD_DOCS=OFF #too much dark magic in cmakelists
+		-DBUILD_EXAMPLES=$(usex examples)
+		-DBUILD_PERF_TESTS=OFF
+		-DBUILD_TESTS=$(usex testprograms)
+
+		# install examples
+		-DINSTALL_C_EXAMPLES=$(usex examples)
+		-DINSTALL_TESTS=$(usex testprograms)
+
+		# build options
+		-DENABLE_PRECOMPILED_HEADERS=$(usex pch)
+		-DENABLE_SOLUTION_FOLDERS=OFF
+		-DENABLE_PROFILING=OFF
+		-DENABLE_COVERAGE=OFF
+		-DENABLE_OMIT_FRAME_POINTER=OFF
+		-DENABLE_FAST_MATH=OFF					#
+		-DENABLE_SSE=OFF					# these options do nothing but
+		-DENABLE_SSE2=OFF					# add params to CFLAGS
+		-DENABLE_SSE3=OFF
+		-DENABLE_SSSE3=OFF
+		-DENABLE_SSE41=OFF
+		-DENABLE_SSE42=OFF
+
+		-DOPENCV_EXTRA_FLAGS_RELEASE=""				# black magic
+	)
+
+	if use qt4; then
+		mycmakeargs+=( -DWITH_QT=4 )
+	elif use qt5; then
+		mycmakeargs+=( -DWITH_QT=5 )
+	else
+		mycmakeargs+=( -DWITH_QT=OFF )
+	fi
+
+	if use cuda; then
+		if [[ "$(gcc-version)" > "4.8" ]]; then
+			# bug 577410
+			# #error -- unsupported GNU version! gcc 4.9 and up are not supported!
+			ewarn "CUDA and >=sys-devel/gcc-4.9 do not play well together. Disabling CUDA support."
+			mycmakeargs+=( -DWITH_CUDA=OFF )
+			mycmakeargs+=( -DWITH_CUBLAS=OFF )
+			mycmakeargs+=( -DWITH_CUFFT=OFF )
+
+		else
+			mycmakeargs+=( -DWITH_CUDA=ON )
+			mycmakeargs+=( -DWITH_CUBLAS=ON )
+			mycmakeargs+=( -DWITH_CUFFT=ON )
+			mycmakeargs+=( -DCUDA_NPP_LIBRARY_ROOT_DIR=/opt/cuda )
+		fi
+	else
+		mycmakeargs+=( -DWITH_CUDA=OFF )
+		mycmakeargs+=( -DWITH_CUBLAS=OFF )
+		mycmakeargs+=( -DWITH_CUFFT=OFF )
+	fi
+
+	if use examples && use python; then
+		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=ON )
+	else
+		mycmakeargs+=( -DINSTALL_PYTHON_EXAMPLES=OFF )
+	fi
+
+	# things we want to be hard off or not yet figured out
+	mycmakeargs+=(
+		-DOPENCV_BUILD_3RDPARTY_LIBS=OFF
+		-DBUILD_PACKAGE=OFF
+	)
+
+	# things we want to be hard enabled not worth useflag
+	mycmakeargs+=(
+		-DCMAKE_SKIP_RPATH=ON
+		-DOPENCV_DOC_INSTALL_PATH=
+	)
+
+	# workaround for bug 413429
+	tc-export CC CXX
+
+	cmake-utils_src_configure
+}

diff --git a/media-libs/opencv/opencv-3.2.0-r1.ebuild b/media-libs/opencv/opencv-3.2.0-r1.ebuild
new file mode 100644
index 00000000000..6e33ecd87af
--- /dev/null
+++ b/media-libs/opencv/opencv-3.2.0-r1.ebuild
@@ -0,0 +1,330 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+inherit toolchain-funcs cmake-utils python-r1 java-pkg-opt-2 java-ant-2
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="http://opencv.org"
+
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+	contrib? ( https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
+		contrib_xfeatures2d? ( http://dev.gentoo.org/~amynka/snap/vgg_boostdesc-${PV}.tar.gz ) )"
+LICENSE="BSD"
+SLOT="0/3.2" # subslot = libopencv* soname version
+KEYWORDS="~amd64 ~arm ~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_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_hdf? ( contrib )
+	contrib_sfm? ( contrib eigen gflags glog )
+	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
+	sys-libs/zlib
+	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
+	contrib_hdf? ( sci-libs/hdf5 )
+	ffmpeg? (
+		libav? ( media-video/libav:0= )
+		!libav? ( media-video/ffmpeg:0= )
+	)
+	gdal? ( sci-libs/gdal:= )
+	gflags? ( dev-cpp/gflags )
+	glog? ( dev-cpp/glog )
+	gphoto2? ( media-libs/libgphoto2 )
+	gstreamer? (
+		media-libs/gstreamer:1.0
+		media-libs/gst-plugins-base:1.0
+	)
+	gtk? (
+		dev-libs/glib:2
+		x11-libs/gtk+:2
+		opengl? ( x11-libs/gtkglext )
+	)
+	ieee1394? (
+		media-libs/libdc1394
+		sys-libs/libraw1394
+		)
+	ipp? ( sci-libs/ipp )
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0 )
+	jpeg2k? ( media-libs/jasper:= )
+	lapack? ( virtual/lapack )
+	opencl? ( virtual/opencl )
+	openexr? ( media-libs/openexr )
+	opengl? ( virtual/opengl virtual/glu )
+	png? ( media-libs/libpng:0= )
+	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 )
+	tiff? ( media-libs/tiff:0 )
+	v4l? ( >=media-libs/libv4l-0.8.3 )
+	vtk? ( sci-libs/vtk[rendering] )
+	webp? ( media-libs/libwebp )
+	xine? ( media-libs/xine-lib )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	eigen? ( dev-cpp/eigen:3 )
+	java?  ( >=virtual/jdk-1.6 )"
+
+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"
+	"${FILESDIR}/${P}-vtk.patch"
+	"${FILESDIR}/${P}-gcc-6.0.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_xfeatures2d; then
+		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
+		eapply "${FILESDIR}/${P}-contrib_xfeatures2d-autodownload.patch"
+		mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
+	fi
+
+	java-pkg-opt-2_src_prepare
+}
+
+src_configure() {
+	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
+
+	# 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=$(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=$(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=$(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=$(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=$(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=$(usex gdal)
+		-DWITH_GPHOTO2=$(usex gphoto2)
+		-DWITH_LAPACK=$(usex lapack)
+	# ===================================================
+	# CUDA build components: nvidia-cuda-toolkit takes care of GCC version
+	# ===================================================
+		-DWITH_CUDA=$(usex cuda)
+		-DWITH_CUBLAS=$(usex cuda)
+		-DWITH_CUFFT=$(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=$(usex examples)
+		-DBUILD_PERF_TESTS=OFF
+		-DBUILD_TESTS=$(usex testprograms)
+		-DBUILD_WITH_DEBUG_INFO=$(usex debug)
+	#	-DBUILD_WITH_STATIC_CRT=OFF
+		-DBUILD_WITH_DYNAMIC_IPP=OFF
+		-DBUILD_FAT_JAVA_LIB=$(usex java)
+	#	-DBUILD_ANDROID_SERVICE=OFF
+		-DBUILD_CUDA_STUBS=$(usex cuda)
+		-DOPENCV_EXTRA_MODULES_PATH=$(usex contrib "${WORKDIR}/opencv_contrib-${PV}/modules" "")
+	# ===================================================
+	# OpenCV installation options
+	# ===================================================
+		-DINSTALL_CREATE_DISTRIB=OFF
+		-DINSTALL_C_EXAMPLES=$(usex examples)
+		-DINSTALL_TESTS=$(usex testprograms)
+		-DINSTALL_PYTHON_EXAMPLES=$(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
+		-DENABLE_OMIT_FRAME_POINTER=OFF
+		-DENABLE_FAST_MATH=OFF
+		-DENABLE_SSE=OFF
+		-DENABLE_SSE2=OFF
+		-DENABLE_SSE3=OFF
+		-DENABLE_SSSE3=OFF
+		-DENABLE_SSE41=OFF
+		-DENABLE_SSE42=OFF
+		-DENABLE_POPCNT=OFF
+		-DENABLE_AVX=OFF
+		-DENABLE_AVX=OFF
+		-DENABLE_AVX2=OFF
+		-DENABLE_FMA3=OFF
+		-DENABLE_NEON=OFF
+
+		-DHAVE_opencv_java=$(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
+		-DENABLE_PROFILING=OFF
+	# ===================================================
+	# 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=OFF
+			-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=$(usex contrib_hdf ON OFF)
+			-DBUILD_opencv_sfm=$(usex contrib_sfm ON OFF)
+		)
+	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 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)
+	)
+
+	# Compile and install all at once because configuration will be wiped
+	# for each impl of Python
+	BUILD_DIR="${WORKDIR}"/${P}_build
+	cd "${BUILD_DIR}" || die "cd failed"
+
+	# 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"
+}
+
+src_install() {
+	cmake-utils_src_install
+
+	# Build and install the python modules for all targets
+	use python && python_foreach_impl python_module_compile
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2017-09-01 11:39 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2017-09-01 11:39 UTC (permalink / raw
  To: gentoo-commits

commit:     a900af241376ab156509ae9a3832dfeb332d95b7
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  1 11:34:13 2017 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Fri Sep  1 11:37:13 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a900af24

media-libs/opencv: 2.4.13 add imgcodecs patch bug #627958

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 .../opencv-2.4.13-imgcodecs-refactoring.patch      | 580 +++++++++++++++++++++
 ...cv-2.4.13-r1.ebuild => opencv-2.4.13-r2.ebuild} |   2 +-
 2 files changed, 581 insertions(+), 1 deletion(-)

diff --git a/media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch b/media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch
new file mode 100644
index 00000000000..d1bea36580f
--- /dev/null
+++ b/media-libs/opencv/files/opencv-2.4.13-imgcodecs-refactoring.patch
@@ -0,0 +1,580 @@
+From 72d29259ca741950527c8cca7fb649030c01f658 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
+Date: Tue, 15 Aug 2017 22:04:55 +0000
+Subject: [PATCH] imgcodecs: refactoring, improve code quality
+
+---
+ modules/core/include/opencv2/core/core.hpp       |   3 +
+ modules/core/include/opencv2/core/operations.hpp |   3 +
+ modules/highgui/src/bitstrm.cpp                  |   2 +
+ modules/highgui/src/bitstrm.hpp                  |  19 ++--
+ modules/highgui/src/grfmt_bmp.cpp                |  13 ++-
+ modules/highgui/src/grfmt_pxm.cpp                | 119 +++++++++++++---------
+ modules/highgui/src/loadsave.cpp                 | 120 +++++++++++++++++++----
+ 7 files changed, 207 insertions(+), 72 deletions(-)
+
+diff --git a/modules/core/include/opencv2/core/core.hpp b/modules/core/include/opencv2/core/core.hpp
+index 6bb295f5c73..86f4eb182b2 100644
+--- a/modules/core/include/opencv2/core/core.hpp
++++ b/modules/core/include/opencv2/core/core.hpp
+@@ -3248,6 +3248,9 @@ template<typename _Tp, size_t fixed_size=4096/sizeof(_Tp)+8> class AutoBuffer
+     //! returns read-only pointer to the real buffer, stack-allocated or head-allocated
+     operator const _Tp* () const;
+ 
++    //! returns number of allocated elements
++    size_t getSize() const;
++
+ protected:
+     //! pointer to the real buffer, can point to buf if the buffer is small enough
+     _Tp* ptr;
+diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp
+index 1b7484aded2..37fd3d97c7a 100644
+--- a/modules/core/include/opencv2/core/operations.hpp
++++ b/modules/core/include/opencv2/core/operations.hpp
+@@ -2581,6 +2581,9 @@ template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::op
+ template<typename _Tp, size_t fixed_size> inline AutoBuffer<_Tp, fixed_size>::operator const _Tp* () const
+ { return ptr; }
+ 
++template<typename _Tp, size_t fixed_size> inline size_t AutoBuffer<_Tp, fixed_size>::getSize() const
++{ return size; }
++
+ 
+ /////////////////////////////////// Ptr ////////////////////////////////////////
+ 
+diff --git a/modules/highgui/src/bitstrm.cpp b/modules/highgui/src/bitstrm.cpp
+index dd8bec87cca..67792a27f28 100644
+--- a/modules/highgui/src/bitstrm.cpp
++++ b/modules/highgui/src/bitstrm.cpp
+@@ -208,6 +208,8 @@ int  RLByteStream::getByte()
+         current = m_current;
+     }
+ 
++    CV_Assert(current < m_end);
++
+     val = *((uchar*)current);
+     m_current = current + 1;
+     return val;
+diff --git a/modules/highgui/src/bitstrm.hpp b/modules/highgui/src/bitstrm.hpp
+index 57956beb539..b22987bc911 100644
+--- a/modules/highgui/src/bitstrm.hpp
++++ b/modules/highgui/src/bitstrm.hpp
+@@ -48,13 +48,20 @@
+ namespace cv
+ {
+ 
+-enum
+-{
+-    RBS_THROW_EOS=-123,  // <end of stream> exception code
+-    RBS_THROW_FORB=-124,  // <forrbidden huffman code> exception code
+-    RBS_HUFF_FORB=2047,  // forrbidden huffman code "value"
+-    RBS_BAD_HEADER=-125 // invalid header
++#define DECLARE_RBS_EXCEPTION(name) \
++class RBS_ ## name ## _Exception : public cv::Exception \
++{ \
++public: \
++    RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
++        cv::Exception(code_, err_, func_, file_, line_) \
++    {} \
+ };
++DECLARE_RBS_EXCEPTION(THROW_EOS)
++#define RBS_THROW_EOS RBS_THROW_EOS_Exception(CV_StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
++DECLARE_RBS_EXCEPTION(THROW_FORB)
++#define RBS_THROW_FORB RBS_THROW_FORB_Exception(CV_StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
++DECLARE_RBS_EXCEPTION(BAD_HEADER)
++#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(CV_StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
+ 
+ typedef unsigned long ulong;
+ 
+diff --git a/modules/highgui/src/grfmt_bmp.cpp b/modules/highgui/src/grfmt_bmp.cpp
+index c8f8218cd3b..026b317467d 100644
+--- a/modules/highgui/src/grfmt_bmp.cpp
++++ b/modules/highgui/src/grfmt_bmp.cpp
+@@ -115,8 +115,9 @@ bool  BmpDecoder::readHeader()
+ 
+                 if( m_bpp <= 8 )
+                 {
+-                    memset( m_palette, 0, sizeof(m_palette));
+-                    m_strm.getBytes( m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
++                    CV_Assert(clrused < 256);
++                    memset(m_palette, 0, sizeof(m_palette));
++                    m_strm.getBytes(m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
+                     iscolor = IsColorPalette( m_palette, m_bpp );
+                 }
+                 else if( m_bpp == 16 && m_rle_code == BMP_BITFIELDS )
+@@ -282,7 +283,9 @@ bool  BmpDecoder::readData( Mat& img )
+                     else if( code > 2 ) // absolute mode
+                     {
+                         if( data + code*nch > line_end ) goto decode_rle4_bad;
+-                        m_strm.getBytes( src, (((code + 1)>>1) + 1) & -2 );
++                        int sz = (((code + 1)>>1) + 1) & (~1);
++                        CV_Assert((size_t)sz < _src.getSize());
++                        m_strm.getBytes(src, sz);
+                         if( color )
+                             data = FillColorRow4( data, src, code, m_palette );
+                         else
+@@ -371,7 +374,9 @@ decode_rle4_bad: ;
+ 
+                         if( data + code3 > line_end )
+                             goto decode_rle8_bad;
+-                        m_strm.getBytes( src, (code + 1) & -2 );
++                        int sz = (code + 1) & (~1);
++                        CV_Assert((size_t)sz < _src.getSize());
++                        m_strm.getBytes(src, sz);
+                         if( color )
+                             data = FillColorRow8( data, src, code, m_palette );
+                         else
+diff --git a/modules/highgui/src/grfmt_pxm.cpp b/modules/highgui/src/grfmt_pxm.cpp
+index f73bbb1bf6b..e609d165966 100644
+--- a/modules/highgui/src/grfmt_pxm.cpp
++++ b/modules/highgui/src/grfmt_pxm.cpp
+@@ -43,50 +43,58 @@
+ #include "precomp.hpp"
+ #include "utils.hpp"
+ #include "grfmt_pxm.hpp"
++#include <iostream>
+ 
+ namespace cv
+ {
+ 
+ ///////////////////////// P?M reader //////////////////////////////
+ 
+-static int ReadNumber( RLByteStream& strm, int maxdigits )
++static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
+ {
+     int code;
+-    int val = 0;
++    int64 val = 0;
+     int digits = 0;
+ 
+     code = strm.getByte();
+ 
+-    if( !isdigit(code))
++    while (!isdigit(code))
+     {
+-        do
++        if (code == '#' )
+         {
+-            if( code == '#' )
++            do
+             {
+-                do
+-                {
+-                    code = strm.getByte();
+-                }
+-                while( code != '\n' && code != '\r' );
++                code = strm.getByte();
+             }
+-
++            while (code != '\n' && code != '\r');
+             code = strm.getByte();
+-
+-            while( isspace(code))
++        }
++        else if (isspace(code))
++        {
++            while (isspace(code))
+                 code = strm.getByte();
+         }
+-        while( !isdigit( code ));
++        else
++        {
++#if 1
++            CV_Error_(CV_StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
++#else
++            code = strm.getByte();
++#endif
++        }
+     }
+ 
+     do
+     {
+-        val = val*10 + code - '0';
+-        if( ++digits >= maxdigits ) break;
++        val = val*10 + (code - '0');
++        CV_Assert(val <= INT_MAX && "PXM: ReadNumber(): result is too large");
++        digits++;
++        if (maxdigits != 0 && digits >= maxdigits) break;
+         code = strm.getByte();
+     }
+-    while( isdigit(code));
++    while (isdigit(code));
+ 
+-    return val;
++    return (int)val;
+ }
+ 
+ 
+@@ -119,13 +127,13 @@ ImageDecoder PxMDecoder::newDecoder() const
+     return new PxMDecoder;
+ }
+ 
+-void  PxMDecoder::close()
++void PxMDecoder::close()
+ {
+     m_strm.close();
+ }
+ 
+ 
+-bool  PxMDecoder::readHeader()
++bool PxMDecoder::readHeader()
+ {
+     bool result = false;
+ 
+@@ -155,10 +163,10 @@ bool  PxMDecoder::readHeader()
+         m_binary = code >= '4';
+         m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
+ 
+-        m_width = ReadNumber( m_strm, INT_MAX );
+-        m_height = ReadNumber( m_strm, INT_MAX );
++        m_width = ReadNumber(m_strm);
++        m_height = ReadNumber(m_strm);
+ 
+-        m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
++        m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
+         if( m_maxval > 65535 )
+             throw RBS_BAD_HEADER;
+ 
+@@ -172,8 +180,14 @@ bool  PxMDecoder::readHeader()
+             result = true;
+         }
+     }
+-    catch(...)
++    catch (const cv::Exception&)
+     {
++        throw;
++    }
++    catch (...)
++    {
++        std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
++        throw;
+     }
+ 
+     if( !result )
+@@ -193,27 +207,23 @@ bool  PxMDecoder::readData( Mat& img )
+     int step = (int)img.step;
+     PaletteEntry palette[256];
+     bool   result = false;
+-    int  bit_depth = CV_ELEM_SIZE1(m_type)*8;
+-    int  src_pitch = (m_width*m_bpp*bit_depth/8 + 7)/8;
++    const int bit_depth = CV_ELEM_SIZE1(m_type)*8;
++    const int src_pitch = (m_width*m_bpp*(bit_depth/8) + 7) / 8;
++
+     int  nch = CV_MAT_CN(m_type);
+     int  width3 = m_width*nch;
+-    int  i, x, y;
+ 
+     if( m_offset < 0 || !m_strm.isOpened())
+         return false;
+ 
+-    AutoBuffer<uchar,1024> _src(src_pitch + 32);
+-    uchar* src = _src;
+-    AutoBuffer<uchar,1024> _gray_palette;
+-    uchar* gray_palette = _gray_palette;
++    uchar gray_palette[256] = {0};
+ 
+     // create LUT for converting colors
+     if( bit_depth == 8 )
+     {
+-        _gray_palette.allocate(m_maxval + 1);
+-        gray_palette = _gray_palette;
++        CV_Assert(m_maxval < 256);
+ 
+-        for( i = 0; i <= m_maxval; i++ )
++        for (int i = 0; i <= m_maxval; i++)
+             gray_palette[i] = (uchar)((i*255/m_maxval)^(m_bpp == 1 ? 255 : 0));
+ 
+         FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
+@@ -227,12 +237,16 @@ bool  PxMDecoder::readData( Mat& img )
+         {
+         ////////////////////////// 1 BPP /////////////////////////
+         case 1:
++            CV_Assert(CV_MAT_DEPTH(m_type) == CV_8U);
+             if( !m_binary )
+             {
+-                for( y = 0; y < m_height; y++, data += step )
++                AutoBuffer<uchar> _src(m_width);
++                uchar* src = _src;
++
++                for (int y = 0; y < m_height; y++, data += step)
+                 {
+-                    for( x = 0; x < m_width; x++ )
+-                        src[x] = ReadNumber( m_strm, 1 ) != 0;
++                    for (int x = 0; x < m_width; x++)
++                        src[x] = ReadNumber(m_strm, 1) != 0;
+ 
+                     if( color )
+                         FillColorRow8( data, src, m_width, palette );
+@@ -242,7 +256,10 @@ bool  PxMDecoder::readData( Mat& img )
+             }
+             else
+             {
+-                for( y = 0; y < m_height; y++, data += step )
++                AutoBuffer<uchar> _src(src_pitch);
++                uchar* src = _src;
++
++                for (int y = 0; y < m_height; y++, data += step)
+                 {
+                     m_strm.getBytes( src, src_pitch );
+ 
+@@ -258,11 +275,15 @@ bool  PxMDecoder::readData( Mat& img )
+         ////////////////////////// 8 BPP /////////////////////////
+         case 8:
+         case 24:
+-            for( y = 0; y < m_height; y++, data += step )
++        {
++            AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
++            uchar* src = _src;
++
++            for (int y = 0; y < m_height; y++, data += step)
+             {
+                 if( !m_binary )
+                 {
+-                    for( x = 0; x < width3; x++ )
++                    for (int x = 0; x < width3; x++)
+                     {
+                         int code = ReadNumber( m_strm, INT_MAX );
+                         if( (unsigned)code > (unsigned)m_maxval ) code = m_maxval;
+@@ -277,7 +298,7 @@ bool  PxMDecoder::readData( Mat& img )
+                     m_strm.getBytes( src, src_pitch );
+                     if( bit_depth == 16 && !isBigEndian() )
+                     {
+-                        for( x = 0; x < width3; x++ )
++                        for (int x = 0; x < width3; x++)
+                         {
+                             uchar v = src[x * 2];
+                             src[x * 2] = src[x * 2 + 1];
+@@ -288,7 +309,7 @@ bool  PxMDecoder::readData( Mat& img )
+ 
+                 if( img.depth() == CV_8U && bit_depth == 16 )
+                 {
+-                    for( x = 0; x < width3; x++ )
++                    for (int x = 0; x < width3; x++)
+                     {
+                         int v = ((ushort *)src)[x];
+                         src[x] = (uchar)(v >> 8);
+@@ -329,12 +350,19 @@ bool  PxMDecoder::readData( Mat& img )
+             }
+             result = true;
+             break;
++        }
+         default:
+-            assert(0);
++            CV_Error(CV_StsError, "m_bpp is not supported");
+         }
+     }
+-    catch(...)
++    catch (const cv::Exception&)
++    {
++        throw;
++    }
++    catch (...)
+     {
++        std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
++        throw;
+     }
+ 
+     return result;
+@@ -410,8 +438,9 @@ bool  PxMEncoder::write( const Mat& img, const vector<int>& params )
+     char* buffer = _buffer;
+ 
+     // write header;
+-    sprintf( buffer, "P%c\n%d %d\n%d\n",
++    sprintf( buffer, "P%c\n# Generated by OpenCV %s\n%d %d\n%d\n",
+              '2' + (channels > 1 ? 1 : 0) + (isBinary ? 3 : 0),
++             CV_VERSION,
+              width, height, (1 << depth) - 1 );
+ 
+     strm.putBytes( buffer, (int)strlen(buffer) );
+diff --git a/modules/highgui/src/loadsave.cpp b/modules/highgui/src/loadsave.cpp
+index 81c708acdd4..9b270c900f7 100644
+--- a/modules/highgui/src/loadsave.cpp
++++ b/modules/highgui/src/loadsave.cpp
+@@ -48,12 +48,32 @@
+ #undef min
+ #undef max
+ 
++#include <iostream>
++
+ /****************************************************************************************\
+ *                                      Image Codecs                                      *
+ \****************************************************************************************/
+ namespace cv
+ {
+ 
++// TODO Add runtime configuration
++#define CV_IO_MAX_IMAGE_PARAMS (50)
++#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
++#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
++#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
++
++static Size validateInputImageSize(const Size& size)
++{
++    CV_Assert(size.width > 0);
++    CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
++    CV_Assert(size.height > 0);
++    CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
++    uint64 pixels = (uint64)size.width * (uint64)size.height;
++    CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
++    return size;
++}
++
++
+ struct ImageCodecInitializer
+ {
+     ImageCodecInitializer()
+@@ -203,12 +223,26 @@ imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
+     if( decoder.empty() )
+         return 0;
+     decoder->setSource(filename);
+-    if( !decoder->readHeader() )
++
++    try
++    {
++        // read the header to make sure it succeeds
++        if (!decoder->readHeader())
++            return 0;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
+         return 0;
++    }
++    catch (...)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++        return 0;
++    }
+ 
+-    CvSize size;
+-    size.width = decoder->width();
+-    size.height = decoder->height();
++
++    Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
+ 
+     int type = decoder->type();
+     if( flags != -1 )
+@@ -242,7 +276,21 @@ imread_( const string& filename, int flags, int hdrtype, Mat* mat=0 )
+         temp = cvarrToMat(image);
+     }
+ 
+-    if( !decoder->readData( *data ))
++    bool success = false;
++    try
++    {
++        if (decoder->readData(*data))
++            success = true;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++    }
++    catch (...)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++    }
++    if (!success)
+     {
+         cvReleaseImage( &image );
+         cvReleaseMat( &matrix );
+@@ -288,6 +336,7 @@ static bool imwrite_( const string& filename, const Mat& image,
+     }
+ 
+     encoder->setDestination( filename );
++    CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2);
+     bool code = encoder->write( *pimage, params );
+ 
+     //    CV_Assert( code );
+@@ -326,16 +375,34 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
+         decoder->setSource(filename);
+     }
+ 
+-    if( !decoder->readHeader() )
++    bool success = false;
++    try
+     {
+-        if( !filename.empty() )
+-            remove(filename.c_str());
++        if (decoder->readHeader())
++            success = true;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
++    }
++    catch (...)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++    }
++    if (!success)
++    {
++        if (!filename.empty())
++        {
++            if (0 != remove(filename.c_str()))
++            {
++                std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
++            }
++        }
+         return 0;
+     }
+ 
+-    CvSize size;
+-    size.width = decoder->width();
+-    size.height = decoder->height();
++    // established the required input image size
++    Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
+ 
+     int type = decoder->type();
+     if( flags != -1 )
+@@ -369,11 +436,30 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
+         temp = cvarrToMat(image);
+     }
+ 
+-    bool code = decoder->readData( *data );
+-    if( !filename.empty() )
+-        remove(filename.c_str());
++    success = false;
++    try
++    {
++        if (decoder->readData(*data))
++            success = true;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++    }
++    catch (...)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++    }
+ 
+-    if( !code )
++    if (!filename.empty())
++    {
++        if (0 != remove(filename.c_str()))
++        {
++            std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
++        }
++    }
++
++    if (!success)
+     {
+         cvReleaseImage( &image );
+         cvReleaseMat( &matrix );
+@@ -490,7 +576,7 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
+     if( _params )
+     {
+         for( ; _params[i] > 0; i += 2 )
+-            ;
++            CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
+     }
+     return cv::imwrite_(filename, cv::cvarrToMat(arr),
+         i > 0 ? cv::vector<int>(_params, _params+i) : cv::vector<int>(),
+@@ -521,7 +607,7 @@ cvEncodeImage( const char* ext, const CvArr* arr, const int* _params )
+     if( _params )
+     {
+         for( ; _params[i] > 0; i += 2 )
+-            ;
++            CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
+     }
+     cv::Mat img = cv::cvarrToMat(arr);
+     if( CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL )

diff --git a/media-libs/opencv/opencv-2.4.13-r1.ebuild b/media-libs/opencv/opencv-2.4.13-r2.ebuild
similarity index 99%
rename from media-libs/opencv/opencv-2.4.13-r1.ebuild
rename to media-libs/opencv/opencv-2.4.13-r2.ebuild
index b57b2652493..4158e701ea4 100644
--- a/media-libs/opencv/opencv-2.4.13-r1.ebuild
+++ b/media-libs/opencv/opencv-2.4.13-r2.ebuild
@@ -87,8 +87,8 @@ PATCHES=(
 	"${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch"
 	"${FILESDIR}/${PN}-3.0.0-gles.patch"
 	"${FILESDIR}/${P}-gcc-6.0.patch"
+	"${FILESDIR}/${P}-imgcodecs-refactoring.patch" #bug 627958
 )
-#"${FILESDIR}/${P}-git-autodetect.patch
 
 pkg_setup() {
 	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2017-09-19  7:52 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2017-09-19  7:52 UTC (permalink / raw
  To: gentoo-commits

commit:     bf987cafbb90f2c798f98539141121d20ddfd796
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 07:46:54 2017 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 07:52:19 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf987caf

media-libs/opencv: version bump 3.3.0 bug #629534

- Patch for CVEs bug #627958
- Add required use for bug #621986
- Version bump fixes bug #627954

Closes: https://bugs.gentoo.org/629534

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 media-libs/opencv/Manifest                         |   2 +
 .../files/opencv-3.3.0-contrib-xfeatures2d.patch   |  19 +
 .../opencv/files/opencv-3.3.0-imgcodecs-gcc.patch  | 902 +++++++++++++++++++++
 media-libs/opencv/opencv-3.3.0.ebuild              | 354 ++++++++
 4 files changed, 1277 insertions(+)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index a529669fefa..1f375ff71d5 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -4,4 +4,6 @@ DIST opencv-3.1.0.tar.gz 76135587 SHA256 f00b3c4f42acda07d89031a2ebb5ebe390764a1
 DIST opencv-3.1.0_contrib-75b3ea9.tar.gz 54277105 SHA256 478f742457d3f4e96f857b726e35b28a8d20a1de8e5f51b8671251bc896d443b SHA512 d1d11520b8729fbaf0257c927654251ff9ac1ba5cf937af9dd973ec39f483d1ee08aff7ad3f1a9941fef921a35dc466ac5574918197ddecd3f6c66b682bf671a WHIRLPOOL 18b70014428c4fa532658ca5ac332bffaae049b468f46cb027a6972f21f5b2bd17d02b33d68c43b84f821a77fa09efb9c372499cfa4f645a0516b93acb858353
 DIST opencv-3.2.0.tar.gz 78861546 SHA256 b9d62dfffb8130d59d587627703d5f3e6252dce4a94c1955784998da7a39dd35 SHA512 a338f4b4cdebfc2dcd763427b9c9632b3a3b0d072117b8e6367c73ea1ac21f7148553a23c7afbb44b01a48be3be95520789c2de1d6ae230b7b414ee713d3606d WHIRLPOOL 092c0c1195d80f89e0e2fd030a93eb80e7b83ce155fdcd9fa071248be20127a684922c83de73be9bf321d934e14b0b4e60cc78ab272ab9d39d6707da37db30d3
 DIST opencv-3.2.0_contrib.tar.gz 54765210 SHA256 1e2bb6c9a41c602904cc7df3f8fb8f98363a88ea564f2a087240483426bf8cbe SHA512 eadb6a8a3625235b0c71e29c36d15d9342278aaf9148ef6a7e1aa80f4db0491aaf30b6df16bfd0cd358402b2a3059b6acbce23fb5fe2c0c57150a733ffbbff5a WHIRLPOOL eb8f916c19474a58f4c2785e50dc261a31f684a917011473b94a19d26e4e9845c042f77196c000dd97543699b745360114cdd31cad549379b6394e9d727c72a8
+DIST opencv-3.3.0.tar.gz 81238534 SHA256 8bb312b9d9fd17336dc1f8b3ac82f021ca50e2034afc866098866176d985adc6 SHA512 13dee5c1c5fec1dccdbb05879d299b93ef8ddeb87f561a6c4178e33a4cf5ae919765119068d0387a3efea0e09a625ca993cffac60a772159690fcbee4e8d70fb WHIRLPOOL 211496e559fa3a78b662329a5e21613fdc39b616155584311f82f3d7c733676bcb58d8e04ffda2d73658933240e16122212413fa1c2e6dfe764439c9460d7c41
+DIST opencv-3.3.0_contrib.tar.gz 54848519 SHA256 e94acf39cd4854c3ef905e06516e5f74f26dddfa6477af89558fb40a57aeb444 SHA512 ebe3dbe6c754c6fbaabbf6b0d2a4209964e625fd68e593f30ce043792740c8c1d4440d7870949b5b33f488fd7e2e05f3752287b7f50dd24c29202e268776520e WHIRLPOOL b186f673e276c4b8c4c5253fd17181f0e1b7bd4a0e0c74f15ab55ea5f2ee54a72fc295247c7bfcbfbedba1fc01b4c5e2a53a2a4eff79ab0480977a6eefc90c58
 DIST vgg_boostdesc-3.2.0.tar.gz 1867770 SHA256 6da9c2465e2b36330fa5d5c45320a0667da5cb4eafd66a5b1f45feb2af047a27 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44 WHIRLPOOL 5c78e43c95d40d103ac741248deb130bcb49a5b7e2cd012135572630b525b6f15a7f89948170c76545d97eb3815a000a2a1236ad24de2205eeb8938ee8eb0c12

diff --git a/media-libs/opencv/files/opencv-3.3.0-contrib-xfeatures2d.patch b/media-libs/opencv/files/opencv-3.3.0-contrib-xfeatures2d.patch
new file mode 100644
index 00000000000..26e4ac767c3
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.3.0-contrib-xfeatures2d.patch
@@ -0,0 +1,19 @@
+--- a/modules/xfeatures2d/CMakeLists.txt	2017-09-16 14:28:38.440000000 +0200
++++ b/modules/xfeatures2d/CMakeLists.txt	2017-09-16 14:27:21.350000000 +0200
+@@ -2,11 +2,11 @@
+ 
+ ocv_define_module(xfeatures2d opencv_core opencv_imgproc opencv_features2d opencv_calib3d OPTIONAL opencv_shape opencv_cudaarithm WRAP python java)
+ 
++#include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_vgg.cmake)
++#include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_boostdesc.cmake)
++#set(DOWNLOAD_DIR "${OpenCV_BINARY_DIR}/downloads/xfeatures2d")
++#download_boost_descriptors("${DOWNLOAD_DIR}" boost_status)
++#download_vgg_descriptors("${DOWNLOAD_DIR}" vgg_status)
+-include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_vgg.cmake)
+-include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/download_boostdesc.cmake)
+-set(DOWNLOAD_DIR "${OpenCV_BINARY_DIR}/downloads/xfeatures2d")
+-download_boost_descriptors("${DOWNLOAD_DIR}" boost_status)
+-download_vgg_descriptors("${DOWNLOAD_DIR}" vgg_status)
+ if(NOT boost_status OR NOT vgg_status)
+   ocv_module_disable(xfeatures2d)
+ endif()

diff --git a/media-libs/opencv/files/opencv-3.3.0-imgcodecs-gcc.patch b/media-libs/opencv/files/opencv-3.3.0-imgcodecs-gcc.patch
new file mode 100644
index 00000000000..d4ec2feb0b2
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.3.0-imgcodecs-gcc.patch
@@ -0,0 +1,902 @@
+From 0d854db361106dfcb055231fd0112c5b85ef2287 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
+Date: Tue, 15 Aug 2017 21:45:05 +0000
+Subject: [PATCH 1/3] build: workaround GCC 7.1.1 compilation issue with
+ sanitize flags
+
+Version: gcc (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3)
+Flags: -fsanitize=address,undefined
+---
+ modules/ts/src/cuda_test.cpp | 56 ++++++++++++++++++++++++++------------------
+ 1 file changed, 33 insertions(+), 23 deletions(-)
+
+diff --git a/modules/ts/src/cuda_test.cpp b/modules/ts/src/cuda_test.cpp
+index a48e0a08719..eb4cee13622 100644
+--- a/modules/ts/src/cuda_test.cpp
++++ b/modules/ts/src/cuda_test.cpp
+@@ -322,16 +322,20 @@ namespace cvtest
+ 
+         if (m1.size() != m2.size())
+         {
+-            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
+-                                      << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
+-                                      << expr2 << "\" [" << PrintToString(m2.size()) << "]";
++            std::stringstream msg;
++            msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
++                << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
++                << expr2 << "\" [" << PrintToString(m2.size()) << "]";
++            return AssertionFailure() << msg.str();
+         }
+ 
+         if (m1.type() != m2.type())
+         {
+-            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
+-                                      << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
+-                                      << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
++            std::stringstream msg;
++            msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
++                << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
++                << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
++             return AssertionFailure() << msg.str();
+         }
+ 
+         Mat diff;
+@@ -343,12 +347,14 @@ namespace cvtest
+ 
+         if (maxVal > eps)
+         {
+-            return AssertionFailure() << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
+-                                      << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
+-                                      << ", which exceeds \"" << eps_expr << "\", where \""
+-                                      << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
+-                                      << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
+-                                      << eps_expr << "\" evaluates to " << eps;
++            std::stringstream msg;
++            msg << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
++                << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
++                << ", which exceeds \"" << eps_expr << "\", where \""
++                << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
++                << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
++                << eps_expr << "\" evaluates to " << eps;
++            return AssertionFailure() << msg.str();
+         }
+ 
+         return AssertionSuccess();
+@@ -469,9 +475,11 @@ namespace cvtest
+     {
+         if (gold.size() != actual.size())
+         {
+-            return testing::AssertionFailure() << "KeyPoints size mistmach\n"
+-                                               << "\"" << gold_expr << "\" : " << gold.size() << "\n"
+-                                               << "\"" << actual_expr << "\" : " << actual.size();
++            std::stringstream msg;
++            msg << "KeyPoints size mistmach\n"
++                << "\"" << gold_expr << "\" : " << gold.size() << "\n"
++                << "\"" << actual_expr << "\" : " << actual.size();
++            return AssertionFailure() << msg.str();
+         }
+ 
+         std::sort(actual.begin(), actual.end(), KeyPointLess());
+@@ -484,14 +492,16 @@ namespace cvtest
+ 
+             if (!keyPointsEquals(p1, p2))
+             {
+-                return testing::AssertionFailure() << "KeyPoints differ at " << i << "\n"
+-                                                   << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
+-                                                   << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
+-                                                   << "size : " << p1.size << " vs " << p2.size << "\n"
+-                                                   << "angle : " << p1.angle << " vs " << p2.angle << "\n"
+-                                                   << "response : " << p1.response << " vs " << p2.response << "\n"
+-                                                   << "octave : " << p1.octave << " vs " << p2.octave << "\n"
+-                                                   << "class_id : " << p1.class_id << " vs " << p2.class_id;
++                std::stringstream msg;
++                msg << "KeyPoints differ at " << i << "\n"
++                    << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
++                    << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
++                    << "size : " << p1.size << " vs " << p2.size << "\n"
++                    << "angle : " << p1.angle << " vs " << p2.angle << "\n"
++                    << "response : " << p1.response << " vs " << p2.response << "\n"
++                    << "octave : " << p1.octave << " vs " << p2.octave << "\n"
++                    << "class_id : " << p1.class_id << " vs " << p2.class_id;
++                return AssertionFailure() << msg.str();
+             }
+         }
+ 
+
+From 999f41fb4f4aa94a0cb47256919ae8b5c29ca5f3 Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
+Date: Tue, 15 Aug 2017 22:04:55 +0000
+Subject: [PATCH 2/3] imgcodecs: refactoring, improve code quality
+
+---
+ modules/imgcodecs/src/bitstrm.cpp   |   2 +
+ modules/imgcodecs/src/bitstrm.hpp   |  19 +++--
+ modules/imgcodecs/src/grfmt_bmp.cpp |  13 ++-
+ modules/imgcodecs/src/grfmt_pxm.cpp | 122 ++++++++++++++++-----------
+ modules/imgcodecs/src/loadsave.cpp  | 164 +++++++++++++++++++++++++++++-------
+ 5 files changed, 231 insertions(+), 89 deletions(-)
+
+diff --git a/modules/imgcodecs/src/bitstrm.cpp b/modules/imgcodecs/src/bitstrm.cpp
+index a7e187fa0cf..0a8941aecf8 100644
+--- a/modules/imgcodecs/src/bitstrm.cpp
++++ b/modules/imgcodecs/src/bitstrm.cpp
+@@ -209,6 +209,8 @@ int  RLByteStream::getByte()
+         current = m_current;
+     }
+ 
++    CV_Assert(current < m_end);
++
+     val = *((uchar*)current);
+     m_current = current + 1;
+     return val;
+diff --git a/modules/imgcodecs/src/bitstrm.hpp b/modules/imgcodecs/src/bitstrm.hpp
+index 465c0a847ba..26947971f35 100644
+--- a/modules/imgcodecs/src/bitstrm.hpp
++++ b/modules/imgcodecs/src/bitstrm.hpp
+@@ -48,13 +48,20 @@
+ namespace cv
+ {
+ 
+-enum
+-{
+-    RBS_THROW_EOS=-123,  // <end of stream> exception code
+-    RBS_THROW_FORB=-124,  // <forrbidden huffman code> exception code
+-    RBS_HUFF_FORB=2047,  // forrbidden huffman code "value"
+-    RBS_BAD_HEADER=-125 // invalid header
++#define DECLARE_RBS_EXCEPTION(name) \
++class RBS_ ## name ## _Exception : public cv::Exception \
++{ \
++public: \
++    RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
++        cv::Exception(code_, err_, func_, file_, line_) \
++    {} \
+ };
++DECLARE_RBS_EXCEPTION(THROW_EOS)
++#define RBS_THROW_EOS RBS_THROW_EOS_Exception(cv::Error::StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
++DECLARE_RBS_EXCEPTION(THROW_FORB)
++#define RBS_THROW_FORB RBS_THROW_FORB_Exception(cv::Error::StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
++DECLARE_RBS_EXCEPTION(BAD_HEADER)
++#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(cv::Error::StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
+ 
+ typedef unsigned long ulong;
+ 
+diff --git a/modules/imgcodecs/src/grfmt_bmp.cpp b/modules/imgcodecs/src/grfmt_bmp.cpp
+index 86cacd31685..257f97c2d8b 100644
+--- a/modules/imgcodecs/src/grfmt_bmp.cpp
++++ b/modules/imgcodecs/src/grfmt_bmp.cpp
+@@ -118,8 +118,9 @@ bool  BmpDecoder::readHeader()
+ 
+                 if( m_bpp <= 8 )
+                 {
+-                    memset( m_palette, 0, sizeof(m_palette));
+-                    m_strm.getBytes( m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
++                    CV_Assert(clrused < 256);
++                    memset(m_palette, 0, sizeof(m_palette));
++                    m_strm.getBytes(m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
+                     iscolor = IsColorPalette( m_palette, m_bpp );
+                 }
+                 else if( m_bpp == 16 && m_rle_code == BMP_BITFIELDS )
+@@ -290,7 +291,9 @@ bool  BmpDecoder::readData( Mat& img )
+                     else if( code > 2 ) // absolute mode
+                     {
+                         if( data + code*nch > line_end ) goto decode_rle4_bad;
+-                        m_strm.getBytes( src, (((code + 1)>>1) + 1) & -2 );
++                        int sz = (((code + 1)>>1) + 1) & (~1);
++                        CV_Assert((size_t)sz < _src.size());
++                        m_strm.getBytes(src, sz);
+                         if( color )
+                             data = FillColorRow4( data, src, code, m_palette );
+                         else
+@@ -379,7 +382,9 @@ decode_rle4_bad: ;
+ 
+                         if( data + code3 > line_end )
+                             goto decode_rle8_bad;
+-                        m_strm.getBytes( src, (code + 1) & -2 );
++                        int sz = (code + 1) & (~1);
++                        CV_Assert((size_t)sz < _src.size());
++                        m_strm.getBytes(src, sz);
+                         if( color )
+                             data = FillColorRow8( data, src, code, m_palette );
+                         else
+diff --git a/modules/imgcodecs/src/grfmt_pxm.cpp b/modules/imgcodecs/src/grfmt_pxm.cpp
+index 1750cb705c3..68bd8fd93f5 100644
+--- a/modules/imgcodecs/src/grfmt_pxm.cpp
++++ b/modules/imgcodecs/src/grfmt_pxm.cpp
+@@ -43,50 +43,58 @@
+ #include "precomp.hpp"
+ #include "utils.hpp"
+ #include "grfmt_pxm.hpp"
++#include <iostream>
+ 
+ namespace cv
+ {
+ 
+ ///////////////////////// P?M reader //////////////////////////////
+ 
+-static int ReadNumber( RLByteStream& strm, int maxdigits )
++static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
+ {
+     int code;
+-    int val = 0;
++    int64 val = 0;
+     int digits = 0;
+ 
+     code = strm.getByte();
+ 
+-    if( !isdigit(code))
++    while (!isdigit(code))
+     {
+-        do
++        if (code == '#' )
+         {
+-            if( code == '#' )
++            do
+             {
+-                do
+-                {
+-                    code = strm.getByte();
+-                }
+-                while( code != '\n' && code != '\r' );
++                code = strm.getByte();
+             }
+-
++            while (code != '\n' && code != '\r');
+             code = strm.getByte();
+-
+-            while( isspace(code))
++        }
++        else if (isspace(code))
++        {
++            while (isspace(code))
+                 code = strm.getByte();
+         }
+-        while( !isdigit( code ));
++        else
++        {
++#if 1
++            CV_ErrorNoReturn_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
++#else
++            code = strm.getByte();
++#endif
++        }
+     }
+ 
+     do
+     {
+-        val = val*10 + code - '0';
+-        if( ++digits >= maxdigits ) break;
++        val = val*10 + (code - '0');
++        CV_Assert(val <= INT_MAX && "PXM: ReadNumber(): result is too large");
++        digits++;
++        if (maxdigits != 0 && digits >= maxdigits) break;
+         code = strm.getByte();
+     }
+-    while( isdigit(code));
++    while (isdigit(code));
+ 
+-    return val;
++    return (int)val;
+ }
+ 
+ 
+@@ -122,13 +130,13 @@ ImageDecoder PxMDecoder::newDecoder() const
+     return makePtr<PxMDecoder>();
+ }
+ 
+-void  PxMDecoder::close()
++void PxMDecoder::close()
+ {
+     m_strm.close();
+ }
+ 
+ 
+-bool  PxMDecoder::readHeader()
++bool PxMDecoder::readHeader()
+ {
+     bool result = false;
+ 
+@@ -158,10 +166,10 @@ bool  PxMDecoder::readHeader()
+         m_binary = code >= '4';
+         m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
+ 
+-        m_width = ReadNumber( m_strm, INT_MAX );
+-        m_height = ReadNumber( m_strm, INT_MAX );
++        m_width = ReadNumber(m_strm);
++        m_height = ReadNumber(m_strm);
+ 
+-        m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
++        m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
+         if( m_maxval > 65535 )
+             throw RBS_BAD_HEADER;
+ 
+@@ -175,8 +183,14 @@ bool  PxMDecoder::readHeader()
+             result = true;
+         }
+     }
+-    catch(...)
++    catch (const cv::Exception&)
++    {
++        throw;
++    }
++    catch (...)
+     {
++        std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
++        throw;
+     }
+ 
+     if( !result )
+@@ -189,33 +203,28 @@ bool  PxMDecoder::readHeader()
+ }
+ 
+ 
+-bool  PxMDecoder::readData( Mat& img )
++bool PxMDecoder::readData( Mat& img )
+ {
+     int color = img.channels() > 1;
+     uchar* data = img.ptr();
+     PaletteEntry palette[256];
+     bool   result = false;
+-    int  bit_depth = CV_ELEM_SIZE1(m_type)*8;
+-    int  src_pitch = (m_width*m_bpp*bit_depth/8 + 7)/8;
++    const int bit_depth = CV_ELEM_SIZE1(m_type)*8;
++    const int src_pitch = divUp(m_width*m_bpp*(bit_depth/8), 8);
+     int  nch = CV_MAT_CN(m_type);
+     int  width3 = m_width*nch;
+-    int  i, x, y;
+ 
+     if( m_offset < 0 || !m_strm.isOpened())
+         return false;
+ 
+-    AutoBuffer<uchar> _src(src_pitch + 32);
+-    uchar* src = _src;
+-    AutoBuffer<uchar> _gray_palette;
+-    uchar* gray_palette = _gray_palette;
++    uchar gray_palette[256] = {0};
+ 
+     // create LUT for converting colors
+     if( bit_depth == 8 )
+     {
+-        _gray_palette.allocate(m_maxval + 1);
+-        gray_palette = _gray_palette;
++        CV_Assert(m_maxval < 256);
+ 
+-        for( i = 0; i <= m_maxval; i++ )
++        for (int i = 0; i <= m_maxval; i++)
+             gray_palette[i] = (uchar)((i*255/m_maxval)^(m_bpp == 1 ? 255 : 0));
+ 
+         FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
+@@ -229,12 +238,16 @@ bool  PxMDecoder::readData( Mat& img )
+         {
+         ////////////////////////// 1 BPP /////////////////////////
+         case 1:
++            CV_Assert(CV_MAT_DEPTH(m_type) == CV_8U);
+             if( !m_binary )
+             {
+-                for( y = 0; y < m_height; y++, data += img.step )
++                AutoBuffer<uchar> _src(m_width);
++                uchar* src = _src;
++
++                for (int y = 0; y < m_height; y++, data += img.step)
+                 {
+-                    for( x = 0; x < m_width; x++ )
+-                        src[x] = ReadNumber( m_strm, 1 ) != 0;
++                    for (int x = 0; x < m_width; x++)
++                        src[x] = ReadNumber(m_strm, 1) != 0;
+ 
+                     if( color )
+                         FillColorRow8( data, src, m_width, palette );
+@@ -244,7 +257,10 @@ bool  PxMDecoder::readData( Mat& img )
+             }
+             else
+             {
+-                for( y = 0; y < m_height; y++, data += img.step )
++                AutoBuffer<uchar> _src(src_pitch);
++                uchar* src = _src;
++
++                for (int y = 0; y < m_height; y++, data += img.step)
+                 {
+                     m_strm.getBytes( src, src_pitch );
+ 
+@@ -260,13 +276,17 @@ bool  PxMDecoder::readData( Mat& img )
+         ////////////////////////// 8 BPP /////////////////////////
+         case 8:
+         case 24:
+-            for( y = 0; y < m_height; y++, data += img.step )
++        {
++            AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
++            uchar* src = _src;
++
++            for (int y = 0; y < m_height; y++, data += img.step)
+             {
+                 if( !m_binary )
+                 {
+-                    for( x = 0; x < width3; x++ )
++                    for (int x = 0; x < width3; x++)
+                     {
+-                        int code = ReadNumber( m_strm, INT_MAX );
++                        int code = ReadNumber(m_strm);
+                         if( (unsigned)code > (unsigned)m_maxval ) code = m_maxval;
+                         if( bit_depth == 8 )
+                             src[x] = gray_palette[code];
+@@ -279,7 +299,7 @@ bool  PxMDecoder::readData( Mat& img )
+                     m_strm.getBytes( src, src_pitch );
+                     if( bit_depth == 16 && !isBigEndian() )
+                     {
+-                        for( x = 0; x < width3; x++ )
++                        for (int x = 0; x < width3; x++)
+                         {
+                             uchar v = src[x * 2];
+                             src[x * 2] = src[x * 2 + 1];
+@@ -290,7 +310,7 @@ bool  PxMDecoder::readData( Mat& img )
+ 
+                 if( img.depth() == CV_8U && bit_depth == 16 )
+                 {
+-                    for( x = 0; x < width3; x++ )
++                    for (int x = 0; x < width3; x++)
+                     {
+                         int v = ((ushort *)src)[x];
+                         src[x] = (uchar)(v >> 8);
+@@ -331,12 +351,19 @@ bool  PxMDecoder::readData( Mat& img )
+             }
+             result = true;
+             break;
++        }
+         default:
+-            assert(0);
++            CV_ErrorNoReturn(Error::StsError, "m_bpp is not supported");
+         }
+     }
+-    catch(...)
++    catch (const cv::Exception&)
++    {
++        throw;
++    }
++    catch (...)
+     {
++        std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
++        throw;
+     }
+ 
+     return result;
+@@ -412,8 +439,9 @@ bool  PxMEncoder::write( const Mat& img, const std::vector<int>& params )
+     char* buffer = _buffer;
+ 
+     // write header;
+-    sprintf( buffer, "P%c\n%d %d\n%d\n",
++    sprintf( buffer, "P%c\n# Generated by OpenCV %s\n%d %d\n%d\n",
+              '2' + (channels > 1 ? 1 : 0) + (isBinary ? 3 : 0),
++             CV_VERSION,
+              width, height, (1 << depth) - 1 );
+ 
+     strm.putBytes( buffer, (int)strlen(buffer) );
+diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp
+index 3b2366217f2..5ee4ca3541b 100644
+--- a/modules/imgcodecs/src/loadsave.cpp
++++ b/modules/imgcodecs/src/loadsave.cpp
+@@ -55,6 +55,27 @@
+ /****************************************************************************************\
+ *                                      Image Codecs                                      *
+ \****************************************************************************************/
++
++namespace cv {
++
++// TODO Add runtime configuration
++#define CV_IO_MAX_IMAGE_PARAMS (50)
++#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
++#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
++#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
++
++static Size validateInputImageSize(const Size& size)
++{
++    CV_Assert(size.width > 0);
++    CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
++    CV_Assert(size.height > 0);
++    CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
++    uint64 pixels = (uint64)size.width * (uint64)size.height;
++    CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
++    return size;
++}
++
++
+ namespace {
+ 
+ class ByteStreamBuffer: public std::streambuf
+@@ -94,9 +115,6 @@ class ByteStreamBuffer: public std::streambuf
+ 
+ }
+ 
+-namespace cv
+-{
+-
+ /**
+  * @struct ImageCodecInitializer
+  *
+@@ -408,14 +426,26 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
+     /// set the filename in the driver
+     decoder->setSource( filename );
+ 
+-   // read the header to make sure it succeeds
+-   if( !decoder->readHeader() )
++    try
++    {
++        // read the header to make sure it succeeds
++        if( !decoder->readHeader() )
++            return 0;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
+         return 0;
++    }
++    catch (...)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++        return 0;
++    }
++
+ 
+     // established the required input image size
+-    CvSize size;
+-    size.width = decoder->width();
+-    size.height = decoder->height();
++    Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
+ 
+     // grab the decoded type
+     int type = decoder->type();
+@@ -451,7 +481,21 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
+     }
+ 
+     // read the image data
+-    if( !decoder->readData( *data ))
++    bool success = false;
++    try
++    {
++        if (decoder->readData(*data))
++            success = true;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++    }
++    catch (...)
++    {
++        std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++    }
++    if (!success)
+     {
+         cvReleaseImage( &image );
+         cvReleaseMat( &matrix );
+@@ -504,8 +548,22 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
+     decoder->setSource(filename);
+ 
+     // read the header to make sure it succeeds
+-    if (!decoder->readHeader())
++    try
++    {
++        // read the header to make sure it succeeds
++        if( !decoder->readHeader() )
++            return 0;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
+         return 0;
++    }
++    catch (...)
++    {
++        std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++        return 0;
++    }
+ 
+     for (;;)
+     {
+@@ -523,17 +581,32 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
+                 type = CV_MAKETYPE(CV_MAT_DEPTH(type), 1);
+         }
+ 
++        // established the required input image size
++        Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
++
+         // read the image data
+-        Mat mat(decoder->height(), decoder->width(), type);
+-        if (!decoder->readData(mat))
++        Mat mat(size.height, size.width, type);
++        bool success = false;
++        try
+         {
+-            // optionally rotate the data if EXIF' orientation flag says so
+-            if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
+-            {
+-                ApplyExifOrientation(filename, mat);
+-            }
+-
++            if (decoder->readData(mat))
++                success = true;
++        }
++        catch (const cv::Exception& e)
++        {
++            std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++        }
++        catch (...)
++        {
++            std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++        }
++        if (!success)
+             break;
++
++        // optionally rotate the data if EXIF' orientation flag says so
++        if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
++        {
++            ApplyExifOrientation(filename, mat);
+         }
+ 
+         mats.push_back(mat);
+@@ -616,6 +689,7 @@ static bool imwrite_( const String& filename, const Mat& image,
+     }
+ 
+     encoder->setDestination( filename );
++    CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2);
+     bool code = encoder->write( *pimage, params );
+ 
+     //    CV_Assert( code );
+@@ -663,22 +737,35 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
+         decoder->setSource(filename);
+     }
+ 
+-    if( !decoder->readHeader() )
++    bool success = false;
++    try
++    {
++        if (decoder->readHeader())
++            success = true;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
++    }
++    catch (...)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
++    }
++    if (!success)
+     {
+         decoder.release();
+-        if ( !filename.empty() )
++        if (!filename.empty())
+         {
+-            if ( remove(filename.c_str()) != 0 )
++            if (0 != remove(filename.c_str()))
+             {
+-                CV_Error( CV_StsError, "unable to remove temporary file" );
++                std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
+             }
+         }
+         return 0;
+     }
+ 
+-    CvSize size;
+-    size.width = decoder->width();
+-    size.height = decoder->height();
++    // established the required input image size
++    Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
+ 
+     int type = decoder->type();
+     if( (flags & IMREAD_LOAD_GDAL) != IMREAD_LOAD_GDAL && flags != IMREAD_UNCHANGED )
+@@ -712,17 +799,30 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
+         temp = cvarrToMat(image);
+     }
+ 
+-    bool code = decoder->readData( *data );
++    success = false;
++    try
++    {
++        if (decoder->readData(*data))
++            success = true;
++    }
++    catch (const cv::Exception& e)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
++    }
++    catch (...)
++    {
++        std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
++    }
+     decoder.release();
+-    if ( !filename.empty() )
++    if (!filename.empty())
+     {
+-        if ( remove(filename.c_str()) != 0 )
++        if (0 != remove(filename.c_str()))
+         {
+-            CV_Error( CV_StsError, "unable to remove temporary file" );
++            std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
+         }
+     }
+ 
+-    if( !code )
++    if (!success)
+     {
+         cvReleaseImage( &image );
+         cvReleaseMat( &matrix );
+@@ -859,7 +959,7 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
+     if( _params )
+     {
+         for( ; _params[i] > 0; i += 2 )
+-            ;
++            CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
+     }
+     return cv::imwrite_(filename, cv::cvarrToMat(arr),
+         i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
+@@ -890,7 +990,7 @@ cvEncodeImage( const char* ext, const CvArr* arr, const int* _params )
+     if( _params )
+     {
+         for( ; _params[i] > 0; i += 2 )
+-            ;
++            CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
+     }
+     cv::Mat img = cv::cvarrToMat(arr);
+     if( CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL )
+
+From 78a310630fb0a1f6d089576202343e672f27609d Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Wed, 16 Aug 2017 13:53:12 +0300
+Subject: [PATCH 3/3] imgproc(test): add checks for remove() call
+
+---
+ modules/imgcodecs/test/test_grfmt.cpp      |  2 +-
+ modules/imgcodecs/test/test_jpeg.cpp       | 12 ++++++------
+ modules/imgcodecs/test/test_png.cpp        |  2 +-
+ modules/imgcodecs/test/test_read_write.cpp |  4 ++--
+ modules/imgcodecs/test/test_tiff.cpp       |  8 ++++----
+ modules/imgcodecs/test/test_webp.cpp       |  6 +++---
+ 6 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp
+index 64a0c1e3ad0..74b72c3b3e9 100644
+--- a/modules/imgcodecs/test/test_grfmt.cpp
++++ b/modules/imgcodecs/test/test_grfmt.cpp
+@@ -175,7 +175,7 @@ TEST_P(Imgcodecs_ExtSize, write_imageseq)
+             EXPECT_LT(n, 1.);
+             EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), img, img_gt);
+         }
+-        remove(filename.c_str());
++        EXPECT_EQ(0, remove(filename.c_str()));
+     }
+ }
+ 
+diff --git a/modules/imgcodecs/test/test_jpeg.cpp b/modules/imgcodecs/test/test_jpeg.cpp
+index 5546f2d91a8..6ddb0284020 100644
+--- a/modules/imgcodecs/test/test_jpeg.cpp
++++ b/modules/imgcodecs/test/test_jpeg.cpp
+@@ -123,8 +123,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_progressive_jpeg)
+ 
+     EXPECT_EQ(0, cvtest::norm(img_jpg_progressive, img_jpg_normal, NORM_INF));
+ 
+-    remove(output_progressive.c_str());
+-    remove(output_normal.c_str());
++    EXPECT_EQ(0, remove(output_progressive.c_str()));
++    EXPECT_EQ(0, remove(output_normal.c_str()));
+ }
+ 
+ TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg)
+@@ -148,8 +148,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg)
+ 
+     EXPECT_EQ(0, cvtest::norm(img_jpg_optimized, img_jpg_normal, NORM_INF));
+ 
+-    remove(output_optimized.c_str());
+-    remove(output_normal.c_str());
++    EXPECT_EQ(0, remove(output_optimized.c_str()));
++    EXPECT_EQ(0, remove(output_normal.c_str()));
+ }
+ 
+ TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg)
+@@ -173,8 +173,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg)
+ 
+     EXPECT_EQ(0, cvtest::norm(img_jpg_rst, img_jpg_normal, NORM_INF));
+ 
+-    remove(output_rst.c_str());
+-    remove(output_normal.c_str());
++    EXPECT_EQ(0, remove(output_rst.c_str()));
++    EXPECT_EQ(0, remove(output_normal.c_str()));
+ }
+ 
+ #endif // HAVE_JPEG
+diff --git a/modules/imgcodecs/test/test_png.cpp b/modules/imgcodecs/test/test_png.cpp
+index c46f901199e..4e97043e1c7 100644
+--- a/modules/imgcodecs/test/test_png.cpp
++++ b/modules/imgcodecs/test/test_png.cpp
+@@ -17,7 +17,7 @@ TEST(Imgcodecs_Png, write_big)
+     EXPECT_EQ(13043, img.cols);
+     EXPECT_EQ(13917, img.rows);
+     ASSERT_NO_THROW(imwrite(dst_file, img));
+-    remove(dst_file.c_str());
++    EXPECT_EQ(0, remove(dst_file.c_str()));
+ }
+ 
+ TEST(Imgcodecs_Png, encode)
+diff --git a/modules/imgcodecs/test/test_read_write.cpp b/modules/imgcodecs/test/test_read_write.cpp
+index 38f10225f68..5119813bf84 100644
+--- a/modules/imgcodecs/test/test_read_write.cpp
++++ b/modules/imgcodecs/test/test_read_write.cpp
+@@ -50,7 +50,7 @@ TEST(Imgcodecs_Image, read_write_bmp)
+         psnr = cvtest::PSNR(buf_loaded, image);
+         EXPECT_GT(psnr, thresDbell);
+ 
+-        remove(dst_name.c_str());
++        EXPECT_EQ(0, remove(dst_name.c_str()));
+     }
+ }
+ 
+@@ -95,7 +95,7 @@ TEST_P(Imgcodecs_Image, read_write)
+     psnr = cvtest::PSNR(buf_loaded, image);
+     EXPECT_GT(psnr, thresDbell);
+ 
+-    remove(full_name.c_str());
++    EXPECT_EQ(0, remove(full_name.c_str()));
+ }
+ 
+ const string exts[] = {
+diff --git a/modules/imgcodecs/test/test_tiff.cpp b/modules/imgcodecs/test/test_tiff.cpp
+index 0264da4cd81..6ef0c174828 100644
+--- a/modules/imgcodecs/test/test_tiff.cpp
++++ b/modules/imgcodecs/test/test_tiff.cpp
+@@ -41,8 +41,8 @@ TEST(Imgcodecs_Tiff, decode_tile16384x16384)
+         // not enough memory
+     }
+ 
+-    remove(file3.c_str());
+-    remove(file4.c_str());
++    EXPECT_EQ(0, remove(file3.c_str()));
++    EXPECT_EQ(0, remove(file4.c_str()));
+ }
+ 
+ TEST(Imgcodecs_Tiff, write_read_16bit_big_little_endian)
+@@ -88,7 +88,7 @@ TEST(Imgcodecs_Tiff, write_read_16bit_big_little_endian)
+         EXPECT_EQ(0xDEAD, img.at<ushort>(0,0));
+         EXPECT_EQ(0xBEEF, img.at<ushort>(0,1));
+ 
+-        remove(filename.c_str());
++        EXPECT_EQ(0, remove(filename.c_str()));
+     }
+ }
+ 
+@@ -143,7 +143,7 @@ TEST(Imgcodecs_Tiff, decode_infinite_rowsperstrip)
+ 
+     EXPECT_NO_THROW(cv::imread(filename, IMREAD_UNCHANGED));
+ 
+-    remove(filename.c_str());
++    EXPECT_EQ(0, remove(filename.c_str()));
+ }
+ 
+ //==================================================================================================
+diff --git a/modules/imgcodecs/test/test_webp.cpp b/modules/imgcodecs/test/test_webp.cpp
+index 6d40ce21e2d..d82fdd28964 100644
+--- a/modules/imgcodecs/test/test_webp.cpp
++++ b/modules/imgcodecs/test/test_webp.cpp
+@@ -44,7 +44,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
+         }
+     }
+ 
+-    remove(output.c_str());
++    EXPECT_EQ(0, remove(output.c_str()));
+ 
+     cv::Mat decode = cv::imdecode(buf, IMREAD_COLOR);
+     ASSERT_FALSE(decode.empty());
+@@ -71,7 +71,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossy_webp)
+ 
+         EXPECT_NO_THROW(cv::imwrite(output, img, params));
+         cv::Mat img_webp = cv::imread(output);
+-        remove(output.c_str());
++        EXPECT_EQ(0, remove(output.c_str()));
+         EXPECT_FALSE(img_webp.empty());
+         EXPECT_EQ(3,   img_webp.channels());
+         EXPECT_EQ(512, img_webp.cols);
+@@ -96,7 +96,7 @@ TEST(Imgcodecs_WebP, encode_decode_with_alpha_webp)
+ 
+     EXPECT_NO_THROW(cv::imwrite(output, img));
+     cv::Mat img_webp = cv::imread(output);
+-    remove(output.c_str());
++    EXPECT_EQ(0, remove(output.c_str()));
+     EXPECT_FALSE(img_webp.empty());
+     EXPECT_EQ(4,   img_webp.channels());
+     EXPECT_EQ(512, img_webp.cols);

diff --git a/media-libs/opencv/opencv-3.3.0.ebuild b/media-libs/opencv/opencv-3.3.0.ebuild
new file mode 100644
index 00000000000..db01ccd1158
--- /dev/null
+++ b/media-libs/opencv/opencv-3.3.0.ebuild
@@ -0,0 +1,354 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+PYTHON_COMPAT=( python{2_7,3_4,3_5} )
+
+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="http://opencv.org"
+
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+	contrib? ( https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.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_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_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}]
+	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}]
+	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
+)
+
+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"
+	"${FILESDIR}/${P}-imgcodecs-gcc.patch" # bug 627958 and https://github.com/opencv/opencv/pull/9376
+)
+
+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_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
+	# ===================================================
+	# 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=OFF
+			-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
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2017-09-19 14:00 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2017-09-19 14:00 UTC (permalink / raw
  To: gentoo-commits

commit:     742fba96406dc63f2f3696674dbc303258d9a76d
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 13:55:28 2017 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 13:55:28 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=742fba96

media-libs/opencv: remove too big patch

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 media-libs/opencv/Manifest                         |   1 +
 .../opencv/files/opencv-3.3.0-imgcodecs-gcc.patch  | 902 ---------------------
 ...{opencv-3.3.0.ebuild => opencv-3.3.0-r1.ebuild} |   3 +-
 3 files changed, 3 insertions(+), 903 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 1f375ff71d5..feb1a990ef8 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,3 +1,4 @@
+DIST imgcodecs-opencv-3.3.0.tar.gz 7724 SHA256 5d1ef31142ed42e06b2bb71134da7e5fae5e94e70896aae26ac2dc0baa74a161 SHA512 9c6fc31830e299e3d15da1cfc3468fe23eecda970a02e5826e0a7cfba34200c557c0e46f940154a26e9916da05859a83376217cbe7452ec8d14e99bc76f63d37 WHIRLPOOL fbf18817a3f6e82d2ce1ecad237b223244328208fe9926033133c2126e785a1ad3fbf06b69113a94996d624e73003564ea9ce2314ffbdecfb0ea3fd67308084d
 DIST opencv-2.4.13.tar.gz 91669572 SHA256 94ebcca61c30034d5fb16feab8ec12c8a868f5162d20a9f0396f0f5f6d8bbbff SHA512 efdc4340fdf557dae44ac604c8c20f61ced89f99274264b61c2640f28741504462c6b57076e207040ca2513e3921275bdfbe6c22fc123bd50df78745e6b7bcd6 WHIRLPOOL 9fdbf2e47edeb8c177cb03ed5dc129475dd704c022975bc875d444a6e6c3df630f1151e738cf07fbe48343d0eb87723091131063fe776c63a386c46c0153f1d5
 DIST opencv-2.4.13.zip 94319943 SHA256 fa6a45f635f4e1dbc982b8ccc93206650e7fc584b2f3dd945759ce28b047b94f SHA512 b5ccaa22deabfedd29b697296d265a32c7db959f2e94ca3643c1cde65fb84463809535f2e6bd49c4baa06958fa223a32bbfdd7234b8e160ec333fd9cd7800d3b WHIRLPOOL 86f7690b460dbcf70dec30c29784d96b2bb99e43ba70fe967d18b375fcee4f8934591f0d9fe2ff6717346eb9be8628766658d589eae9943d528352d1ce1df455
 DIST opencv-3.1.0.tar.gz 76135587 SHA256 f00b3c4f42acda07d89031a2ebb5ebe390764a133502c03a511f67b78bbd4fbf SHA512 57e0fe41e3d5d1dc036e7fc5673523e53d54f5f62e4d3bcb95238a9cd53e79da7c1704dc136ce632f7cfce369ebf5eb27f629a9b6ac4f7fa34120b80b5c7438f WHIRLPOOL b2825d5cafa87e0fe9cacd093ddb969913d916c0370819073b2bde3c598798efcf23c406aae2116f2628c564ca99e5f871a448a3ece97d8d29ec73841ac283b4

diff --git a/media-libs/opencv/files/opencv-3.3.0-imgcodecs-gcc.patch b/media-libs/opencv/files/opencv-3.3.0-imgcodecs-gcc.patch
deleted file mode 100644
index d4ec2feb0b2..00000000000
--- a/media-libs/opencv/files/opencv-3.3.0-imgcodecs-gcc.patch
+++ /dev/null
@@ -1,902 +0,0 @@
-From 0d854db361106dfcb055231fd0112c5b85ef2287 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
-Date: Tue, 15 Aug 2017 21:45:05 +0000
-Subject: [PATCH 1/3] build: workaround GCC 7.1.1 compilation issue with
- sanitize flags
-
-Version: gcc (GCC) 7.1.1 20170622 (Red Hat 7.1.1-3)
-Flags: -fsanitize=address,undefined
----
- modules/ts/src/cuda_test.cpp | 56 ++++++++++++++++++++++++++------------------
- 1 file changed, 33 insertions(+), 23 deletions(-)
-
-diff --git a/modules/ts/src/cuda_test.cpp b/modules/ts/src/cuda_test.cpp
-index a48e0a08719..eb4cee13622 100644
---- a/modules/ts/src/cuda_test.cpp
-+++ b/modules/ts/src/cuda_test.cpp
-@@ -322,16 +322,20 @@ namespace cvtest
- 
-         if (m1.size() != m2.size())
-         {
--            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
--                                      << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
--                                      << expr2 << "\" [" << PrintToString(m2.size()) << "]";
-+            std::stringstream msg;
-+            msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different sizes : \""
-+                << expr1 << "\" [" << PrintToString(m1.size()) << "] vs \""
-+                << expr2 << "\" [" << PrintToString(m2.size()) << "]";
-+            return AssertionFailure() << msg.str();
-         }
- 
-         if (m1.type() != m2.type())
-         {
--            return AssertionFailure() << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
--                                      << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
--                                      << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
-+            std::stringstream msg;
-+            msg << "Matrices \"" << expr1 << "\" and \"" << expr2 << "\" have different types : \""
-+                << expr1 << "\" [" << PrintToString(MatType(m1.type())) << "] vs \""
-+                << expr2 << "\" [" << PrintToString(MatType(m2.type())) << "]";
-+             return AssertionFailure() << msg.str();
-         }
- 
-         Mat diff;
-@@ -343,12 +347,14 @@ namespace cvtest
- 
-         if (maxVal > eps)
-         {
--            return AssertionFailure() << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
--                                      << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
--                                      << ", which exceeds \"" << eps_expr << "\", where \""
--                                      << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
--                                      << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
--                                      << eps_expr << "\" evaluates to " << eps;
-+            std::stringstream msg;
-+            msg << "The max difference between matrices \"" << expr1 << "\" and \"" << expr2
-+                << "\" is " << maxVal << " at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ")"
-+                << ", which exceeds \"" << eps_expr << "\", where \""
-+                << expr1 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m1, maxLoc) << ", \""
-+                << expr2 << "\" at (" << maxLoc.y << ", " << maxLoc.x / m1.channels() << ") evaluates to " << printMatVal(m2, maxLoc) << ", \""
-+                << eps_expr << "\" evaluates to " << eps;
-+            return AssertionFailure() << msg.str();
-         }
- 
-         return AssertionSuccess();
-@@ -469,9 +475,11 @@ namespace cvtest
-     {
-         if (gold.size() != actual.size())
-         {
--            return testing::AssertionFailure() << "KeyPoints size mistmach\n"
--                                               << "\"" << gold_expr << "\" : " << gold.size() << "\n"
--                                               << "\"" << actual_expr << "\" : " << actual.size();
-+            std::stringstream msg;
-+            msg << "KeyPoints size mistmach\n"
-+                << "\"" << gold_expr << "\" : " << gold.size() << "\n"
-+                << "\"" << actual_expr << "\" : " << actual.size();
-+            return AssertionFailure() << msg.str();
-         }
- 
-         std::sort(actual.begin(), actual.end(), KeyPointLess());
-@@ -484,14 +492,16 @@ namespace cvtest
- 
-             if (!keyPointsEquals(p1, p2))
-             {
--                return testing::AssertionFailure() << "KeyPoints differ at " << i << "\n"
--                                                   << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
--                                                   << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
--                                                   << "size : " << p1.size << " vs " << p2.size << "\n"
--                                                   << "angle : " << p1.angle << " vs " << p2.angle << "\n"
--                                                   << "response : " << p1.response << " vs " << p2.response << "\n"
--                                                   << "octave : " << p1.octave << " vs " << p2.octave << "\n"
--                                                   << "class_id : " << p1.class_id << " vs " << p2.class_id;
-+                std::stringstream msg;
-+                msg << "KeyPoints differ at " << i << "\n"
-+                    << "\"" << gold_expr << "\" vs \"" << actual_expr << "\" : \n"
-+                    << "pt : " << testing::PrintToString(p1.pt) << " vs " << testing::PrintToString(p2.pt) << "\n"
-+                    << "size : " << p1.size << " vs " << p2.size << "\n"
-+                    << "angle : " << p1.angle << " vs " << p2.angle << "\n"
-+                    << "response : " << p1.response << " vs " << p2.response << "\n"
-+                    << "octave : " << p1.octave << " vs " << p2.octave << "\n"
-+                    << "class_id : " << p1.class_id << " vs " << p2.class_id;
-+                return AssertionFailure() << msg.str();
-             }
-         }
- 
-
-From 999f41fb4f4aa94a0cb47256919ae8b5c29ca5f3 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
-Date: Tue, 15 Aug 2017 22:04:55 +0000
-Subject: [PATCH 2/3] imgcodecs: refactoring, improve code quality
-
----
- modules/imgcodecs/src/bitstrm.cpp   |   2 +
- modules/imgcodecs/src/bitstrm.hpp   |  19 +++--
- modules/imgcodecs/src/grfmt_bmp.cpp |  13 ++-
- modules/imgcodecs/src/grfmt_pxm.cpp | 122 ++++++++++++++++-----------
- modules/imgcodecs/src/loadsave.cpp  | 164 +++++++++++++++++++++++++++++-------
- 5 files changed, 231 insertions(+), 89 deletions(-)
-
-diff --git a/modules/imgcodecs/src/bitstrm.cpp b/modules/imgcodecs/src/bitstrm.cpp
-index a7e187fa0cf..0a8941aecf8 100644
---- a/modules/imgcodecs/src/bitstrm.cpp
-+++ b/modules/imgcodecs/src/bitstrm.cpp
-@@ -209,6 +209,8 @@ int  RLByteStream::getByte()
-         current = m_current;
-     }
- 
-+    CV_Assert(current < m_end);
-+
-     val = *((uchar*)current);
-     m_current = current + 1;
-     return val;
-diff --git a/modules/imgcodecs/src/bitstrm.hpp b/modules/imgcodecs/src/bitstrm.hpp
-index 465c0a847ba..26947971f35 100644
---- a/modules/imgcodecs/src/bitstrm.hpp
-+++ b/modules/imgcodecs/src/bitstrm.hpp
-@@ -48,13 +48,20 @@
- namespace cv
- {
- 
--enum
--{
--    RBS_THROW_EOS=-123,  // <end of stream> exception code
--    RBS_THROW_FORB=-124,  // <forrbidden huffman code> exception code
--    RBS_HUFF_FORB=2047,  // forrbidden huffman code "value"
--    RBS_BAD_HEADER=-125 // invalid header
-+#define DECLARE_RBS_EXCEPTION(name) \
-+class RBS_ ## name ## _Exception : public cv::Exception \
-+{ \
-+public: \
-+    RBS_ ## name ## _Exception(int code_, const String& err_, const String& func_, const String& file_, int line_) : \
-+        cv::Exception(code_, err_, func_, file_, line_) \
-+    {} \
- };
-+DECLARE_RBS_EXCEPTION(THROW_EOS)
-+#define RBS_THROW_EOS RBS_THROW_EOS_Exception(cv::Error::StsError, "Unexpected end of input stream", CV_Func, __FILE__, __LINE__)
-+DECLARE_RBS_EXCEPTION(THROW_FORB)
-+#define RBS_THROW_FORB RBS_THROW_FORB_Exception(cv::Error::StsError, "Forrbidden huffman code", CV_Func, __FILE__, __LINE__)
-+DECLARE_RBS_EXCEPTION(BAD_HEADER)
-+#define RBS_BAD_HEADER RBS_BAD_HEADER_Exception(cv::Error::StsError, "Invalid header", CV_Func, __FILE__, __LINE__)
- 
- typedef unsigned long ulong;
- 
-diff --git a/modules/imgcodecs/src/grfmt_bmp.cpp b/modules/imgcodecs/src/grfmt_bmp.cpp
-index 86cacd31685..257f97c2d8b 100644
---- a/modules/imgcodecs/src/grfmt_bmp.cpp
-+++ b/modules/imgcodecs/src/grfmt_bmp.cpp
-@@ -118,8 +118,9 @@ bool  BmpDecoder::readHeader()
- 
-                 if( m_bpp <= 8 )
-                 {
--                    memset( m_palette, 0, sizeof(m_palette));
--                    m_strm.getBytes( m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
-+                    CV_Assert(clrused < 256);
-+                    memset(m_palette, 0, sizeof(m_palette));
-+                    m_strm.getBytes(m_palette, (clrused == 0? 1<<m_bpp : clrused)*4 );
-                     iscolor = IsColorPalette( m_palette, m_bpp );
-                 }
-                 else if( m_bpp == 16 && m_rle_code == BMP_BITFIELDS )
-@@ -290,7 +291,9 @@ bool  BmpDecoder::readData( Mat& img )
-                     else if( code > 2 ) // absolute mode
-                     {
-                         if( data + code*nch > line_end ) goto decode_rle4_bad;
--                        m_strm.getBytes( src, (((code + 1)>>1) + 1) & -2 );
-+                        int sz = (((code + 1)>>1) + 1) & (~1);
-+                        CV_Assert((size_t)sz < _src.size());
-+                        m_strm.getBytes(src, sz);
-                         if( color )
-                             data = FillColorRow4( data, src, code, m_palette );
-                         else
-@@ -379,7 +382,9 @@ decode_rle4_bad: ;
- 
-                         if( data + code3 > line_end )
-                             goto decode_rle8_bad;
--                        m_strm.getBytes( src, (code + 1) & -2 );
-+                        int sz = (code + 1) & (~1);
-+                        CV_Assert((size_t)sz < _src.size());
-+                        m_strm.getBytes(src, sz);
-                         if( color )
-                             data = FillColorRow8( data, src, code, m_palette );
-                         else
-diff --git a/modules/imgcodecs/src/grfmt_pxm.cpp b/modules/imgcodecs/src/grfmt_pxm.cpp
-index 1750cb705c3..68bd8fd93f5 100644
---- a/modules/imgcodecs/src/grfmt_pxm.cpp
-+++ b/modules/imgcodecs/src/grfmt_pxm.cpp
-@@ -43,50 +43,58 @@
- #include "precomp.hpp"
- #include "utils.hpp"
- #include "grfmt_pxm.hpp"
-+#include <iostream>
- 
- namespace cv
- {
- 
- ///////////////////////// P?M reader //////////////////////////////
- 
--static int ReadNumber( RLByteStream& strm, int maxdigits )
-+static int ReadNumber(RLByteStream& strm, int maxdigits = 0)
- {
-     int code;
--    int val = 0;
-+    int64 val = 0;
-     int digits = 0;
- 
-     code = strm.getByte();
- 
--    if( !isdigit(code))
-+    while (!isdigit(code))
-     {
--        do
-+        if (code == '#' )
-         {
--            if( code == '#' )
-+            do
-             {
--                do
--                {
--                    code = strm.getByte();
--                }
--                while( code != '\n' && code != '\r' );
-+                code = strm.getByte();
-             }
--
-+            while (code != '\n' && code != '\r');
-             code = strm.getByte();
--
--            while( isspace(code))
-+        }
-+        else if (isspace(code))
-+        {
-+            while (isspace(code))
-                 code = strm.getByte();
-         }
--        while( !isdigit( code ));
-+        else
-+        {
-+#if 1
-+            CV_ErrorNoReturn_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code));
-+#else
-+            code = strm.getByte();
-+#endif
-+        }
-     }
- 
-     do
-     {
--        val = val*10 + code - '0';
--        if( ++digits >= maxdigits ) break;
-+        val = val*10 + (code - '0');
-+        CV_Assert(val <= INT_MAX && "PXM: ReadNumber(): result is too large");
-+        digits++;
-+        if (maxdigits != 0 && digits >= maxdigits) break;
-         code = strm.getByte();
-     }
--    while( isdigit(code));
-+    while (isdigit(code));
- 
--    return val;
-+    return (int)val;
- }
- 
- 
-@@ -122,13 +130,13 @@ ImageDecoder PxMDecoder::newDecoder() const
-     return makePtr<PxMDecoder>();
- }
- 
--void  PxMDecoder::close()
-+void PxMDecoder::close()
- {
-     m_strm.close();
- }
- 
- 
--bool  PxMDecoder::readHeader()
-+bool PxMDecoder::readHeader()
- {
-     bool result = false;
- 
-@@ -158,10 +166,10 @@ bool  PxMDecoder::readHeader()
-         m_binary = code >= '4';
-         m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
- 
--        m_width = ReadNumber( m_strm, INT_MAX );
--        m_height = ReadNumber( m_strm, INT_MAX );
-+        m_width = ReadNumber(m_strm);
-+        m_height = ReadNumber(m_strm);
- 
--        m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
-+        m_maxval = m_bpp == 1 ? 1 : ReadNumber(m_strm);
-         if( m_maxval > 65535 )
-             throw RBS_BAD_HEADER;
- 
-@@ -175,8 +183,14 @@ bool  PxMDecoder::readHeader()
-             result = true;
-         }
-     }
--    catch(...)
-+    catch (const cv::Exception&)
-+    {
-+        throw;
-+    }
-+    catch (...)
-     {
-+        std::cerr << "PXM::readHeader(): unknown C++ exception" << std::endl << std::flush;
-+        throw;
-     }
- 
-     if( !result )
-@@ -189,33 +203,28 @@ bool  PxMDecoder::readHeader()
- }
- 
- 
--bool  PxMDecoder::readData( Mat& img )
-+bool PxMDecoder::readData( Mat& img )
- {
-     int color = img.channels() > 1;
-     uchar* data = img.ptr();
-     PaletteEntry palette[256];
-     bool   result = false;
--    int  bit_depth = CV_ELEM_SIZE1(m_type)*8;
--    int  src_pitch = (m_width*m_bpp*bit_depth/8 + 7)/8;
-+    const int bit_depth = CV_ELEM_SIZE1(m_type)*8;
-+    const int src_pitch = divUp(m_width*m_bpp*(bit_depth/8), 8);
-     int  nch = CV_MAT_CN(m_type);
-     int  width3 = m_width*nch;
--    int  i, x, y;
- 
-     if( m_offset < 0 || !m_strm.isOpened())
-         return false;
- 
--    AutoBuffer<uchar> _src(src_pitch + 32);
--    uchar* src = _src;
--    AutoBuffer<uchar> _gray_palette;
--    uchar* gray_palette = _gray_palette;
-+    uchar gray_palette[256] = {0};
- 
-     // create LUT for converting colors
-     if( bit_depth == 8 )
-     {
--        _gray_palette.allocate(m_maxval + 1);
--        gray_palette = _gray_palette;
-+        CV_Assert(m_maxval < 256);
- 
--        for( i = 0; i <= m_maxval; i++ )
-+        for (int i = 0; i <= m_maxval; i++)
-             gray_palette[i] = (uchar)((i*255/m_maxval)^(m_bpp == 1 ? 255 : 0));
- 
-         FillGrayPalette( palette, m_bpp==1 ? 1 : 8 , m_bpp == 1 );
-@@ -229,12 +238,16 @@ bool  PxMDecoder::readData( Mat& img )
-         {
-         ////////////////////////// 1 BPP /////////////////////////
-         case 1:
-+            CV_Assert(CV_MAT_DEPTH(m_type) == CV_8U);
-             if( !m_binary )
-             {
--                for( y = 0; y < m_height; y++, data += img.step )
-+                AutoBuffer<uchar> _src(m_width);
-+                uchar* src = _src;
-+
-+                for (int y = 0; y < m_height; y++, data += img.step)
-                 {
--                    for( x = 0; x < m_width; x++ )
--                        src[x] = ReadNumber( m_strm, 1 ) != 0;
-+                    for (int x = 0; x < m_width; x++)
-+                        src[x] = ReadNumber(m_strm, 1) != 0;
- 
-                     if( color )
-                         FillColorRow8( data, src, m_width, palette );
-@@ -244,7 +257,10 @@ bool  PxMDecoder::readData( Mat& img )
-             }
-             else
-             {
--                for( y = 0; y < m_height; y++, data += img.step )
-+                AutoBuffer<uchar> _src(src_pitch);
-+                uchar* src = _src;
-+
-+                for (int y = 0; y < m_height; y++, data += img.step)
-                 {
-                     m_strm.getBytes( src, src_pitch );
- 
-@@ -260,13 +276,17 @@ bool  PxMDecoder::readData( Mat& img )
-         ////////////////////////// 8 BPP /////////////////////////
-         case 8:
-         case 24:
--            for( y = 0; y < m_height; y++, data += img.step )
-+        {
-+            AutoBuffer<uchar> _src(std::max<size_t>(width3*2, src_pitch));
-+            uchar* src = _src;
-+
-+            for (int y = 0; y < m_height; y++, data += img.step)
-             {
-                 if( !m_binary )
-                 {
--                    for( x = 0; x < width3; x++ )
-+                    for (int x = 0; x < width3; x++)
-                     {
--                        int code = ReadNumber( m_strm, INT_MAX );
-+                        int code = ReadNumber(m_strm);
-                         if( (unsigned)code > (unsigned)m_maxval ) code = m_maxval;
-                         if( bit_depth == 8 )
-                             src[x] = gray_palette[code];
-@@ -279,7 +299,7 @@ bool  PxMDecoder::readData( Mat& img )
-                     m_strm.getBytes( src, src_pitch );
-                     if( bit_depth == 16 && !isBigEndian() )
-                     {
--                        for( x = 0; x < width3; x++ )
-+                        for (int x = 0; x < width3; x++)
-                         {
-                             uchar v = src[x * 2];
-                             src[x * 2] = src[x * 2 + 1];
-@@ -290,7 +310,7 @@ bool  PxMDecoder::readData( Mat& img )
- 
-                 if( img.depth() == CV_8U && bit_depth == 16 )
-                 {
--                    for( x = 0; x < width3; x++ )
-+                    for (int x = 0; x < width3; x++)
-                     {
-                         int v = ((ushort *)src)[x];
-                         src[x] = (uchar)(v >> 8);
-@@ -331,12 +351,19 @@ bool  PxMDecoder::readData( Mat& img )
-             }
-             result = true;
-             break;
-+        }
-         default:
--            assert(0);
-+            CV_ErrorNoReturn(Error::StsError, "m_bpp is not supported");
-         }
-     }
--    catch(...)
-+    catch (const cv::Exception&)
-+    {
-+        throw;
-+    }
-+    catch (...)
-     {
-+        std::cerr << "PXM::readData(): unknown exception" << std::endl << std::flush;
-+        throw;
-     }
- 
-     return result;
-@@ -412,8 +439,9 @@ bool  PxMEncoder::write( const Mat& img, const std::vector<int>& params )
-     char* buffer = _buffer;
- 
-     // write header;
--    sprintf( buffer, "P%c\n%d %d\n%d\n",
-+    sprintf( buffer, "P%c\n# Generated by OpenCV %s\n%d %d\n%d\n",
-              '2' + (channels > 1 ? 1 : 0) + (isBinary ? 3 : 0),
-+             CV_VERSION,
-              width, height, (1 << depth) - 1 );
- 
-     strm.putBytes( buffer, (int)strlen(buffer) );
-diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp
-index 3b2366217f2..5ee4ca3541b 100644
---- a/modules/imgcodecs/src/loadsave.cpp
-+++ b/modules/imgcodecs/src/loadsave.cpp
-@@ -55,6 +55,27 @@
- /****************************************************************************************\
- *                                      Image Codecs                                      *
- \****************************************************************************************/
-+
-+namespace cv {
-+
-+// TODO Add runtime configuration
-+#define CV_IO_MAX_IMAGE_PARAMS (50)
-+#define CV_IO_MAX_IMAGE_WIDTH (1<<20)
-+#define CV_IO_MAX_IMAGE_HEIGHT (1<<20)
-+#define CV_IO_MAX_IMAGE_PIXELS (1<<30) // 1 Gigapixel
-+
-+static Size validateInputImageSize(const Size& size)
-+{
-+    CV_Assert(size.width > 0);
-+    CV_Assert(size.width <= CV_IO_MAX_IMAGE_WIDTH);
-+    CV_Assert(size.height > 0);
-+    CV_Assert(size.height <= CV_IO_MAX_IMAGE_HEIGHT);
-+    uint64 pixels = (uint64)size.width * (uint64)size.height;
-+    CV_Assert(pixels <= CV_IO_MAX_IMAGE_PIXELS);
-+    return size;
-+}
-+
-+
- namespace {
- 
- class ByteStreamBuffer: public std::streambuf
-@@ -94,9 +115,6 @@ class ByteStreamBuffer: public std::streambuf
- 
- }
- 
--namespace cv
--{
--
- /**
-  * @struct ImageCodecInitializer
-  *
-@@ -408,14 +426,26 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
-     /// set the filename in the driver
-     decoder->setSource( filename );
- 
--   // read the header to make sure it succeeds
--   if( !decoder->readHeader() )
-+    try
-+    {
-+        // read the header to make sure it succeeds
-+        if( !decoder->readHeader() )
-+            return 0;
-+    }
-+    catch (const cv::Exception& e)
-+    {
-+        std::cerr << "imread_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
-         return 0;
-+    }
-+    catch (...)
-+    {
-+        std::cerr << "imread_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
-+        return 0;
-+    }
-+
- 
-     // established the required input image size
--    CvSize size;
--    size.width = decoder->width();
--    size.height = decoder->height();
-+    Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
- 
-     // grab the decoded type
-     int type = decoder->type();
-@@ -451,7 +481,21 @@ imread_( const String& filename, int flags, int hdrtype, Mat* mat=0 )
-     }
- 
-     // read the image data
--    if( !decoder->readData( *data ))
-+    bool success = false;
-+    try
-+    {
-+        if (decoder->readData(*data))
-+            success = true;
-+    }
-+    catch (const cv::Exception& e)
-+    {
-+        std::cerr << "imread_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
-+    }
-+    catch (...)
-+    {
-+        std::cerr << "imread_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
-+    }
-+    if (!success)
-     {
-         cvReleaseImage( &image );
-         cvReleaseMat( &matrix );
-@@ -504,8 +548,22 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
-     decoder->setSource(filename);
- 
-     // read the header to make sure it succeeds
--    if (!decoder->readHeader())
-+    try
-+    {
-+        // read the header to make sure it succeeds
-+        if( !decoder->readHeader() )
-+            return 0;
-+    }
-+    catch (const cv::Exception& e)
-+    {
-+        std::cerr << "imreadmulti_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
-         return 0;
-+    }
-+    catch (...)
-+    {
-+        std::cerr << "imreadmulti_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
-+        return 0;
-+    }
- 
-     for (;;)
-     {
-@@ -523,17 +581,32 @@ imreadmulti_(const String& filename, int flags, std::vector<Mat>& mats)
-                 type = CV_MAKETYPE(CV_MAT_DEPTH(type), 1);
-         }
- 
-+        // established the required input image size
-+        Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
-+
-         // read the image data
--        Mat mat(decoder->height(), decoder->width(), type);
--        if (!decoder->readData(mat))
-+        Mat mat(size.height, size.width, type);
-+        bool success = false;
-+        try
-         {
--            // optionally rotate the data if EXIF' orientation flag says so
--            if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
--            {
--                ApplyExifOrientation(filename, mat);
--            }
--
-+            if (decoder->readData(mat))
-+                success = true;
-+        }
-+        catch (const cv::Exception& e)
-+        {
-+            std::cerr << "imreadmulti_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
-+        }
-+        catch (...)
-+        {
-+            std::cerr << "imreadmulti_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
-+        }
-+        if (!success)
-             break;
-+
-+        // optionally rotate the data if EXIF' orientation flag says so
-+        if( (flags & IMREAD_IGNORE_ORIENTATION) == 0 && flags != IMREAD_UNCHANGED )
-+        {
-+            ApplyExifOrientation(filename, mat);
-         }
- 
-         mats.push_back(mat);
-@@ -616,6 +689,7 @@ static bool imwrite_( const String& filename, const Mat& image,
-     }
- 
-     encoder->setDestination( filename );
-+    CV_Assert(params.size() <= CV_IO_MAX_IMAGE_PARAMS*2);
-     bool code = encoder->write( *pimage, params );
- 
-     //    CV_Assert( code );
-@@ -663,22 +737,35 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
-         decoder->setSource(filename);
-     }
- 
--    if( !decoder->readHeader() )
-+    bool success = false;
-+    try
-+    {
-+        if (decoder->readHeader())
-+            success = true;
-+    }
-+    catch (const cv::Exception& e)
-+    {
-+        std::cerr << "imdecode_('" << filename << "'): can't read header: " << e.what() << std::endl << std::flush;
-+    }
-+    catch (...)
-+    {
-+        std::cerr << "imdecode_('" << filename << "'): can't read header: unknown exception" << std::endl << std::flush;
-+    }
-+    if (!success)
-     {
-         decoder.release();
--        if ( !filename.empty() )
-+        if (!filename.empty())
-         {
--            if ( remove(filename.c_str()) != 0 )
-+            if (0 != remove(filename.c_str()))
-             {
--                CV_Error( CV_StsError, "unable to remove temporary file" );
-+                std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
-             }
-         }
-         return 0;
-     }
- 
--    CvSize size;
--    size.width = decoder->width();
--    size.height = decoder->height();
-+    // established the required input image size
-+    Size size = validateInputImageSize(Size(decoder->width(), decoder->height()));
- 
-     int type = decoder->type();
-     if( (flags & IMREAD_LOAD_GDAL) != IMREAD_LOAD_GDAL && flags != IMREAD_UNCHANGED )
-@@ -712,17 +799,30 @@ imdecode_( const Mat& buf, int flags, int hdrtype, Mat* mat=0 )
-         temp = cvarrToMat(image);
-     }
- 
--    bool code = decoder->readData( *data );
-+    success = false;
-+    try
-+    {
-+        if (decoder->readData(*data))
-+            success = true;
-+    }
-+    catch (const cv::Exception& e)
-+    {
-+        std::cerr << "imdecode_('" << filename << "'): can't read data: " << e.what() << std::endl << std::flush;
-+    }
-+    catch (...)
-+    {
-+        std::cerr << "imdecode_('" << filename << "'): can't read data: unknown exception" << std::endl << std::flush;
-+    }
-     decoder.release();
--    if ( !filename.empty() )
-+    if (!filename.empty())
-     {
--        if ( remove(filename.c_str()) != 0 )
-+        if (0 != remove(filename.c_str()))
-         {
--            CV_Error( CV_StsError, "unable to remove temporary file" );
-+            std::cerr << "unable to remove temporary file:" << filename << std::endl << std::flush;
-         }
-     }
- 
--    if( !code )
-+    if (!success)
-     {
-         cvReleaseImage( &image );
-         cvReleaseMat( &matrix );
-@@ -859,7 +959,7 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
-     if( _params )
-     {
-         for( ; _params[i] > 0; i += 2 )
--            ;
-+            CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
-     }
-     return cv::imwrite_(filename, cv::cvarrToMat(arr),
-         i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
-@@ -890,7 +990,7 @@ cvEncodeImage( const char* ext, const CvArr* arr, const int* _params )
-     if( _params )
-     {
-         for( ; _params[i] > 0; i += 2 )
--            ;
-+            CV_Assert(i < CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
-     }
-     cv::Mat img = cv::cvarrToMat(arr);
-     if( CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL )
-
-From 78a310630fb0a1f6d089576202343e672f27609d Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Wed, 16 Aug 2017 13:53:12 +0300
-Subject: [PATCH 3/3] imgproc(test): add checks for remove() call
-
----
- modules/imgcodecs/test/test_grfmt.cpp      |  2 +-
- modules/imgcodecs/test/test_jpeg.cpp       | 12 ++++++------
- modules/imgcodecs/test/test_png.cpp        |  2 +-
- modules/imgcodecs/test/test_read_write.cpp |  4 ++--
- modules/imgcodecs/test/test_tiff.cpp       |  8 ++++----
- modules/imgcodecs/test/test_webp.cpp       |  6 +++---
- 6 files changed, 17 insertions(+), 17 deletions(-)
-
-diff --git a/modules/imgcodecs/test/test_grfmt.cpp b/modules/imgcodecs/test/test_grfmt.cpp
-index 64a0c1e3ad0..74b72c3b3e9 100644
---- a/modules/imgcodecs/test/test_grfmt.cpp
-+++ b/modules/imgcodecs/test/test_grfmt.cpp
-@@ -175,7 +175,7 @@ TEST_P(Imgcodecs_ExtSize, write_imageseq)
-             EXPECT_LT(n, 1.);
-             EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), img, img_gt);
-         }
--        remove(filename.c_str());
-+        EXPECT_EQ(0, remove(filename.c_str()));
-     }
- }
- 
-diff --git a/modules/imgcodecs/test/test_jpeg.cpp b/modules/imgcodecs/test/test_jpeg.cpp
-index 5546f2d91a8..6ddb0284020 100644
---- a/modules/imgcodecs/test/test_jpeg.cpp
-+++ b/modules/imgcodecs/test/test_jpeg.cpp
-@@ -123,8 +123,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_progressive_jpeg)
- 
-     EXPECT_EQ(0, cvtest::norm(img_jpg_progressive, img_jpg_normal, NORM_INF));
- 
--    remove(output_progressive.c_str());
--    remove(output_normal.c_str());
-+    EXPECT_EQ(0, remove(output_progressive.c_str()));
-+    EXPECT_EQ(0, remove(output_normal.c_str()));
- }
- 
- TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg)
-@@ -148,8 +148,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_optimize_jpeg)
- 
-     EXPECT_EQ(0, cvtest::norm(img_jpg_optimized, img_jpg_normal, NORM_INF));
- 
--    remove(output_optimized.c_str());
--    remove(output_normal.c_str());
-+    EXPECT_EQ(0, remove(output_optimized.c_str()));
-+    EXPECT_EQ(0, remove(output_normal.c_str()));
- }
- 
- TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg)
-@@ -173,8 +173,8 @@ TEST(Imgcodecs_Jpeg, encode_decode_rst_jpeg)
- 
-     EXPECT_EQ(0, cvtest::norm(img_jpg_rst, img_jpg_normal, NORM_INF));
- 
--    remove(output_rst.c_str());
--    remove(output_normal.c_str());
-+    EXPECT_EQ(0, remove(output_rst.c_str()));
-+    EXPECT_EQ(0, remove(output_normal.c_str()));
- }
- 
- #endif // HAVE_JPEG
-diff --git a/modules/imgcodecs/test/test_png.cpp b/modules/imgcodecs/test/test_png.cpp
-index c46f901199e..4e97043e1c7 100644
---- a/modules/imgcodecs/test/test_png.cpp
-+++ b/modules/imgcodecs/test/test_png.cpp
-@@ -17,7 +17,7 @@ TEST(Imgcodecs_Png, write_big)
-     EXPECT_EQ(13043, img.cols);
-     EXPECT_EQ(13917, img.rows);
-     ASSERT_NO_THROW(imwrite(dst_file, img));
--    remove(dst_file.c_str());
-+    EXPECT_EQ(0, remove(dst_file.c_str()));
- }
- 
- TEST(Imgcodecs_Png, encode)
-diff --git a/modules/imgcodecs/test/test_read_write.cpp b/modules/imgcodecs/test/test_read_write.cpp
-index 38f10225f68..5119813bf84 100644
---- a/modules/imgcodecs/test/test_read_write.cpp
-+++ b/modules/imgcodecs/test/test_read_write.cpp
-@@ -50,7 +50,7 @@ TEST(Imgcodecs_Image, read_write_bmp)
-         psnr = cvtest::PSNR(buf_loaded, image);
-         EXPECT_GT(psnr, thresDbell);
- 
--        remove(dst_name.c_str());
-+        EXPECT_EQ(0, remove(dst_name.c_str()));
-     }
- }
- 
-@@ -95,7 +95,7 @@ TEST_P(Imgcodecs_Image, read_write)
-     psnr = cvtest::PSNR(buf_loaded, image);
-     EXPECT_GT(psnr, thresDbell);
- 
--    remove(full_name.c_str());
-+    EXPECT_EQ(0, remove(full_name.c_str()));
- }
- 
- const string exts[] = {
-diff --git a/modules/imgcodecs/test/test_tiff.cpp b/modules/imgcodecs/test/test_tiff.cpp
-index 0264da4cd81..6ef0c174828 100644
---- a/modules/imgcodecs/test/test_tiff.cpp
-+++ b/modules/imgcodecs/test/test_tiff.cpp
-@@ -41,8 +41,8 @@ TEST(Imgcodecs_Tiff, decode_tile16384x16384)
-         // not enough memory
-     }
- 
--    remove(file3.c_str());
--    remove(file4.c_str());
-+    EXPECT_EQ(0, remove(file3.c_str()));
-+    EXPECT_EQ(0, remove(file4.c_str()));
- }
- 
- TEST(Imgcodecs_Tiff, write_read_16bit_big_little_endian)
-@@ -88,7 +88,7 @@ TEST(Imgcodecs_Tiff, write_read_16bit_big_little_endian)
-         EXPECT_EQ(0xDEAD, img.at<ushort>(0,0));
-         EXPECT_EQ(0xBEEF, img.at<ushort>(0,1));
- 
--        remove(filename.c_str());
-+        EXPECT_EQ(0, remove(filename.c_str()));
-     }
- }
- 
-@@ -143,7 +143,7 @@ TEST(Imgcodecs_Tiff, decode_infinite_rowsperstrip)
- 
-     EXPECT_NO_THROW(cv::imread(filename, IMREAD_UNCHANGED));
- 
--    remove(filename.c_str());
-+    EXPECT_EQ(0, remove(filename.c_str()));
- }
- 
- //==================================================================================================
-diff --git a/modules/imgcodecs/test/test_webp.cpp b/modules/imgcodecs/test/test_webp.cpp
-index 6d40ce21e2d..d82fdd28964 100644
---- a/modules/imgcodecs/test/test_webp.cpp
-+++ b/modules/imgcodecs/test/test_webp.cpp
-@@ -44,7 +44,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossless_webp)
-         }
-     }
- 
--    remove(output.c_str());
-+    EXPECT_EQ(0, remove(output.c_str()));
- 
-     cv::Mat decode = cv::imdecode(buf, IMREAD_COLOR);
-     ASSERT_FALSE(decode.empty());
-@@ -71,7 +71,7 @@ TEST(Imgcodecs_WebP, encode_decode_lossy_webp)
- 
-         EXPECT_NO_THROW(cv::imwrite(output, img, params));
-         cv::Mat img_webp = cv::imread(output);
--        remove(output.c_str());
-+        EXPECT_EQ(0, remove(output.c_str()));
-         EXPECT_FALSE(img_webp.empty());
-         EXPECT_EQ(3,   img_webp.channels());
-         EXPECT_EQ(512, img_webp.cols);
-@@ -96,7 +96,7 @@ TEST(Imgcodecs_WebP, encode_decode_with_alpha_webp)
- 
-     EXPECT_NO_THROW(cv::imwrite(output, img));
-     cv::Mat img_webp = cv::imread(output);
--    remove(output.c_str());
-+    EXPECT_EQ(0, remove(output.c_str()));
-     EXPECT_FALSE(img_webp.empty());
-     EXPECT_EQ(4,   img_webp.channels());
-     EXPECT_EQ(512, img_webp.cols);

diff --git a/media-libs/opencv/opencv-3.3.0.ebuild b/media-libs/opencv/opencv-3.3.0-r1.ebuild
similarity index 98%
rename from media-libs/opencv/opencv-3.3.0.ebuild
rename to media-libs/opencv/opencv-3.3.0-r1.ebuild
index db01ccd1158..eaa25d8ec26 100644
--- a/media-libs/opencv/opencv-3.3.0.ebuild
+++ b/media-libs/opencv/opencv-3.3.0-r1.ebuild
@@ -10,6 +10,7 @@ DESCRIPTION="A collection of algorithms and sample code for various computer vis
 HOMEPAGE="http://opencv.org"
 
 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_xfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz  ) ) "
 LICENSE="BSD"
@@ -124,7 +125,7 @@ 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"
-	"${FILESDIR}/${P}-imgcodecs-gcc.patch" # bug 627958 and https://github.com/opencv/opencv/pull/9376
+	"${WORKDIR}/${P}-imgcodecs-gcc.patch" # bug 627958 and https://github.com/opencv/opencv/pull/9376
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2019-01-17 18:12 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2019-01-17 18:12 UTC (permalink / raw
  To: gentoo-commits

commit:     510d7eb712901d372fba19bccc96e9d23855bae4
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 17 08:59:50 2019 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Thu Jan 17 18:12:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=510d7eb7

media-libs/opencv: add missing build dep

Closes: https://bugs.gentoo.org/656576
Signed-off-by: Amy Liffey <amynka <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 .../files/opencv-3.4.1-fix-build-with-va.patch     | 26 ++++++++++++++++++++++
 media-libs/opencv/opencv-3.4.1-r5.ebuild           |  4 +++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch b/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch
new file mode 100644
index 00000000000..813eb7e4ae6
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch
@@ -0,0 +1,26 @@
+From 20f5fa8e3e880bc8b2e5156e9f25f7fb756ed8e4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
+Date: Wed, 28 Feb 2018 19:21:31 +0000
+Subject: [PATCH] Fix build with VA
+
+This commit readd ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}
+that was missed in commit 2200e13c7193e0fe9db4b9f7c4bee3a7ef043909
+
+    diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
+    -    ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
+    +  ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
+---
+ samples/va_intel/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
+index af51dd32061..04f2ea5fd40 100644
+--- a/samples/va_intel/CMakeLists.txt
++++ b/samples/va_intel/CMakeLists.txt
+@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
+ file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
+ foreach(sample_filename ${all_samples})
+   ocv_define_sample(tgt ${sample_filename} va_intel)
+-  ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
++  ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
+ endforeach()

diff --git a/media-libs/opencv/opencv-3.4.1-r5.ebuild b/media-libs/opencv/opencv-3.4.1-r5.ebuild
index 4b41ad5b750..45086698e73 100644
--- a/media-libs/opencv/opencv-3.4.1-r5.ebuild
+++ b/media-libs/opencv/opencv-3.4.1-r5.ebuild
@@ -105,7 +105,8 @@ DEPEND="${RDEPEND}
 	virtual/pkgconfig[${MULTILIB_USEDEP}]
 	contrib_dnn? ( dev-libs/cereal )
 	eigen? ( dev-cpp/eigen:3 )
-	java?  ( >=virtual/jdk-1.6 )"
+	java?  ( >=virtual/jdk-1.6 )
+	vaapi?  ( x11-libs/libva )"
 
 MULTILIB_WRAPPED_HEADERS=(
 	/usr/include/opencv2/cvconfig.h
@@ -231,6 +232,7 @@ PATCHES=(
 	"${FILESDIR}/${P}-python-lib-suffix-hack.patch"
 	"${FILESDIR}/${P}-cuda-add-relaxed-constexpr.patch"
 	"${FILESDIR}/${P}-remove-git-autodetect.patch"
+	"${FILESDIR}/${P}-fix-build-with-va.patch" # bug https://bugs.gentoo.org/656576
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2019-01-24  9:24 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2019-01-24  9:24 UTC (permalink / raw
  To: gentoo-commits

commit:     feeb7a004035ddf5a3c45b19399165cff76c6f82
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 24 08:54:25 2019 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Thu Jan 24 09:24:08 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=feeb7a00

media-libs/opencv: fix popcnt detection

Closes: https://bugs.gentoo.org/633900
Submitted-by:  Branko Grubic <bitlord0xff <AT> gmail.com>
Signed-off-by: Amy Liffey <amynka <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 media-libs/opencv/files/opencv-3.4.1-popcnt.patch | 30 +++++++++++++++++++++++
 media-libs/opencv/opencv-3.4.1-r5.ebuild          |  1 +
 2 files changed, 31 insertions(+)

diff --git a/media-libs/opencv/files/opencv-3.4.1-popcnt.patch b/media-libs/opencv/files/opencv-3.4.1-popcnt.patch
new file mode 100644
index 00000000000..51a6d554a25
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.4.1-popcnt.patch
@@ -0,0 +1,30 @@
+From a2d6fc7ac040c6ef94a36515f9ea24428f8f1ecc Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Tue, 24 Apr 2018 12:40:25 +0300
+Subject: [PATCH] cmake: fix popcnt detection
+
+via GCC/Clang __POPCNT__ define
+---
+ cmake/checks/cpu_popcnt.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/checks/cpu_popcnt.cpp b/cmake/checks/cpu_popcnt.cpp
+index 16e5575108b..44c7deda053 100644
+--- a/cmake/checks/cpu_popcnt.cpp
++++ b/cmake/checks/cpu_popcnt.cpp
+@@ -4,12 +4,14 @@
+ #    define CV_POPCNT_U64 _mm_popcnt_u64
+ #  endif
+ #  define CV_POPCNT_U32 _mm_popcnt_u32
+-#else
++#elif defined(__POPCNT__)
+ #  include <popcntintrin.h>
+ #  if defined(__x86_64__)
+ #    define CV_POPCNT_U64 __builtin_popcountll
+ #  endif
+ #  define CV_POPCNT_U32 __builtin_popcount
++#else
++#  error "__POPCNT__ is not defined by compiler"
+ #endif
+ 
+ int main()

diff --git a/media-libs/opencv/opencv-3.4.1-r5.ebuild b/media-libs/opencv/opencv-3.4.1-r5.ebuild
index 45086698e73..c8bf140695b 100644
--- a/media-libs/opencv/opencv-3.4.1-r5.ebuild
+++ b/media-libs/opencv/opencv-3.4.1-r5.ebuild
@@ -233,6 +233,7 @@ PATCHES=(
 	"${FILESDIR}/${P}-cuda-add-relaxed-constexpr.patch"
 	"${FILESDIR}/${P}-remove-git-autodetect.patch"
 	"${FILESDIR}/${P}-fix-build-with-va.patch" # bug https://bugs.gentoo.org/656576
+	"${FILESDIR}/${P}-popcnt.patch" # https://bugs.gentoo.org/633900
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2019-03-31 18:52 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2019-03-31 18:52 UTC (permalink / raw
  To: gentoo-commits

commit:     42ffb447e4f3a045a9613c9c8b85f55b9dfbab7e
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 31 14:47:51 2019 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Sun Mar 31 18:52:08 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=42ffb447

media-libs/opencv: fix build on x86

- Add upstream patch found by kensington to fix build on x86

Closes: https://bugs.gentoo.org/682104
Signed-off-by: Amy Liffey <amynka <AT> gentoo.org>
Package-Manager: Portage-2.3.62, Repoman-2.3.11

 .../opencv/files/opencv-3.4.1-fix-on-x86.patch     | 27 ++++++++++++++++++++++
 media-libs/opencv/opencv-3.4.1-r5.ebuild           |  1 +
 2 files changed, 28 insertions(+)

diff --git a/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch b/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch
new file mode 100644
index 00000000000..f36d643cf73
--- /dev/null
+++ b/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch
@@ -0,0 +1,27 @@
+From 7dc162cb4252ccf461f1c63650abde3c8807b79c Mon Sep 17 00:00:00 2001
+From: Alexander Alekhin <alexander.alekhin@intel.com>
+Date: Mon, 9 Apr 2018 18:25:51 +0300
+Subject: [PATCH] core: fix mm_pause() for non-SSE i386 builds
+
+replaced to safe binary compatible 'rep; nop' asm instruction
+---
+ modules/core/src/parallel_impl.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp
+index 78d9eb63694..bc64fce7a81 100644
+--- a/modules/core/src/parallel_impl.cpp
++++ b/modules/core/src/parallel_impl.cpp
+@@ -49,7 +49,11 @@ DECLARE_CV_YIELD
+ DECLARE_CV_PAUSE
+ #endif
+ #ifndef CV_PAUSE
+-#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
++# if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
++#   if !defined(__SSE__)
++      static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); }
++#     define _mm_pause cv_non_sse_mm_pause
++#   endif
+ #   define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0)
+ # elif defined __GNUC__ && defined __aarch64__
+ #   define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0)

diff --git a/media-libs/opencv/opencv-3.4.1-r5.ebuild b/media-libs/opencv/opencv-3.4.1-r5.ebuild
index 092e2a0d7eb..cb9bc604ea9 100644
--- a/media-libs/opencv/opencv-3.4.1-r5.ebuild
+++ b/media-libs/opencv/opencv-3.4.1-r5.ebuild
@@ -234,6 +234,7 @@ PATCHES=(
 	"${FILESDIR}/${P}-remove-git-autodetect.patch"
 	"${FILESDIR}/${P}-fix-build-with-va.patch" # bug https://bugs.gentoo.org/656576
 	"${FILESDIR}/${P}-popcnt.patch" # https://bugs.gentoo.org/633900
+	"${FILESDIR}/${P}-fix-on-x86.patch" # https://bugs.gentoo.org/682104
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2019-12-06 20:37 Amy Liffey
  0 siblings, 0 replies; 27+ messages in thread
From: Amy Liffey @ 2019-12-06 20:37 UTC (permalink / raw
  To: gentoo-commits

commit:     93efdf78e5dea766ec0fb02840a59698a88b905b
Author:     Amy Liffey <amynka <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  6 20:35:45 2019 +0000
Commit:     Amy Liffey <amynka <AT> gentoo <DOT> org>
CommitDate: Fri Dec  6 20:37:03 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=93efdf78

media-libs/opencv: fix pkg-config file generation

Closes: https://bugs.gentoo.org/701662
Package-Manager: Portage-2.3.76, Repoman-2.3.16
Signed-off-by: Amy Liffey <amynka <AT> gentoo.org>

 .../files/opencv-4.1.2-pkg-config-file.patch       |  11 +
 media-libs/opencv/opencv-4.1.2-r2.ebuild           | 497 +++++++++++++++++++++
 2 files changed, 508 insertions(+)

diff --git a/media-libs/opencv/files/opencv-4.1.2-pkg-config-file.patch b/media-libs/opencv/files/opencv-4.1.2-pkg-config-file.patch
new file mode 100644
index 00000000000..496216186af
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.1.2-pkg-config-file.patch
@@ -0,0 +1,11 @@
+--- a/cmake/templates/opencv-XXX.pc.in	2019-12-04 21:28:09.686525699 +0100
++++ b/cmake/templates/opencv-XXX.pc.in	2019-12-04 21:29:21.319265154 +0100
+@@ -3,7 +3,7 @@
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+-includedir_old=@includedir@/opencv
++includedir_old=@includedir@/opencv2
+ includedir_new=@includedir@
+ 
+ Name: OpenCV

diff --git a/media-libs/opencv/opencv-4.1.2-r2.ebuild b/media-libs/opencv/opencv-4.1.2-r2.ebuild
new file mode 100644
index 00000000000..5f9efaf9134
--- /dev/null
+++ b/media-libs/opencv/opencv-4.1.2-r2.ebuild
@@ -0,0 +1,497 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
+
+inherit java-pkg-opt-2 java-ant-2 python-r1 toolchain-funcs 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
+	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
+	contrib? (
+		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
+		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
+		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
+	)"
+
+LICENSE="BSD"
+SLOT="0/4.1.2" # subslot = libopencv* soname version
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux"
+IUSE="contrib contribcvv contribdnn contribhdf contribsfm contribxfeatures2d cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_ssse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_popcnt cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cuda debug dnnsamples -download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk ieee1394 jpeg jpeg2k lapack libav opencl openexr opengl openmp opencvapps pch png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
+# OpenGL needs gtk or Qt installed to activate, otherwise build system
+# will silently disable it Wwithout the user knowing, which defeats the
+# purpose of the opengl use flag.
+REQUIRED_USE="
+	cuda? ( tesseract? ( opencl ) )
+	dnnsamples? ( examples )
+	gflags? ( contrib )
+	glog? ( contrib )
+	contribcvv? ( contrib qt5 )
+	contribdnn? ( contrib )
+	contribhdf? ( contrib )
+	contribsfm? ( contrib eigen gflags glog )
+	contribxfeatures2d? ( contrib download )
+	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= )
+	contribhdf? ( 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}]
+	)
+	java? ( >=virtual/jre-1.6:* )
+	jpeg? ( virtual/jpeg:0[${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}]
+	eigen? ( dev-cpp/eigen:3 )
+	java?  ( >=virtual/jdk-1.6 )
+	vaapi?  ( x11-libs/libva )"
+
+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
+	# [opencv4]
+	/usr/include/opencv4/opencv2/core/cv_cpu_dispatch.h
+	/usr/include/opencv4/opencv2/core/cvdef.h
+	/usr/include/opencv4/opencv2/dnn.hpp
+	/usr/include/opencv4/opencv2/core/cuda/transform.hpp
+	/usr/include/opencv4/opencv2/core/opencl/runtime/opencl_core.hpp
+	/usr/include/opencv4/opencv2/cvconfig.h
+	/usr/include/opencv4/opencv2/core/utils/allocator_stats.impl.hpp
+	/usr/include/opencv4/opencv2/video/tracking.hpp
+	/usr/include/opencv4/opencv2/objdetect.hpp
+)
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.0.0-gles.patch"
+	"${FILESDIR}/${PN}-3.4.0-disable-download.patch"
+	"${FILESDIR}/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch"
+	"${FILESDIR}/${P}-pkg-config-file.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 dnnsamples; then
+		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
+	fi
+
+	if use contrib; then
+		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
+		if use contribxfeatures2d; then
+			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
+		fi
+	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
+	# ===================================================
+		-DENABLE_DOWNLOAD=$(usex download)
+		-DWITH_QUIRC=OFF # Do not have dependencies
+		-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=OFF
+		-DWITH_JASPER=OFF
+		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
+		-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=OFF
+	#	-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
+		-DOPENCV_GENERATE_PKGCONFIG=ON
+		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
+		# to set its destination libdir
+		-DLIB_SUFFIX=
+	# ===================================================
+	# 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=
+	# ==================================================
+	# cpu flags, should solve 633900
+	#===================================================
+		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
+		-DCPU_BASELINE=$(printf "%s," "${cpu_flags[@]}")
+		-DCPU_DISPATCH=
+		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
+	)
+
+	# ===================================================
+	# OpenCV Contrib Modules
+	# ===================================================
+	if use contrib; then
+		GLOBALCMAKEARGS+=(
+			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
+			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
+			-DBUILD_opencv_dnns_easily_fooled=OFF
+			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
+			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
+			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
+			-DBUILD_opencv_sfm=$(usex contribsfm 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
+		-DBUILD_opencv_python2=OFF
+		-DBUILD_opencv_python3=OFF
+	)
+
+	cmake-utils_src_configure
+
+	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
+	# TODO patch ocv_download to copy files into destination dirs
+	if use contribdnn; then
+		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
+		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
+	fi
+
+}
+
+python_module_compile() {
+	local BUILD_DIR=${orig_BUILD_DIR}
+	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
+
+	# Set all python variables to load the correct Gentoo paths
+	mycmakeargs+=(
+		# python_setup alters PATH and sets this as wrapper
+		# to the correct interpreter we are building for
+		-DPYTHON_DEFAULT_EXECUTABLE=python
+		-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
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2020-06-25 17:08 Andreas Sturmlechner
  0 siblings, 0 replies; 27+ messages in thread
From: Andreas Sturmlechner @ 2020-06-25 17:08 UTC (permalink / raw
  To: gentoo-commits

commit:     e00c8edae30e54a80c29fabf1ecac66462a5edde
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 25 07:56:35 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Jun 25 17:07:43 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e00c8eda

media-libs/opencv: Drop vulnerable 3.4.1-r7

Bug: https://bugs.gentoo.org/711284
Bug: https://bugs.gentoo.org/729504
Package-Manager: Portage-2.3.103, Repoman-2.3.23
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 media-libs/opencv/Manifest                         |   3 -
 ...opencv-3.3.0-remove-tiny-dnn-autodownload.patch |  27 --
 .../files/opencv-3.4.1-compilation-C-mode.patch    |  56 ---
 .../files/opencv-3.4.1-fix-build-with-va.patch     |  26 --
 .../opencv/files/opencv-3.4.1-fix-on-x86.patch     |  27 --
 media-libs/opencv/files/opencv-3.4.1-popcnt.patch  |  30 --
 .../opencv-3.4.1-python-lib-suffix-hack.patch      |  13 -
 .../opencv/files/opencv-3.4.1-python37.patch       |  12 -
 .../files/opencv-3.4.1-remove-git-autodetect.patch |  42 --
 media-libs/opencv/opencv-3.4.1-r7.ebuild           | 501 ---------------------
 10 files changed, 737 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 079529c915c..3f4b2dfa9bb 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,8 +1,5 @@
 DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
 DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
-DIST opencv-3.4.1.tar.gz 87051748 BLAKE2B 87c83ab9b3d7fb048263f047aa5d6e95b153e1a28f3e34cc885eff7eb080a2258cfa1aa494cd56b32f1098ab158c17c23fc8464fcbe70642a3a1842f2fd1b4ac SHA512 e1fc14285090c6fe9e26e721f2d67d7096650c523147e925567426ef76aa7f4c6f12035d6f6ce3ec7991a75a6828a810fd4f9b75f78ed5fcccecefbadd79944b
-DIST opencv-3.4.1_contrib.tar.gz 57126844 BLAKE2B 63d9d5cb088371754eb132607789c8f1d4820f3e0e486593d6f64ee8f918ea4362152f050baec16f17904c03a6cdc0abc6e5fb2510308dcbabebe97b29285fbc SHA512 431dfba0f413071d7faa18bc6e6f5e4f015285e2cc730c5dd69b2a4d6aa4250b7e0bcb1814ac6f06f5c76f103aea1f93f72f32aee6bc0cd7ddacdaf1f40075c1
 DIST opencv-4.1.2.tar.gz 87468598 BLAKE2B 9e0fbd8499f783cd1a2b5ffddf557aef424b0a446f71f826522ffd4526d04742e0c408b99810fe6b39753d40c475922d2e273732fdc0a0b4ee0bc56052a7a26c SHA512 d18d2cc35dc1c95c8870d35feb14459db27ebf6d09ff89a185918b1faff1b36dedacc18f268a6483570c404aca19b83ba627ce7af2265af7195a029cb766c09f
 DIST opencv-4.1.2_contrib.tar.gz 60881937 BLAKE2B c461aaa62306b226bde9211e2d611dcf705510e32c8598458737eb09c510cfdb49c33e11f1a7c591090d8243590e915b779fdb55955550fe44dab7545e4cc308 SHA512 1e14f94f9228c5d6a598493eed265aab1d8a740d5bfa00639afb05287732220eb71f88bb374de47dcd440f4376486f9db0e8b338e90e5dc4f6af8d355340b622
-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-remove-tiny-dnn-autodownload.patch b/media-libs/opencv/files/opencv-3.3.0-remove-tiny-dnn-autodownload.patch
deleted file mode 100644
index 6929a4c2ce4..00000000000
--- a/media-libs/opencv/files/opencv-3.3.0-remove-tiny-dnn-autodownload.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff -purN a/modules/dnn_modern/CMakeLists.txt b/modules/dnn_modern/CMakeLists.txt
---- a/modules/dnn_modern/CMakeLists.txt	2017-07-31 15:58:38.000000000 +0100
-+++ b/modules/dnn_modern/CMakeLists.txt	2018-01-15 17:15:15.202454388 +0000
-@@ -15,23 +15,6 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CU
- # MODULE REQUIREMENTS
- # ----------------------------------------------------------------------------
- 
--set(TINY_DNN_CPP_PATH "${OpenCV_BINARY_DIR}/3rdparty/tinydnn")
--set(TINY_DNN_CPP_ROOT "${TINY_DNN_CPP_PATH}/tiny-dnn-1.0.0a3")
--ocv_download(FILENAME "v1.0.0a3.tar.gz"
--               HASH "adb1c512e09ca2c7a6faef36f9c53e59"
--               URL
--                 "${OPENCV_TINY_DNN_URL}"
--                 "$ENV{OPENCV_TINY_DNN_URL}"
--                 "https://github.com/tiny-dnn/tiny-dnn/archive/"
--               DESTINATION_DIR "${TINY_DNN_CPP_PATH}"
--               STATUS TINY_DNN_DOWNLOAD_SUCCESS
--               ID "tiny-dnn"
--               UNPACK RELATIVE_URL)
--
--if(NOT TINY_DNN_DOWNLOAD_SUCCESS)
--  message(STATUS "Failed to download tiny-dnn sources")
--endif()
--
- find_package(TinyDNN QUIET)
- 
- include(CheckCXXCompilerFlag)

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
deleted file mode 100644
index c94f206ed4f..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-compilation-C-mode.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 549b5df22520b60b91dd77096434d79425b31ac2 Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Mon, 28 May 2018 18:07:23 +0300
-Subject: [PATCH] build: workaround issues with C compilation mode
-
-- cvdef.h + cvRound (double only)
-- highgui_c.h
----
- modules/core/include/opencv2/core/cvdef.h           | 8 +++++++-
- modules/highgui/include/opencv2/highgui/highgui_c.h | 2 ++
- 2 files changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h
-index a87ced09d78..4ab72b34cc1 100644
---- a/modules/core/include/opencv2/core/cvdef.h
-+++ b/modules/core/include/opencv2/core/cvdef.h
-@@ -480,7 +480,7 @@ Cv64suf;
- // Integer types portatibility
- #ifdef OPENCV_STDINT_HEADER
- #include OPENCV_STDINT_HEADER
--#else
-+#elif defined(__cplusplus)
- #if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */
- namespace cv {
- typedef signed char int8_t;
-@@ -517,9 +517,15 @@ typedef ::int64_t int64_t;
- typedef ::uint64_t uint64_t;
- }
- #endif
-+#else // pure C
-+#include <stdint.h>
- #endif
- 
- 
- //! @}
- 
-+#ifndef __cplusplus
-+#include "opencv2/core/fast_math.hpp" // define cvRound(double)
-+#endif
-+
- #endif // OPENCV_CORE_CVDEF_H
-diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h
-index 1eb414a76ca..35413139c79 100644
---- a/modules/highgui/include/opencv2/highgui/highgui_c.h
-+++ b/modules/highgui/include/opencv2/highgui/highgui_c.h
-@@ -135,8 +135,10 @@ CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOS
- CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value);
- CVAPI(double) cvGetWindowProperty(const char* name, int prop_id);
- 
-+#ifdef __cplusplus  // FIXIT remove in OpenCV 4.0
- /* Get window image rectangle coordinates, width and height */
- CVAPI(cv::Rect)cvGetWindowImageRect(const char* name);
-+#endif
- 
- /* display image within window (highgui windows remember their content) */
- CVAPI(void) cvShowImage( const char* name, const CvArr* image );

diff --git a/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch b/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch
deleted file mode 100644
index 813eb7e4ae6..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-fix-build-with-va.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 20f5fa8e3e880bc8b2e5156e9f25f7fb756ed8e4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
-Date: Wed, 28 Feb 2018 19:21:31 +0000
-Subject: [PATCH] Fix build with VA
-
-This commit readd ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES}
-that was missed in commit 2200e13c7193e0fe9db4b9f7c4bee3a7ef043909
-
-    diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
-    -    ocv_target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
-    +  ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
----
- samples/va_intel/CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/samples/va_intel/CMakeLists.txt b/samples/va_intel/CMakeLists.txt
-index af51dd32061..04f2ea5fd40 100644
---- a/samples/va_intel/CMakeLists.txt
-+++ b/samples/va_intel/CMakeLists.txt
-@@ -17,5 +17,5 @@ ocv_include_modules_recurse(${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
- file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
- foreach(sample_filename ${all_samples})
-   ocv_define_sample(tgt ${sample_filename} va_intel)
--  ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS})
-+  ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS} ${VA_LIBRARIES} ${VA_INTEL_LIBRARIES})
- endforeach()

diff --git a/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch b/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch
deleted file mode 100644
index f36d643cf73..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-fix-on-x86.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 7dc162cb4252ccf461f1c63650abde3c8807b79c Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Mon, 9 Apr 2018 18:25:51 +0300
-Subject: [PATCH] core: fix mm_pause() for non-SSE i386 builds
-
-replaced to safe binary compatible 'rep; nop' asm instruction
----
- modules/core/src/parallel_impl.cpp | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp
-index 78d9eb63694..bc64fce7a81 100644
---- a/modules/core/src/parallel_impl.cpp
-+++ b/modules/core/src/parallel_impl.cpp
-@@ -49,7 +49,11 @@ DECLARE_CV_YIELD
- DECLARE_CV_PAUSE
- #endif
- #ifndef CV_PAUSE
--#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
-+# if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
-+#   if !defined(__SSE__)
-+      static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); }
-+#     define _mm_pause cv_non_sse_mm_pause
-+#   endif
- #   define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0)
- # elif defined __GNUC__ && defined __aarch64__
- #   define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0)

diff --git a/media-libs/opencv/files/opencv-3.4.1-popcnt.patch b/media-libs/opencv/files/opencv-3.4.1-popcnt.patch
deleted file mode 100644
index 51a6d554a25..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-popcnt.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From a2d6fc7ac040c6ef94a36515f9ea24428f8f1ecc Mon Sep 17 00:00:00 2001
-From: Alexander Alekhin <alexander.alekhin@intel.com>
-Date: Tue, 24 Apr 2018 12:40:25 +0300
-Subject: [PATCH] cmake: fix popcnt detection
-
-via GCC/Clang __POPCNT__ define
----
- cmake/checks/cpu_popcnt.cpp | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/cmake/checks/cpu_popcnt.cpp b/cmake/checks/cpu_popcnt.cpp
-index 16e5575108b..44c7deda053 100644
---- a/cmake/checks/cpu_popcnt.cpp
-+++ b/cmake/checks/cpu_popcnt.cpp
-@@ -4,12 +4,14 @@
- #    define CV_POPCNT_U64 _mm_popcnt_u64
- #  endif
- #  define CV_POPCNT_U32 _mm_popcnt_u32
--#else
-+#elif defined(__POPCNT__)
- #  include <popcntintrin.h>
- #  if defined(__x86_64__)
- #    define CV_POPCNT_U64 __builtin_popcountll
- #  endif
- #  define CV_POPCNT_U32 __builtin_popcount
-+#else
-+#  error "__POPCNT__ is not defined by compiler"
- #endif
- 
- int main()

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
deleted file mode 100644
index 248e5034a21..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-python-lib-suffix-hack.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/cmake/OpenCVDetectPython.cmake	2018-05-31 09:14:42.998873104 +0200
-+++ b/cmake/OpenCVDetectPython.cmake	2018-05-31 09:26:08.444914001 +0200
-@@ -140,8 +140,8 @@
-         else() #debian based assumed, install to the dist-packages.
-           set(_packages_path "python${_version_major_minor}/dist-packages")
-         endif()
--        if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${${packages_path}}")
--          set(_packages_path "lib${LIB_SUFFIX}/${_packages_path}")
-+        if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIBPY_SUFFIX}/${${packages_path}}")
-+          set(_packages_path "lib${LIBPY_SUFFIX}/${_packages_path}")
-         else()
-           set(_packages_path "lib/${_packages_path}")
-         endif()

diff --git a/media-libs/opencv/files/opencv-3.4.1-python37.patch b/media-libs/opencv/files/opencv-3.4.1-python37.patch
deleted file mode 100644
index 94d307b748c..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-python37.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -urN a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp
---- a/modules/python/src2/cv2.cpp	2018-02-23 11:38:33.000000000 +0300
-+++ b/modules/python/src2/cv2.cpp	2019-08-10 22:28:03.337071791 +0300
-@@ -886,7 +886,7 @@
-     (void)name;
-     if(!obj || obj == Py_None)
-         return true;
--    char* str = PyString_AsString(obj);
-+    const char* str = PyString_AsString(obj);
-     if(!str)
-         return false;
-     value = String(str);

diff --git a/media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch b/media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch
deleted file mode 100644
index 94b221ab9a8..00000000000
--- a/media-libs/opencv/files/opencv-3.4.1-remove-git-autodetect.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/CMakeLists.txt	2019-01-10 19:29:06.831367707 +0100
-+++ b/CMakeLists.txt	2019-01-10 19:30:11.125364384 +0100
-@@ -522,23 +522,23 @@
- # ----------------------------------------------------------------------------
- #  Autodetect if we are in a GIT repository
- # ----------------------------------------------------------------------------
--find_host_package(Git QUIET)
-+# find_host_package(Git QUIET)
- 
--if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
--  execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
--    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
--    OUTPUT_VARIABLE OPENCV_VCSVERSION
--    RESULT_VARIABLE GIT_RESULT
--    ERROR_QUIET
--    OUTPUT_STRIP_TRAILING_WHITESPACE
--  )
--  if(NOT GIT_RESULT EQUAL 0)
--    set(OPENCV_VCSVERSION "unknown")
--  endif()
--elseif(NOT DEFINED OPENCV_VCSVERSION)
--  # We don't have git:
--  set(OPENCV_VCSVERSION "unknown")
--endif()
-+# if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
-+#  execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
-+#    WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
-+#    OUTPUT_VARIABLE OPENCV_VCSVERSION
-+#    RESULT_VARIABLE GIT_RESULT
-+#    ERROR_QUIET
-+#    OUTPUT_STRIP_TRAILING_WHITESPACE
-+#  )
-+#  if(NOT GIT_RESULT EQUAL 0)
-+#    set(OPENCV_VCSVERSION "unknown")
-+#  endif()
-+# elseif(NOT DEFINED OPENCV_VCSVERSION)
-+#  # We don't have git:
-+# set(OPENCV_VCSVERSION "unknown")
-+#endif()
- 
- 
- # ----------------------------------------------------------------------------

diff --git a/media-libs/opencv/opencv-3.4.1-r7.ebuild b/media-libs/opencv/opencv-3.4.1-r7.ebuild
deleted file mode 100644
index 76c7ada5db8..00000000000
--- a/media-libs/opencv/opencv-3.4.1-r7.ebuild
+++ /dev/null
@@ -1,501 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{6,7} )
-
-: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
-inherit java-pkg-opt-2 java-ant-2 python-r1 toolchain-funcs 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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? (
-			https://github.com/tiny-dnn/tiny-dnn/archive/v${TINY_DNN_PV}.tar.gz -> tiny-dnn-${TINY_DNN_PV}.tar.gz
-			https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz
-		)
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="BSD"
-SLOT="0/3.4.1" # subslot = libopencv* soname version
-KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 x86 ~amd64-linux"
-IUSE="contrib contribcvv contribdnn contribhdf contribsfm contribxfeatures2d cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_ssse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_popcnt cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cuda debug dnnsamples +eigen examples ffmpeg gdal gflags glog gphoto2 gstreamer gtk ieee1394 jpeg lapack opencl openexr opengl openmp pch png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-REQUIRED_USE="
-	cuda? ( tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribhdf? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( 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= )
-	contribhdf? ( sci-libs/hdf5 )
-	ffmpeg? ( 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}]
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0[${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
-	eigen? ( dev-cpp/eigen:3 )
-	java?  ( >=virtual/jdk-1.6 )
-	vaapi?  ( x11-libs/libva )"
-
-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.4.0-disable-download.patch"
-	"${FILESDIR}/${P}-compilation-C-mode.patch" # https://bugs.gentoo.org/656530
-	"${FILESDIR}/${P}-python-lib-suffix-hack.patch"
-	"${FILESDIR}/${P}-cuda-add-relaxed-constexpr.patch"
-	"${FILESDIR}/${P}-remove-git-autodetect.patch"
-	"${FILESDIR}/${P}-fix-build-with-va.patch" # bug https://bugs.gentoo.org/656576
-	"${FILESDIR}/${P}-popcnt.patch" # https://bugs.gentoo.org/633900
-	"${FILESDIR}/${P}-fix-on-x86.patch" # https://bugs.gentoo.org/682104
-	"${FILESDIR}/${P}-python37.patch" # https://bugs.gentoo.org/691480
-)
-
-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 dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		eapply "${FILESDIR}/${PN}-3.3.0-remove-tiny-dnn-autodownload.patch"
-
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	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
-	# ===================================================
-		-DENABLE_DOWNLOAD=OFF
-		-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=OFF
-		-DWITH_JASPER=OFF
-		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_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 uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# 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=
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_DISPATCH=
-		-DENABLE_SSE=$(usex cpu_flags_x86_sse)
-		-DENABLE_SSE2=$(usex cpu_flags_x86_sse2)
-		-DENABLE_SSE3=$(usex cpu_flags_x86_sse3)
-		-DENABLE_SSSE3=$(usex cpu_flags_x86_ssse3)
-		-DENABLE_SSE41=$(usex cpu_flags_x86_sse4_1)
-		-DENABLE_SSE42=$(usex cpu_flags_x86_sse4_2)
-		-DENABLE_POPCNT=$(usex cpu_flags_x86_popcnt)
-		-DENABLE_AVX=$(usex cpu_flags_x86_avx)
-		-DENABLE_AVX2=$(usex cpu_flags_x86_avx2)
-		-DENABLE_FMA3=$(usex cpu_flags_x86_fma3)
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm 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
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR=${orig_BUILD_DIR}
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=python
-		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
-		-DLIBPY_SUFFIX=64
-	)
-
-	# 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
-}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2020-11-03  7:18 Sam James
  0 siblings, 0 replies; 27+ messages in thread
From: Sam James @ 2020-11-03  7:18 UTC (permalink / raw
  To: gentoo-commits

commit:     c92eaa6a7d93400503334e9c65df2b8e400ab90f
Author:     Ross Charles Campbell <rossbridger.cc <AT> gmail <DOT> com>
AuthorDate: Sun Oct 18 14:59:46 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov  3 07:18:26 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c92eaa6a

media-libs/opencv: various fixes

 - Explicitly depends on virtual/lapacke to prevent its cmake build scripts from
implicitly disabling lapack support when it can't find lapacke.h.

 - Link with cblas when sci-libs/lapack is supplimented as the default lapack
implementation.

 - examples USE requires contribdnn USE to be enabled to prevent build failure.

Closes: https://bugs.gentoo.org/700176
Closes: https://bugs.gentoo.org/749681
Closes: https://bugs.gentoo.org/717812
Closes: https://bugs.gentoo.org/701790
Closes: https://bugs.gentoo.org/704518
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Ross Charles Campbell <rossbridger.cc <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/17964
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../opencv-4.5.0-link-with-cblas-for-lapack.patch      | 18 ++++++++++++++++++
 media-libs/opencv/opencv-4.5.0.ebuild                  |  8 +++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/media-libs/opencv/files/opencv-4.5.0-link-with-cblas-for-lapack.patch b/media-libs/opencv/files/opencv-4.5.0-link-with-cblas-for-lapack.patch
new file mode 100644
index 00000000000..acee677052d
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.5.0-link-with-cblas-for-lapack.patch
@@ -0,0 +1,18 @@
+diff --git a/cmake/OpenCVFindLAPACK.cmake b/cmake/OpenCVFindLAPACK.cmake
+index 342bebc..9ebd206 100644
+--- a/cmake/OpenCVFindLAPACK.cmake
++++ b/cmake/OpenCVFindLAPACK.cmake
+@@ -136,10 +136,12 @@ if(WITH_LAPACK)
+         ocv_lapack_check()
+       endif()
+       if(NOT HAVE_LAPACK)
+-        if(LAPACKE_INCLUDE_DIR)
++        find_package(CBLAS)
++        if(LAPACKE_INCLUDE_DIR AND CBLAS_FOUND)
+           set(LAPACK_INCLUDE_DIR  ${LAPACKE_INCLUDE_DIR})
+           set(LAPACK_CBLAS_H      "cblas.h")
+           set(LAPACK_LAPACKE_H    "lapacke.h")
++          set(LAPACK_LIBRARIES    ${LAPACK_LIBRARIES} ${CBLAS_LIBRARIES})
+           set(LAPACK_IMPL         "LAPACK/Generic")
+           ocv_lapack_check()
+         elseif(APPLE)

diff --git a/media-libs/opencv/opencv-4.5.0.ebuild b/media-libs/opencv/opencv-4.5.0.ebuild
index 54bb9292356..21f4784aa91 100644
--- a/media-libs/opencv/opencv-4.5.0.ebuild
+++ b/media-libs/opencv/opencv-4.5.0.ebuild
@@ -70,6 +70,7 @@ REQUIRED_USE="
 	contribovis? ( contrib )
 	contribsfm? ( contrib eigen gflags glog )
 	contribxfeatures2d? ( contrib download )
+	examples? ( contribdnn )
 	java? ( python )
 	opengl? ( qt5 )
 	python? ( ${PYTHON_REQUIRED_USE} )
@@ -111,7 +112,11 @@ RDEPEND="
 	java? ( >=virtual/jre-1.6:* )
 	jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
 	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
-	lapack? ( virtual/lapack )
+	lapack? (
+		virtual/cblas
+		virtual/lapack
+		virtual/lapacke
+	)
 	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
 	openexr? ( media-libs/openexr[${MULTILIB_USEDEP}] )
 	opengl? (
@@ -274,6 +279,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
 	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
 	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
+	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2021-05-31 20:53 Michał Górny
  0 siblings, 0 replies; 27+ messages in thread
From: Michał Górny @ 2021-05-31 20:53 UTC (permalink / raw
  To: gentoo-commits

commit:     a4e93c7f16e365035d6c40dec0d1db9ff050caaa
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon May 31 20:48:17 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May 31 20:53:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4e93c7f

media-libs/opencv: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 media-libs/opencv/Manifest                         |   2 -
 media-libs/opencv/files/opencv-3.0.0-gles.patch    |  14 -
 .../files/opencv-4.1.2-pkg-config-file.patch       |  11 -
 media-libs/opencv/opencv-4.1.2-r3.ebuild           | 498 ---------------------
 4 files changed, 525 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 20748a1ff12..d09b3e97e0c 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,7 +1,5 @@
 DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
 DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
-DIST opencv-4.1.2.tar.gz 87468598 BLAKE2B 9e0fbd8499f783cd1a2b5ffddf557aef424b0a446f71f826522ffd4526d04742e0c408b99810fe6b39753d40c475922d2e273732fdc0a0b4ee0bc56052a7a26c SHA512 d18d2cc35dc1c95c8870d35feb14459db27ebf6d09ff89a185918b1faff1b36dedacc18f268a6483570c404aca19b83ba627ce7af2265af7195a029cb766c09f
-DIST opencv-4.1.2_contrib.tar.gz 60881937 BLAKE2B c461aaa62306b226bde9211e2d611dcf705510e32c8598458737eb09c510cfdb49c33e11f1a7c591090d8243590e915b779fdb55955550fe44dab7545e4cc308 SHA512 1e14f94f9228c5d6a598493eed265aab1d8a740d5bfa00639afb05287732220eb71f88bb374de47dcd440f4376486f9db0e8b338e90e5dc4f6af8d355340b622
 DIST opencv-4.4.0_extdep.tar.gz 65334871 BLAKE2B 89fa0083da428e986bb4287295bdbff626d0f84866377413649c1d7ca77338288141f22d2a3c0b64d6d0fc1db98f918c8b33a665274cee4c4aefb44359e4333d SHA512 7b758099ce4abef151051e3e9e1e45b73e4054669d3aa53051e4d4c5f43d9373c9bda5ecbce51f6b024562cb566bd1117505af29ab5f3c36a493f185111a3b4e
 DIST opencv-4.5.0.tar.gz 90116240 BLAKE2B bcd6ccc4ff0cb1b66923c17c9d9e4ced711527b5d92abd2a5330f791fb07ff93dafa7a3f3095e6d96cb6cea877ac170bb2533f563fa843f284501019263daff3 SHA512 c34100f3f3fe45f2115975350d23288a3badb32864ba0cbd32512387416d1cf10d16d3ef5f3d089d6a1c2be587d788d33997513fc015dbf7d774a622f2d3811f
 DIST opencv-4.5.0_contrib.tar.gz 60115063 BLAKE2B 4068905c9f5f308f30f15ad383ae459cbb421d1871344c3548a6c11647ac9da7af8c46798e860bdd1fcbacccda0fb03f6c1cf07b458ddfa5a0c311511627af52 SHA512 b2ae72e920c78472fd677281b8dd6f25872399d8ade97b0d3b0fc50bbabea8c00ea849d87bfb311ac148cef663481d0c89c0f6875578c052c1cc7ddcd70e6e17

diff --git a/media-libs/opencv/files/opencv-3.0.0-gles.patch b/media-libs/opencv/files/opencv-3.0.0-gles.patch
deleted file mode 100644
index a2629d928e8..00000000000
--- a/media-libs/opencv/files/opencv-3.0.0-gles.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: opencv-2.4.11/modules/highgui/src/window_QT.cpp
-===================================================================
---- opencv-2.4.11.orig/modules/highgui/src/window_QT.cpp
-+++ opencv-2.4.11/modules/highgui/src/window_QT.cpp
-@@ -3118,7 +3118,9 @@ void OpenGlViewPort::updateGl()
- 
- void OpenGlViewPort::initializeGL()
- {
-+#ifdef GL_PERSPECTIVE_CORRECTION_HINT
-     glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-+#endif
- }
- 
- void OpenGlViewPort::resizeGL(int w, int h)

diff --git a/media-libs/opencv/files/opencv-4.1.2-pkg-config-file.patch b/media-libs/opencv/files/opencv-4.1.2-pkg-config-file.patch
deleted file mode 100644
index 496216186af..00000000000
--- a/media-libs/opencv/files/opencv-4.1.2-pkg-config-file.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/cmake/templates/opencv-XXX.pc.in	2019-12-04 21:28:09.686525699 +0100
-+++ b/cmake/templates/opencv-XXX.pc.in	2019-12-04 21:29:21.319265154 +0100
-@@ -3,7 +3,7 @@
- prefix=@prefix@
- exec_prefix=@exec_prefix@
- libdir=@libdir@
--includedir_old=@includedir@/opencv
-+includedir_old=@includedir@/opencv2
- includedir_new=@includedir@
- 
- Name: OpenCV

diff --git a/media-libs/opencv/opencv-4.1.2-r3.ebuild b/media-libs/opencv/opencv-4.1.2-r3.ebuild
deleted file mode 100644
index de4bb53e8da..00000000000
--- a/media-libs/opencv/opencv-4.1.2-r3.ebuild
+++ /dev/null
@@ -1,498 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_7 )
-
-inherit java-pkg-opt-2 java-ant-2 python-r1 toolchain-funcs 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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="BSD"
-SLOT="0/4.1.2" # subslot = libopencv* soname version
-KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 x86 ~amd64-linux"
-IUSE="contrib contribcvv contribdnn contribhdf contribsfm contribxfeatures2d cpu_flags_x86_sse cpu_flags_x86_sse2 cpu_flags_x86_sse3 cpu_flags_x86_ssse3 cpu_flags_x86_sse4_1 cpu_flags_x86_sse4_2 cpu_flags_x86_popcnt cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_fma3 cuda debug dnnsamples -download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack opencl openexr opengl openmp opencvapps pch png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-REQUIRED_USE="
-	cuda? ( tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribhdf? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( contrib download )
-	java? ( python )
-	opengl? ( qt5 )
-	python? ( ${PYTHON_REQUIRED_USE} )
-	tesseract? ( contrib )
-	?? ( gtk3 qt5 )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-#	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= )
-	contribhdf? ( sci-libs/hdf5:= )
-	ffmpeg? ( 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}]
-	)
-	gtk3? (
-		dev-libs/glib:2[${MULTILIB_USEDEP}]
-		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
-	)
-	ieee1394? (
-		media-libs/libdc1394[${MULTILIB_USEDEP}]
-		sys-libs/libraw1394[${MULTILIB_USEDEP}]
-	)
-	java? ( >=virtual/jre-1.6:* )
-	jpeg? ( virtual/jpeg:0[${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}
-	eigen? ( dev-cpp/eigen:3 )
-	java? ( >=virtual/jdk-1.6 )
-	vaapi? ( x11-libs/libva )"
-BDEPEND="
-	java? ( >=virtual/jdk-1.6 )
-	virtual/pkgconfig"
-
-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
-	# [opencv4]
-	/usr/include/opencv4/opencv2/core/cv_cpu_dispatch.h
-	/usr/include/opencv4/opencv2/core/cvdef.h
-	/usr/include/opencv4/opencv2/dnn.hpp
-	/usr/include/opencv4/opencv2/core/cuda/transform.hpp
-	/usr/include/opencv4/opencv2/core/opencl/runtime/opencl_core.hpp
-	/usr/include/opencv4/opencv2/cvconfig.h
-	/usr/include/opencv4/opencv2/core/utils/allocator_stats.impl.hpp
-	/usr/include/opencv4/opencv2/video/tracking.hpp
-	/usr/include/opencv4/opencv2/objdetect.hpp
-)
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.0.0-gles.patch
-	"${FILESDIR}"/${PN}-3.4.0-disable-download.patch
-	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
-	"${FILESDIR}"/${P}-pkg-config-file.patch
-	"${FILESDIR}"/${P}-opencl-license.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 dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	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
-	# ===================================================
-		-DENABLE_DOWNLOAD=$(usex download)
-		-DWITH_QUIRC=OFF # Do not have dependencies
-		-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 gtk3)
-		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
-		-DWITH_IPP=OFF
-		-DWITH_JASPER=OFF
-		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
-		-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=OFF
-	#	-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
-		-DOPENCV_GENERATE_PKGCONFIG=ON
-		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# 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=
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_BASELINE=$(printf "%s," "${cpu_flags[@]}")
-		-DCPU_DISPATCH=
-		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm 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
-		-DBUILD_opencv_python2=OFF
-		-DBUILD_opencv_python3=OFF
-	)
-
-	cmake-utils_src_configure
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR=${orig_BUILD_DIR}
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=python
-		-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"
-
-	python_optimize "${D}"/$(python_get_sitedir)
-}
-
-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
-}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2022-04-19  5:50 Matt Turner
  0 siblings, 0 replies; 27+ messages in thread
From: Matt Turner @ 2022-04-19  5:50 UTC (permalink / raw
  To: gentoo-commits

commit:     db31e728d75e3ea0f74c259846c1786856c4a5e4
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 19 05:49:33 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Apr 19 05:49:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db31e728

media-libs/opencv: Drop old versions

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 media-libs/opencv/Manifest                         |   4 -
 .../opencv/files/opencv-4.5.2-lapack-3.10.patch    | 123 -----
 media-libs/opencv/opencv-4.5.2-r3.ebuild           | 573 --------------------
 media-libs/opencv/opencv-4.5.2-r5.ebuild           | 574 --------------------
 media-libs/opencv/opencv-4.5.4.ebuild              | 585 ---------------------
 media-libs/opencv/opencv-4.5.5.ebuild              | 583 --------------------
 6 files changed, 2442 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 4d32599e1140..cf43ea8cfd9e 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,10 +1,6 @@
 DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
 DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
 DIST opencv-4.4.0_extdep.tar.gz 65334871 BLAKE2B 89fa0083da428e986bb4287295bdbff626d0f84866377413649c1d7ca77338288141f22d2a3c0b64d6d0fc1db98f918c8b33a665274cee4c4aefb44359e4333d SHA512 7b758099ce4abef151051e3e9e1e45b73e4054669d3aa53051e4d4c5f43d9373c9bda5ecbce51f6b024562cb566bd1117505af29ab5f3c36a493f185111a3b4e
-DIST opencv-4.5.2.tar.gz 88925795 BLAKE2B 625d3e1d98d4438ebfa165e595fc661658ae1f218d3c50c0b8dfedf936019093c1e61ead86b19c643205f0d77e40c69ea15c3d95454129a23a2c4e17885b65f3 SHA512 07788ec49801bdab963a057871e81fc2b081149c75764810197766d987e54db0d6fd142d2397bbbacefcea6a8be100235ea886ee7e5d5c07ed1156e76249dfec
-DIST opencv-4.5.2_contrib.tar.gz 60800680 BLAKE2B d96b3c440090d3ab26f99a3822d1d85581e370dc0fde7cf3a0ff89e79cd598942be7d9bc9f892510f2d66474ceb59c645483a94131ccbbe09f1cf4eeaaa44879 SHA512 72ce91dfefc1c3e12cc8e965d90392cfed6c236daafb512aafc14cdad83242bfa0fc1adea308cd07a5483e010633e2996c3b239b2ce12cea47e6e21c36ed398b
-DIST opencv-4.5.4.tar.gz 89724634 BLAKE2B 76ce5ab8182c87e5f9e18faf62f2ee0eb629e4997877c59aa0f6ac334c27d737cf5205f4b85f64cabfdd587a57096fa3241ae6e48cebbd963ec8ad3ebe07ad35 SHA512 39a7af95bc30d427c6df5e5d481469ab1ceea7878a93ae5c119991333e877a88d0a644e17dc6bd316e64b2840e48411a97f1b2397a8000719c5cec32751fa954
-DIST opencv-4.5.4_contrib.tar.gz 61054226 BLAKE2B c553bfc6fd1b5fd17f562b27248ddd4bd946089cd8cce346f152b47d4a8a22faa35ceb9bd501c31901189b884d782fbfec1dc041d69e1b8cc0ac0d5d079e610e SHA512 a48d4b5d764170814d9027fdf50f61bb4a24f0b5a547dded79d06b948f86443f14734efc7bbb708b3870781cafc6bc9e3092d35dac34a81da2bf1740d5f93ff9
 DIST opencv-4.5.5.tar.gz 89879893 BLAKE2B 6f2ce34b33132ad544d661417f730e17aedfbe17a22048ad0b8d287970626756c51309410d0fb5bf487af773ff4415d36b6768158ebc3cb963b37bb888ee4ba6 SHA512 4d1783fd78425cc43bb2153446dd634cedd366a49592bccc0c538a40aa161fcf67db8f1b6b68f1ce0b4a93504b3f06f65931709277afb1a1ee9fe963094bca02
 DIST opencv-4.5.5_contrib.tar.gz 60563220 BLAKE2B 4a020824688e379f1d127fb834b0008b3cbf78acea4847cb4994e9e0b6ddfeec3f06867967b8546725cf050c1fd0df042a18caff80463ad101cf14dc66daea9a SHA512 8469de524e8e6f4c50a74b8cbec5e4cfc48a63a6dfc787609696099eca40dc02b9dc7a347a014d4416fd4efd66955d3af5f4847f44612312a8362f453e6c2e35
 DIST vgg_boostdesc-3.2.0.tar.gz 1867770 BLAKE2B 1fa5b58e73b6fa56ecf8d19af22298f729942ee1369082e173445d09d3de767bf844bad3d2b462efc1199c392f37c88ba49a9996ba8bfd84b4abeba7de94db63 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44

diff --git a/media-libs/opencv/files/opencv-4.5.2-lapack-3.10.patch b/media-libs/opencv/files/opencv-4.5.2-lapack-3.10.patch
deleted file mode 100644
index 31e2fc60d121..000000000000
--- a/media-libs/opencv/files/opencv-4.5.2-lapack-3.10.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-https://bugs.gentoo.org/800539
-
---- a/modules/core/src/hal_internal.cpp
-+++ b/modules/core/src/hal_internal.cpp
-@@ -163,9 +163,9 @@
-         if(n == 1 && b_step == sizeof(fptype))
-         {
-             if(typeid(fptype) == typeid(float))
--                sposv_(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus);
-+                LAPACK_sposv_(L, &m, &n, (float*)a, &lda, (float*)b, &m, &lapackStatus);
-             else if(typeid(fptype) == typeid(double))
--                dposv_(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus);
-+                LAPACK_dposv_(L, &m, &n, (double*)a, &lda, (double*)b, &m, &lapackStatus);
-         }
-         else
-         {
-@@ -174,9 +174,9 @@
-             transpose(b, ldb, tmpB, m, m, n);
- 
-             if(typeid(fptype) == typeid(float))
--                sposv_(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus);
-+                LAPACK_sposv_(L, &m, &n, (float*)a, &lda, (float*)tmpB, &m, &lapackStatus);
-             else if(typeid(fptype) == typeid(double))
--                dposv_(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus);
-+                LAPACK_dposv_(L, &m, &n, (double*)a, &lda, (double*)tmpB, &m, &lapackStatus);
- 
-             transpose(tmpB, m, b, ldb, n, m);
-             delete[] tmpB;
-@@ -185,9 +185,9 @@
-     else
-     {
-         if(typeid(fptype) == typeid(float))
--            spotrf_(L, &m, (float*)a, &lda, &lapackStatus);
-+            LAPACK_spotrf_(L, &m, (float*)a, &lda, &lapackStatus);
-         else if(typeid(fptype) == typeid(double))
--            dpotrf_(L, &m, (double*)a, &lda, &lapackStatus);
-+            LAPACK_dpotrf_(L, &m, (double*)a, &lda, &lapackStatus);
-     }
- 
-     if(lapackStatus == 0) *info = true;
-@@ -227,17 +227,17 @@
-     }
- 
-     if(typeid(fptype) == typeid(float))
--        sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info);
-+        LAPACK_sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)&work1, &lwork, iworkBuf, info);
-     else if(typeid(fptype) == typeid(double))
--        dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)&work1, &lwork, iworkBuf, info);
-+        LAPACK_dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)&work1, &lwork, iworkBuf, info);
- 
-     lwork = (int)round(work1); //optimal buffer size
-     fptype* buffer = new fptype[lwork + 1];
- 
-     if(typeid(fptype) == typeid(float))
--        sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info);
-+        LAPACK_sgesdd_(mode, &m, &n, (float*)a, &lda, (float*)w, (float*)u, &ldu, (float*)vt, &ldv, (float*)buffer, &lwork, iworkBuf, info);
-     else if(typeid(fptype) == typeid(double))
--        dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)buffer, &lwork, iworkBuf, info);
-+        LAPACK_dgesdd_(mode, &m, &n, (double*)a, &lda, (double*)w, (double*)u, &ldu, (double*)vt, &ldv, (double*)buffer, &lwork, iworkBuf, info);
- 
-     if(!(flags & CV_HAL_SVD_NO_UV))
-         transpose_square_inplace(vt, ldv, n);
-@@ -288,18 +288,18 @@
-         if (k == 1 && b_step == sizeof(fptype))
-         {
-             if (typeid(fptype) == typeid(float))
--                sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)&work1, &lwork, info);
-+                LAPACK_sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)&work1, &lwork, info);
-             else if (typeid(fptype) == typeid(double))
--                dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info);
-+                LAPACK_dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)&work1, &lwork, info);
- 
-             lwork = cvRound(work1); //optimal buffer size
-             std::vector<fptype> workBufMemHolder(lwork + 1);
-             fptype* buffer = &workBufMemHolder.front();
- 
-             if (typeid(fptype) == typeid(float))
--                sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)buffer, &lwork, info);
-+                LAPACK_sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)b, &m, (float*)buffer, &lwork, info);
-             else if (typeid(fptype) == typeid(double))
--                dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info);
-+                LAPACK_dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)b, &m, (double*)buffer, &lwork, info);
-         }
-         else
-         {
-@@ -309,18 +309,18 @@
-             transpose(b, ldb, tmpB, m, m, k);
- 
-             if (typeid(fptype) == typeid(float))
--                sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)&work1, &lwork, info);
-+                LAPACK_sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)&work1, &lwork, info);
-             else if (typeid(fptype) == typeid(double))
--                dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info);
-+                LAPACK_dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)&work1, &lwork, info);
- 
-             lwork = cvRound(work1); //optimal buffer size
-             std::vector<fptype> workBufMemHolder(lwork + 1);
-             fptype* buffer = &workBufMemHolder.front();
- 
-             if (typeid(fptype) == typeid(float))
--                sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)buffer, &lwork, info);
-+                LAPACK_sgels_(mode, &m, &n, &k, (float*)tmpA, &ldtmpA, (float*)tmpB, &m, (float*)buffer, &lwork, info);
-             else if (typeid(fptype) == typeid(double))
--                dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info);
-+                LAPACK_dgels_(mode, &m, &n, &k, (double*)tmpA, &ldtmpA, (double*)tmpB, &m, (double*)buffer, &lwork, info);
- 
-             transpose(tmpB, m, b, ldb, k, m);
-         }
---- a/cmake/checks/lapack_check.cpp
-+++ b/cmake/checks/lapack_check.cpp
-@@ -2,9 +2,9 @@
- #include "opencv_lapack.h"
- 
- static char* check_fn1 = (char*)sgesv_;
--static char* check_fn2 = (char*)sposv_;
--static char* check_fn3 = (char*)spotrf_;
--static char* check_fn4 = (char*)sgesdd_;
-+static char* check_fn2 = (char*)LAPACK_sposv_;
-+static char* check_fn3 = (char*)LAPACK_spotrf_;
-+static char* check_fn4 = (char*)LAPACK_sgesdd_;
- 
- int main(int argc, char* argv[])
- {

diff --git a/media-libs/opencv/opencv-4.5.2-r3.ebuild b/media-libs/opencv/opencv-4.5.2-r3.ebuild
deleted file mode 100644
index 9b3f36c342d0..000000000000
--- a/media-libs/opencv/opencv-4.5.2-r3.ebuild
+++ /dev/null
@@ -1,573 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9} )
-CMAKE_ECLASS=cmake
-inherit flag-o-matic java-pkg-opt-2 java-ant-2 cmake-multilib python-r1 toolchain-funcs
-
-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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	download? ( https://github.com/rossbridger/opencv-extdep/archive/4.4.0.tar.gz -> ${PN}-4.4.0_extdep.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="Apache-2.0"
-SLOT="0/${PV}" # subslot = libopencv* soname version
-KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 ~riscv x86"
-IUSE="contrib contribcvv contribdnn contribfreetype contribhdf contribovis contribsfm contribxfeatures2d cuda debug dnnsamples download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack lto opencl openexr opengl openmp opencvapps png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-
-# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications
-ARM_CPU_FEATURES=(
-	cpu_flags_arm_neon:NEON
-	cpu_flags_arm_vfpv3:VFPV3
-)
-PPC_CPU_FEATURES=(
-	cpu_flags_ppc_vsx:VSX
-	cpu_flags_ppc_vsx3:VSX3
-)
-X86_CPU_FEATURES_RAW=(
-	avx:AVX
-	avx2:AVX2
-	avx512f:AVX_512F
-	f16c:FP16
-	fma3:FMA3
-	popcnt:POPCNT
-	sse:SSE
-	sse2:SSE2
-	sse3:SSE3
-	ssse3:SSSE3
-	sse4_1:SSE4_1
-	sse4_2:SSE4_2
-)
-X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
-CPU_FEATURES_MAP=(
-	${ARM_CPU_FEATURES[@]}
-	${PPC_CPU_FEATURES[@]}
-	${X86_CPU_FEATURES[@]}
-)
-IUSE="${IUSE} ${CPU_FEATURES_MAP[@]%:*}"
-
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-# cuda needs contrib, bug #701712
-REQUIRED_USE="
-	cpu_flags_x86_avx2? ( cpu_flags_x86_f16c )
-	cpu_flags_x86_f16c? ( cpu_flags_x86_avx )
-	cuda? ( contrib
-		tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribfreetype? ( contrib )
-	contribhdf? ( contrib )
-	contribovis? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( contrib download )
-	examples? ( contribdnn )
-	java? ( python )
-	opengl? ( qt5 )
-	python? ( ${PYTHON_REQUIRED_USE} )
-	tesseract? ( contrib )
-	?? ( gtk3 qt5 )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2[${MULTILIB_USEDEP}]
-	<dev-libs/protobuf-3.19:=[${MULTILIB_USEDEP}]
-	sys-libs/zlib[${MULTILIB_USEDEP}]
-	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
-	contribhdf? ( sci-libs/hdf5:= )
-	contribfreetype? (
-		media-libs/freetype:2[${MULTILIB_USEDEP}]
-		media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
-	)
-	contribovis? ( dev-games/ogre:0/1.12 )
-	ffmpeg? ( 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}]
-	)
-	gtk3? (
-		dev-libs/glib:2[${MULTILIB_USEDEP}]
-		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
-	)
-	ieee1394? (
-		media-libs/libdc1394:=[${MULTILIB_USEDEP}]
-		sys-libs/libraw1394[${MULTILIB_USEDEP}]
-	)
-	java? ( >=virtual/jre-1.8:* )
-	jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
-	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
-	lapack? (
-		virtual/cblas
-		virtual/lapack
-	)
-	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
-	openexr? ( <media-libs/openexr-3.0.0:0=[${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=,${MULTILIB_USEDEP}] )
-	threads? ( dev-cpp/tbb:=[${MULTILIB_USEDEP}] )
-	tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
-	v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
-	vaapi? ( x11-libs/libva[${MULTILIB_USEDEP}] )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
-	xine? ( media-libs/xine-lib )"
-# bug #747949 for eigen (eigen-3.3.8 was broken upstream)
-DEPEND="${RDEPEND}
-	eigen? (
-		|| (
-			>=dev-cpp/eigen-3.3.8-r1:3
-			<dev-cpp/eigen-3.3.8:3
-		)
-	)
-	java? ( >=virtual/jdk-1.8:* )"
-BDEPEND="virtual/pkgconfig"
-
-MULTILIB_WRAPPED_HEADERS=(
-	# [opencv4]
-	/usr/include/opencv4/opencv2/cvconfig.h
-	/usr/include/opencv4/opencv2/opencv_modules.hpp
-	# [cudev]
-	/usr/include/opencv4/opencv2/cudaarithm.hpp
-	/usr/include/opencv4/opencv2/cudabgsegm.hpp
-	/usr/include/opencv4/opencv2/cudacodec.hpp
-	/usr/include/opencv4/opencv2/cudafeatures2d.hpp
-	/usr/include/opencv4/opencv2/cudafilters.hpp
-	/usr/include/opencv4/opencv2/cudaimgproc.hpp
-	/usr/include/opencv4/opencv2/cudalegacy.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVHaarObjectDetection.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCV.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVPyramid.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NPP_staging.hpp
-	/usr/include/opencv4/opencv2/cudaobjdetect.hpp
-	/usr/include/opencv4/opencv2/cudaoptflow.hpp
-	/usr/include/opencv4/opencv2/cudastereo.hpp
-	/usr/include/opencv4/opencv2/cudawarping.hpp
-	/usr/include/opencv4/opencv2/cudev/block/block.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/block/dynamic_smem.hpp
-	/usr/include/opencv4/opencv2/cudev/block/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/block/vec_distance.hpp
-	/usr/include/opencv4/opencv2/cudev/common.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/color.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/expr.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/per_element_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/reduction.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/detail/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/functional.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/tuple_adapter.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/minmaxloc.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_down.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_up.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_column.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_row.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/pyramids.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce_to_vec.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/constant.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/detail/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/extrapolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/glob.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/interpolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/lut.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/mask.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/remap.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/resize.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/texture.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/traits.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/zip.hpp
-	/usr/include/opencv4/opencv2/cudev/util/atomic.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/limits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/saturate_cast.hpp
-	/usr/include/opencv4/opencv2/cudev/util/simd_functions.hpp
-	/usr/include/opencv4/opencv2/cudev/util/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_math.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/shuffle.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/warp.hpp
-	# [contrib_cvv]
-	/usr/include/opencv4/opencv2/cvv/call_meta_data.hpp
-	/usr/include/opencv4/opencv2/cvv/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/debug_mode.hpp
-	/usr/include/opencv4/opencv2/cvv/dmatch.hpp
-	/usr/include/opencv4/opencv2/cvv/filter.hpp
-	/usr/include/opencv4/opencv2/cvv/final_show.hpp
-	/usr/include/opencv4/opencv2/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/show_image.hpp
-	# [contrib_hdf]
-	/usr/include/opencv4/opencv2/hdf/hdf5.hpp
-	/usr/include/opencv4/opencv2/hdf.hpp
-	# [contrib_ovis]
-	/usr/include/opencv4/opencv2/ovis.hpp
-	# [vtk]
-	/usr/include/opencv4/opencv2/viz.hpp
-	/usr/include/opencv4/opencv2/viz/types.hpp
-	/usr/include/opencv4/opencv2/viz/viz3d.hpp
-	/usr/include/opencv4/opencv2/viz/vizcore.hpp
-	/usr/include/opencv4/opencv2/viz/widget_accessor.hpp
-	/usr/include/opencv4/opencv2/viz/widgets.hpp
-)
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.4.0-disable-download.patch
-	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
-	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
-	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
-	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.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() {
-	# https://bugs.gentoo.org/838274
-	replace-flags -O3 -O2
-
-	cmake_src_prepare
-
-	# remove bundled stuff
-	rm -r 3rdparty || die "Removing 3rd party components failed"
-	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
-		-i CMakeLists.txt cmake/*cmake || die
-
-	if use dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	fi
-
-	if use download; then
-		mv "${WORKDIR}/${PN}-extdep-4.4.0" "${WORKDIR}/${P}/.cache/" || 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
-	# ===================================================
-		-DENABLE_DOWNLOAD=$(usex download)
-		-DWITH_QUIRC=OFF # Do not have dependencies
-		-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 gtk3)
-		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
-		-DWITH_IPP=OFF
-		# Jasper was removed from tree because of security problems.
-		# Upstream were/are making progress. We use openjpeg instead.
-		# bug 734284
-		-DWITH_JASPER=OFF
-		-DWITH_JPEG=$(usex jpeg)
-		-DWITH_OPENJPEG=$(usex jpeg2k)
-		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
-		-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=OFF
-	#	-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
-		-DOPENCV_GENERATE_PKGCONFIG=ON
-		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_CCACHE=OFF
-		# bug 733796, but PCH is a risky game in CMake anyway
-		-DENABLE_PRECOMPILED_HEADERS=OFF
-		-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
-		-DENABLE_LTO=$(usex lto)
-	# ===================================================
-	# 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=
-		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
-	)
-
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-	local CPU_BASELINE=""
-	for i in "${CPU_FEATURES_MAP[@]}" ; do
-		if [[ ${ABI} != x86 || ${i%:*} != "cpu_flags_x86_avx2" ]]; then # workaround for Bug 747163
-			use ${i%:*} && CPU_BASELINE="${CPU_BASELINE}${i#*:};"
-		fi
-	done
-
-	GLOBALCMAKEARGS+=(
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_BASELINE=${CPU_BASELINE}
-		-DCPU_DISPATCH=
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm ON OFF)
-			-DBUILD_opencv_freetype=$(usex contribfreetype ON OFF)
-			-DBUILD_opencv_ovis=$(usex contribovis 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
-		-DBUILD_opencv_python2=OFF
-		-DBUILD_opencv_python3=OFF
-	)
-
-	cmake_src_configure
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR="${orig_BUILD_DIR}"
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=${EPYTHON}
-		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
-	)
-
-	# Regenerate cache file. Can't use rebuild_cache as it won't
-	# have the Gentoo specific options.
-	rm CMakeCache.txt || die "rm failed"
-	cmake_src_configure
-	cmake_src_compile
-	cmake_src_install
-
-	# Remove compiled binary so new version compiles
-	# Avoid conflicts with new module builds as build system doesn't
-	# really support it.
-	rm -r modules/python3 || die "rm failed"
-
-	python_optimize "${ED}"/$(python_get_sitedir)
-}
-
-multilib_src_install() {
-	cmake_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
-}

diff --git a/media-libs/opencv/opencv-4.5.2-r5.ebuild b/media-libs/opencv/opencv-4.5.2-r5.ebuild
deleted file mode 100644
index 2b66d2c57956..000000000000
--- a/media-libs/opencv/opencv-4.5.2-r5.ebuild
+++ /dev/null
@@ -1,574 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7,8,9,10} )
-CMAKE_ECLASS=cmake
-inherit flag-o-matic java-pkg-opt-2 java-ant-2 cmake-multilib python-r1 toolchain-funcs
-
-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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	download? ( https://github.com/rossbridger/opencv-extdep/archive/4.4.0.tar.gz -> ${PN}-4.4.0_extdep.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="Apache-2.0"
-SLOT="0/${PV}" # subslot = libopencv* soname version
-KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 ~riscv x86"
-IUSE="contrib contribcvv contribdnn contribfreetype contribhdf contribovis contribsfm contribxfeatures2d cuda debug dnnsamples download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack lto opencl openexr opengl openmp opencvapps png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-
-# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications
-ARM_CPU_FEATURES=(
-	cpu_flags_arm_neon:NEON
-	cpu_flags_arm_vfpv3:VFPV3
-)
-PPC_CPU_FEATURES=(
-	cpu_flags_ppc_vsx:VSX
-	cpu_flags_ppc_vsx3:VSX3
-)
-X86_CPU_FEATURES_RAW=(
-	avx:AVX
-	avx2:AVX2
-	avx512f:AVX_512F
-	f16c:FP16
-	fma3:FMA3
-	popcnt:POPCNT
-	sse:SSE
-	sse2:SSE2
-	sse3:SSE3
-	ssse3:SSSE3
-	sse4_1:SSE4_1
-	sse4_2:SSE4_2
-)
-X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
-CPU_FEATURES_MAP=(
-	${ARM_CPU_FEATURES[@]}
-	${PPC_CPU_FEATURES[@]}
-	${X86_CPU_FEATURES[@]}
-)
-IUSE="${IUSE} ${CPU_FEATURES_MAP[@]%:*}"
-
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-# cuda needs contrib, bug #701712
-REQUIRED_USE="
-	cpu_flags_x86_avx2? ( cpu_flags_x86_f16c )
-	cpu_flags_x86_f16c? ( cpu_flags_x86_avx )
-	cuda? ( contrib
-		tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribfreetype? ( contrib )
-	contribhdf? ( contrib )
-	contribovis? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( contrib download )
-	examples? ( contribdnn )
-	java? ( python )
-	opengl? ( qt5 )
-	python? ( ${PYTHON_REQUIRED_USE} )
-	tesseract? ( contrib )
-	?? ( gtk3 qt5 )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2[${MULTILIB_USEDEP}]
-	<dev-libs/protobuf-3.19:=[${MULTILIB_USEDEP}]
-	sys-libs/zlib[${MULTILIB_USEDEP}]
-	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
-	contribhdf? ( sci-libs/hdf5:= )
-	contribfreetype? (
-		media-libs/freetype:2[${MULTILIB_USEDEP}]
-		media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
-	)
-	contribovis? ( dev-games/ogre:0/1.12 )
-	ffmpeg? ( 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}]
-	)
-	gtk3? (
-		dev-libs/glib:2[${MULTILIB_USEDEP}]
-		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
-	)
-	ieee1394? (
-		media-libs/libdc1394:=[${MULTILIB_USEDEP}]
-		sys-libs/libraw1394[${MULTILIB_USEDEP}]
-	)
-	java? ( >=virtual/jre-1.8:* )
-	jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
-	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
-	lapack? (
-		virtual/cblas
-		>=virtual/lapack-3.10
-	)
-	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
-	openexr? ( <media-libs/openexr-3.0.0:0=[${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=,${MULTILIB_USEDEP}] )
-	threads? ( dev-cpp/tbb:=[${MULTILIB_USEDEP}] )
-	tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
-	v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
-	vaapi? ( x11-libs/libva[${MULTILIB_USEDEP}] )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
-	xine? ( media-libs/xine-lib )"
-# bug #747949 for eigen (eigen-3.3.8 was broken upstream)
-DEPEND="${RDEPEND}
-	eigen? (
-		|| (
-			>=dev-cpp/eigen-3.3.8-r1:3
-			<dev-cpp/eigen-3.3.8:3
-		)
-	)
-	java? ( >=virtual/jdk-1.8:* )"
-BDEPEND="virtual/pkgconfig"
-
-MULTILIB_WRAPPED_HEADERS=(
-	# [opencv4]
-	/usr/include/opencv4/opencv2/cvconfig.h
-	/usr/include/opencv4/opencv2/opencv_modules.hpp
-	# [cudev]
-	/usr/include/opencv4/opencv2/cudaarithm.hpp
-	/usr/include/opencv4/opencv2/cudabgsegm.hpp
-	/usr/include/opencv4/opencv2/cudacodec.hpp
-	/usr/include/opencv4/opencv2/cudafeatures2d.hpp
-	/usr/include/opencv4/opencv2/cudafilters.hpp
-	/usr/include/opencv4/opencv2/cudaimgproc.hpp
-	/usr/include/opencv4/opencv2/cudalegacy.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVHaarObjectDetection.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCV.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVPyramid.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NPP_staging.hpp
-	/usr/include/opencv4/opencv2/cudaobjdetect.hpp
-	/usr/include/opencv4/opencv2/cudaoptflow.hpp
-	/usr/include/opencv4/opencv2/cudastereo.hpp
-	/usr/include/opencv4/opencv2/cudawarping.hpp
-	/usr/include/opencv4/opencv2/cudev/block/block.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/block/dynamic_smem.hpp
-	/usr/include/opencv4/opencv2/cudev/block/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/block/vec_distance.hpp
-	/usr/include/opencv4/opencv2/cudev/common.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/color.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/expr.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/per_element_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/reduction.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/detail/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/functional.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/tuple_adapter.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/minmaxloc.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_down.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_up.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_column.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_row.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/pyramids.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce_to_vec.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/constant.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/detail/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/extrapolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/glob.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/interpolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/lut.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/mask.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/remap.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/resize.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/texture.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/traits.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/zip.hpp
-	/usr/include/opencv4/opencv2/cudev/util/atomic.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/limits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/saturate_cast.hpp
-	/usr/include/opencv4/opencv2/cudev/util/simd_functions.hpp
-	/usr/include/opencv4/opencv2/cudev/util/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_math.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/shuffle.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/warp.hpp
-	# [contrib_cvv]
-	/usr/include/opencv4/opencv2/cvv/call_meta_data.hpp
-	/usr/include/opencv4/opencv2/cvv/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/debug_mode.hpp
-	/usr/include/opencv4/opencv2/cvv/dmatch.hpp
-	/usr/include/opencv4/opencv2/cvv/filter.hpp
-	/usr/include/opencv4/opencv2/cvv/final_show.hpp
-	/usr/include/opencv4/opencv2/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/show_image.hpp
-	# [contrib_hdf]
-	/usr/include/opencv4/opencv2/hdf/hdf5.hpp
-	/usr/include/opencv4/opencv2/hdf.hpp
-	# [contrib_ovis]
-	/usr/include/opencv4/opencv2/ovis.hpp
-	# [vtk]
-	/usr/include/opencv4/opencv2/viz.hpp
-	/usr/include/opencv4/opencv2/viz/types.hpp
-	/usr/include/opencv4/opencv2/viz/viz3d.hpp
-	/usr/include/opencv4/opencv2/viz/vizcore.hpp
-	/usr/include/opencv4/opencv2/viz/widget_accessor.hpp
-	/usr/include/opencv4/opencv2/viz/widgets.hpp
-)
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.4.0-disable-download.patch
-	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
-	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
-	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
-	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
-	"${FILESDIR}"/${PN}-4.5.2-lapack-3.10.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() {
-	# https://bugs.gentoo.org/838274
-	replace-flags -O3 -O2
-
-	cmake_src_prepare
-
-	# remove bundled stuff
-	rm -r 3rdparty || die "Removing 3rd party components failed"
-	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
-		-i CMakeLists.txt cmake/*cmake || die
-
-	if use dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	fi
-
-	if use download; then
-		mv "${WORKDIR}/${PN}-extdep-4.4.0" "${WORKDIR}/${P}/.cache/" || 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
-	# ===================================================
-		-DENABLE_DOWNLOAD=$(usex download)
-		-DWITH_QUIRC=OFF # Do not have dependencies
-		-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 gtk3)
-		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
-		-DWITH_IPP=OFF
-		# Jasper was removed from tree because of security problems.
-		# Upstream were/are making progress. We use openjpeg instead.
-		# bug 734284
-		-DWITH_JASPER=OFF
-		-DWITH_JPEG=$(usex jpeg)
-		-DWITH_OPENJPEG=$(usex jpeg2k)
-		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
-		-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=OFF
-	#	-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
-		-DOPENCV_GENERATE_PKGCONFIG=ON
-		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_CCACHE=OFF
-		# bug 733796, but PCH is a risky game in CMake anyway
-		-DENABLE_PRECOMPILED_HEADERS=OFF
-		-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
-		-DENABLE_LTO=$(usex lto)
-	# ===================================================
-	# 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=
-		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
-	)
-
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-	local CPU_BASELINE=""
-	for i in "${CPU_FEATURES_MAP[@]}" ; do
-		if [[ ${ABI} != x86 || ${i%:*} != "cpu_flags_x86_avx2" ]]; then # workaround for Bug 747163
-			use ${i%:*} && CPU_BASELINE="${CPU_BASELINE}${i#*:};"
-		fi
-	done
-
-	GLOBALCMAKEARGS+=(
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_BASELINE=${CPU_BASELINE}
-		-DCPU_DISPATCH=
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm ON OFF)
-			-DBUILD_opencv_freetype=$(usex contribfreetype ON OFF)
-			-DBUILD_opencv_ovis=$(usex contribovis 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
-		-DBUILD_opencv_python2=OFF
-		-DBUILD_opencv_python3=OFF
-	)
-
-	cmake_src_configure
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR="${orig_BUILD_DIR}"
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=${EPYTHON}
-		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
-	)
-
-	# Regenerate cache file. Can't use rebuild_cache as it won't
-	# have the Gentoo specific options.
-	rm CMakeCache.txt || die "rm failed"
-	cmake_src_configure
-	cmake_src_compile
-	cmake_src_install
-
-	# Remove compiled binary so new version compiles
-	# Avoid conflicts with new module builds as build system doesn't
-	# really support it.
-	rm -r modules/python3 || die "rm failed"
-
-	python_optimize "${ED}"/$(python_get_sitedir)
-}
-
-multilib_src_install() {
-	cmake_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
-}

diff --git a/media-libs/opencv/opencv-4.5.4.ebuild b/media-libs/opencv/opencv-4.5.4.ebuild
deleted file mode 100644
index 24070fe0c2e4..000000000000
--- a/media-libs/opencv/opencv-4.5.4.ebuild
+++ /dev/null
@@ -1,585 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{8..10} )
-CMAKE_ECLASS=cmake
-inherit flag-o-matic java-pkg-opt-2 java-ant-2 cmake-multilib python-r1 toolchain-funcs
-
-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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	download? ( https://github.com/rossbridger/opencv-extdep/archive/4.4.0.tar.gz -> ${PN}-4.4.0_extdep.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="Apache-2.0"
-SLOT="0/${PV}" # subslot = libopencv* soname version
-KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 ~riscv x86"
-IUSE="contrib contribcvv contribdnn contribfreetype contribhdf contribovis contribsfm contribxfeatures2d cuda debug dnnsamples download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack lto opencl openexr opengl openmp opencvapps png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-
-# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications
-ARM_CPU_FEATURES=(
-	cpu_flags_arm_neon:NEON
-	cpu_flags_arm_vfpv3:VFPV3
-)
-PPC_CPU_FEATURES=(
-	cpu_flags_ppc_vsx:VSX
-	cpu_flags_ppc_vsx3:VSX3
-)
-X86_CPU_FEATURES_RAW=(
-	avx:AVX
-	avx2:AVX2
-	avx512f:AVX_512F
-	f16c:FP16
-	fma3:FMA3
-	popcnt:POPCNT
-	sse:SSE
-	sse2:SSE2
-	sse3:SSE3
-	ssse3:SSSE3
-	sse4_1:SSE4_1
-	sse4_2:SSE4_2
-)
-X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
-CPU_FEATURES_MAP=(
-	${ARM_CPU_FEATURES[@]}
-	${PPC_CPU_FEATURES[@]}
-	${X86_CPU_FEATURES[@]}
-)
-IUSE="${IUSE} ${CPU_FEATURES_MAP[@]%:*}"
-
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-# cuda needs contrib, bug #701712
-REQUIRED_USE="
-	cpu_flags_x86_avx2? ( cpu_flags_x86_f16c )
-	cpu_flags_x86_f16c? ( cpu_flags_x86_avx )
-	cuda? ( contrib
-		tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribfreetype? ( contrib )
-	contribhdf? ( contrib )
-	contribovis? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( contrib download )
-	examples? ( contribdnn )
-	java? ( python )
-	opengl? ( qt5 )
-	python? ( ${PYTHON_REQUIRED_USE} )
-	tesseract? ( contrib )
-	?? ( gtk3 qt5 )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-#	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= )
-	contribhdf? ( sci-libs/hdf5:= )
-	contribfreetype? (
-		media-libs/freetype:2[${MULTILIB_USEDEP}]
-		media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
-	)
-	contribovis? ( dev-games/ogre:0/1.12 )
-	ffmpeg? ( 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}]
-	)
-	gtk3? (
-		dev-libs/glib:2[${MULTILIB_USEDEP}]
-		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
-	)
-	ieee1394? (
-		media-libs/libdc1394:=[${MULTILIB_USEDEP}]
-		sys-libs/libraw1394[${MULTILIB_USEDEP}]
-	)
-	java? ( >=virtual/jre-1.8:* )
-	jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
-	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
-	lapack? (
-		virtual/cblas
-		>=virtual/lapack-3.10
-	)
-	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
-	openexr? ( <media-libs/openexr-3.0.0:0=[${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=,${MULTILIB_USEDEP}] )
-	threads? ( dev-cpp/tbb:=[${MULTILIB_USEDEP}] )
-	tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
-	v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
-	vaapi? ( x11-libs/libva[${MULTILIB_USEDEP}] )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
-	xine? ( media-libs/xine-lib )"
-# bug #747949 for eigen (eigen-3.3.8 was broken upstream)
-DEPEND="${RDEPEND}
-	eigen? (
-		|| (
-			>=dev-cpp/eigen-3.3.8-r1:3
-			<dev-cpp/eigen-3.3.8:3
-		)
-	)
-	java? ( >=virtual/jdk-1.8:* )"
-BDEPEND="virtual/pkgconfig"
-
-MULTILIB_WRAPPED_HEADERS=(
-	# [opencv4]
-	/usr/include/opencv4/opencv2/cvconfig.h
-	/usr/include/opencv4/opencv2/opencv_modules.hpp
-	# [cudev]
-	/usr/include/opencv4/opencv2/cudaarithm.hpp
-	/usr/include/opencv4/opencv2/cudabgsegm.hpp
-	/usr/include/opencv4/opencv2/cudacodec.hpp
-	/usr/include/opencv4/opencv2/cudafeatures2d.hpp
-	/usr/include/opencv4/opencv2/cudafilters.hpp
-	/usr/include/opencv4/opencv2/cudaimgproc.hpp
-	/usr/include/opencv4/opencv2/cudalegacy.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVHaarObjectDetection.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCV.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVPyramid.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NPP_staging.hpp
-	/usr/include/opencv4/opencv2/cudaobjdetect.hpp
-	/usr/include/opencv4/opencv2/cudaoptflow.hpp
-	/usr/include/opencv4/opencv2/cudastereo.hpp
-	/usr/include/opencv4/opencv2/cudawarping.hpp
-	/usr/include/opencv4/opencv2/cudev/block/block.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/block/dynamic_smem.hpp
-	/usr/include/opencv4/opencv2/cudev/block/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/block/vec_distance.hpp
-	/usr/include/opencv4/opencv2/cudev/common.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/color.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/expr.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/per_element_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/reduction.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/detail/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/functional.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/tuple_adapter.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/minmaxloc.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_down.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_up.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_column.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_row.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/pyramids.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce_to_vec.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/constant.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/detail/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/extrapolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/glob.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/interpolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/lut.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/mask.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/remap.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/resize.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/texture.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/traits.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/zip.hpp
-	/usr/include/opencv4/opencv2/cudev/util/atomic.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/limits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/saturate_cast.hpp
-	/usr/include/opencv4/opencv2/cudev/util/simd_functions.hpp
-	/usr/include/opencv4/opencv2/cudev/util/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_math.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/shuffle.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/warp.hpp
-	# [contrib_cvv]
-	/usr/include/opencv4/opencv2/cvv/call_meta_data.hpp
-	/usr/include/opencv4/opencv2/cvv/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/debug_mode.hpp
-	/usr/include/opencv4/opencv2/cvv/dmatch.hpp
-	/usr/include/opencv4/opencv2/cvv/filter.hpp
-	/usr/include/opencv4/opencv2/cvv/final_show.hpp
-	/usr/include/opencv4/opencv2/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/show_image.hpp
-	# [contrib_hdf]
-	/usr/include/opencv4/opencv2/hdf/hdf5.hpp
-	/usr/include/opencv4/opencv2/hdf.hpp
-	# [contrib_ovis]
-	/usr/include/opencv4/opencv2/ovis.hpp
-	# [contrib_sfm]
-	/usr/include/opencv4/opencv2/sfm.hpp
-	/usr/include/opencv4/opencv2/sfm/conditioning.hpp
-	/usr/include/opencv4/opencv2/sfm/fundamental.hpp
-	/usr/include/opencv4/opencv2/sfm/io.hpp
-	/usr/include/opencv4/opencv2/sfm/numeric.hpp
-	/usr/include/opencv4/opencv2/sfm/projection.hpp
-	/usr/include/opencv4/opencv2/sfm/reconstruct.hpp
-	/usr/include/opencv4/opencv2/sfm/robust.hpp
-	/usr/include/opencv4/opencv2/sfm/simple_pipeline.hpp
-	/usr/include/opencv4/opencv2/sfm/triangulation.hpp
-	# [vtk]
-	/usr/include/opencv4/opencv2/viz.hpp
-	/usr/include/opencv4/opencv2/viz/types.hpp
-	/usr/include/opencv4/opencv2/viz/viz3d.hpp
-	/usr/include/opencv4/opencv2/viz/vizcore.hpp
-	/usr/include/opencv4/opencv2/viz/widget_accessor.hpp
-	/usr/include/opencv4/opencv2/viz/widgets.hpp
-)
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.4.0-disable-download.patch
-	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
-	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
-	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
-	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
-	"${FILESDIR}"/${PN}-4.5.2-lapack-3.10.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() {
-	# https://bugs.gentoo.org/838274
-	replace-flags -O3 -O2
-
-	cmake_src_prepare
-
-	# remove bundled stuff
-	rm -r 3rdparty || die "Removing 3rd party components failed"
-	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
-		-i CMakeLists.txt cmake/*cmake || die
-
-	if use dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	fi
-
-	if use download; then
-		mv "${WORKDIR}/${PN}-extdep-4.4.0" "${WORKDIR}/${P}/.cache/" || 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
-	# ===================================================
-		-DENABLE_DOWNLOAD=$(usex download)
-		-DWITH_QUIRC=OFF # Do not have dependencies
-		-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 gtk3)
-		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
-		-DWITH_IPP=OFF
-		# Jasper was removed from tree because of security problems.
-		# Upstream were/are making progress. We use openjpeg instead.
-		# bug 734284
-		-DWITH_JASPER=OFF
-		-DWITH_JPEG=$(usex jpeg)
-		-DWITH_OPENJPEG=$(usex jpeg2k)
-		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
-		-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=OFF
-	#	-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
-		-DOPENCV_GENERATE_PKGCONFIG=ON
-		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_CCACHE=OFF
-		# bug 733796, but PCH is a risky game in CMake anyway
-		-DENABLE_PRECOMPILED_HEADERS=OFF
-		-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
-		-DENABLE_LTO=$(usex lto)
-	# ===================================================
-	# 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=
-		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
-	)
-
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-	local CPU_BASELINE=""
-	for i in "${CPU_FEATURES_MAP[@]}" ; do
-		if [[ ${ABI} != x86 || ${i%:*} != "cpu_flags_x86_avx2" ]]; then # workaround for Bug 747163
-			use ${i%:*} && CPU_BASELINE="${CPU_BASELINE}${i#*:};"
-		fi
-	done
-
-	GLOBALCMAKEARGS+=(
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_BASELINE=${CPU_BASELINE}
-		-DCPU_DISPATCH=
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm ON OFF)
-			-DBUILD_opencv_freetype=$(usex contribfreetype ON OFF)
-			-DBUILD_opencv_ovis=$(usex contribovis 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
-		-DBUILD_opencv_python2=OFF
-		-DBUILD_opencv_python3=OFF
-	)
-
-	cmake_src_configure
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR="${orig_BUILD_DIR}"
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=${EPYTHON}
-		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
-	)
-
-	# Regenerate cache file. Can't use rebuild_cache as it won't
-	# have the Gentoo specific options.
-	rm CMakeCache.txt || die "rm failed"
-	cmake_src_configure
-	cmake_src_compile
-	cmake_src_install
-
-	# Remove compiled binary so new version compiles
-	# Avoid conflicts with new module builds as build system doesn't
-	# really support it.
-	rm -r modules/python3 || die "rm failed"
-
-	python_optimize "${ED}"/$(python_get_sitedir)
-}
-
-multilib_src_install() {
-	cmake_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
-}

diff --git a/media-libs/opencv/opencv-4.5.5.ebuild b/media-libs/opencv/opencv-4.5.5.ebuild
deleted file mode 100644
index 7eddbcd042ce..000000000000
--- a/media-libs/opencv/opencv-4.5.5.ebuild
+++ /dev/null
@@ -1,583 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{8..10} )
-CMAKE_ECLASS=cmake
-inherit flag-o-matic java-pkg-opt-2 java-ant-2 cmake-multilib python-r1 toolchain-funcs
-
-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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	download? ( https://github.com/rossbridger/opencv-extdep/archive/4.4.0.tar.gz -> ${PN}-4.4.0_extdep.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="Apache-2.0"
-SLOT="0/${PV}" # subslot = libopencv* soname version
-KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
-IUSE="contrib contribcvv contribdnn contribfreetype contribhdf contribovis contribsfm contribxfeatures2d cuda debug dnnsamples download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack lto opencl openexr opengl openmp opencvapps png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-
-# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications
-ARM_CPU_FEATURES=(
-	cpu_flags_arm_neon:NEON
-	cpu_flags_arm_vfpv3:VFPV3
-)
-PPC_CPU_FEATURES=(
-	cpu_flags_ppc_vsx:VSX
-	cpu_flags_ppc_vsx3:VSX3
-)
-X86_CPU_FEATURES_RAW=(
-	avx:AVX
-	avx2:AVX2
-	avx512f:AVX_512F
-	f16c:FP16
-	fma3:FMA3
-	popcnt:POPCNT
-	sse:SSE
-	sse2:SSE2
-	sse3:SSE3
-	ssse3:SSSE3
-	sse4_1:SSE4_1
-	sse4_2:SSE4_2
-)
-X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
-CPU_FEATURES_MAP=(
-	${ARM_CPU_FEATURES[@]}
-	${PPC_CPU_FEATURES[@]}
-	${X86_CPU_FEATURES[@]}
-)
-IUSE="${IUSE} ${CPU_FEATURES_MAP[@]%:*}"
-
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-# cuda needs contrib, bug #701712
-REQUIRED_USE="
-	cpu_flags_x86_avx2? ( cpu_flags_x86_f16c )
-	cpu_flags_x86_f16c? ( cpu_flags_x86_avx )
-	cuda? ( contrib
-		tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribfreetype? ( contrib )
-	contribhdf? ( contrib )
-	contribovis? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( contrib download )
-	examples? ( contribdnn )
-	java? ( python )
-	opengl? ( qt5 )
-	python? ( ${PYTHON_REQUIRED_USE} )
-	tesseract? ( contrib )
-	?? ( gtk3 qt5 )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-#	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= )
-	contribhdf? ( sci-libs/hdf5:= )
-	contribfreetype? (
-		media-libs/freetype:2[${MULTILIB_USEDEP}]
-		media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
-	)
-	contribovis? ( dev-games/ogre:0/1.12 )
-	ffmpeg? ( 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}]
-	)
-	gtk3? (
-		dev-libs/glib:2[${MULTILIB_USEDEP}]
-		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
-	)
-	ieee1394? (
-		media-libs/libdc1394:=[${MULTILIB_USEDEP}]
-		sys-libs/libraw1394[${MULTILIB_USEDEP}]
-	)
-	java? ( >=virtual/jre-1.8:* )
-	jpeg? ( virtual/jpeg:0[${MULTILIB_USEDEP}] )
-	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
-	lapack? (
-		virtual/cblas
-		>=virtual/lapack-3.10
-	)
-	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
-	openexr? (
-		<media-libs/openexr-3.0.0:0=[${MULTILIB_USEDEP}]
-		media-libs/ilmbase:=[${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=,${MULTILIB_USEDEP}] )
-	threads? ( dev-cpp/tbb:=[${MULTILIB_USEDEP}] )
-	tiff? ( media-libs/tiff:0[${MULTILIB_USEDEP}] )
-	v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
-	vaapi? ( x11-libs/libva[${MULTILIB_USEDEP}] )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
-	xine? ( media-libs/xine-lib )"
-DEPEND="${RDEPEND}
-	eigen? ( >=dev-cpp/eigen-3.3.8-r1:3 )
-	java? ( >=virtual/jdk-1.8:* )"
-BDEPEND="virtual/pkgconfig"
-
-MULTILIB_WRAPPED_HEADERS=(
-	# [opencv4]
-	/usr/include/opencv4/opencv2/cvconfig.h
-	/usr/include/opencv4/opencv2/opencv_modules.hpp
-	# [cudev]
-	/usr/include/opencv4/opencv2/cudaarithm.hpp
-	/usr/include/opencv4/opencv2/cudabgsegm.hpp
-	/usr/include/opencv4/opencv2/cudacodec.hpp
-	/usr/include/opencv4/opencv2/cudafeatures2d.hpp
-	/usr/include/opencv4/opencv2/cudafilters.hpp
-	/usr/include/opencv4/opencv2/cudaimgproc.hpp
-	/usr/include/opencv4/opencv2/cudalegacy.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVHaarObjectDetection.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCV.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVPyramid.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NPP_staging.hpp
-	/usr/include/opencv4/opencv2/cudaobjdetect.hpp
-	/usr/include/opencv4/opencv2/cudaoptflow.hpp
-	/usr/include/opencv4/opencv2/cudastereo.hpp
-	/usr/include/opencv4/opencv2/cudawarping.hpp
-	/usr/include/opencv4/opencv2/cudev/block/block.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/block/dynamic_smem.hpp
-	/usr/include/opencv4/opencv2/cudev/block/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/block/vec_distance.hpp
-	/usr/include/opencv4/opencv2/cudev/common.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/color.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/expr.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/per_element_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/reduction.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/detail/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/functional.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/tuple_adapter.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/minmaxloc.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_down.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_up.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_column.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_row.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/pyramids.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce_to_vec.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/constant.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/detail/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/extrapolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/glob.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/interpolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/lut.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/mask.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/remap.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/resize.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/texture.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/traits.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/zip.hpp
-	/usr/include/opencv4/opencv2/cudev/util/atomic.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/limits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/saturate_cast.hpp
-	/usr/include/opencv4/opencv2/cudev/util/simd_functions.hpp
-	/usr/include/opencv4/opencv2/cudev/util/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_math.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/shuffle.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/warp.hpp
-	# [contrib_cvv]
-	/usr/include/opencv4/opencv2/cvv/call_meta_data.hpp
-	/usr/include/opencv4/opencv2/cvv/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/debug_mode.hpp
-	/usr/include/opencv4/opencv2/cvv/dmatch.hpp
-	/usr/include/opencv4/opencv2/cvv/filter.hpp
-	/usr/include/opencv4/opencv2/cvv/final_show.hpp
-	/usr/include/opencv4/opencv2/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/show_image.hpp
-	# [contrib_hdf]
-	/usr/include/opencv4/opencv2/hdf/hdf5.hpp
-	/usr/include/opencv4/opencv2/hdf.hpp
-	# [contrib_ovis]
-	/usr/include/opencv4/opencv2/ovis.hpp
-	# [contrib_sfm]
-	/usr/include/opencv4/opencv2/sfm.hpp
-	/usr/include/opencv4/opencv2/sfm/conditioning.hpp
-	/usr/include/opencv4/opencv2/sfm/fundamental.hpp
-	/usr/include/opencv4/opencv2/sfm/io.hpp
-	/usr/include/opencv4/opencv2/sfm/numeric.hpp
-	/usr/include/opencv4/opencv2/sfm/projection.hpp
-	/usr/include/opencv4/opencv2/sfm/reconstruct.hpp
-	/usr/include/opencv4/opencv2/sfm/robust.hpp
-	/usr/include/opencv4/opencv2/sfm/simple_pipeline.hpp
-	/usr/include/opencv4/opencv2/sfm/triangulation.hpp
-	# [vtk]
-	/usr/include/opencv4/opencv2/viz.hpp
-	/usr/include/opencv4/opencv2/viz/types.hpp
-	/usr/include/opencv4/opencv2/viz/viz3d.hpp
-	/usr/include/opencv4/opencv2/viz/vizcore.hpp
-	/usr/include/opencv4/opencv2/viz/widget_accessor.hpp
-	/usr/include/opencv4/opencv2/viz/widgets.hpp
-)
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.4.0-disable-download.patch
-	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
-	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
-	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
-	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.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() {
-	# https://bugs.gentoo.org/838274
-	replace-flags -O3 -O2
-
-	cmake_src_prepare
-
-	# remove bundled stuff
-	rm -r 3rdparty || die "Removing 3rd party components failed"
-	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
-		-i CMakeLists.txt cmake/*cmake || die
-
-	if use dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	fi
-
-	if use download; then
-		mv "${WORKDIR}/${PN}-extdep-4.4.0" "${WORKDIR}/${P}/.cache/" || 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
-	# ===================================================
-		-DENABLE_DOWNLOAD=$(usex download)
-		-DWITH_QUIRC=OFF # Do not have dependencies
-		-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 gtk3)
-		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
-		-DWITH_IPP=OFF
-		# Jasper was removed from tree because of security problems.
-		# Upstream were/are making progress. We use openjpeg instead.
-		# bug 734284
-		-DWITH_JASPER=OFF
-		-DWITH_JPEG=$(usex jpeg)
-		-DWITH_OPENJPEG=$(usex jpeg2k)
-		-DWITH_WEBP=$(usex webp)
-		-DWITH_OPENEXR=$(usex openexr)
-		# Try to force OpenEXR 2 for now. bug #830124
-		-DOPENEXR_ROOT="${ESYSROOT}"/usr
-		-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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
-		-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=OFF
-	#	-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
-		-DOPENCV_GENERATE_PKGCONFIG=ON
-		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_CCACHE=OFF
-		# bug 733796, but PCH is a risky game in CMake anyway
-		-DENABLE_PRECOMPILED_HEADERS=OFF
-		-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
-		-DENABLE_LTO=$(usex lto)
-	# ===================================================
-	# 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=
-		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
-	)
-
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-	local CPU_BASELINE=""
-	for i in "${CPU_FEATURES_MAP[@]}" ; do
-		if [[ ${ABI} != x86 || ${i%:*} != "cpu_flags_x86_avx2" ]]; then # workaround for Bug 747163
-			use ${i%:*} && CPU_BASELINE="${CPU_BASELINE}${i#*:};"
-		fi
-	done
-
-	GLOBALCMAKEARGS+=(
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_BASELINE=${CPU_BASELINE}
-		-DCPU_DISPATCH=
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm ON OFF)
-			-DBUILD_opencv_freetype=$(usex contribfreetype ON OFF)
-			-DBUILD_opencv_ovis=$(usex contribovis 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
-		-DBUILD_opencv_python2=OFF
-		-DBUILD_opencv_python3=OFF
-	)
-
-	cmake_src_configure
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR="${orig_BUILD_DIR}"
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=${EPYTHON}
-		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
-	)
-
-	# Regenerate cache file. Can't use rebuild_cache as it won't
-	# have the Gentoo specific options.
-	rm CMakeCache.txt || die "rm failed"
-	cmake_src_configure
-	cmake_src_compile
-	cmake_src_install
-
-	# Remove compiled binary so new version compiles
-	# Avoid conflicts with new module builds as build system doesn't
-	# really support it.
-	rm -r modules/python3 || die "rm failed"
-
-	python_optimize "${ED}"/$(python_get_sitedir)
-}
-
-multilib_src_install() {
-	cmake_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
-}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2022-09-14  9:19 Andreas Sturmlechner
  0 siblings, 0 replies; 27+ messages in thread
From: Andreas Sturmlechner @ 2022-09-14  9:19 UTC (permalink / raw
  To: gentoo-commits

commit:     118a0104ca9c4a75c1caf1b2c9eff1e7f9d7b02d
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 14 08:34:27 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 09:18:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=118a0104

media-libs/opencv: Fix IUSE=examples

Closes: https://bugs.gentoo.org/830163
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/opencv-4.6.0-fix-build-examples.patch     | 21 +++++++++++++++++++++
 media-libs/opencv/opencv-4.6.0-r2.ebuild            |  1 +
 2 files changed, 22 insertions(+)

diff --git a/media-libs/opencv/files/opencv-4.6.0-fix-build-examples.patch b/media-libs/opencv/files/opencv-4.6.0-fix-build-examples.patch
new file mode 100644
index 000000000000..3cc6328a2323
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.6.0-fix-build-examples.patch
@@ -0,0 +1,21 @@
+From 5acf351e4b9d099d446f401df690d559ed5dfdad Mon Sep 17 00:00:00 2001
+From: Prasanth R <prasanth.r@timesys.com>
+Date: Thu, 14 Jul 2022 13:34:54 +0530
+Subject: [PATCH] #21804 Add opencv_gapi as dep to samples/cpp
+
+---
+ samples/cpp/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt
+index c9c4440f22c7..f23b333ca93a 100644
+--- a/samples/cpp/CMakeLists.txt
++++ b/samples/cpp/CMakeLists.txt
+@@ -15,6 +15,7 @@ set(OPENCV_CPP_SAMPLES_REQUIRED_DEPS
+   opencv_calib3d
+   opencv_stitching
+   opencv_dnn
++  opencv_gapi
+   ${OPENCV_MODULES_PUBLIC}
+   ${OpenCV_LIB_COMPONENTS})
+ ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})

diff --git a/media-libs/opencv/opencv-4.6.0-r2.ebuild b/media-libs/opencv/opencv-4.6.0-r2.ebuild
index 49f04357d294..8cca419b41eb 100644
--- a/media-libs/opencv/opencv-4.6.0-r2.ebuild
+++ b/media-libs/opencv/opencv-4.6.0-r2.ebuild
@@ -290,6 +290,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
 	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
 	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
+	"${FILESDIR}"/${P}-fix-build-examples.patch # bug 830163, pending upstream PR #22245
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2023-08-28  4:05 Sam James
  0 siblings, 0 replies; 27+ messages in thread
From: Sam James @ 2023-08-28  4:05 UTC (permalink / raw
  To: gentoo-commits

commit:     4e6bb1138e0e8009b6e66b479e417d4d7c066fda
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 28 03:44:11 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 28 04:03:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4e6bb113

media-libs/opencv: fix build on (some) arm64

See patch for details.

Closes: https://bugs.gentoo.org/913031
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../opencv/files/opencv-4.8.0-arm64-fp16.patch     | 272 +++++++++++++++++++++
 media-libs/opencv/opencv-4.8.0-r1.ebuild           |   1 +
 2 files changed, 273 insertions(+)

diff --git a/media-libs/opencv/files/opencv-4.8.0-arm64-fp16.patch b/media-libs/opencv/files/opencv-4.8.0-arm64-fp16.patch
new file mode 100644
index 000000000000..84e36f88e6f7
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.0-arm64-fp16.patch
@@ -0,0 +1,272 @@
+https://github.com/opencv/opencv/pull/24203
+
+From 689fa6f372975d58e9f50fd17a0abd105b1815f1 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Mon, 28 Aug 2023 04:20:58 +0100
+Subject: [PATCH] Fix compilation on arm64 with FP16 when disabled
+
+If building with -mcpu=native or any other setting which implies the current
+CPU has FP16 but with intrinsics disabled, we mistakenly try to use it even
+though convolution.hpp conditionally defines it correctly based on whether
+we should *use it*. convolution.cpp on the other hand was mismatched and
+trying to use it if the CPU supported it, even if not enabled in the build
+system.
+
+Make the guards match.
+
+Bug: https://bugs.gentoo.org/913031
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/modules/dnn/src/layers/cpu_kernels/convolution.cpp
++++ b/modules/dnn/src/layers/cpu_kernels/convolution.cpp
+@@ -118,7 +118,7 @@ Ptr<FastConv> initFastConv(
+     const size_t wstep = weightsMat.step1();
+ 
+     conv->useFP16 = false;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+     // TODO: add FP16 support for Winograd.
+     if (_useFP16 && (conv->conv_type == CONV_TYPE_GENERIC || conv->conv_type == CONV_TYPE_DEPTHWISE_REMAIN))
+         conv->useFP16 = true;
+@@ -137,7 +137,7 @@ Ptr<FastConv> initFastConv(
+         int padded_ksize = ((ksize + VEC_ALIGN-1) / VEC_ALIGN) * VEC_ALIGN;
+         int nweights = C * padded_ksize;
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+         if (conv->useFP16)
+         {
+             conv->weightsBuf_FP16.resize(nweights + VEC_ALIGN);
+@@ -190,7 +190,7 @@ Ptr<FastConv> initFastConv(
+ #endif
+         const int CONV_WINO_NATOMS_F32 = CONV_WINO_AREA / CONV_WINO_ATOM_F32; // for AVX2, it is 8, otherwise, it's 16.
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+         // FP 16
+         const int CONV_WINO_ATOM_F16 = CONV_WINO_ATOM_F32 * 2;
+         const int CONV_WINO_NATOMS_F16 = CONV_WINO_AREA / CONV_WINO_ATOM_F16;
+@@ -208,7 +208,7 @@ Ptr<FastConv> initFastConv(
+         size_t nweights = ngroups*Kg_nblocks*Cg*CONV_WINO_KBLOCK*CONV_WINO_AREA;
+ 
+         float* wptrWino = nullptr;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+         float16_t* wptrWino_FP16 = nullptr;
+         if (conv->useFP16)
+         {
+@@ -264,7 +264,7 @@ Ptr<FastConv> initFastConv(
+                 }
+ 
+                 // repack the data.
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                 if (conv->useFP16)
+                 {
+                     float16_t* wptr = wptrWino_FP16 + (g*Kg_nblocks + ki) * Cg *CONV_WINO_KBLOCK*CONV_WINO_AREA +
+@@ -308,7 +308,7 @@ Ptr<FastConv> initFastConv(
+ 
+         float* weightsBufPtr = nullptr;
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+         int numStripsMR_FP16 = (Kg + CONV_MR_FP16 - 1) / CONV_MR_FP16;
+         int Kg_aligned_FP16 = numStripsMR_FP16 * CONV_MR_FP16;
+         size_t nweights_FP16 = ngroups * Kg_aligned_FP16 * DkHkWkCg;
+@@ -331,7 +331,7 @@ Ptr<FastConv> initFastConv(
+         }
+ 
+         // Pack the weight.
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+         if (conv->useFP16)
+         {
+             parallel_for_(Range(0, ngroups * numStripsMR_FP16), [&](const Range& r0){
+@@ -415,7 +415,7 @@ static inline void packData8(char*& inpbuf, float*& inptrIn, int& in_w, int& x0,
+     char * inpbufC = inpbuf + s0 * esz;
+     float* inptrInC = (float* )inptrIn;
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+     float16_t* inpbufC_FP16 = (float16_t *)inpbufC;
+     if (esz == sizeof(float16_t))
+     {
+@@ -521,7 +521,7 @@ static inline void packData2(char *& inpbuf, float*& inptrIn, int& in_w, int& x0
+     char* inpbufC = inpbuf + s0 * esz;
+     float* inptrInC = inptrIn;
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+     float16_t* inpbufC_FP16 = (float16_t *)inpbufC;
+     if (esz == sizeof(float16_t))
+     {
+@@ -553,7 +553,7 @@ static inline void packData2(char *& inpbuf, float*& inptrIn, int& in_w, int& x0
+     in_w += stride_w;
+ }
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+ // Fast convert float 32 to float16
+ static inline void _cvt32f16f( const float* src, float16_t* dst, int len)
+ {
+@@ -623,7 +623,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+             {
+                 // Make special branch where memcpy() is called with a constant buffer size.
+                 // Compilers will likely unroll this loop properly.
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                 if (useFP16)
+                 {
+                     for (int c = 0; c < Cg; c++, inptr += inp_planesize, inpbuf += CONV_NR_esz)
+@@ -636,7 +636,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+             }
+             else
+             {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                 if (useFP16)
+                 {
+                     for (int c = 0; c < Cg; c++, inptr += inp_planesize, inpbuf += CONV_NR_esz)
+@@ -700,7 +700,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                             int w0 = std::max(0, (-in_w + dilation_w-1)/dilation_w);
+                             int w1 = std::min(Wk, (Wi - in_w + dilation_w-1)/dilation_w);
+                             const float* inptrInC = inptrIn;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                             if (useFP16)
+                             {
+                                 float16_t* inpbufC = (float16_t *)inpbuf + s0;
+@@ -761,7 +761,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                             int w1 = std::min(Wk, (Wi - in_w + dilation_w-1)/dilation_w);
+ 
+                             const float* inptrInC = inptrIn;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                             if (useFP16)
+                             {
+                                 float16_t* inpbufC = (float16_t *)inpbuf + s0;
+@@ -834,7 +834,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                             int w0 = std::max(0, (-in_w + dilation_w-1)/dilation_w);
+                             int w1 = std::min(Wk, (Wi - in_w + dilation_w-1)/dilation_w);
+                             const float* inptrInC = inptrIn;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                             if (useFP16)
+                             {
+                                 float16_t* inpbufC = (float16_t* )inpbuf + s0;
+@@ -887,7 +887,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                 for (; i < CONV_NR;)
+                 {
+                     float* inpbuf_ki = (float* )inpbuf + k * CONV_NR * Cg + i;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                     float16_t * inpbuf_ki_FP16 = (float16_t *)inpbuf + k * CONV_NR * Cg + i;
+ #endif
+ 
+@@ -903,7 +903,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                         {
+                             if (stride_w == 1)
+                             {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                                 if (useFP16)
+                                 {
+                                     for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
+@@ -934,7 +934,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                             }
+                             else if (stride_w == 2)
+                             {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                                 if (useFP16)
+                                 {
+                                     for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
+@@ -967,7 +967,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                             }
+                             else
+                             {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                                 if (useFP16)
+                                 {
+                                     for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
+@@ -1006,7 +1006,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                         {
+                             if (stride_w == 1)
+                             {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                                 if (useFP16)
+                                 {
+                                     for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
+@@ -1029,7 +1029,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                             }
+                             else
+                             {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                                 if (useFP16)
+                                 {
+                                     for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
+@@ -1057,7 +1057,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                         }
+                         else
+                         {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                             if (useFP16)
+                             {
+                                 for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR, inptr_ki += inp_planesize)
+@@ -1073,7 +1073,7 @@ static inline void packInputData(char* inpbuf_task, float* inp, const int* ofsta
+                     }
+                     else
+                     {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                         if (useFP16)
+                         {
+                             for (int c = 0; c < Cg; c++, inpbuf_ki_FP16 += CONV_NR)
+@@ -1260,7 +1260,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
+     int CONV_MR = CONV_MR_FP32;
+     int esz = sizeof(float );
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+     if (useFP16)
+     {
+         // works at FP 16.
+@@ -1433,7 +1433,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
+                 }
+ 
+                 char *weights = nullptr;
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                 if (useFP16)
+                 {
+                     CV_Assert(!conv->weightsBuf_FP16.empty());
+@@ -1474,7 +1474,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
+ #if CV_NEON && CV_NEON_AARCH64
+                         if (conv->useNEON)
+                         {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                             if (useFP16)
+                             {
+                                 opt_NEON::convBlockMR1_FP16(DkHkWkCg, weights, inptr, cptr, biasVal, fusedAdd, minval, maxval, ifMinMaxAct, outLen, CONV_NR);
+@@ -1537,7 +1537,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
+ #if CV_NEON
+                                 if (conv->useNEON)
+                                 {
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                                     if (useFP16)
+                                     {
+                                         opt_NEON::convBlock_FP16(c1 - c0, wptr, inptr, (char *)cptr_f16, ldc, c0 == 0, outLen, CONV_MR, CONV_NR);
+@@ -1567,7 +1567,7 @@ void runFastConv(InputArray _input, OutputArray _output, const Ptr<FastConv>& co
+                         float biasval = biasptr[k];
+                         int j = 0;
+ 
+-#ifdef CONV_ARM_FP16
++#if CV_FP16
+                         if (useFP16)
+                         {
+                             float32x4_t vbias = vdupq_n_f32(biasval);

diff --git a/media-libs/opencv/opencv-4.8.0-r1.ebuild b/media-libs/opencv/opencv-4.8.0-r1.ebuild
index 846e57c7514b..27cec3eb3fa4 100644
--- a/media-libs/opencv/opencv-4.8.0-r1.ebuild
+++ b/media-libs/opencv/opencv-4.8.0-r1.ebuild
@@ -294,6 +294,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
 	"${FILESDIR}"/${PN}-4.8.0-fix-protobuf.patch
 	"${FILESDIR}"/${PN}-4.8.0-fix-flatbuffer.patch
+	"${FILESDIR}"/${PN}-4.8.0-arm64-fp16.patch
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2023-11-22 11:40 Sam James
  0 siblings, 0 replies; 27+ messages in thread
From: Sam James @ 2023-11-22 11:40 UTC (permalink / raw
  To: gentoo-commits

commit:     8912df505fed8b242f01d5ee8d78b23c7a72fd86
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Tue Nov 21 15:05:43 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 22 11:39:53 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8912df50

media-libs/opencv: 4.8.x fix for compatibility with CUDA Toolkit >= 12.2.0

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

 .../files/opencv-4.8.0-fix-cuda-12.2.0.patch       | 40 ++++++++++++++++++++++
 media-libs/opencv/opencv-4.8.0-r1.ebuild           |  1 +
 media-libs/opencv/opencv-4.8.0.ebuild              |  1 +
 media-libs/opencv/opencv-4.8.1.ebuild              |  1 +
 4 files changed, 43 insertions(+)

diff --git a/media-libs/opencv/files/opencv-4.8.0-fix-cuda-12.2.0.patch b/media-libs/opencv/files/opencv-4.8.0-fix-cuda-12.2.0.patch
new file mode 100644
index 000000000000..fd7d12af2644
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.0-fix-cuda-12.2.0.patch
@@ -0,0 +1,40 @@
+https://github.com/opencv/opencv/pull/24104
+https://github.com/opencv/opencv/commit/5466fd2606ca6df57bbe43f064d2ae73fe4329eb
+https://bugs.gentoo.org/915775
+
+From ab8cb6f8a9034da2a289b84685c6d959266029be Mon Sep 17 00:00:00 2001
+From: cudawarped <12133430+cudawarped@users.noreply.github.com>
+Date: Tue, 1 Aug 2023 13:02:42 +0300
+Subject: [PATCH] cuda: fix for compatibility with CUDA Toolkit >= 12.2.0
+
+---
+ modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp | 2 +-
+ modules/dnn/src/cuda4dnn/primitives/region.hpp         | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp b/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp
+index f067dddaa701..91ff33f81718 100644
+--- a/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp
++++ b/modules/dnn/src/cuda4dnn/primitives/normalize_bbox.hpp
+@@ -111,7 +111,7 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+              * or there might be several weights
+              * or we don't have to scale
+              */
+-            if (weight != 1.0)
++            if (weight != static_cast<T>(1.0f))
+             {
+                 kernels::scale1_with_bias1<T>(stream, output, input, weight, 1.0);
+             }
+diff --git a/modules/dnn/src/cuda4dnn/primitives/region.hpp b/modules/dnn/src/cuda4dnn/primitives/region.hpp
+index d22d44214e7b..3af05155feea 100644
+--- a/modules/dnn/src/cuda4dnn/primitives/region.hpp
++++ b/modules/dnn/src/cuda4dnn/primitives/region.hpp
+@@ -121,7 +121,7 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+                 new_coords
+             );
+ 
+-            if (nms_iou_threshold > 0) {
++            if (nms_iou_threshold > static_cast<T>(0.0f)) {
+                 auto output_mat = output_wrapper->getMutableHostMat();
+                 CV_Assert(output_mat.type() == CV_32F);
+                 for (int i = 0; i < input.get_axis_size(0); i++) {

diff --git a/media-libs/opencv/opencv-4.8.0-r1.ebuild b/media-libs/opencv/opencv-4.8.0-r1.ebuild
index 2910615c0b36..ad47071aba4d 100644
--- a/media-libs/opencv/opencv-4.8.0-r1.ebuild
+++ b/media-libs/opencv/opencv-4.8.0-r1.ebuild
@@ -295,6 +295,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-4.8.0-fix-protobuf.patch
 	"${FILESDIR}"/${PN}-4.8.0-fix-flatbuffer.patch
 	"${FILESDIR}"/${PN}-4.8.0-arm64-fp16.patch
+	"${FILESDIR}"/${PN}-4.8.0-fix-cuda-12.2.0.patch
 )
 
 pkg_pretend() {

diff --git a/media-libs/opencv/opencv-4.8.0.ebuild b/media-libs/opencv/opencv-4.8.0.ebuild
index 772cd8408d98..82322d2d67fb 100644
--- a/media-libs/opencv/opencv-4.8.0.ebuild
+++ b/media-libs/opencv/opencv-4.8.0.ebuild
@@ -290,6 +290,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
 	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
 	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
+	"${FILESDIR}"/${PN}-4.8.0-fix-cuda-12.2.0.patch
 )
 
 pkg_pretend() {

diff --git a/media-libs/opencv/opencv-4.8.1.ebuild b/media-libs/opencv/opencv-4.8.1.ebuild
index 0bfc5cab4674..3f219f22a627 100644
--- a/media-libs/opencv/opencv-4.8.1.ebuild
+++ b/media-libs/opencv/opencv-4.8.1.ebuild
@@ -300,6 +300,7 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-4.8.0-fix-protobuf.patch
 	"${FILESDIR}"/${PN}-4.8.0-fix-flatbuffer.patch
 	"${FILESDIR}"/${PN}-4.8.0-arm64-fp16.patch
+	"${FILESDIR}"/${PN}-4.8.0-fix-cuda-12.2.0.patch
 )
 
 pkg_pretend() {


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2024-01-10 12:33 Sam James
  0 siblings, 0 replies; 27+ messages in thread
From: Sam James @ 2024-01-10 12:33 UTC (permalink / raw
  To: gentoo-commits

commit:     0e9205edb9922309ecd568b7085fd59726c7d2ca
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Fri Dec  8 14:58:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 10 12:32:37 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e9205ed

media-libs/opencv: add 4.8.1-r1

Closes: https://bugs.gentoo.org/702258
Closes: https://bugs.gentoo.org/830294
Closes: https://bugs.gentoo.org/883375
Closes: https://bugs.gentoo.org/913740
Closes: https://bugs.gentoo.org/914922
Closes: https://bugs.gentoo.org/917121
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-libs/opencv/Manifest                         |   7 +
 .../files/opencv-4.8.1-ade-0.1.2a.tar.gz.patch     |  18 +
 .../opencv-4.8.1-drop-python2-detection.patch      |  23 +
 ...ncv-4.8.1-eliminate-lto-compiler-warnings.patch |  36 ++
 .../opencv/files/opencv-4.8.1-libpng16.patch       |  58 ++
 .../opencv/files/opencv-4.8.1-opencv_test.patch    |  18 +
 .../files/opencv-4.8.1-python3_12-support.patch    |  25 +
 .../opencv-4.8.1-use-system-flatbuffers.patch      |  36 ++
 .../files/opencv-4.8.1-use-system-opencl.patch     |  25 +
 ...rib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch |  20 +
 .../opencv/files/opencv_contrib-4.8.1-rgbd.patch   |  15 +
 media-libs/opencv/metadata.xml                     |  34 +-
 media-libs/opencv/opencv-4.8.1-r1.ebuild           | 644 +++++++++++++++++++++
 13 files changed, 945 insertions(+), 14 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 4c83059fb2d5..293a8806aa85 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,3 +1,5 @@
+DIST NVIDIAOpticalFlowSDK-edb50da3cf849840d680249aa6dbef248ebce2ca.tar.gz 8771 BLAKE2B f579960448bdaf57fbefd5e88002d8f6f4dbb828429b0f3a0112916c03039d4e4de65263eb8464a4d62924c1b77f0a61c2d93b7307657439bfbf7d59785f1533 SHA512 85dfdc52260f54f62c980508f4b6ab384e44200bd1c13761c4947f9a898c08f0faed2d734a85a4ba7a46f8788ed58ee89f12f61cee97881b69ba626bbd04f655
+DIST ade-0.1.2a.tar.gz 116737 BLAKE2B 9ac2af2f21aab8cb5d599e0b653bb6126642588e508f55e5fbfe5ce9607267f25e5187fd31ed69349064551c06e15b2ba548319708ed5f70e7761470775cc6e0 SHA512 d3ed210ff25f4c05393b0039cb4a73a6ceb8b42ba3d776e0469da2362899d3f76564cc6a06965b7de91f38517e1cd4ff4b18c00185d2b1a0af5a34ecf0d9dd44
 DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
 DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
 DIST opencv-4.4.0_extdep.tar.gz 65334871 BLAKE2B 89fa0083da428e986bb4287295bdbff626d0f84866377413649c1d7ca77338288141f22d2a3c0b64d6d0fc1db98f918c8b33a665274cee4c4aefb44359e4333d SHA512 7b758099ce4abef151051e3e9e1e45b73e4054669d3aa53051e4d4c5f43d9373c9bda5ecbce51f6b024562cb566bd1117505af29ab5f3c36a493f185111a3b4e
@@ -5,4 +7,9 @@ DIST opencv-4.8.0.tar.gz 91992565 BLAKE2B eede5479acdcef7dfb49d260b696ed14e85a27
 DIST opencv-4.8.0_contrib.tar.gz 59201076 BLAKE2B e30c4f17e1e89c8b0821bbf8ea44b6b4ce505ad2761222a8b119c5aee5ae4ef50e06a73f41fee3b2fa60b71c736989904f6d1fb31a16abfe39e605e2d32d851b SHA512 81cc41cfe1ea03e60b0657edeaa76a90926e5e79a9f93a482e17bc9edbf1b5ce36b13d108fd8fb097f2fb3d6381fbeb102811f44bfc761c2de7f69bf3c5298a1
 DIST opencv-4.8.1.tar.gz 92006711 BLAKE2B 54728a37e3e8a528bd8d2e6df5963a996820a51160d05ac72b350234ce5372f99c037af96e13c55de1452e517fffb478c2335b9e1cbc07a36c78f99351eabd58 SHA512 b98d89b8e7b8ae8138bce00c5226816b761b53fbeb8f28ca516e08c5d130f216f9388a81785cd6684034530f768e097cbe12f19a9361f362b7d2048bfc427a65
 DIST opencv-4.8.1_contrib.tar.gz 59200293 BLAKE2B 8cf3ee60cb38a9fa2649013b9b4704022abe5cc65c331078dc7ea87028bc99df8b0de12f835905f5bb5c00a811f256754cac018ca8e02739ac5c6fe36aa4346d SHA512 e3df49e6a1411f55eebbc02f4534ddefabff961b4f63c69b21fe06ff3df894773a8643ab0cb123b83c2bdc8fa02698b332d3c243e8546c894e6c6c8ecaa65500
+DIST opencv_3rdparty-34e4206aef44d50e6bbcd0ab06354b52e7466d26.tar.gz 397901 BLAKE2B 9adbe14ee3a2c90b890be694aa80d65b67e23a23f47ccabee4564e31eb9857d717b5a751df32004cfa5d6a53a9e1d8ea8d8943b705a0eaea5ca741169e2222f6 SHA512 8a92555aed2ac8752818586ab9762dd96ec128c5465cb87e402f15b15d16f7d371b3de045ef7295526e9ef99ec817766bb685a21d24dba29c650cf44e384a4e3
+DIST opencv_3rdparty-8afa57abc8229d611c4937165d20e2a2d9fc5a12.tar.gz 63301261 BLAKE2B 923dc944edfda4c292d42207290bee414bfe21998f6ffe341ea3b38b6f2f581f3a243653e2c1fd3fa86084068ad6e7acd5ca73ab43094aa15f124d379833a5d8 SHA512 68cce870da0846cbd12a093ec7896b510e34590dad2b91699be1df5d4f72d343f9789d54c45c1b801784f7e57e0e80b19ba65dd99855225da99b4193dae97aaa
+DIST opencv_3rdparty-a8b69ccc738421293254aec5ddb38bd523503252.tar.gz 920403 BLAKE2B 5f834e8ccef9d88d0650f8ae5d215a2d07d0a356aaad4de1622068e0b2a7def88fccc84bc4397f0182732e836fcd6e363ae25a2cdeaa4d458a7d8ef9afc81da5 SHA512 5611b9db40477759213ab35320570c198f1f224f92ca801ca3accd1f7620faf3d44f306e44abefd10be118acee9b56da643ca82abaa7c4d2102fe92e5b298a6e
+DIST opencv_3rdparty-b2bfc75f6aea5b1f834ff0f0b865a7c18ff1459f.tar.gz 10036903 BLAKE2B c13559569808db24105049e2081bc466c0e8b6dab58bcc69001e49ff82e03ec4701e25648b5e542b7df2c8e522abfbd82c9825e66c37d6a673847b41bf6effae SHA512 3fc44f12802aa1dad0b12372d53242ae2134a2d74ca0b6d8e4639551623426106781a41d77ebfce79ac625a49aec26b0d7425e0d31f09bab6a15e3d43caef8bc
+DIST opencv_3rdparty-fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d.tar.gz 1470898 BLAKE2B f1794cc8f8684501f670db3d720c02f35c57ebe91f276cc21dea1f1c1426740d03569143fec74380e941703b5086db5f013ca913fb296eda99559115fd53ca30 SHA512 07118b9d688bf0ff34a6e4ca1548006124d80d11e7b48f08c9e1910b64249b1dad0ace460f50adda0ecb69b90871fc59cc25f451570c63f7c6d6ba2b92d8801c
 DIST vgg_boostdesc-3.2.0.tar.gz 1867770 BLAKE2B 1fa5b58e73b6fa56ecf8d19af22298f729942ee1369082e173445d09d3de767bf844bad3d2b462efc1199c392f37c88ba49a9996ba8bfd84b4abeba7de94db63 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44

diff --git a/media-libs/opencv/files/opencv-4.8.1-ade-0.1.2a.tar.gz.patch b/media-libs/opencv/files/opencv-4.8.1-ade-0.1.2a.tar.gz.patch
new file mode 100644
index 000000000000..056553695ee2
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-ade-0.1.2a.tar.gz.patch
@@ -0,0 +1,18 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Use tar.gz instead of zip to make CI happy.
+
+diff --git a/modules/gapi/cmake/DownloadADE.cmake b/modules/gapi/cmake/DownloadADE.cmake
+index e22c4f1..fb0c10a 100644
+--- a/modules/gapi/cmake/DownloadADE.cmake
++++ b/modules/gapi/cmake/DownloadADE.cmake
+@@ -1,7 +1,7 @@
+ set(ade_src_dir "${OpenCV_BINARY_DIR}/3rdparty/ade")
+-set(ade_filename "v0.1.2a.zip")
++set(ade_filename "v0.1.2a.tar.gz")
+ set(ade_subdir "ade-0.1.2a")
+-set(ade_md5 "fa4b3e25167319cb0fa9432ef8281945")
++set(ade_md5 "89fd5f32c2796d3fecf62273c4aa7c4d")
+ ocv_download(FILENAME ${ade_filename}
+              HASH ${ade_md5}
+              URL

diff --git a/media-libs/opencv/files/opencv-4.8.1-drop-python2-detection.patch b/media-libs/opencv/files/opencv-4.8.1-drop-python2-detection.patch
new file mode 100644
index 000000000000..5a3a89f665b4
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-drop-python2-detection.patch
@@ -0,0 +1,23 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Python2 is long gone. So don't try finding it.
+
+diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
+index 599b2eb..345e3ef 100644
+--- a/cmake/OpenCVDetectPython.cmake
++++ b/cmake/OpenCVDetectPython.cmake
+@@ -268,14 +268,6 @@ if(OPENCV_PYTHON_SKIP_DETECTION)
+   return()
+ endif()
+
+-find_python("" "${MIN_VER_PYTHON2}" PYTHON2_LIBRARY PYTHON2_INCLUDE_DIR
+-    PYTHON2INTERP_FOUND PYTHON2_EXECUTABLE PYTHON2_VERSION_STRING
+-    PYTHON2_VERSION_MAJOR PYTHON2_VERSION_MINOR PYTHON2LIBS_FOUND
+-    PYTHON2LIBS_VERSION_STRING PYTHON2_LIBRARIES PYTHON2_LIBRARY
+-    PYTHON2_DEBUG_LIBRARIES PYTHON2_LIBRARY_DEBUG PYTHON2_INCLUDE_PATH
+-    PYTHON2_INCLUDE_DIR PYTHON2_INCLUDE_DIR2 PYTHON2_PACKAGES_PATH
+-    PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_NUMPY_VERSION)
+-
+ option(OPENCV_PYTHON3_VERSION "Python3 version" "")
+ find_python("${OPENCV_PYTHON3_VERSION}" "${MIN_VER_PYTHON3}" PYTHON3_LIBRARY PYTHON3_INCLUDE_DIR
+     PYTHON3INTERP_FOUND PYTHON3_EXECUTABLE PYTHON3_VERSION_STRING

diff --git a/media-libs/opencv/files/opencv-4.8.1-eliminate-lto-compiler-warnings.patch b/media-libs/opencv/files/opencv-4.8.1-eliminate-lto-compiler-warnings.patch
new file mode 100644
index 000000000000..7d6a5456a63f
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-eliminate-lto-compiler-warnings.patch
@@ -0,0 +1,36 @@
+https://github.com/opencv/opencv/pull/23991
+
+From 4ee0f212cc19f7e77483d34d4cf8378945e3da31 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=E4=B8=8D=E9=B1=BC=E5=84=BF?=
+ <36976072+buyuer@users.noreply.github.com>
+Date: Fri, 14 Jul 2023 08:45:14 +0000
+Subject: [PATCH] Eliminating compilation warnings when using lto in gcc12 and
+ later versions
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+use -flto=auto when use gcc12 or later
+
+Signed-off-by: 不鱼儿 <36976072+buyuer@users.noreply.github.com>
+---
+ cmake/OpenCVCompilerOptions.cmake | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake
+index d4600943fb0d..8bd86681303e 100644
+--- a/cmake/OpenCVCompilerOptions.cmake
++++ b/cmake/OpenCVCompilerOptions.cmake
+@@ -261,7 +261,11 @@ if(CV_GCC OR CV_CLANG)
+   endif()
+ 
+   if(ENABLE_LTO)
+-    add_extra_compiler_option(-flto)
++    if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
++      add_extra_compiler_option(-flto=auto)
++    else()
++      add_extra_compiler_option(-flto)
++    endif()
+   endif()
+   if(ENABLE_THIN_LTO)
+     add_extra_compiler_option(-flto=thin)

diff --git a/media-libs/opencv/files/opencv-4.8.1-libpng16.patch b/media-libs/opencv/files/opencv-4.8.1-libpng16.patch
new file mode 100644
index 000000000000..a5b2aedb063a
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-libpng16.patch
@@ -0,0 +1,58 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Gentoo installs libpng as libpng16, so adjust the detection.
+
+diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
+index 46b5108..0ff88ea 100644
+--- a/cmake/OpenCVFindLibsGrfmt.cmake
++++ b/cmake/OpenCVFindLibsGrfmt.cmake
+@@ -245,9 +245,9 @@ if(NOT HAVE_SPNG AND WITH_PNG)
+     include(FindPNG)
+     if(PNG_FOUND)
+       include(CheckIncludeFile)
+-      check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
+-      if(HAVE_LIBPNG_PNG_H)
+-        ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
++      check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng16/png.h" HAVE_LIBPNG16_PNG_H)
++      if(HAVE_LIBPNG16_PNG_H)
++        ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/libpng16/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
+       else()
+         ocv_parse_header("${PNG_PNG_INCLUDE_DIR}/png.h" PNG_VERSION_LINES PNG_LIBPNG_VER_MAJOR PNG_LIBPNG_VER_MINOR PNG_LIBPNG_VER_RELEASE)
+       endif()
+@@ -255,7 +255,7 @@ if(NOT HAVE_SPNG AND WITH_PNG)
+   endif()
+
+   if(NOT PNG_FOUND)
+-    ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG_PNG_H PNG_DEFINITIONS)
++    ocv_clear_vars(PNG_LIBRARY PNG_LIBRARIES PNG_INCLUDE_DIR PNG_PNG_INCLUDE_DIR HAVE_LIBPNG16_PNG_H PNG_DEFINITIONS)
+
+     set(PNG_LIBRARY libpng CACHE INTERNAL "")
+     set(PNG_LIBRARIES ${PNG_LIBRARY})
+diff --git a/cmake/templates/cvconfig.h.in b/cmake/templates/cvconfig.h.in
+index d6c7875..005e9b3 100644
+--- a/cmake/templates/cvconfig.h.in
++++ b/cmake/templates/cvconfig.h.in
+@@ -79,7 +79,7 @@
+ #cmakedefine HAVE_JPEG
+
+ /* libpng/png.h needs to be included */
+-#cmakedefine HAVE_LIBPNG_PNG_H
++#cmakedefine HAVE_LIBPNG16_PNG_H
+
+ /* GDCM DICOM codec */
+ #cmakedefine HAVE_GDCM
+diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp
+index 388a3fc..4dde181 100644
+--- a/modules/imgcodecs/src/grfmt_png.cpp
++++ b/modules/imgcodecs/src/grfmt_png.cpp
+@@ -58,8 +58,8 @@
+ #  define _FILE_OFFSET_BITS 0
+ #endif
+
+-#ifdef HAVE_LIBPNG_PNG_H
+-#include <libpng/png.h>
++#ifdef HAVE_LIBPNG16_PNG_H
++#include <libpng16/png.h>
+ #else
+ #include <png.h>
+ #endif

diff --git a/media-libs/opencv/files/opencv-4.8.1-opencv_test.patch b/media-libs/opencv/files/opencv-4.8.1-opencv_test.patch
new file mode 100644
index 000000000000..2bdc2d830570
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-opencv_test.patch
@@ -0,0 +1,18 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+We don't package quirc, so the misplaced #ifdef breaks compilation.
+
+diff --git a/modules/objdetect/test/test_qrcode.cpp b/modules/objdetect/test/test_qrcode.cpp
+index 5e6ec6f..6dc14cc 100644
+--- a/modules/objdetect/test/test_qrcode.cpp
++++ b/modules/objdetect/test/test_qrcode.cpp
+@@ -374,8 +374,8 @@ TEST_P(Objdetect_QRCode_Multi, regression)
+         qrcode = QRCodeDetectorAruco();
+     }
+     std::vector<Point> corners;
+-#ifdef HAVE_QUIRC
+     std::vector<cv::String> decoded_info;
++#ifdef HAVE_QUIRC
+     std::vector<Mat> straight_barcode;
+     EXPECT_TRUE(qrcode.detectAndDecodeMulti(src, decoded_info, corners, straight_barcode));
+     ASSERT_FALSE(corners.empty());

diff --git a/media-libs/opencv/files/opencv-4.8.1-python3_12-support.patch b/media-libs/opencv/files/opencv-4.8.1-python3_12-support.patch
new file mode 100644
index 000000000000..7eae8a180ce6
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-python3_12-support.patch
@@ -0,0 +1,25 @@
+https://github.com/opencv/opencv/pull/23991
+
+From 00ca8f455e6a5588d905e3a0b268f18ee3fda5dd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9rgio=20M=2E=20Basto?= <sergio@serjux.com>
+Date: Sun, 1 Oct 2023 16:12:25 +0100
+Subject: [PATCH] `numpy.distutils` is removed in numpy 1.26 on Python 3.12.
+
+so we don't use numpy.distutils to get includes dirs of python-numpy
+---
+ cmake/OpenCVDetectPython.cmake | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
+index 88a434185622..d4098ce8e60d 100644
+--- a/cmake/OpenCVDetectPython.cmake
++++ b/cmake/OpenCVDetectPython.cmake
+@@ -216,7 +216,7 @@ if(NOT ${found})
+           message(STATUS "  PYTHON3_NUMPY_INCLUDE_DIRS")
+         else()
+           # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
+-          execute_process(COMMAND "${_executable}" -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print(os.pathsep.join(numpy.distutils.misc_util.get_numpy_include_dirs()))"
++          execute_process(COMMAND "${_executable}" -c "import numpy; print(numpy.get_include())"
+                           RESULT_VARIABLE _numpy_process
+                           OUTPUT_VARIABLE _numpy_include_dirs
+                           OUTPUT_STRIP_TRAILING_WHITESPACE)

diff --git a/media-libs/opencv/files/opencv-4.8.1-use-system-flatbuffers.patch b/media-libs/opencv/files/opencv-4.8.1-use-system-flatbuffers.patch
new file mode 100644
index 000000000000..11c42aea0e6d
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-use-system-flatbuffers.patch
@@ -0,0 +1,36 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Find the system flatbuffers and allow for newer revisions.
+
+diff --git a/cmake/OpenCVDetectFlatbuffers.cmake b/cmake/OpenCVDetectFlatbuffers.cmake
+index 537b738..dbfa532 100644
+--- a/cmake/OpenCVDetectFlatbuffers.cmake
++++ b/cmake/OpenCVDetectFlatbuffers.cmake
+@@ -1,12 +1,6 @@
+ if(WITH_FLATBUFFERS)
+-  set(HAVE_FLATBUFFERS 1)
+-  set(flatbuffers_VERSION "23.5.9")
+-  ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt")
+-  ocv_add_external_target(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/include" "" "HAVE_FLATBUFFERS=1")
+-  set(CUSTOM_STATUS_flatbuffers "    Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})")
+-endif()
+-
+-if(WITH_FLATBUFFERS OR HAVE_FLATBUFFERS)
++  find_package(flatbuffers REQUIRED)
++  set(HAVE_FLATBUFFERS "${flatbuffers_FOUND}")
+   list(APPEND CUSTOM_STATUS flatbuffers)
+ 
+   if(HAVE_FLATBUFFERS)
+diff --git a/modules/dnn/misc/tflite/schema_generated.h b/modules/dnn/misc/tflite/schema_generated.h
+index 44162ee..1c3c35a 100644
+--- a/modules/dnn/misc/tflite/schema_generated.h
++++ b/modules/dnn/misc/tflite/schema_generated.h
+@@ -10,7 +10,7 @@
+ // generated, otherwise it may not be compatible.
+ static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
+               FLATBUFFERS_VERSION_MINOR == 5 &&
+-              FLATBUFFERS_VERSION_REVISION == 9,
++              FLATBUFFERS_VERSION_REVISION >= 9,
+              "Non-compatible flatbuffers version included");
+ 
+ namespace opencv_tflite {

diff --git a/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch b/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch
new file mode 100644
index 000000000000..f4efd06897df
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-use-system-opencl.patch
@@ -0,0 +1,25 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Find the system opencl and inject the include dir.
+
+diff --git a/cmake/OpenCVDetectOpenCL.cmake b/cmake/OpenCVDetectOpenCL.cmake
+index 100fb0e..ab30bf9 100644
+--- a/cmake/OpenCVDetectOpenCL.cmake
++++ b/cmake/OpenCVDetectOpenCL.cmake
+@@ -1,3 +1,8 @@
++find_package(OpenCLHeaders REQUIRED)
++if(NOT TARGET OpenCL::Headers)
++  message(FATAL_ERROR "OpenCL::Headers not found")
++endif()
++
+ set(OPENCL_FOUND ON CACHE BOOL "OpenCL library is found")
+ if(APPLE)
+   set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
+@@ -5,6 +10,7 @@ if(APPLE)
+ else()
+   set(OPENCL_LIBRARY "" CACHE STRING "OpenCL library")
+   set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2" CACHE PATH "OpenCL include directory")
++  get_target_property(OPENCL_INCLUDE_DIR OpenCL::Headers INTERFACE_INCLUDE_DIRECTORIES)
+ endif()
+ mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
+ 

diff --git a/media-libs/opencv/files/opencv_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch b/media-libs/opencv/files/opencv_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch
new file mode 100644
index 000000000000..fe66258b15f2
--- /dev/null
+++ b/media-libs/opencv/files/opencv_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch
@@ -0,0 +1,20 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Use tar.gz instead of zip to make CI happy.
+
+diff --git a/modules/cudaoptflow/CMakeLists.txt b/modules/cudaoptflow/CMakeLists.txt
+index b295abc..1e916e5 100644
+--- a/modules/cudaoptflow/CMakeLists.txt
++++ b/modules/cudaoptflow/CMakeLists.txt
+@@ -10,9 +10,9 @@ ocv_define_module(cudaoptflow opencv_video opencv_optflow opencv_cudaarithm open
+ 
+ if(NOT CUDA_VERSION VERSION_LESS "10.0")
+   set(NVIDIA_OPTICAL_FLOW_2_0_HEADERS_COMMIT "edb50da3cf849840d680249aa6dbef248ebce2ca")
+-  set(NVIDIA_OPTICAL_FLOW_2_0_HEADERS_MD5 "a73cd48b18dcc0cc8933b30796074191")
++  set(NVIDIA_OPTICAL_FLOW_2_0_HEADERS_MD5 "5626b1d1c335fbcbf893fcb27e1230be")
+   set(NVIDIA_OPTICAL_FLOW_2_0_HEADERS_PATH "${OpenCV_BINARY_DIR}/3rdparty/NVIDIAOpticalFlowSDK_2_0_Headers")
+-  ocv_download(FILENAME "${NVIDIA_OPTICAL_FLOW_2_0_HEADERS_COMMIT}.zip"
++  ocv_download(FILENAME "${NVIDIA_OPTICAL_FLOW_2_0_HEADERS_COMMIT}.tar.gz"
+                  HASH ${NVIDIA_OPTICAL_FLOW_2_0_HEADERS_MD5}
+                  URL "https://github.com/NVIDIA/NVIDIAOpticalFlowSDK/archive/"
+                  DESTINATION_DIR "${NVIDIA_OPTICAL_FLOW_2_0_HEADERS_PATH}"

diff --git a/media-libs/opencv/files/opencv_contrib-4.8.1-rgbd.patch b/media-libs/opencv/files/opencv_contrib-4.8.1-rgbd.patch
new file mode 100644
index 000000000000..0e1f12d6df46
--- /dev/null
+++ b/media-libs/opencv/files/opencv_contrib-4.8.1-rgbd.patch
@@ -0,0 +1,15 @@
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+
+Fixes compilation when using GLVND.
+
+diff --git a/modules/rgbd/CMakeLists.txt b/modules/rgbd/CMakeLists.txt
+index 79e1562..eaebc3a 100644
+--- a/modules/rgbd/CMakeLists.txt
++++ b/modules/rgbd/CMakeLists.txt
+@@ -7,5 +7,5 @@ if(NOT HAVE_EIGEN)
+ endif()
+ 
+ if(HAVE_OPENGL)
+-  ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}")
++  ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}" GL)
+ endif()

diff --git a/media-libs/opencv/metadata.xml b/media-libs/opencv/metadata.xml
index 67f63c03fd9d..80f1912bd4fd 100644
--- a/media-libs/opencv/metadata.xml
+++ b/media-libs/opencv/metadata.xml
@@ -16,32 +16,38 @@
 	</longdescription>
 	<use>
 		<flag name="contrib">Install user contributed scripts from opencv_contrib (Experimental!)</flag>
+		<flag name="contribcvv">Enable CVV in contrib (requires Qt5)</flag>
+		<flag name="contribdnn">Enable DNN module contrib (requires tinydnn)</flag>
+		<flag name="contribfreetype">Enable Drawing UTF-8 strings with <pkg>media-libs/freetype</pkg>&amp;<pkg>media-libs/harfbuzz</pkg></flag>
+		<flag name="contribhdf">Enable HDF module (requires <pkg>sci-libs/hdf5</pkg>)</flag>
+		<flag name="contribovis">Enable OGRE vision module support (<pkg>dev-games/ogre</pkg>)</flag>
+		<flag name="contribsfm">Enable SFM module (requires USE="eigen gflags glog")</flag>
+		<flag name="contribxfeatures2d" restrict="&gt;media-libs/opencv-4.8.1-r1">Enable xfeatures2d in contrib</flag>
+		<flag name="contribxfeatures2d" restrict="&lt;=media-libs/opencv-4.8.1">Enables xfeatures2d and autodownload of samples in contrib</flag>
 		<flag name="cuda">Enable NVIDIA Cuda computations support (Experimental!)</flag>
-		<flag restrict="&gt;=media-libs/opencv-4.1.2" name="download">Enable download during cmake configure</flag>
+		<flag name="cudnn">Enable support for nVidia cuDNN library</flag>
+		<flag name="dnnsamples">Enable dnn caffeemodel samples</flag>
+		<flag name="download">Enable download during cmake configure</flag>
 		<flag name="eigen">Enable usage of <pkg>dev-cpp/eigen</pkg> for computations</flag>
 		<flag name="features2d">Enable features2d module</flag>
 		<flag name="gdal">Enable support for <pkg>sci-libs/gdal</pkg> library</flag>
+		<flag name="gflags">Use Google's C++ argument parsing library (<pkg>dev-cpp/gflags</pkg>)</flag>
+		<flag name="glog">Use Google's C++ logging library (<pkg>dev-cpp/glog</pkg>)</flag>
 		<flag name="gtk3">Enable <pkg>x11-libs/gtk+</pkg>:3 support</flag>
-		<flag restrict="&gt;=media-libs/opencv-4.4.0" name="lto">Build using Link Time Optimizations (LTO)</flag>
-		<flag restrict="&gt;=media-libs/opencv-4.1.2" name="opencvapps">Enable compilation with opencvapps</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="gflags">Use Google's C++ argument parsing library</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="glog">Use Google's C++ loggin library</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contribxfeatures2d">Enables xfeatures2d and autodownload of samples in contrib</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contribcvv">CVV module requires Qt5</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.3.0" name="contribdnn">DNN module contrib requires tiny dnn</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contribhdf">HDF module requires <pkg>sci-libs/hdf5</pkg></flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="contribsfm">SFM module requires eigen, gflags, and glog</flag>
-		<flag restrict="&gt;=media-libs/opencv-4.4.0" name="contribfreetype">Enable Drawing UTF-8 strings with freetype/harfbuzz</flag>
-		<flag restrict="&gt;=media-libs/opencv-4.4.0" name="contribovis">Enable Ogre vision module support</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.4.0" name="dnnsamples">Download dnn caffeemodel samples</flag>
-		<flag restrict="&gt;=media-libs/opencv-3.1.0" name="tesseract">Use Google's OCR Engine</flag>
+		<flag name="lto">Build using Link Time Optimizations (LTO)</flag>
+		<flag name="non-free">Enable non-free components</flag>
+		<flag name="opencvapps">Enable compilation with opencvapps</flag>
+		<flag name="tbb">Enable multithreading with the Intel Threads Building Block (<pkg>dev-cpp/tbb</pkg>)</flag>
+		<flag name="tesseract">Use Google's OCR Engine</flag>
 		<flag name="testprograms">Build and install programs for testing OpenCV (performance)</flag>
+		<flag name="video_cards_intel">Enable Video Acceleration API for hardware decoding for Intel cards</flag>
 		<flag name="vtk">Build new 3D visualization module viz based on <pkg>sci-libs/vtk</pkg></flag>
 	</use>
 	<upstream>
 		<remote-id type="cpe">cpe:/a:opencv:opencv</remote-id>
 		<remote-id type="github">opencv/opencv</remote-id>
 		<remote-id type="github">opencv/opencv_contrib</remote-id>
+		<remote-id type="github">opencv/opencv_3rdparty</remote-id>
 		<remote-id type="sourceforge">opencvlibrary</remote-id>
 	</upstream>
 </pkgmetadata>

diff --git a/media-libs/opencv/opencv-4.8.1-r1.ebuild b/media-libs/opencv/opencv-4.8.1-r1.ebuild
new file mode 100644
index 000000000000..2ac1b3b9fcc5
--- /dev/null
+++ b/media-libs/opencv/opencv-4.8.1-r1.ebuild
@@ -0,0 +1,644 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+inherit cuda java-pkg-opt-2 java-ant-2 cmake-multilib python-r1 toolchain-funcs
+
+DESCRIPTION="A collection of algorithms and sample code for various computer vision problems"
+HOMEPAGE="https://opencv.org"
+
+ADE_PV="0.1.2a" # branch master
+QRCODE_COMMIT="a8b69ccc738421293254aec5ddb38bd523503252" # branch wechat_qrcode_20210119
+DNN_SAMPLES_FACE_DETECTOR_COMMIT="b2bfc75f6aea5b1f834ff0f0b865a7c18ff1459f" # branch dnn_samples_face_detector_20170830
+XFEATURES2D_BOOSTDESC_COMMIT="34e4206aef44d50e6bbcd0ab06354b52e7466d26" # branch contrib_xfeatures2d_boostdesc_20161012
+XFEATURES2D_VGG_COMMIT="fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d" # branch contrib_xfeatures2d_vgg_20160317
+FACE_ALIGNMENT_COMMIT="8afa57abc8229d611c4937165d20e2a2d9fc5a12" # branch contrib_face_alignment_20170818
+NVIDIA_OPTICAL_FLOW_COMMIT="edb50da3cf849840d680249aa6dbef248ebce2ca" # branch nvof_2_0_bsd
+
+SRC_URI="https://github.com/${PN}/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+	https://github.com/opencv/ade/archive/v${ADE_PV}.tar.gz -> ade-${ADE_PV}.tar.gz
+	contrib? (
+		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
+		dnnsamples? (
+			https://github.com/${PN}/${PN}_3rdparty/archive/${QRCODE_COMMIT}.tar.gz -> ${PN}_3rdparty-${QRCODE_COMMIT}.tar.gz
+			https://github.com/${PN}/${PN}_3rdparty/archive/${DNN_SAMPLES_FACE_DETECTOR_COMMIT}.tar.gz
+			 -> ${PN}_3rdparty-${DNN_SAMPLES_FACE_DETECTOR_COMMIT}.tar.gz
+		)
+		contribxfeatures2d? (
+			https://github.com/${PN}/${PN}_3rdparty/archive/${XFEATURES2D_BOOSTDESC_COMMIT}.tar.gz
+			 -> ${PN}_3rdparty-${XFEATURES2D_BOOSTDESC_COMMIT}.tar.gz
+			https://github.com/${PN}/${PN}_3rdparty/archive/${XFEATURES2D_VGG_COMMIT}.tar.gz
+			 -> ${PN}_3rdparty-${XFEATURES2D_VGG_COMMIT}.tar.gz
+		)
+		contribdnn? (
+			https://github.com/${PN}/${PN}_3rdparty/archive/${FACE_ALIGNMENT_COMMIT}.tar.gz
+			 -> ${PN}_3rdparty-${FACE_ALIGNMENT_COMMIT}.tar.gz
+		)
+		cuda? (
+			https://github.com/NVIDIA/NVIDIAOpticalFlowSDK/archive/${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz
+			 -> NVIDIAOpticalFlowSDK-${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz
+		)
+	)
+"
+
+LICENSE="Apache-2.0"
+SLOT="0/${PV}" # subslot = libopencv* soname version
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="contrib contribcvv contribdnn contribfreetype contribhdf contribovis contribsfm contribxfeatures2d cuda cudnn debug dnnsamples +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack non-free opencl openexr opengl openmp opencvapps png +python qt5 qt6 tesseract testprograms tbb tiff vaapi v4l vtk webp xine video_cards_intel"
+
+# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications
+ARM_CPU_FEATURES=(
+	cpu_flags_arm_neon:NEON
+	cpu_flags_arm_vfpv3:VFPV3
+)
+PPC_CPU_FEATURES=(
+	cpu_flags_ppc_vsx:VSX
+	cpu_flags_ppc_vsx3:VSX3
+)
+X86_CPU_FEATURES_RAW=(
+	sse:SSE
+	sse2:SSE2
+	sse3:SSE3
+	ssse3:SSSE3
+	sse4_1:SSE4_1
+	popcnt:POPCNT
+	sse4_2:SSE4_2
+	f16c:FP16
+	fma3:FMA3
+	avx:AVX
+	avx2:AVX2
+	avx512f:AVX_512F
+)
+X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
+CPU_FEATURES_MAP=(
+	${ARM_CPU_FEATURES[@]}
+	${PPC_CPU_FEATURES[@]}
+	${X86_CPU_FEATURES[@]}
+)
+IUSE="${IUSE} ${CPU_FEATURES_MAP[@]%:*}"
+
+# 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.
+# cuda needs contrib, bug #701712
+REQUIRED_USE="
+	cpu_flags_x86_avx2? ( cpu_flags_x86_f16c )
+	cpu_flags_x86_f16c? ( cpu_flags_x86_avx )
+	cuda? (
+		contrib
+		tesseract? ( opencl )
+	)
+	cudnn? ( cuda )
+	dnnsamples? ( examples )
+	gflags? ( contrib )
+	glog? ( contrib )
+	contribcvv? ( contrib || ( qt5 qt6 ) )
+	contribdnn? ( contrib )
+	contribfreetype? ( contrib )
+	contribhdf? ( contrib )
+	contribovis? ( contrib )
+	contribsfm? ( contrib eigen gflags glog )
+	contribxfeatures2d? ( contrib )
+	java? ( python )
+	opengl? ( || ( qt5 qt6 ) )
+	python? ( ${PYTHON_REQUIRED_USE} )
+	tesseract? ( contrib )
+	?? ( gtk3 || ( qt5 qt6 ) )
+	?? ( cuda gdal )
+	?? ( cuda openexr )
+	?? ( cuda tbb )
+"
+
+# The following logic is intrinsic in the build system, but we do not enforce
+# it on the useflags since this just blocks emerging pointlessly:
+#	openmp? ( !tbb )
+
+RDEPEND="
+	app-arch/bzip2[${MULTILIB_USEDEP}]
+	<dev-libs/protobuf-23:=[${MULTILIB_USEDEP}]
+	sys-libs/zlib[${MULTILIB_USEDEP}]
+	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
+	cudnn? ( dev-libs/cudnn:= )
+	contribdnn? ( dev-libs/flatbuffers:= )
+	contribhdf? ( sci-libs/hdf5:= )
+	contribfreetype? (
+		media-libs/freetype:2[${MULTILIB_USEDEP}]
+		media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
+	)
+	contribovis? ( >=dev-games/ogre-1.12:= )
+	ffmpeg? ( 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}]
+	)
+	gtk3? (
+		dev-libs/glib:2[${MULTILIB_USEDEP}]
+		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+	)
+	ieee1394? (
+		media-libs/libdc1394:=[${MULTILIB_USEDEP}]
+		sys-libs/libraw1394[${MULTILIB_USEDEP}]
+	)
+	java? ( >=virtual/jre-1.8:* )
+	jpeg? ( media-libs/libjpeg-turbo:=[${MULTILIB_USEDEP}] )
+	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
+	lapack? (
+		virtual/cblas
+		>=virtual/lapack-3.10
+		virtual/lapacke
+	)
+	opencl? (
+		virtual/opencl[${MULTILIB_USEDEP}]
+		dev-util/opencl-headers
+	)
+	openexr? (
+		dev-libs/imath:=
+		media-libs/openexr:=
+	)
+	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 )
+	)
+	!qt5? (
+		qt6? (
+			dev-qt/qtbase:6[gui,widgets,concurrent,opengl?]
+		)
+	)
+	tesseract? ( app-text/tesseract[opencl=,${MULTILIB_USEDEP}] )
+	tbb? ( dev-cpp/tbb:=[${MULTILIB_USEDEP}] )
+	tiff? ( media-libs/tiff:=[${MULTILIB_USEDEP}] )
+	v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
+	vaapi? ( media-libs/libva[${MULTILIB_USEDEP}] )
+	vtk? ( sci-libs/vtk:=[rendering,cuda=] )
+	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
+	xine? ( media-libs/xine-lib )"
+DEPEND="${RDEPEND}
+	eigen? ( >=dev-cpp/eigen-3.3.8-r1:3 )
+	java? ( >=virtual/jdk-1.8:* )"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.4.0-disable-download.patch"
+	"${FILESDIR}/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch"
+	"${FILESDIR}/${PN}-4.1.2-opencl-license.patch"
+	"${FILESDIR}/${PN}-4.4.0-disable-native-cpuflag-detect.patch"
+	"${FILESDIR}/${PN}-4.5.0-link-with-cblas-for-lapack.patch"
+	"${FILESDIR}/${PN}-4.8.0-arm64-fp16.patch"
+	"${FILESDIR}/${PN}-4.8.0-fix-cuda-12.2.0.patch"
+
+	"${FILESDIR}/${PN}-4.8.1-use-system-flatbuffers.patch"
+	"${FILESDIR}/${PN}-4.8.1-eliminate-lto-compiler-warnings.patch"
+	"${FILESDIR}/${PN}-4.8.1-python3_12-support.patch"
+
+	"${FILESDIR}/${PN}-4.8.1-use-system-opencl.patch"
+	"${FILESDIR}/${PN}-4.8.1-opencv_test.patch"
+	"${FILESDIR}/${PN}-4.8.1-drop-python2-detection.patch"
+	"${FILESDIR}/${PN}-4.8.1-libpng16.patch"
+	"${FILESDIR}/${PN}-4.8.1-ade-0.1.2a.tar.gz.patch"
+
+	# TODO applied in src_prepare
+	# "${FILESDIR}/${PN}_contrib-${PV}-rgbd.patch"
+	# "${FILESDIR}/${PN}_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch"
+)
+
+pkg_pretend() {
+	if use cuda && [[ -z "${CUDA_GENERATION}" ]] && [[ -z "${CUDA_ARCH_BIN}" ]]; then
+		einfo "The target CUDA architecture can be set via one of:"
+		einfo "  - CUDA_GENERATION set to one of Maxwell, Pascal, Volta, Turing, Ampere, Lovelace, Hopper, Auto"
+		einfo "  - CUDA_ARCH_BIN, (and optionally CUDA_ARCH_PTX) in the form of x.y tuples."
+		einfo "      You can specify multiple tuple separated by \";\"."
+		einfo ""
+		einfo "The CUDA architecture tuple for your device can be found at https://developer.nvidia.com/cuda-gpus."
+	fi
+
+	if [[ ${MERGE_TYPE} == "buildonly" ]] && [[ -n "${CUDA_GENERATION}" || -n "${CUDA_ARCH_BIN}" ]]; then
+		local info_message="When building a binary package it's recommended to unset CUDA_GENERATION and CUDA_ARCH_BIN"
+		einfo "$info_message so all available architectures are build."
+	fi
+
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+	use java && java-pkg-opt-2_pkg_setup
+}
+
+src_unpack() {
+	unpack $(echo "${A}" | tr ' ' '\n' | grep -vP "(ade-0.1.2|NVIDIAOpticalFlowSDK)")
+}
+
+src_prepare() {
+	if use cuda; then
+		export CUDA_VERBOSE="$(usex debug "true" "false")"
+		cuda_src_prepare
+	fi
+
+	cmake_src_prepare
+
+	# remove bundled stuff
+	rm -r 3rdparty || die "Removing 3rd party components failed"
+	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
+		-i CMakeLists.txt cmake/*cmake || die
+
+	if use contrib; then
+		cd "${WORKDIR}/${PN}_contrib-${PV}" || die
+		eapply "${FILESDIR}/${PN}_contrib-${PV}-rgbd.patch"
+		eapply "${FILESDIR}/${PN}_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch"
+		cd "${S}" || die
+
+		! use contribcvv && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/cvv" || die; }
+		# ! use contribdnn && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/dnn" || die; }
+		! use contribfreetype && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/freetype" || die; }
+		! use contribhdf && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/hdf" || die; }
+		! use contribovis && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/ovis" || die; }
+		! use contribsfm && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/sfm" || die; }
+		! use contribxfeatures2d && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/xfeatures2d" || die; }
+	fi
+
+	mkdir -p "${S}/.cache/ade" || die
+	cp \
+		"${DISTDIR}/ade-${ADE_PV}.tar.gz" \
+		"${S}/.cache/ade/$(md5sum "${DISTDIR}/ade-${ADE_PV}.tar.gz" | cut -f 1 -d " ")-v${ADE_PV}.tar.gz" || die
+
+	if use dnnsamples; then
+		mkdir -p "${S}/.cache/wechat_qrcode" || die
+		for file in "detect.caffemodel" "detect.prototxt" "sr.prototxt" "sr.caffemodel"; do
+			mv \
+				"${WORKDIR}/${PN}_3rdparty-${QRCODE_COMMIT}/${file}" \
+				"${S}/.cache/wechat_qrcode/$( \
+					md5sum "${WORKDIR}/${PN}_3rdparty-${QRCODE_COMMIT}/${file}" | cut -f 1 -d " " \
+				)-${file}" || die
+		done
+
+		mv \
+			"${WORKDIR}/${PN}_3rdparty-${DNN_SAMPLES_FACE_DETECTOR_COMMIT}/res10_300x300_ssd_iter_140000.caffemodel" \
+			"${S}/samples/dnn/" || die
+	fi
+
+	if use contribxfeatures2d; then
+		cp \
+			"${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_BOOSTDESC_COMMIT}/"*.i \
+			"${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
+		mkdir -p "${S}/.cache/xfeatures2d/boostdesc" || die
+		for file in "${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_BOOSTDESC_COMMIT}/"*.i; do
+			mv \
+				"${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_BOOSTDESC_COMMIT}/$(basename "${file}")" \
+				"${S}/.cache/xfeatures2d/boostdesc/$( \
+					md5sum "${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_BOOSTDESC_COMMIT}/$(basename "${file}")" | cut -f 1 -d " " \
+				)-$(basename "${file}")" || die
+		done
+
+		cp \
+			"${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_VGG_COMMIT}/"*.i \
+			"${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
+		mkdir -p "${S}/.cache/xfeatures2d/vgg" || die
+		for file in "${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_VGG_COMMIT}/"*.i; do
+			mv \
+				"${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_VGG_COMMIT}/$(basename "${file}")" \
+				"${S}/.cache/xfeatures2d/vgg/$( \
+					md5sum "${WORKDIR}/${PN}_3rdparty-${XFEATURES2D_VGG_COMMIT}/$(basename "${file}")" | cut -f 1 -d " " \
+				)-$(basename "${file}")" || die
+		done
+	fi
+
+	if use contribdnn; then
+		mkdir -p "${S}/.cache/data" || die
+		for file in "face_landmark_model.dat"; do
+			mv \
+				"${WORKDIR}/${PN}_3rdparty-${FACE_ALIGNMENT_COMMIT}/${file}" \
+				"${S}/.cache/data/$( \
+					md5sum "${WORKDIR}/${PN}_3rdparty-${FACE_ALIGNMENT_COMMIT}/${file}" | cut -f 1 -d " " \
+				)-${file}" || die
+		done
+	fi
+
+	if use cuda; then
+		mkdir -p "${S}/.cache/nvidia_optical_flow"
+		cp \
+			"${DISTDIR}/NVIDIAOpticalFlowSDK-${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz" \
+			"${S}/.cache/nvidia_optical_flow/$( \
+				md5sum "${DISTDIR}/NVIDIAOpticalFlowSDK-${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz" | cut -f 1 -d " " \
+			)-${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz" || die
+	fi
+
+	if use java; then
+		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"
+	fi
+}
+
+multilib_src_configure() {
+	# please dont sort here, order is the same as in CMakeLists.txt
+	local mycmakeargs=(
+		-DMIN_VER_CMAKE=3.26
+
+		-DCMAKE_POLICY_DEFAULT_CMP0146="OLD" # FindCUDA
+		-DCMAKE_POLICY_DEFAULT_CMP0148="OLD" # FindPythonInterp
+
+		# for protobuf
+		-DCMAKE_CXX_STANDARD=14
+
+	# Optional 3rd party components
+	# ===================================================
+		-DENABLE_DOWNLOAD=yes
+		-DOPENCV_ENABLE_NONFREE=$(usex non-free)
+		-DWITH_QUIRC=OFF # Do not have dependencies
+		-DWITH_FLATBUFFERS=$(usex contribdnn)
+		-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 gtk3)
+		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
+		-DWITH_IPP=OFF
+		# Jasper was removed from tree because of security problems.
+		# Upstream were/are making progress. We use openjpeg instead.
+		# bug 734284
+		-DWITH_JASPER=OFF
+		-DWITH_JPEG=$(usex jpeg)
+		-DWITH_OPENJPEG=$(usex jpeg2k)
+		-DWITH_WEBP=$(usex webp)
+		-DWITH_OPENEXR=$(multilib_native_usex openexr)
+		-DWITH_OPENGL=$(usex opengl)
+		-DOpenGL_GL_PREFERENCE="GLVND"
+		-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_WIN32UI=OFF		# Windows only
+	#	-DWITH_QUICKTIME=OFF
+	#	-DWITH_QTKIT=OFF
+		-DWITH_TBB=$(usex tbb)
+		-DWITH_OPENMP=$(usex !tbb $(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_IPP_A=OFF
+		-DWITH_MATLAB=OFF
+		-DWITH_VA=$(usex vaapi)
+		-DWITH_VA_INTEL=$(usex vaapi $(usex video_cards_intel))
+		-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
+	# ===================================================
+		-DWITH_CUDA=$(multilib_native_usex cuda)
+		-DWITH_CUBLAS=$(multilib_native_usex cuda)
+		-DWITH_CUFFT=$(multilib_native_usex cuda)
+		-DWITH_CUDNN=$(multilib_native_usex cudnn)
+		-DWITH_NVCUVID="no"
+		-DCUDA_NPP_LIBRARY_ROOT_DIR=$(usex cuda "${EPREFIX}/opt/cuda" "")
+	# ===================================================
+	# OpenCV build components
+	# ===================================================
+		-DBUILD_SHARED_LIBS=ON
+		-DBUILD_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
+		-DBUILD_ANDROID_EXAMPLES=OFF
+		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
+		-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)
+		-DOPENCV_ENABLE_MEMORY_SANITIZER=$(usex debug)
+	#	-DBUILD_WITH_STATIC_CRT=OFF
+		-DBUILD_WITH_DYNAMIC_IPP=OFF
+		-DBUILD_FAT_JAVA_LIB=OFF
+	#	-DBUILD_ANDROID_SERVICE=OFF
+		-DBUILD_CUDA_STUBS=$(multilib_native_usex cuda)
+		-DOPENCV_EXTRA_MODULES_PATH=$(usex contrib "${WORKDIR}/${PN}_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
+		-DOPENCV_GENERATE_PKGCONFIG=ON
+		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
+		# to set its destination libdir
+		-DLIB_SUFFIX=
+	# ===================================================
+	# OpenCV build options
+	# ===================================================
+		-DENABLE_CCACHE=OFF
+		# bug 733796, but PCH is a risky game in CMake anyway
+		-DENABLE_PRECOMPILED_HEADERS=OFF
+		-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
+		# -DENABLE_LTO=$(usex lto)
+	# ===================================================
+	# things we want to be hard off or not yet figured out
+	# ===================================================
+		-DBUILD_PACKAGE=OFF
+	# ===================================================
+	# Not building protobuf but update files bug #631418
+	# ===================================================
+		-DWITH_PROTOBUF=ON
+		-DBUILD_PROTOBUF=OFF
+		-DPROTOBUF_UPDATE_FILES=ON
+		-DProtobuf_MODULE_COMPATIBLE=ON
+	# ===================================================
+	# things we want to be hard enabled not worth useflag
+	# ===================================================
+		-DCMAKE_SKIP_RPATH=ON
+		-DOPENCV_DOC_INSTALL_PATH=
+		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
+	)
+
+	if use qt5; then
+		mycmakeargs+=(
+			-DWITH_QT=$(multilib_native_usex qt5 ON OFF)
+			-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON
+		)
+	elif use qt6; then
+		mycmakeargs+=(
+			-DWITH_QT=$(multilib_native_usex qt6 ON OFF)
+			-DCMAKE_DISABLE_FIND_PACKAGE_Qt5=ON
+		)
+	else
+		mycmakeargs+=(
+			-DWITH_QT=OFF
+			-DCMAKE_DISABLE_FIND_PACKAGE_Qt5=ON
+			-DCMAKE_DISABLE_FIND_PACKAGE_Qt6=ON
+		)
+	fi
+
+	# ==================================================
+	# cpu flags, should solve 633900
+	#===================================================
+	local CPU_BASELINE=""
+	for i in "${CPU_FEATURES_MAP[@]}" ; do
+		if [[ ${ABI} != x86 || ${i%:*} != "cpu_flags_x86_avx2" ]]; then # workaround for Bug 747163
+			use ${i%:*} && CPU_BASELINE="${CPU_BASELINE}${i#*:};"
+		fi
+	done
+
+	mycmakeargs+=(
+		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
+		-DCPU_BASELINE="${CPU_BASELINE}"
+		-DCPU_DISPATCH=
+	)
+
+	# ===================================================
+	# OpenCV Contrib Modules
+	# ===================================================
+	if use contrib; then
+		mycmakeargs+=(
+			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
+			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
+			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
+			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
+			-DBUILD_opencv_sfm=$(usex contribsfm ON OFF)
+			-DBUILD_opencv_freetype=$(usex contribfreetype ON OFF)
+			-DBUILD_opencv_ovis=$(usex contribovis ON OFF)
+		)
+
+		if multilib_is_native_abi; then
+			mycmakeargs+=(
+				-DCMAKE_DISABLE_FIND_PACKAGE_Tesseract=$(usex !tesseract)
+			)
+		else
+			mycmakeargs+=(
+				-DCMAKE_DISABLE_FIND_PACKAGE_Tesseract=ON
+			)
+		fi
+	fi
+
+	# workaround for bug 413429
+	tc-export CC CXX
+
+	if use cuda; then
+		cuda_add_sandbox -w
+
+		if [[ -n "${CUDA_GENERATION}" ]]; then
+			mycmakeargs+=(
+				-DCUDA_GENERATION="${CUDA_GENERATION}"
+			)
+		fi
+
+		if [[ -n "${CUDA_ARCH_BIN}" ]]; then
+				mycmakeargs+=(
+					-DCUDA_ARCH_BIN="${CUDA_ARCH_BIN}"
+				)
+
+			if [[ -n "${CUDA_ARCH_PTX}" ]]; then
+				mycmakeargs+=(
+					-DCUDA_ARCH_PTX="${CUDA_ARCH_PTX}"
+				)
+			fi
+		fi
+
+		local NVCCFLAGS_OpenCV="${NVCCFLAGS// /\;}"
+		mycmakeargs+=(
+			-DOPENCV_CUDA_DETECTION_NVCC_FLAGS="-ccbin=$(cuda_gccdir)"
+			-DCUDA_NVCC_FLAGS="-forward-unknown-opts;${NVCCFLAGS_OpenCV//\"/}"
+		)
+
+		use vtk && mycmakeargs+=(
+			-DCMAKE_CUDA_FLAGS="-forward-unknown-opts ${NVCCFLAGS//\;/ }"
+		)
+	fi
+
+	if multilib_is_native_abi && use python; then
+		python_configure() {
+			# Set all python variables to load the correct Gentoo paths
+			local mycmakeargs=(
+				"${mycmakeargs[@]}"
+				# python_setup alters PATH and sets this as wrapper
+				# to the correct interpreter we are building for
+				-DPYTHON_DEFAULT_EXECUTABLE="${EPYTHON}"
+				-DINSTALL_PYTHON_EXAMPLES="$(usex examples)"
+			)
+			cmake_src_configure
+			use java && java-ant-2_src_configure
+		}
+
+		python_foreach_impl python_configure
+	else
+		mycmakeargs+=(
+			-DPYTHON_EXECUTABLE=OFF
+			-DINSTALL_PYTHON_EXAMPLES=OFF
+			-DBUILD_opencv_python2=OFF
+			-DBUILD_opencv_python3=OFF
+		)
+		cmake_src_configure
+		use java && java-ant-2_src_configure
+	fi
+
+}
+
+multilib_src_compile() {
+	if multilib_is_native_abi && use python; then
+		python_foreach_impl cmake_src_compile
+	else
+		cmake_src_compile
+	fi
+}
+
+multilib_src_install() {
+	if multilib_is_native_abi && use python; then
+		python_foreach_impl cmake_src_install
+		python_foreach_impl python_optimize
+	else
+		cmake_src_install
+	fi
+}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2024-02-04 12:45 Andreas Sturmlechner
  0 siblings, 0 replies; 27+ messages in thread
From: Andreas Sturmlechner @ 2024-02-04 12:45 UTC (permalink / raw
  To: gentoo-commits

commit:     5c080f8d73d1351815fa52e13155c6a12093693f
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  4 10:39:56 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Feb  4 12:44:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c080f8d

media-libs/opencv: Fix build with >=dev-libs/protobuf-22

Urgent fix since someone decided to bump dev-libs/protobuf-22.5 ...

Closes: https://bugs.gentoo.org/909087
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../opencv/files/opencv-4.8.1-protobuf-22.patch    | 190 +++++++++++++++++++++
 media-libs/opencv/opencv-4.8.1-r1.ebuild           |   4 +-
 2 files changed, 193 insertions(+), 1 deletion(-)

diff --git a/media-libs/opencv/files/opencv-4.8.1-protobuf-22.patch b/media-libs/opencv/files/opencv-4.8.1-protobuf-22.patch
new file mode 100644
index 000000000000..1e8a369777a5
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.8.1-protobuf-22.patch
@@ -0,0 +1,190 @@
+From 6f3dde396f6eed53afcd5cc882402e18ff7c1ca8 Mon Sep 17 00:00:00 2001
+From: Kumataro <Kumataro@users.noreply.github.com>
+Date: Sat, 7 Oct 2023 10:11:25 +0900
+Subject: [PATCH] 3rdparty: supporting protobuf v22 and later
+
+subsumes:
+
+- dnn: disable some tests for external protobuf
+- use GREATER instead of GREATER_EQUAL and remove new blank line at EOF
+- fix for BUILD_TESTS=OFF
+- Use Config mode in CMake.
+
+(cleaning up review noise)
+
+---
+ cmake/OpenCVFindProtobuf.cmake   | 35 +++++++++++++++++++++++++++-----
+ modules/dnn/CMakeLists.txt       |  6 ++++++
+ modules/dnn/test/test_layers.cpp | 24 ++++++++++++++++++----
+ 3 files changed, 56 insertions(+), 9 deletions(-)
+
+diff --git a/cmake/OpenCVFindProtobuf.cmake b/cmake/OpenCVFindProtobuf.cmake
+index 8835347..5b1e175 100644
+--- a/cmake/OpenCVFindProtobuf.cmake
++++ b/cmake/OpenCVFindProtobuf.cmake
+@@ -30,8 +30,14 @@ if(BUILD_PROTOBUF)
+   set(Protobuf_LIBRARIES "libprotobuf")
+   set(HAVE_PROTOBUF TRUE)
+ else()
++  # we still need this for command PROTOBUF_GENERATE_CPP.
++  set(protobuf_MODULE_COMPATIBLE ON)
++
+   unset(Protobuf_VERSION CACHE)
+-  find_package(Protobuf QUIET)
++  find_package(Protobuf QUIET CONFIG)
++  if(NOT Protobuf_FOUND)
++    find_package(Protobuf QUIET)
++  endif()
+ 
+   # Backwards compatibility
+   # Define camel case versions of input variables
+@@ -67,6 +73,20 @@ else()
+   endif()
+ endif()
+ 
++# See https://github.com/opencv/opencv/issues/24369
++# In Protocol Buffers v22.0 and later drops C++11 support and depends abseil-cpp.
++#   Details: https://protobuf.dev/news/2022-08-03/
++# And if std::text_view is in abseil-cpp requests C++17 and later.
++
++if(HAVE_PROTOBUF)
++  if(NOT (Protobuf_VERSION VERSION_LESS 22))
++    if((CMAKE_CXX_STANDARD EQUAL 98) OR (CMAKE_CXX_STANDARD LESS 17))
++      message(STATUS "CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} is too old to support protobuf(${Protobuf_VERSION}) and/or abseil-cpp. Use C++17 or later. Turning HAVE_PROTOBUF off")
++      set(HAVE_PROTOBUF FALSE)
++    endif()
++  endif()
++endif()
++
+ if(HAVE_PROTOBUF AND PROTOBUF_UPDATE_FILES AND NOT COMMAND PROTOBUF_GENERATE_CPP)
+   message(FATAL_ERROR "Can't configure protobuf dependency (BUILD_PROTOBUF=${BUILD_PROTOBUF} PROTOBUF_UPDATE_FILES=${PROTOBUF_UPDATE_FILES})")
+ endif()
+@@ -74,15 +94,20 @@ endif()
+ if(HAVE_PROTOBUF)
+   list(APPEND CUSTOM_STATUS protobuf)
+   if(NOT BUILD_PROTOBUF)
++    unset( __location)
+     if(TARGET "${Protobuf_LIBRARIES}")
+       get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION_RELEASE)
+       if(NOT __location)
+         get_target_property(__location "${Protobuf_LIBRARIES}" IMPORTED_LOCATION)
+       endif()
+-    elseif(Protobuf_LIBRARY)
+-      set(__location "${Protobuf_LIBRARY}")
+-    else()
+-      set(__location "${Protobuf_LIBRARIES}")
++    endif()
++
++    if(NOT __location)
++      if(Protobuf_LIBRARY)
++        set(__location "${Protobuf_LIBRARY}")
++      else()
++        set(__location "${Protobuf_LIBRARIES}")
++      endif()
+     endif()
+   endif()
+   list(APPEND CUSTOM_STATUS_protobuf "    Protobuf:"
+diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt
+index 804b78e..9fcc460 100644
+--- a/modules/dnn/CMakeLists.txt
++++ b/modules/dnn/CMakeLists.txt
+@@ -245,6 +245,12 @@ ocv_create_module(${libs} ${dnn_runtime_libs})
+ ocv_add_samples()
+ ocv_add_accuracy_tests(${dnn_runtime_libs})
+ 
++if(NOT BUILD_PROTOBUF)
++  if(TARGET opencv_test_dnn)
++    ocv_target_compile_definitions(opencv_test_dnn PRIVATE "OPENCV_DNN_EXTERNAL_PROTOBUF=1")
++  endif()
++endif()
++
+ set(perf_path "${CMAKE_CURRENT_LIST_DIR}/perf")
+ file(GLOB_RECURSE perf_srcs "${perf_path}/*.cpp")
+ file(GLOB_RECURSE perf_hdrs "${perf_path}/*.hpp" "${perf_path}/*.h")
+diff --git a/modules/dnn/test/test_layers.cpp b/modules/dnn/test/test_layers.cpp
+index 763d94b..6cb6d54 100644
+--- a/modules/dnn/test/test_layers.cpp
++++ b/modules/dnn/test/test_layers.cpp
+@@ -756,11 +756,15 @@ TEST_F(Layer_RNN_Test, get_set_test)
+ 
+ TEST_P(Test_Caffe_layers, Accum)
+ {
++#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
++    throw SkipTestException("Requires patched protobuf");
++#else
+     if (backend == DNN_BACKEND_OPENCV && target != DNN_TARGET_CPU)
+         applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
+ 
+     testLayerUsingCaffeModels("accum", false, false, 0.0, 0.0, 2);
+     testLayerUsingCaffeModels("accum_ref", false, false, 0.0, 0.0, 2);
++#endif
+ }
+ 
+ TEST_P(Test_Caffe_layers, FlowWarp)
+@@ -780,27 +784,39 @@ TEST_P(Test_Caffe_layers, ChannelNorm)
+ 
+ TEST_P(Test_Caffe_layers, DataAugmentation)
+ {
++#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
++    throw SkipTestException("Requires patched protobuf");
++#else
+     if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
+         applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
+     testLayerUsingCaffeModels("data_augmentation", true, false);
+     testLayerUsingCaffeModels("data_augmentation_2x1", true, false);
+     testLayerUsingCaffeModels("data_augmentation_8x6", true, false);
++#endif
+ }
+ 
+ TEST_P(Test_Caffe_layers, Resample)
+ {
++#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
++    throw SkipTestException("Requires patched protobuf");
++#else
+     if (backend != DNN_BACKEND_OPENCV)
+         applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
+     testLayerUsingCaffeModels("nearest_2inps", false, false, 0.0, 0.0, 2);
+     testLayerUsingCaffeModels("nearest", false, false);
++#endif
+ }
+ 
+ TEST_P(Test_Caffe_layers, Correlation)
+ {
++#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
++    throw SkipTestException("Requires patched protobuf");
++#else
+     if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
+         applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER,
+                      CV_TEST_TAG_DNN_SKIP_OPENCL, CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
+     testLayerUsingCaffeModels("correlation", false, false, 0.0, 0.0, 2);
++#endif
+ }
+ 
+ TEST_P(Test_Caffe_layers, Convolution2Inputs)
+@@ -1641,12 +1657,11 @@ private:
+     int outWidth, outHeight, zoomFactor;
+ };
+ 
+-#ifndef OPENCV_DNN_EXTERNAL_PROTOBUF
+ TEST_P(Test_Caffe_layers, Interp)
+-#else
+-TEST_P(Test_Caffe_layers, DISABLED_Interp)  // requires patched protobuf (available in OpenCV source tree only)
+-#endif
+ {
++#ifdef OPENCV_DNN_EXTERNAL_PROTOBUF
++    throw SkipTestException("Requires patched protobuf");
++#else
+ #if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021030000)
+     if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
+         applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);  // exception
+@@ -1670,6 +1685,7 @@ TEST_P(Test_Caffe_layers, DISABLED_Interp)  // requires patched protobuf (availa
+ 
+     // Test an implemented layer.
+     testLayerUsingCaffeModels("layer_interp", false, false);
++#endif
+ }
+ 
+ INSTANTIATE_TEST_CASE_P(/*nothing*/, Test_Caffe_layers, dnnBackendsAndTargets());
+-- 
+2.43.0
+

diff --git a/media-libs/opencv/opencv-4.8.1-r1.ebuild b/media-libs/opencv/opencv-4.8.1-r1.ebuild
index 9d7ece8e5c85..d183c6f8d97a 100644
--- a/media-libs/opencv/opencv-4.8.1-r1.ebuild
+++ b/media-libs/opencv/opencv-4.8.1-r1.ebuild
@@ -117,7 +117,7 @@ REQUIRED_USE="
 
 RDEPEND="
 	app-arch/bzip2[${MULTILIB_USEDEP}]
-	<dev-libs/protobuf-23:=[${MULTILIB_USEDEP}]
+	dev-libs/protobuf:=[${MULTILIB_USEDEP}]
 	sys-libs/zlib[${MULTILIB_USEDEP}]
 	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
 	cudnn? ( dev-libs/cudnn:= )
@@ -214,6 +214,8 @@ PATCHES=(
 	"${FILESDIR}/${PN}-4.8.1-libpng16.patch"
 	"${FILESDIR}/${PN}-4.8.1-ade-0.1.2a.tar.gz.patch"
 
+	"${FILESDIR}/${PN}-4.8.1-protobuf-22.patch" # bug 909087, in 4.9.0
+
 	# TODO applied in src_prepare
 	# "${FILESDIR}/${PN}_contrib-${PV}-rgbd.patch"
 	# "${FILESDIR}/${PN}_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch"


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2024-02-04 13:15 Andreas Sturmlechner
  0 siblings, 0 replies; 27+ messages in thread
From: Andreas Sturmlechner @ 2024-02-04 13:15 UTC (permalink / raw
  To: gentoo-commits

commit:     11f09619e0506c909af7274ed73d6906b31d1a99
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  4 11:39:43 2024 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Feb  4 13:15:02 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11f09619

media-libs/opencv: drop 4.8.0-r3

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 media-libs/opencv/Manifest                         |   6 -
 .../opencv/files/opencv-4.8.0-fix-flatbuffer.patch |  31 --
 media-libs/opencv/metadata.xml                     |   1 -
 media-libs/opencv/opencv-4.8.0-r3.ebuild           | 593 ---------------------
 4 files changed, 631 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index 293a8806aa85..b425507a8c4c 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -1,10 +1,5 @@
 DIST NVIDIAOpticalFlowSDK-edb50da3cf849840d680249aa6dbef248ebce2ca.tar.gz 8771 BLAKE2B f579960448bdaf57fbefd5e88002d8f6f4dbb828429b0f3a0112916c03039d4e4de65263eb8464a4d62924c1b77f0a61c2d93b7307657439bfbf7d59785f1533 SHA512 85dfdc52260f54f62c980508f4b6ab384e44200bd1c13761c4947f9a898c08f0faed2d734a85a4ba7a46f8788ed58ee89f12f61cee97881b69ba626bbd04f655
 DIST ade-0.1.2a.tar.gz 116737 BLAKE2B 9ac2af2f21aab8cb5d599e0b653bb6126642588e508f55e5fbfe5ce9607267f25e5187fd31ed69349064551c06e15b2ba548319708ed5f70e7761470775cc6e0 SHA512 d3ed210ff25f4c05393b0039cb4a73a6ceb8b42ba3d776e0469da2362899d3f76564cc6a06965b7de91f38517e1cd4ff4b18c00185d2b1a0af5a34ecf0d9dd44
-DIST opencv-3.4.0-face_landmark_model.tar.gz 63299830 BLAKE2B 58f08cd8c030ee1c8b66e76a561fd625e112face427d001185f8d7c0eaace55adbd8474663021841a1382bfe393a210e64c51223441713cdb9156fac866a845c SHA512 2cd29ce42c08b2966db3ef4a2bc217ab3d07051819757ec6de8f3deea29e28f60abab39f101dba03f766f17018598e411bd687a7eaab0c681c113e10a2de2b23
-DIST opencv-3.4.0-res10_300x300-caffeemodel.tar.gz 10036604 BLAKE2B 2a2de48fc420f13e7be146ac88f311901c5b4e409c30e466152e33cae1f8afd87dcb6d758af447c268d90bd67989c8798cd80cab172b10499a6ad5224509dbdf SHA512 96fee9f447d5739bc01a5cab37c453cf7237457dfb5d2bf93ac37f8e5aa557ac222316f449cd58e37e856abe4d8e9d4a7820daaba32f0b22cbcde8e340287d4b
-DIST opencv-4.4.0_extdep.tar.gz 65334871 BLAKE2B 89fa0083da428e986bb4287295bdbff626d0f84866377413649c1d7ca77338288141f22d2a3c0b64d6d0fc1db98f918c8b33a665274cee4c4aefb44359e4333d SHA512 7b758099ce4abef151051e3e9e1e45b73e4054669d3aa53051e4d4c5f43d9373c9bda5ecbce51f6b024562cb566bd1117505af29ab5f3c36a493f185111a3b4e
-DIST opencv-4.8.0.tar.gz 91992565 BLAKE2B eede5479acdcef7dfb49d260b696ed14e85a27b8cd7211934d3fa9df9a46072daca9e1b7c50d1d56633d5e7bdf96e4a5731c8ea0e04886dc381e7864357ed8de SHA512 48738c3e7460a361274357aef1dd427082ccd59f749d6317d92a414b3741ce6116ea15ed4fedd2d47a25e456c705f3ba114357558646097bfc0e6dba9b3b865c
-DIST opencv-4.8.0_contrib.tar.gz 59201076 BLAKE2B e30c4f17e1e89c8b0821bbf8ea44b6b4ce505ad2761222a8b119c5aee5ae4ef50e06a73f41fee3b2fa60b71c736989904f6d1fb31a16abfe39e605e2d32d851b SHA512 81cc41cfe1ea03e60b0657edeaa76a90926e5e79a9f93a482e17bc9edbf1b5ce36b13d108fd8fb097f2fb3d6381fbeb102811f44bfc761c2de7f69bf3c5298a1
 DIST opencv-4.8.1.tar.gz 92006711 BLAKE2B 54728a37e3e8a528bd8d2e6df5963a996820a51160d05ac72b350234ce5372f99c037af96e13c55de1452e517fffb478c2335b9e1cbc07a36c78f99351eabd58 SHA512 b98d89b8e7b8ae8138bce00c5226816b761b53fbeb8f28ca516e08c5d130f216f9388a81785cd6684034530f768e097cbe12f19a9361f362b7d2048bfc427a65
 DIST opencv-4.8.1_contrib.tar.gz 59200293 BLAKE2B 8cf3ee60cb38a9fa2649013b9b4704022abe5cc65c331078dc7ea87028bc99df8b0de12f835905f5bb5c00a811f256754cac018ca8e02739ac5c6fe36aa4346d SHA512 e3df49e6a1411f55eebbc02f4534ddefabff961b4f63c69b21fe06ff3df894773a8643ab0cb123b83c2bdc8fa02698b332d3c243e8546c894e6c6c8ecaa65500
 DIST opencv_3rdparty-34e4206aef44d50e6bbcd0ab06354b52e7466d26.tar.gz 397901 BLAKE2B 9adbe14ee3a2c90b890be694aa80d65b67e23a23f47ccabee4564e31eb9857d717b5a751df32004cfa5d6a53a9e1d8ea8d8943b705a0eaea5ca741169e2222f6 SHA512 8a92555aed2ac8752818586ab9762dd96ec128c5465cb87e402f15b15d16f7d371b3de045ef7295526e9ef99ec817766bb685a21d24dba29c650cf44e384a4e3
@@ -12,4 +7,3 @@ DIST opencv_3rdparty-8afa57abc8229d611c4937165d20e2a2d9fc5a12.tar.gz 63301261 BL
 DIST opencv_3rdparty-a8b69ccc738421293254aec5ddb38bd523503252.tar.gz 920403 BLAKE2B 5f834e8ccef9d88d0650f8ae5d215a2d07d0a356aaad4de1622068e0b2a7def88fccc84bc4397f0182732e836fcd6e363ae25a2cdeaa4d458a7d8ef9afc81da5 SHA512 5611b9db40477759213ab35320570c198f1f224f92ca801ca3accd1f7620faf3d44f306e44abefd10be118acee9b56da643ca82abaa7c4d2102fe92e5b298a6e
 DIST opencv_3rdparty-b2bfc75f6aea5b1f834ff0f0b865a7c18ff1459f.tar.gz 10036903 BLAKE2B c13559569808db24105049e2081bc466c0e8b6dab58bcc69001e49ff82e03ec4701e25648b5e542b7df2c8e522abfbd82c9825e66c37d6a673847b41bf6effae SHA512 3fc44f12802aa1dad0b12372d53242ae2134a2d74ca0b6d8e4639551623426106781a41d77ebfce79ac625a49aec26b0d7425e0d31f09bab6a15e3d43caef8bc
 DIST opencv_3rdparty-fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d.tar.gz 1470898 BLAKE2B f1794cc8f8684501f670db3d720c02f35c57ebe91f276cc21dea1f1c1426740d03569143fec74380e941703b5086db5f013ca913fb296eda99559115fd53ca30 SHA512 07118b9d688bf0ff34a6e4ca1548006124d80d11e7b48f08c9e1910b64249b1dad0ace460f50adda0ecb69b90871fc59cc25f451570c63f7c6d6ba2b92d8801c
-DIST vgg_boostdesc-3.2.0.tar.gz 1867770 BLAKE2B 1fa5b58e73b6fa56ecf8d19af22298f729942ee1369082e173445d09d3de767bf844bad3d2b462efc1199c392f37c88ba49a9996ba8bfd84b4abeba7de94db63 SHA512 4a046aedd639c8eb4b295b0f499e756deb66210ca083f0124c75531e540663367cb58f6d175f66c4713324177036cd89a8869bdab2de8d1736dafc7f00ef9f44

diff --git a/media-libs/opencv/files/opencv-4.8.0-fix-flatbuffer.patch b/media-libs/opencv/files/opencv-4.8.0-fix-flatbuffer.patch
deleted file mode 100644
index 395f0998a3b9..000000000000
--- a/media-libs/opencv/files/opencv-4.8.0-fix-flatbuffer.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/modules/dnn/misc/tflite/schema_generated.h	2023-06-28 19:53:33.000000000 +0800
-+++ b/modules/dnn/misc/tflite/schema_generated.h	2023-08-24 15:17:19.594480034 +0800
-@@ -8,9 +8,9 @@
- 
- // Ensure the included flatbuffers.h is the same version as when this file was
- // generated, otherwise it may not be compatible.
--static_assert(FLATBUFFERS_VERSION_MAJOR == 23 &&
--              FLATBUFFERS_VERSION_MINOR == 5 &&
--              FLATBUFFERS_VERSION_REVISION == 9,
-+static_assert(FLATBUFFERS_VERSION_MAJOR == FLATBUFFERS_VERSION_MAJOR &&
-+              FLATBUFFERS_VERSION_MINOR == FLATBUFFERS_VERSION_MINOR &&
-+              FLATBUFFERS_VERSION_REVISION == FLATBUFFERS_VERSION_REVISION,
-              "Non-compatible flatbuffers version included");
- 
- namespace opencv_tflite {
---- a/cmake/OpenCVDetectFlatbuffers.cmake	2023-08-24 15:31:50.129947159 +0800
-+++ b/cmake/OpenCVDetectFlatbuffers.cmake	2023-08-24 15:36:15.176705845 +0800
-@@ -1,9 +1,9 @@
- if(WITH_FLATBUFFERS)
-   set(HAVE_FLATBUFFERS 1)
--  set(flatbuffers_VERSION "23.5.9")
--  ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt")
--  ocv_add_external_target(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/include" "" "HAVE_FLATBUFFERS=1")
--  set(CUSTOM_STATUS_flatbuffers "    Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})")
-+  #set(flatbuffers_VERSION "23.5.9")
-+  #ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt")
-+  #ocv_add_external_target(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/include" "" "HAVE_FLATBUFFERS=1")
-+  #set(CUSTOM_STATUS_flatbuffers "    Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})")
- endif()
- 
- if(WITH_FLATBUFFERS OR HAVE_FLATBUFFERS)

diff --git a/media-libs/opencv/metadata.xml b/media-libs/opencv/metadata.xml
index fc1efa988e96..4fbf7c494e1c 100644
--- a/media-libs/opencv/metadata.xml
+++ b/media-libs/opencv/metadata.xml
@@ -27,7 +27,6 @@
 		<flag name="cuda">Enable NVIDIA Cuda computations support (Experimental!)</flag>
 		<flag name="cudnn">Enable support for nVidia cuDNN library</flag>
 		<flag name="dnnsamples">Enable dnn caffeemodel samples</flag>
-		<flag name="download">Enable download during cmake configure</flag>
 		<flag name="eigen">Enable usage of <pkg>dev-cpp/eigen</pkg> for computations</flag>
 		<flag name="features2d">Enable features2d module</flag>
 		<flag name="gdal">Enable support for <pkg>sci-libs/gdal</pkg> library</flag>

diff --git a/media-libs/opencv/opencv-4.8.0-r3.ebuild b/media-libs/opencv/opencv-4.8.0-r3.ebuild
deleted file mode 100644
index 99a65fe7d7c7..000000000000
--- a/media-libs/opencv/opencv-4.8.0-r3.ebuild
+++ /dev/null
@@ -1,593 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# No 3.12 yet for bug #912987
-PYTHON_COMPAT=( python3_{10..11} )
-inherit flag-o-matic java-pkg-opt-2 java-ant-2 cmake-multilib python-r1 toolchain-funcs
-
-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
-	dnnsamples? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-res10_300x300-caffeemodel.tar.gz )
-	download? ( https://github.com/rossbridger/opencv-extdep/archive/4.4.0.tar.gz -> ${PN}-4.4.0_extdep.tar.gz )
-	contrib? (
-		https://github.com/${PN}/${PN}_contrib/archive/${PV}.tar.gz -> ${P}_contrib.tar.gz
-		contribdnn? ( https://dev.gentoo.org/~amynka/snap/${PN}-3.4.0-face_landmark_model.tar.gz )
-		contribxfeatures2d? ( https://dev.gentoo.org/~amynka/snap/vgg_boostdesc-3.2.0.tar.gz )
-	)"
-
-LICENSE="Apache-2.0"
-SLOT="0/${PV}" # subslot = libopencv* soname version
-KEYWORDS="amd64 ~arm arm64 ~loong ~ppc ~ppc64 ~riscv x86"
-IUSE="contrib contribcvv contribdnn contribfreetype contribhdf contribovis contribsfm contribxfeatures2d cuda debug dnnsamples download +eigen examples +features2d ffmpeg gdal gflags glog gphoto2 gstreamer gtk3 ieee1394 jpeg jpeg2k lapack opencl openexr opengl openmp opencvapps png +python qt5 tesseract testprograms threads tiff vaapi v4l vtk webp xine"
-
-# The following lines are shamelessly stolen from ffmpeg-9999.ebuild with modifications
-ARM_CPU_FEATURES=(
-	cpu_flags_arm_neon:NEON
-	cpu_flags_arm_vfpv3:VFPV3
-)
-PPC_CPU_FEATURES=(
-	cpu_flags_ppc_vsx:VSX
-	cpu_flags_ppc_vsx3:VSX3
-)
-X86_CPU_FEATURES_RAW=(
-	avx:AVX
-	avx2:AVX2
-	avx512f:AVX_512F
-	f16c:FP16
-	fma3:FMA3
-	popcnt:POPCNT
-	sse:SSE
-	sse2:SSE2
-	sse3:SSE3
-	ssse3:SSSE3
-	sse4_1:SSE4_1
-	sse4_2:SSE4_2
-)
-X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
-CPU_FEATURES_MAP=(
-	${ARM_CPU_FEATURES[@]}
-	${PPC_CPU_FEATURES[@]}
-	${X86_CPU_FEATURES[@]}
-)
-IUSE="${IUSE} ${CPU_FEATURES_MAP[@]%:*}"
-
-# OpenGL needs gtk or Qt installed to activate, otherwise build system
-# will silently disable it Wwithout the user knowing, which defeats the
-# purpose of the opengl use flag.
-# cuda needs contrib, bug #701712
-REQUIRED_USE="
-	cpu_flags_x86_avx2? ( cpu_flags_x86_f16c )
-	cpu_flags_x86_f16c? ( cpu_flags_x86_avx )
-	cuda? ( contrib
-		tesseract? ( opencl ) )
-	dnnsamples? ( examples )
-	gflags? ( contrib )
-	glog? ( contrib )
-	contribcvv? ( contrib qt5 )
-	contribdnn? ( contrib )
-	contribfreetype? ( contrib )
-	contribhdf? ( contrib )
-	contribovis? ( contrib )
-	contribsfm? ( contrib eigen gflags glog )
-	contribxfeatures2d? ( contrib download )
-	examples? ( contribdnn )
-	java? ( python )
-	opengl? ( qt5 )
-	python? ( ${PYTHON_REQUIRED_USE} )
-	tesseract? ( contrib )
-	?? ( gtk3 qt5 )"
-
-# The following logic is intrinsic in the build system, but we do not enforce
-# it on the useflags since this just blocks emerging pointlessly:
-#	openmp? ( !threads )
-
-RDEPEND="
-	app-arch/bzip2[${MULTILIB_USEDEP}]
-	<dev-libs/protobuf-23:=[${MULTILIB_USEDEP}]
-	sys-libs/zlib[${MULTILIB_USEDEP}]
-	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
-	contribdnn? ( dev-libs/flatbuffers:= )
-	contribhdf? ( sci-libs/hdf5:= )
-	contribfreetype? (
-		media-libs/freetype:2[${MULTILIB_USEDEP}]
-		media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
-	)
-	contribovis? ( dev-games/ogre:0/1.12 )
-	ffmpeg? ( 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}]
-	)
-	gtk3? (
-		dev-libs/glib:2[${MULTILIB_USEDEP}]
-		x11-libs/gtk+:3[${MULTILIB_USEDEP}]
-	)
-	ieee1394? (
-		media-libs/libdc1394:=[${MULTILIB_USEDEP}]
-		sys-libs/libraw1394[${MULTILIB_USEDEP}]
-	)
-	java? ( >=virtual/jre-1.8:* )
-	jpeg? ( media-libs/libjpeg-turbo:=[${MULTILIB_USEDEP}] )
-	jpeg2k? ( media-libs/openjpeg:2=[${MULTILIB_USEDEP}] )
-	lapack? (
-		virtual/cblas
-		>=virtual/lapack-3.10
-	)
-	opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
-	openexr? (
-		dev-libs/imath:=
-		media-libs/openexr:=
-	)
-	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=,${MULTILIB_USEDEP}] )
-	threads? ( dev-cpp/tbb:=[${MULTILIB_USEDEP}] )
-	tiff? ( media-libs/tiff:=[${MULTILIB_USEDEP}] )
-	v4l? ( >=media-libs/libv4l-0.8.3[${MULTILIB_USEDEP}] )
-	vaapi? ( media-libs/libva[${MULTILIB_USEDEP}] )
-	vtk? ( sci-libs/vtk[rendering] )
-	webp? ( media-libs/libwebp:=[${MULTILIB_USEDEP}] )
-	xine? ( media-libs/xine-lib )"
-DEPEND="${RDEPEND}
-	eigen? ( >=dev-cpp/eigen-3.3.8-r1:3 )
-	java? ( >=virtual/jdk-1.8:* )"
-BDEPEND="virtual/pkgconfig"
-
-MULTILIB_WRAPPED_HEADERS=(
-	# [opencv4]
-	/usr/include/opencv4/opencv2/cvconfig.h
-	/usr/include/opencv4/opencv2/opencv_modules.hpp
-	# [cudev]
-	/usr/include/opencv4/opencv2/cudaarithm.hpp
-	/usr/include/opencv4/opencv2/cudabgsegm.hpp
-	/usr/include/opencv4/opencv2/cudacodec.hpp
-	/usr/include/opencv4/opencv2/cudafeatures2d.hpp
-	/usr/include/opencv4/opencv2/cudafilters.hpp
-	/usr/include/opencv4/opencv2/cudaimgproc.hpp
-	/usr/include/opencv4/opencv2/cudalegacy.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVBroxOpticalFlow.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVHaarObjectDetection.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCV.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NCVPyramid.hpp
-	/usr/include/opencv4/opencv2/cudalegacy/NPP_staging.hpp
-	/usr/include/opencv4/opencv2/cudaobjdetect.hpp
-	/usr/include/opencv4/opencv2/cudaoptflow.hpp
-	/usr/include/opencv4/opencv2/cudastereo.hpp
-	/usr/include/opencv4/opencv2/cudawarping.hpp
-	/usr/include/opencv4/opencv2/cudev/block/block.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/block/dynamic_smem.hpp
-	/usr/include/opencv4/opencv2/cudev/block/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/block/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/block/vec_distance.hpp
-	/usr/include/opencv4/opencv2/cudev/common.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/binary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/color.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/expr.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/per_element_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/reduction.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_func.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/unary_op.hpp
-	/usr/include/opencv4/opencv2/cudev/expr/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/detail/color_cvt.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/functional.hpp
-	/usr/include/opencv4/opencv2/cudev/functional/tuple_adapter.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/copy.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/minmaxloc.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_down.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/pyr_up.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_column.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/reduce_to_row.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/detail/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/histogram.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/integral.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/pyramids.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/reduce_to_vec.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/split_merge.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/grid/transpose.hpp
-	/usr/include/opencv4/opencv2/cudev.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/constant.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/deriv.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/detail/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/extrapolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/glob.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/gpumat.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/interpolation.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/lut.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/mask.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/remap.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/resize.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/texture.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/traits.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/transform.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/warping.hpp
-	/usr/include/opencv4/opencv2/cudev/ptr2d/zip.hpp
-	/usr/include/opencv4/opencv2/cudev/util/atomic.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/detail/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/limits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/saturate_cast.hpp
-	/usr/include/opencv4/opencv2/cudev/util/simd_functions.hpp
-	/usr/include/opencv4/opencv2/cudev/util/tuple.hpp
-	/usr/include/opencv4/opencv2/cudev/util/type_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_math.hpp
-	/usr/include/opencv4/opencv2/cudev/util/vec_traits.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/detail/reduce_key_val.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/reduce.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/scan.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/shuffle.hpp
-	/usr/include/opencv4/opencv2/cudev/warp/warp.hpp
-	# [contrib_cvv]
-	/usr/include/opencv4/opencv2/cvv/call_meta_data.hpp
-	/usr/include/opencv4/opencv2/cvv/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/debug_mode.hpp
-	/usr/include/opencv4/opencv2/cvv/dmatch.hpp
-	/usr/include/opencv4/opencv2/cvv/filter.hpp
-	/usr/include/opencv4/opencv2/cvv/final_show.hpp
-	/usr/include/opencv4/opencv2/cvv.hpp
-	/usr/include/opencv4/opencv2/cvv/show_image.hpp
-	# [contrib_hdf]
-	/usr/include/opencv4/opencv2/hdf/hdf5.hpp
-	/usr/include/opencv4/opencv2/hdf.hpp
-	# [contrib_ovis]
-	/usr/include/opencv4/opencv2/ovis.hpp
-	# [contrib_sfm]
-	/usr/include/opencv4/opencv2/sfm.hpp
-	/usr/include/opencv4/opencv2/sfm/conditioning.hpp
-	/usr/include/opencv4/opencv2/sfm/fundamental.hpp
-	/usr/include/opencv4/opencv2/sfm/io.hpp
-	/usr/include/opencv4/opencv2/sfm/numeric.hpp
-	/usr/include/opencv4/opencv2/sfm/projection.hpp
-	/usr/include/opencv4/opencv2/sfm/reconstruct.hpp
-	/usr/include/opencv4/opencv2/sfm/robust.hpp
-	/usr/include/opencv4/opencv2/sfm/simple_pipeline.hpp
-	/usr/include/opencv4/opencv2/sfm/triangulation.hpp
-	# [vtk]
-	/usr/include/opencv4/opencv2/viz.hpp
-	/usr/include/opencv4/opencv2/viz/types.hpp
-	/usr/include/opencv4/opencv2/viz/viz3d.hpp
-	/usr/include/opencv4/opencv2/viz/vizcore.hpp
-	/usr/include/opencv4/opencv2/viz/widget_accessor.hpp
-	/usr/include/opencv4/opencv2/viz/widgets.hpp
-)
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-3.4.0-disable-download.patch
-	"${FILESDIR}"/${PN}-3.4.1-cuda-add-relaxed-constexpr.patch
-	"${FILESDIR}"/${PN}-4.1.2-opencl-license.patch
-	"${FILESDIR}"/${PN}-4.4.0-disable-native-cpuflag-detect.patch
-	"${FILESDIR}"/${PN}-4.5.0-link-with-cblas-for-lapack.patch
-	"${FILESDIR}"/${PN}-4.8.0-fix-flatbuffer.patch
-	"${FILESDIR}"/${PN}-4.8.0-arm64-fp16.patch
-	"${FILESDIR}"/${PN}-4.8.0-fix-cuda-12.2.0.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() {
-	# https://bugs.gentoo.org/838274
-	replace-flags -O3 -O2
-
-	cmake_src_prepare
-
-	# remove bundled stuff
-	rm -r 3rdparty || die "Removing 3rd party components failed"
-	sed -e '/add_subdirectory(.*3rdparty.*)/ d' \
-		-i CMakeLists.txt cmake/*cmake || die
-
-	if use dnnsamples; then
-		mv  "${WORKDIR}/res10_300x300_ssd_iter_140000.caffemodel" "${WORKDIR}/${P}/samples/dnn/" || die
-	fi
-
-	if use contrib; then
-		cd  "${WORKDIR}/${PN}_contrib-${PV}" || die
-		if use contribxfeatures2d; then
-			mv "${WORKDIR}"/*.i "${WORKDIR}/${PN}_contrib-${PV}"/modules/xfeatures2d/src/ || die
-		fi
-	fi
-
-	if use download; then
-		mv "${WORKDIR}/${PN}-extdep-4.4.0" "${WORKDIR}/${P}/.cache/" || 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() {
-	# bug #919101 and https://github.com/opencv/opencv/issues/19020
-	filter-lto
-
-	# please dont sort here, order is the same as in CMakeLists.txt
-	GLOBALCMAKEARGS=(
-		# for protobuf
-		-DCMAKE_CXX_STANDARD=14
-
-	# Optional 3rd party components
-	# ===================================================
-		-DENABLE_DOWNLOAD=$(usex download)
-		-DWITH_QUIRC=OFF # Do not have dependencies
-		-DWITH_FLATBUFFERS=$(usex contribdnn)
-		-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 gtk3)
-		-DWITH_GTK_2_X=OFF # only want gtk3 nowadays
-		-DWITH_IPP=OFF
-		# Jasper was removed from tree because of security problems.
-		# Upstream were/are making progress. We use openjpeg instead.
-		# bug 734284
-		-DWITH_JASPER=OFF
-		-DWITH_JPEG=$(usex jpeg)
-		-DWITH_OPENJPEG=$(usex jpeg2k)
-		-DWITH_WEBP=$(usex webp)
-		-DWITH_OPENEXR=$(multilib_native_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_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_JAVA=$(multilib_native_usex java) # Ant needed, no compile flag
-		-DBUILD_ANDROID_EXAMPLES=OFF
-		-DBUILD_opencv_apps=$(usex opencvapps ON OFF)
-		-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=OFF
-	#	-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
-		-DOPENCV_GENERATE_PKGCONFIG=ON
-		# opencv uses both ${CMAKE_INSTALL_LIBDIR} and ${LIB_SUFFIX}
-		# to set its destination libdir
-		-DLIB_SUFFIX=
-	# ===================================================
-	# OpenCV build options
-	# ===================================================
-		-DENABLE_CCACHE=OFF
-		# bug 733796, but PCH is a risky game in CMake anyway
-		-DENABLE_PRECOMPILED_HEADERS=OFF
-		-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
-	# ===================================================
-		-DWITH_PROTOBUF=ON
-		-DBUILD_PROTOBUF=OFF
-		-DPROTOBUF_UPDATE_FILES=ON
-		-Dprotobuf_MODULE_COMPATIBLE=ON
-	# ===================================================
-	# things we want to be hard enabled not worth useflag
-	# ===================================================
-		-DCMAKE_SKIP_RPATH=ON
-		-DOPENCV_DOC_INSTALL_PATH=
-		-DBUILD_opencv_features2d=$(usex features2d ON OFF)
-	)
-
-	# ==================================================
-	# cpu flags, should solve 633900
-	#===================================================
-	local CPU_BASELINE=""
-	for i in "${CPU_FEATURES_MAP[@]}" ; do
-		if [[ ${ABI} != x86 || ${i%:*} != "cpu_flags_x86_avx2" ]]; then # workaround for Bug 747163
-			use ${i%:*} && CPU_BASELINE="${CPU_BASELINE}${i#*:};"
-		fi
-	done
-
-	GLOBALCMAKEARGS+=(
-		-DOPENCV_CPU_OPT_IMPLIES_IGNORE=ON
-		-DCPU_BASELINE=${CPU_BASELINE}
-		-DCPU_DISPATCH=
-	)
-
-	# ===================================================
-	# OpenCV Contrib Modules
-	# ===================================================
-	if use contrib; then
-		GLOBALCMAKEARGS+=(
-			-DBUILD_opencv_dnn=$(usex contribdnn ON OFF)
-			-DTINYDNN_ROOT="${WORKDIR}/tiny-dnn-${TINY_DNN_PV}"
-			-DBUILD_opencv_dnns_easily_fooled=OFF
-			-DBUILD_opencv_xfeatures2d=$(usex contribxfeatures2d ON OFF)
-			-DBUILD_opencv_cvv=$(usex contribcvv ON OFF)
-			-DBUILD_opencv_hdf=$(multilib_native_usex contribhdf ON OFF)
-			-DBUILD_opencv_sfm=$(usex contribsfm ON OFF)
-			-DBUILD_opencv_freetype=$(usex contribfreetype ON OFF)
-			-DBUILD_opencv_ovis=$(usex contribovis 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
-		-DBUILD_opencv_python2=OFF
-		-DBUILD_opencv_python3=OFF
-	)
-
-	cmake_src_configure
-
-	# Copy face_land_model to ${CMAKE_BINARY_DIR}/${OPENCV_TEST_DATA_INSTALL_PATH}
-	# TODO patch ocv_download to copy files into destination dirs
-	if use contribdnn; then
-		mkdir -p "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-		cp "${WORKDIR}"/face_landmark_model.dat "${BUILD_DIR}"/share/OpenCV/testdata/cv/face/ || die
-	fi
-
-}
-
-python_module_compile() {
-	local BUILD_DIR="${orig_BUILD_DIR}"
-	local mycmakeargs=( ${GLOBALCMAKEARGS[@]} )
-
-	# Set all python variables to load the correct Gentoo paths
-	mycmakeargs+=(
-		# python_setup alters PATH and sets this as wrapper
-		# to the correct interpreter we are building for
-		-DPYTHON_DEFAULT_EXECUTABLE=${EPYTHON}
-		-DINSTALL_PYTHON_EXAMPLES=$(usex examples)
-	)
-
-	# Regenerate cache file. Can't use rebuild_cache as it won't
-	# have the Gentoo specific options.
-	rm CMakeCache.txt || die "rm failed"
-	cmake_src_configure
-	cmake_src_compile
-	cmake_src_install
-
-	# Remove compiled binary so new version compiles
-	# Avoid conflicts with new module builds as build system doesn't
-	# really support it.
-	rm -r modules/python3 || die "rm failed"
-
-	python_optimize "${ED}"/$(python_get_sitedir)
-}
-
-multilib_src_install() {
-	cmake_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
-}


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2024-11-05  2:03 Sam James
  0 siblings, 0 replies; 27+ messages in thread
From: Sam James @ 2024-11-05  2:03 UTC (permalink / raw
  To: gentoo-commits

commit:     4c9a19202381c1d51d0fb54fe24eb446e2bc067e
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Oct 21 11:27:04 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov  5 02:02:35 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4c9a1920

media-libs/opencv: backport cuda-12.6 support

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

 media-libs/opencv/Manifest                         |   1 +
 .../opencv/files/opencv-4.10.0-cuda-fp16.patch     | 226 +++++++++++++++++++++
 .../opencv/files/opencv-4.10.0-cudnn-9.patch       |  32 +++
 .../opencv/files/opencv-4.10.0-tbb-detection.patch |  28 +++
 ...pencv_contrib-4.10.0-CUDA-12.6-tuple_size.patch |  53 +++++
 media-libs/opencv/opencv-4.10.0.ebuild             |  18 +-
 6 files changed, 353 insertions(+), 5 deletions(-)

diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest
index bd9f8567bf7f..75d70689375b 100644
--- a/media-libs/opencv/Manifest
+++ b/media-libs/opencv/Manifest
@@ -7,6 +7,7 @@ DIST opencv_3rdparty-8afa57abc8229d611c4937165d20e2a2d9fc5a12.tar.gz 63301261 BL
 DIST opencv_3rdparty-a8b69ccc738421293254aec5ddb38bd523503252.tar.gz 920403 BLAKE2B 5f834e8ccef9d88d0650f8ae5d215a2d07d0a356aaad4de1622068e0b2a7def88fccc84bc4397f0182732e836fcd6e363ae25a2cdeaa4d458a7d8ef9afc81da5 SHA512 5611b9db40477759213ab35320570c198f1f224f92ca801ca3accd1f7620faf3d44f306e44abefd10be118acee9b56da643ca82abaa7c4d2102fe92e5b298a6e
 DIST opencv_3rdparty-b2bfc75f6aea5b1f834ff0f0b865a7c18ff1459f.tar.gz 10036903 BLAKE2B c13559569808db24105049e2081bc466c0e8b6dab58bcc69001e49ff82e03ec4701e25648b5e542b7df2c8e522abfbd82c9825e66c37d6a673847b41bf6effae SHA512 3fc44f12802aa1dad0b12372d53242ae2134a2d74ca0b6d8e4639551623426106781a41d77ebfce79ac625a49aec26b0d7425e0d31f09bab6a15e3d43caef8bc
 DIST opencv_3rdparty-fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d.tar.gz 1470898 BLAKE2B f1794cc8f8684501f670db3d720c02f35c57ebe91f276cc21dea1f1c1426740d03569143fec74380e941703b5086db5f013ca913fb296eda99559115fd53ca30 SHA512 07118b9d688bf0ff34a6e4ca1548006124d80d11e7b48f08c9e1910b64249b1dad0ace460f50adda0ecb69b90871fc59cc25f451570c63f7c6d6ba2b92d8801c
+DIST opencv_contrib-4.10.0-3607.patch 29870 BLAKE2B cf43afbd24d0b32817e908c55ac3bf0d5da8b82b2c459bc04ef31414e16285eefe334c46eeee730bd3cad2bbec062f5bc212a82bd7f2ac83baca231d711545d4 SHA512 3fdd08cee6d7da8edf36411f30c8d6230ebd86a1c896a08f1dc86d3a0982e1f1f99797066722bc51ce4b1a60a2db55853c348441b3e6edc0d318fcb7bd5cf944
 DIST opencv_contrib-4.10.0.tar.gz 55387316 BLAKE2B 5d6f884817b6d45b86833fcab1e31cd0fd7be19885698e0aefe300fa570f93c446d7f564567cc08099d559a98a65e9c3dd0fd35ceeca7e0e9a1e56edc74a0fe9 SHA512 480df862250692a97ce6431cba00dbecb70332307a19c1c04aa9d7444e6e74ab4f8c798548dce76d2319a9877624b82e361fb22a71df14b996087ade448be501
 DIST opencv_contrib-4.9.0.tar.gz 59803362 BLAKE2B e6b90e9bd462f96ef010490d45105d7125622d6c49912653c0d387568ae7109b1cbcac4cc0f52c1f997a45ed75923caea90bf4ad9336e689a56742b029789038 SHA512 ebaee3b88bd7ae246727e65a98d9fbc1d9772a4181a1926f3af742410b78dc87d2386bcd96ac67d7fb1a3020c3717a2cdebdcf9304d6dfd9ea494004791cf043
 DIST opencv_extra-4.10.0.tar.gz 504349887 BLAKE2B 6e76860beb95cf00698980a19cfd2894e5bfe0d477d94352cbb2ff98688acbc1c404953cbc3baa95453588e7b9063175a067f24006c5d2719a6c75d15f2ef891 SHA512 1a581dad61bc1e5075af5afed2dd3d67793232a9e1219408448d08c518ae714cf0c4d5fec2c25791351a49a0d265fe051ea142b2170f82843e19e82f65abc8c6

diff --git a/media-libs/opencv/files/opencv-4.10.0-cuda-fp16.patch b/media-libs/opencv/files/opencv-4.10.0-cuda-fp16.patch
new file mode 100644
index 000000000000..ed0f128b99c5
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.10.0-cuda-fp16.patch
@@ -0,0 +1,226 @@
+https://github.com/opencv/opencv/issues/25711
+https://github.com/opencv/opencv/pull/25880
+
+From 5115dc62f8af616c6e75e4b3df3eb8f201298432 Mon Sep 17 00:00:00 2001
+From: Aliaksei Urbanski <aliaksei.urbanski@gmail.com>
+Date: Tue, 9 Jul 2024 01:46:12 +0300
+Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20Fix=20CUDA=20for=20old=20GPU?=
+ =?UTF-8?q?s=20without=20FP16=20support?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+--- a/modules/dnn/src/cuda4dnn/init.hpp
++++ b/modules/dnn/src/cuda4dnn/init.hpp
+@@ -15,7 +15,7 @@
+ 
+ namespace cv { namespace dnn { namespace cuda4dnn {
+ 
+-    void checkVersions()
++    inline void checkVersions()
+     {
+         // https://docs.nvidia.com/deeplearning/cudnn/developer-guide/index.html#programming-model
+         // cuDNN API Compatibility
+@@ -44,19 +44,19 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+         }
+     }
+ 
+-    int getDeviceCount()
++    inline int getDeviceCount()
+     {
+         return cuda::getCudaEnabledDeviceCount();
+     }
+ 
+-    int getDevice()
++    inline int getDevice()
+     {
+         int device_id = -1;
+         CUDA4DNN_CHECK_CUDA(cudaGetDevice(&device_id));
+         return device_id;
+     }
+ 
+-    bool isDeviceCompatible()
++    inline bool isDeviceCompatible()
+     {
+         int device_id = getDevice();
+         if (device_id < 0)
+@@ -76,7 +76,7 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+         return false;
+     }
+ 
+-    bool doesDeviceSupportFP16()
++    inline bool doesDeviceSupportFP16()
+     {
+         int device_id = getDevice();
+         if (device_id < 0)
+--- a/modules/dnn/src/registry.cpp
++++ b/modules/dnn/src/registry.cpp
+@@ -18,6 +18,10 @@
+ #include "backend.hpp"
+ #include "factory.hpp"
+ 
++#ifdef HAVE_CUDA
++#include "cuda4dnn/init.hpp"
++#endif
++
+ namespace cv {
+ namespace dnn {
+ CV__DNN_INLINE_NS_BEGIN
+@@ -121,7 +125,8 @@ class BackendRegistry
+         if (haveCUDA())
+         {
+             backends.push_back(std::make_pair(DNN_BACKEND_CUDA, DNN_TARGET_CUDA));
+-            backends.push_back(std::make_pair(DNN_BACKEND_CUDA, DNN_TARGET_CUDA_FP16));
++            if (cuda4dnn::doesDeviceSupportFP16())
++                backends.push_back(std::make_pair(DNN_BACKEND_CUDA, DNN_TARGET_CUDA_FP16));
+         }
+ #endif
+ 
+
+From cfb2bc34acd7699707110523f067a7452a404206 Mon Sep 17 00:00:00 2001
+From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
+Date: Tue, 9 Jul 2024 11:21:58 +0300
+Subject: [PATCH 2/3] Added CUDA FP16 availability check for target management.
+
+--- a/modules/dnn/src/cuda4dnn/init.hpp
++++ b/modules/dnn/src/cuda4dnn/init.hpp
+@@ -56,9 +56,11 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+         return device_id;
+     }
+ 
+-    inline bool isDeviceCompatible()
++    inline bool isDeviceCompatible(int device_id = -1)
+     {
+-        int device_id = getDevice();
++        if (device_id < 0)
++            device_id = getDevice();
++
+         if (device_id < 0)
+             return false;
+ 
+@@ -76,9 +78,11 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+         return false;
+     }
+ 
+-    inline bool doesDeviceSupportFP16()
++    inline bool doesDeviceSupportFP16(int device_id = -1)
+     {
+-        int device_id = getDevice();
++        if (device_id < 0)
++            device_id = getDevice();
++
+         if (device_id < 0)
+             return false;
+ 
+@@ -87,9 +91,7 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+         CUDA4DNN_CHECK_CUDA(cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, device_id));
+ 
+         int version = major * 10 + minor;
+-        if (version < 53)
+-            return false;
+-        return true;
++        return (version >= 53);
+     }
+ 
+ }}} /* namespace cv::dnn::cuda4dnn */
+--- a/modules/dnn/src/net_impl_backend.cpp
++++ b/modules/dnn/src/net_impl_backend.cpp
+@@ -10,6 +10,10 @@
+ #include "backend.hpp"
+ #include "factory.hpp"
+ 
++#ifdef HAVE_CUDA
++#include "cuda4dnn/init.hpp"
++#endif
++
+ namespace cv {
+ namespace dnn {
+ CV__DNN_INLINE_NS_BEGIN
+@@ -242,6 +246,16 @@ void Net::Impl::setPreferableTarget(int targetId)
+ #endif
+         }
+ 
++        if (IS_DNN_CUDA_TARGET(targetId))
++        {
++            preferableTarget = DNN_TARGET_CPU;
++#ifdef HAVE_CUDA
++            if (cuda4dnn::doesDeviceSupportFP16() && targetId == DNN_TARGET_CUDA_FP16)
++                preferableTarget = DNN_TARGET_CUDA_FP16;
++            else
++                preferableTarget = DNN_TARGET_CUDA;
++#endif
++        }
+ #if !defined(__arm64__) || !__arm64__
+         if (targetId == DNN_TARGET_CPU_FP16)
+         {
+--- a/modules/dnn/src/registry.cpp
++++ b/modules/dnn/src/registry.cpp
+@@ -122,10 +122,24 @@ class BackendRegistry
+ #endif
+ 
+ #ifdef HAVE_CUDA
+-        if (haveCUDA())
++        cuda4dnn::checkVersions();
++
++        bool hasCudaCompatible = false;
++        bool hasCudaFP16 = false;
++        for (int i = 0; i < cuda4dnn::getDeviceCount(); i++)
++        {
++            if (cuda4dnn::isDeviceCompatible(i))
++            {
++                hasCudaCompatible = true;
++                if (cuda4dnn::doesDeviceSupportFP16(i))
++                    hasCudaFP16 = true;
++            }
++        }
++
++        if (hasCudaCompatible)
+         {
+             backends.push_back(std::make_pair(DNN_BACKEND_CUDA, DNN_TARGET_CUDA));
+-            if (cuda4dnn::doesDeviceSupportFP16())
++            if (hasCudaFP16)
+                 backends.push_back(std::make_pair(DNN_BACKEND_CUDA, DNN_TARGET_CUDA_FP16));
+         }
+ #endif
+--- a/modules/dnn/test/test_common.hpp
++++ b/modules/dnn/test/test_common.hpp
+@@ -211,7 +211,7 @@ class DNNTestLayer : public TestWithParam<tuple<Backend, Target> >
+             if ((!l->supportBackend(backend) || l->preferableTarget != target) && !fused)
+             {
+                 hasFallbacks = true;
+-                std::cout << "FALLBACK: Layer [" << l->type << "]:[" << l->name << "] is expected to has backend implementation" << endl;
++                std::cout << "FALLBACK: Layer [" << l->type << "]:[" << l->name << "] is expected to have backend implementation" << endl;
+             }
+         }
+         if (hasFallbacks && raiseError)
+--- a/modules/dnn/test/test_onnx_conformance.cpp
++++ b/modules/dnn/test/test_onnx_conformance.cpp
+@@ -1008,7 +1008,7 @@ class Test_ONNX_conformance : public TestWithParam<ONNXConfParams>
+             if ((!l->supportBackend(backend) || l->preferableTarget != target) && !fused)
+             {
+                 hasFallbacks = true;
+-                std::cout << "FALLBACK: Layer [" << l->type << "]:[" << l->name << "] is expected to has backend implementation" << endl;
++                std::cout << "FALLBACK: Layer [" << l->type << "]:[" << l->name << "] is expected to have backend implementation" << endl;
+             }
+         }
+         return hasFallbacks;
+
+From cc9178903daff229bc396db718bf347c4eafd33b Mon Sep 17 00:00:00 2001
+From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
+Date: Wed, 10 Jul 2024 09:06:09 +0300
+Subject: [PATCH 3/3] Update modules/dnn/src/registry.cpp
+
+Co-authored-by: Aliaksei Urbanski <aliaksei.urbanski@gmail.com>
+--- a/modules/dnn/src/registry.cpp
++++ b/modules/dnn/src/registry.cpp
+@@ -132,7 +132,10 @@ class BackendRegistry
+             {
+                 hasCudaCompatible = true;
+                 if (cuda4dnn::doesDeviceSupportFP16(i))
++                {
+                     hasCudaFP16 = true;
++                    break; // we already have all we need here
++                }
+             }
+         }
+ 

diff --git a/media-libs/opencv/files/opencv-4.10.0-cudnn-9.patch b/media-libs/opencv/files/opencv-4.10.0-cudnn-9.patch
new file mode 100644
index 000000000000..78ac162bef2d
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.10.0-cudnn-9.patch
@@ -0,0 +1,32 @@
+https://github.com/opencv/opencv/issues/25711
+https://github.com/opencv/opencv/pull/25841
+
+From 3d74d646d8c4c48e400e650fef9463f174414b96 Mon Sep 17 00:00:00 2001
+From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
+Date: Mon, 1 Jul 2024 17:33:24 +0300
+Subject: [PATCH] Fixed CuDNN runtime version check for CuDNN 9+.
+
+--- a/modules/dnn/src/cuda4dnn/init.hpp
++++ b/modules/dnn/src/cuda4dnn/init.hpp
+@@ -23,8 +23,19 @@ namespace cv { namespace dnn { namespace cuda4dnn {
+         //     Any patch release x.y.z is forward or backward-compatible with applications built against another cuDNN patch release x.y.w (meaning, of the same major and minor version number, but having w!=z).
+         //     cuDNN minor releases beginning with cuDNN 7 are binary backward-compatible with applications built against the same or earlier patch release (meaning, an application built against cuDNN 7.x is binary compatible with cuDNN library 7.y, where y>=x).
+         //     Applications compiled with a cuDNN version 7.y are not guaranteed to work with 7.x release when y > x.
+-        auto cudnn_bversion = cudnnGetVersion();
+-        auto cudnn_major_bversion = cudnn_bversion / 1000, cudnn_minor_bversion = cudnn_bversion % 1000 / 100;
++        int cudnn_bversion = cudnnGetVersion();
++        int cudnn_major_bversion = 0, cudnn_minor_bversion = 0;
++        // CuDNN changed major version multiplier in 9.0
++        if (cudnn_bversion >= 9*10000)
++        {
++            cudnn_major_bversion = cudnn_bversion / 10000;
++            cudnn_minor_bversion = cudnn_bversion % 10000 / 100;
++        }
++        else
++        {
++            cudnn_major_bversion = cudnn_bversion / 1000;
++            cudnn_minor_bversion = cudnn_bversion % 1000 / 100;
++        }
+         if (cudnn_major_bversion != CUDNN_MAJOR || cudnn_minor_bversion < CUDNN_MINOR)
+         {
+             std::ostringstream oss;

diff --git a/media-libs/opencv/files/opencv-4.10.0-tbb-detection.patch b/media-libs/opencv/files/opencv-4.10.0-tbb-detection.patch
new file mode 100644
index 000000000000..e808aec04547
--- /dev/null
+++ b/media-libs/opencv/files/opencv-4.10.0-tbb-detection.patch
@@ -0,0 +1,28 @@
+From 460bf0927fcc09e8c7a21d5bb48044fc923a8ee7 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Tue, 8 Oct 2024 00:31:52 +0200
+Subject: [PATCH] Fix tbb detection
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+
+diff --git a/cmake/OpenCVDetectTBB.cmake b/cmake/OpenCVDetectTBB.cmake
+index c9ecc02..3db3ae0 100644
+--- a/cmake/OpenCVDetectTBB.cmake
++++ b/cmake/OpenCVDetectTBB.cmake
+@@ -25,7 +25,12 @@ function(ocv_tbb_cmake_guess _found)
+         message(WARNING "No TBB::tbb target found!")
+         return()
+       endif()
+-      get_target_property(_lib TBB::tbb IMPORTED_LOCATION_RELEASE)
++
++      # Get installed configuration of tbb
++      get_target_property (TARGET_TBB_IMPORT_CONFS TBB::tbb IMPORTED_CONFIGURATIONS)
++      list (GET TARGET_TBB_IMPORT_CONFS 0 CHOSEN_IMPORT_CONF)
++
++      get_target_property(_lib TBB::tbb IMPORTED_LOCATION_${CHOSEN_IMPORT_CONF})
+       message(STATUS "Found TBB (cmake): ${_lib}")
+       get_target_property(_inc TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
+       add_library(tbb INTERFACE IMPORTED)
+-- 
+2.46.2
+

diff --git a/media-libs/opencv/files/opencv_contrib-4.10.0-CUDA-12.6-tuple_size.patch b/media-libs/opencv/files/opencv_contrib-4.10.0-CUDA-12.6-tuple_size.patch
new file mode 100644
index 000000000000..252ecdee6cb6
--- /dev/null
+++ b/media-libs/opencv/files/opencv_contrib-4.10.0-CUDA-12.6-tuple_size.patch
@@ -0,0 +1,53 @@
+https://github.com/opencv/opencv_contrib/pull/3785
+From 09eb618804588f77026924096d848800630c8d6f Mon Sep 17 00:00:00 2001
+From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
+Date: Tue, 3 Sep 2024 13:47:48 +0300
+Subject: [PATCH] Workaround for CUDA 12.6 tuple_size issue #3773.
+
+---
+ modules/cudaarithm/src/cuda/polar_cart.cu | 20 +++++---------------
+ 1 file changed, 5 insertions(+), 15 deletions(-)
+
+diff --git a/modules/cudaarithm/src/cuda/polar_cart.cu b/modules/cudaarithm/src/cuda/polar_cart.cu
+index 725f5741d8..c65b894bf6 100644
+--- a/modules/cudaarithm/src/cuda/polar_cart.cu
++++ b/modules/cudaarithm/src/cuda/polar_cart.cu
+@@ -159,25 +159,15 @@ void cv::cuda::cartToPolar(InputArray _xy, OutputArray _mag, OutputArray _angle,
+     GpuMat_<float> magc(mag);
+     GpuMat_<float> anglec(angle);
+ 
++    gridTransformUnary(globPtr<float2>(xy), globPtr<float>(magc), magnitude_interleaved_func<float2>(), stream);
++
+     if (angleInDegrees)
+     {
+-        auto f1 = magnitude_interleaved_func<float2>();
+-        auto f2 = direction_interleaved_func<float2, true>();
+-        cv::cudev::tuple<decltype(f1), decltype(f2)> f12 = cv::cudev::make_tuple(f1, f2);
+-        gridTransformTuple(globPtr<float2>(xy),
+-                           tie(magc, anglec),
+-                           f12,
+-                           stream);
++        gridTransformUnary(globPtr<float2>(xy), globPtr<float>(anglec), direction_interleaved_func<float2, true>(), stream);
+     }
+     else
+     {
+-        auto f1 = magnitude_interleaved_func<float2>();
+-        auto f2 = direction_interleaved_func<float2, false>();
+-        cv::cudev::tuple<decltype(f1), decltype(f2)> f12 = cv::cudev::make_tuple(f1, f2);
+-        gridTransformTuple(globPtr<float2>(xy),
+-                           tie(magc, anglec),
+-                           f12,
+-                           stream);
++        gridTransformUnary(globPtr<float2>(xy), globPtr<float>(anglec), direction_interleaved_func<float2, false>(), stream);
+     }
+ 
+     syncOutput(mag, _mag, stream);
+@@ -191,7 +181,7 @@ void cv::cuda::cartToPolar(InputArray _xy, OutputArray _magAngle, bool angleInDe
+     CV_Assert( xy.type() == CV_32FC2 );
+ 
+     GpuMat magAngle = getOutputMat(_magAngle, xy.size(), CV_32FC2, stream);
+-    
++
+     if (angleInDegrees)
+     {
+         gridTransformUnary(globPtr<float2>(xy),

diff --git a/media-libs/opencv/opencv-4.10.0.ebuild b/media-libs/opencv/opencv-4.10.0.ebuild
index dc2b31fa8321..27c7ce81d7cb 100644
--- a/media-libs/opencv/opencv-4.10.0.ebuild
+++ b/media-libs/opencv/opencv-4.10.0.ebuild
@@ -51,6 +51,8 @@ else
 				https://github.com/NVIDIA/NVIDIAOpticalFlowSDK/archive/${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz
 					-> NVIDIAOpticalFlowSDK-${NVIDIA_OPTICAL_FLOW_COMMIT}.tar.gz
 			)
+			https://github.com/${PN}/${PN}_contrib/commit/667a66ee0e99f3f3263c1ef2de1b90d9244b7bd4.patch
+			-> ${PN}_contrib-4.10.0-3607.patch
 		)
 		test? (
 			https://github.com/${PN}/${PN}_extra/archive/refs/tags/${PV}.tar.gz -> ${PN}_extra-${PV}.tar.gz
@@ -177,7 +179,7 @@ COMMON_DEPEND="
 	app-arch/bzip2[${MULTILIB_USEDEP}]
 	dev-libs/protobuf:=[${MULTILIB_USEDEP}]
 	sys-libs/zlib[${MULTILIB_USEDEP}]
-	cuda? ( <dev-util/nvidia-cuda-toolkit-12.4:0= )
+	cuda? ( dev-util/nvidia-cuda-toolkit:= )
 	cudnn? (
 		dev-cpp/abseil-cpp:=
 		dev-libs/cudnn:=
@@ -282,7 +284,7 @@ RDEPEND="
 "
 BDEPEND="
 	virtual/pkgconfig
-	cuda? ( dev-util/nvidia-cuda-toolkit:0= )
+	cuda? ( dev-util/nvidia-cuda-toolkit:= )
 	doc? (
 		app-text/doxygen[dot]
 		python? (
@@ -306,10 +308,15 @@ PATCHES=(
 	"${FILESDIR}/${PN}-4.9.0-cmake-cleanup.patch"
 
 	"${FILESDIR}/${PN}-4.10.0-dnn-explicitly-include-abseil-cpp.patch"
+	"${FILESDIR}/${PN}-4.10.0-cudnn-9.patch" # 25841
+	"${FILESDIR}/${PN}-4.10.0-cuda-fp16.patch" # 25880
+	"${FILESDIR}/${PN}-4.10.0-tbb-detection.patch"
 
 	# TODO applied in src_prepare
 	# "${FILESDIR}/${PN}_contrib-${PV}-rgbd.patch"
 	# "${FILESDIR}/${PN}_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch"
+
+	# "${FILESDIR}/${PN}_contrib-4.10.0-CUDA-12.6-tuple_size.patch" # 3785
 )
 
 cuda_get_host_compiler() {
@@ -419,10 +426,11 @@ src_prepare() {
 		cd "${WORKDIR}/${PN}_contrib-${PV}" || die
 		eapply "${FILESDIR}/${PN}_contrib-4.8.1-rgbd.patch"
 		eapply "${FILESDIR}/${PN}_contrib-4.8.1-NVIDIAOpticalFlowSDK-2.0.tar.gz.patch"
-		if has_version ">=dev-util/nvidia-cuda-toolkit-12.4" && use cuda; then
-			# TODO https://github.com/NVIDIA/cccl/pull/1522
-			eapply "${FILESDIR}/${PN}_contrib-4.9.0-cuda-12.4.patch"
+		if ver_test "$(nvcc --version | tail -n 1 | cut -d '_' -f 2- | cut -d '.' -f 1-2)" -ge 12.4; then
+			eapply "${DISTDIR}/${PN}_contrib-4.10.0-3607.patch"
+			eapply "${FILESDIR}/${PN}_contrib-4.10.0-CUDA-12.6-tuple_size.patch" # 3785
 		fi
+
 		cd "${S}" || die
 
 		! use contribcvv && { rm -R "${WORKDIR}/${PN}_contrib-${PV}/modules/cvv" || die; }


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/
@ 2024-11-05  2:03 Sam James
  0 siblings, 0 replies; 27+ messages in thread
From: Sam James @ 2024-11-05  2:03 UTC (permalink / raw
  To: gentoo-commits

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

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

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

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

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

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

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


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2024-11-05  2:03 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 12:14 [gentoo-commits] repo/gentoo:master commit in: media-libs/opencv/, media-libs/opencv/files/ Amy Winston
  -- strict thread matches above, loose matches on Subject: below --
2024-11-05  2:03 Sam James
2024-11-05  2:03 Sam James
2024-02-04 13:15 Andreas Sturmlechner
2024-02-04 12:45 Andreas Sturmlechner
2024-01-10 12:33 Sam James
2023-11-22 11:40 Sam James
2023-08-28  4:05 Sam James
2022-09-14  9:19 Andreas Sturmlechner
2022-04-19  5:50 Matt Turner
2021-05-31 20:53 Michał Górny
2020-11-03  7:18 Sam James
2020-06-25 17:08 Andreas Sturmlechner
2019-12-06 20:37 Amy Liffey
2019-03-31 18:52 Amy Liffey
2019-01-24  9:24 Amy Liffey
2019-01-17 18:12 Amy Liffey
2017-09-19 14:00 Amy Liffey
2017-09-19  7:52 Amy Liffey
2017-09-01 11:39 Amy Liffey
2017-06-06 14:45 Amy Liffey
2017-04-16 14:15 Amy Liffey
2016-11-08  7:01 Amy Winston
2016-11-08  7:01 Amy Winston
2016-06-09 18:27 Amy Winston
2016-05-15 13:52 Amy Winston
2016-01-23 17:51 Amy Winston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox