diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /media-libs/opencv | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'media-libs/opencv')
-rw-r--r-- | media-libs/opencv/Manifest | 3 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch | 10 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.10-pic-x86.patch | 49 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.2-cflags.patch | 21 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.3-gcc47.patch | 22 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.8-javamagic.patch | 32 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch | 12 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.9-cuda.patch | 89 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-2.4.9-libav10.patch | 748 | ||||
-rw-r--r-- | media-libs/opencv/files/opencv-3.0.0-gles.patch | 14 | ||||
-rw-r--r-- | media-libs/opencv/metadata.xml | 30 | ||||
-rw-r--r-- | media-libs/opencv/opencv-2.4.10.ebuild | 222 | ||||
-rw-r--r-- | media-libs/opencv/opencv-2.4.9.ebuild | 222 | ||||
-rw-r--r-- | media-libs/opencv/opencv-3.0.0.ebuild | 222 |
14 files changed, 1696 insertions, 0 deletions
diff --git a/media-libs/opencv/Manifest b/media-libs/opencv/Manifest new file mode 100644 index 000000000000..c6dfcf380843 --- /dev/null +++ b/media-libs/opencv/Manifest @@ -0,0 +1,3 @@ +DIST opencv-2.4.10.zip 91692581 SHA256 1bf4cb87283797fd91669d4f90b622a677a903c20b4a577b7958a2164f7596c6 SHA512 545345f2984bda9ec5e5f0947077c5f40028ea018cbb21362f33615e5a02d5ed19a51c77a9b183086534e6496509dd008f9d7d40c2efc46bf2a942c710b4424c WHIRLPOOL 3231c1f6b766b39a44b10354532037f5f9f856bd1533c205cc39a1a3758aa53dd4d15595127fd6d1c1d2b6b7bdafe64521ca833c036a5075de4b298218d4bf0c +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 diff --git a/media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch b/media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch new file mode 100644 index 000000000000..59090703d149 --- /dev/null +++ b/media-libs/opencv/files/opencv-2.3.1a-libav-0.7.patch @@ -0,0 +1,10 @@ +--- OpenCV-2.3.1.orig/modules/highgui/src/cap_ffmpeg_impl.hpp 2011-11-14 05:33:37.000000000 +0100 ++++ OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp 2011-11-14 05:33:18.000000000 +0100 +@@ -104,6 +104,7 @@ + #endif + #if defined(HAVE_LIBAVCODEC_AVCODEC_H) + #include <libavcodec/avcodec.h> ++ #include <libavutil/mathematics.h> + #endif + #if defined(HAVE_LIBSWSCALE_SWSCALE_H) + #include <libswscale/swscale.h> 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 new file mode 100644 index 000000000000..74b75016183b --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.10-pic-x86.patch @@ -0,0 +1,49 @@ +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.2-cflags.patch b/media-libs/opencv/files/opencv-2.4.2-cflags.patch new file mode 100644 index 000000000000..d52e6b6a39f4 --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.2-cflags.patch @@ -0,0 +1,21 @@ +diff -ruN OpenCV-2.4.2.orig/cmake/OpenCVCompilerOptions.cmake OpenCV-2.4.2/cmake/OpenCVCompilerOptions.cmake +--- OpenCV-2.4.2.orig/cmake/OpenCVCompilerOptions.cmake 2012-06-29 00:55:15.000000000 +0200 ++++ OpenCV-2.4.2/cmake/OpenCVCompilerOptions.cmake 2012-07-16 23:51:24.244907235 +0200 +@@ -110,17 +110,6 @@ + endif() + + # Other optimizations +- if(ENABLE_OMIT_FRAME_POINTER) +- add_extra_compiler_option(-fomit-frame-pointer) +- else() +- add_extra_compiler_option(-fno-omit-frame-pointer) +- endif() +- if(ENABLE_FAST_MATH) +- add_extra_compiler_option(-ffast-math) +- endif() +- if(ENABLE_POWERPC) +- add_extra_compiler_option("-mcpu=G3 -mtune=G5") +- endif() + if(ENABLE_SSE) + add_extra_compiler_option(-msse) + endif() diff --git a/media-libs/opencv/files/opencv-2.4.3-gcc47.patch b/media-libs/opencv/files/opencv-2.4.3-gcc47.patch new file mode 100644 index 000000000000..13ac8f8fb58f --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.3-gcc47.patch @@ -0,0 +1,22 @@ +diff -ruN OpenCV-2.4.3.orig/modules/highgui/src/grfmt_tiff.cpp OpenCV-2.4.3/modules/highgui/src/grfmt_tiff.cpp +--- OpenCV-2.4.3.orig/modules/highgui/src/grfmt_tiff.cpp 2012-10-12 00:55:12.000000000 +0200 ++++ OpenCV-2.4.3/modules/highgui/src/grfmt_tiff.cpp 2012-11-05 21:37:40.000000000 +0100 +@@ -47,6 +47,7 @@ + + #include "precomp.hpp" + #include "grfmt_tiff.hpp" ++#include "unistd.h" + + namespace cv + { +diff -ruN OpenCV-2.4.3.orig/modules/highgui/src/window_QT.h OpenCV-2.4.3/modules/highgui/src/window_QT.h +--- OpenCV-2.4.3.orig/modules/highgui/src/window_QT.h 2012-10-18 00:55:38.000000000 +0200 ++++ OpenCV-2.4.3/modules/highgui/src/window_QT.h 2012-11-05 21:38:41.000000000 +0100 +@@ -41,6 +41,7 @@ + #define __OPENCV_HIGHGUI_QT_H__ + + #include "precomp.hpp" ++#include "unistd.h" + + #if defined( HAVE_QT_OPENGL ) + #include <QtOpenGL> diff --git a/media-libs/opencv/files/opencv-2.4.8-javamagic.patch b/media-libs/opencv/files/opencv-2.4.8-javamagic.patch new file mode 100644 index 000000000000..766abc1e0941 --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.8-javamagic.patch @@ -0,0 +1,32 @@ +diff -ruN opencv-2.4.8.orig/CMakeLists.txt opencv-2.4.8/CMakeLists.txt +--- opencv-2.4.8.orig/CMakeLists.txt 2013-12-27 18:09:18.000000000 +0100 ++++ opencv-2.4.8/CMakeLists.txt 2014-01-24 22:06:12.000000000 +0100 +@@ -164,6 +164,7 @@ + OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) ) + OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) ) + OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 ) ++OCV_OPTION(WITH_JAVA "Include Java support" ON) + + # OpenCV build components + # =================================================== +@@ -449,6 +450,8 @@ + include(cmake/OpenCVDetectPython.cmake) + + # --- Java Support --- ++if(WITH_JAVA) ++ + include(cmake/OpenCVDetectApacheAnt.cmake) + if(ANDROID) + include(cmake/OpenCVDetectAndroidSDK.cmake) +@@ -466,6 +469,11 @@ + SET(CAN_BUILD_ANDROID_PROJECTS FALSE) + endif() + ++else() ++ SET(ANT_EXECUTABLE "") ++ SET(CAN_BUILD_ANDROID_PROJECTS FALSE) ++endif() ++ + # --- OpenCL --- + if(WITH_OPENCL) + include(cmake/OpenCVDetectOpenCL.cmake) diff --git a/media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch b/media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch new file mode 100644 index 000000000000..d7ff3c7eaf67 --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.9-cuda-pkg-config.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -528,6 +528,9 @@
+ if(HAVE_CUFFT)
+ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CUDA_cufft_LIBRARY})
+ endif()
++ foreach(p ${CUDA_LIBS_PATH})
++ set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} -L${p})
++ endforeach()
+ endif()
+
+ # ----------------------------------------------------------------------------
diff --git a/media-libs/opencv/files/opencv-2.4.9-cuda.patch b/media-libs/opencv/files/opencv-2.4.9-cuda.patch new file mode 100644 index 000000000000..2cb84160022b --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.9-cuda.patch @@ -0,0 +1,89 @@ +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-libav10.patch b/media-libs/opencv/files/opencv-2.4.9-libav10.patch new file mode 100644 index 000000000000..df517285e000 --- /dev/null +++ b/media-libs/opencv/files/opencv-2.4.9-libav10.patch @@ -0,0 +1,748 @@ +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/files/opencv-3.0.0-gles.patch b/media-libs/opencv/files/opencv-3.0.0-gles.patch new file mode 100644 index 000000000000..a2629d928e82 --- /dev/null +++ b/media-libs/opencv/files/opencv-3.0.0-gles.patch @@ -0,0 +1,14 @@ +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/metadata.xml b/media-libs/opencv/metadata.xml new file mode 100644 index 000000000000..94c7862604ac --- /dev/null +++ b/media-libs/opencv/metadata.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>kde</herd> + <maintainer> + <email>dilfridge@gentoo.org</email> + <name>Andreas K. Huettel</name> + </maintainer> + <maintainer> + <email>amynka@gentoo.org</email> + <name>Amy Winston</name> + </maintainer> + <longdescription> +OpenCV (Open Source Computer Vision) is a library of programming functions mainly aimed at real time computer vision. +Example applications of the OpenCV library are Human-Computer Interaction (HCI); Object Identification, Segmentation and Recognition; +Face Recognition; Gesture Recognition; Motion Tracking, Ego Motion, Motion Understanding; Structure From Motion (SFM); and Mobile Robotics. +</longdescription> + <use> + <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="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> + </use> + <upstream> + <remote-id type="sourceforge">opencvlibrary</remote-id> + <remote-id type="github">Itseez/opencv</remote-id> + </upstream> +</pkgmetadata> diff --git a/media-libs/opencv/opencv-2.4.10.ebuild b/media-libs/opencv/opencv-2.4.10.ebuild new file mode 100644 index 000000000000..458675970fc0 --- /dev/null +++ b/media-libs/opencv/opencv-2.4.10.ebuild @@ -0,0 +1,222 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 +PYTHON_COMPAT=( python2_7 ) + +inherit base 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 ) +" + +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-libav10.patch" + "${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch" + "${FILESDIR}/${PN}-2.4.10-pic-x86.patch" +) + +pkg_setup() { + use python && python-single-r1_pkg_setup + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + base_src_prepare + + # 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 new file mode 100644 index 000000000000..b91b22fe4207 --- /dev/null +++ b/media-libs/opencv/opencv-2.4.9.ebuild @@ -0,0 +1,222 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 +PYTHON_COMPAT=( python2_7 ) + +inherit base 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 ) +" + +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.patch" + "${FILESDIR}/${PN}-2.4.9-libav10.patch" + "${FILESDIR}/${PN}-2.4.9-cuda-pkg-config.patch" +) + +pkg_setup() { + use python && python-single-r1_pkg_setup + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + base_src_prepare + + # 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 new file mode 100644 index 000000000000..5f5616762991 --- /dev/null +++ b/media-libs/opencv/opencv-3.0.0.ebuild @@ -0,0 +1,222 @@ +# Copyright 1999-2015 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 base 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" + +LICENSE="BSD" +SLOT="0/3.0" +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 qt5 testprograms threads tiff v4l vtk xine" +REQUIRED_USE=" + python? ( ${PYTHON_REQUIRED_USE} ) + qt4? ( !qt5 ) + qt5? ( !qt4 ) +" + +# 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: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 ) + ) + 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}/${P}-gles.patch" +) + +pkg_setup() { + use python && python-single-r1_pkg_setup + java-pkg-opt-2_pkg_setup +} + +src_prepare() { + base_src_prepare + + # remove bundled stuff + rm -rf 3rdparty + 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=( + # 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 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 +} |