summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Bermond2018-11-25 23:15:46 +0000
committerDaniel Bermond2018-11-25 23:15:46 +0000
commite6101cdb248734b7e1b2f82281649ddbebf735ea (patch)
tree09bef3927990e1e50376fe386b967e7eb70392f9
parent0bbecda9321accec7adb9a41da9979826c712ed6 (diff)
downloadaur-e6101cdb248734b7e1b2f82281649ddbebf735ea.tar.gz
Fix build with opencv 4.0
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD12
-rw-r--r--caffe2-git-opencv4-fix.patch48
3 files changed, 61 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6dec02b7300..3ef94bd0b5d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = caffe2-git
pkgdesc = A new lightweight, modular, and scalable deep learning framework (git version)
- pkgver = 0.8.2.r14826.gf79fb58744
- pkgrel = 2
+ pkgver = 0.8.2.r14834.g60e7d04961
+ pkgrel = 1
epoch = 1
url = https://caffe2.ai/
arch = i686
@@ -86,6 +86,7 @@ pkgbase = caffe2-git
source = git+https://github.com/intel/ARM_NEON_2_x86_SSE.git
source = git+https://github.com/pytorch/fbgemm
source = git+https://github.com/asmjit/asmjit.git
+ source = caffe2-git-opencv4-fix.patch
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
@@ -116,6 +117,7 @@ pkgbase = caffe2-git
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
+ sha256sums = 3a9bb782dc77414ba2d86d222d30b6c33c8fc434e489eaf5958c108ab3565c06
pkgname = caffe2-git
diff --git a/PKGBUILD b/PKGBUILD
index 299764b69f8..5ae76916501 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,8 +2,8 @@
pkgname=caffe2-git
_srcname=pytorch
-pkgver=0.8.2.r14826.gf79fb58744
-pkgrel=2
+pkgver=0.8.2.r14834.g60e7d04961
+pkgrel=1
epoch=1
pkgdesc='A new lightweight, modular, and scalable deep learning framework (git version)'
arch=('i686' 'x86_64')
@@ -67,6 +67,8 @@ source=(
'git+https://github.com/pytorch/fbgemm'
# others:
'git+https://github.com/asmjit/asmjit.git'
+ # patches:
+ 'caffe2-git-opencv4-fix.patch'
)
sha256sums=('SKIP'
'SKIP'
@@ -97,7 +99,8 @@ sha256sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
- 'SKIP')
+ 'SKIP'
+ '3a9bb782dc77414ba2d86d222d30b6c33c8fc434e489eaf5958c108ab3565c06')
prepare() {
cd "$_srcname"
@@ -132,6 +135,9 @@ prepare() {
git config --local 'submodule.third-party/cpuinfo.url' "${srcdir}/cpuinfo"
git submodule update
+
+ # opencv 4.0 fix
+ patch -Np1 -i "${srcdir}/caffe2-git-opencv4-fix.patch"
}
pkgver() {
diff --git a/caffe2-git-opencv4-fix.patch b/caffe2-git-opencv4-fix.patch
new file mode 100644
index 00000000000..1b88e26ce6b
--- /dev/null
+++ b/caffe2-git-opencv4-fix.patch
@@ -0,0 +1,48 @@
+commit 431bba7ccb765830fdbd951264c8dc9dcab4d145
+Author: Daniel Bermond <danielbermond@yahoo.com>
+Date: Sun Nov 25 19:05:26 2018 +0000
+
+ [caffe2] Fix build with OpenCV 4.0
+
+ Fixes #14355
+
+diff --git a/caffe2/video/optical_flow.cc b/caffe2/video/optical_flow.cc
+index 4855b2c0a..8d343042f 100644
+--- a/caffe2/video/optical_flow.cc
++++ b/caffe2/video/optical_flow.cc
+@@ -7,7 +7,11 @@ void OpticalFlowExtractor(
+ const cv::Mat& curr_gray,
+ const int flow_alg_type,
+ cv::Mat& flow) {
++#if CV_MAJOR_VERSION >= 4
++ cv::Ptr<cv::DISOpticalFlow> tvl1 = cv::DISOpticalFlow::create();
++#else
+ cv::Ptr<cv::DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
++#endif
+ switch (flow_alg_type) {
+ case FLowAlgType::FarnebackOpticalFlow:
+ cv::calcOpticalFlowFarneback(
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 01e35947e..3014c2d9a 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -430,11 +430,15 @@ endif()
+
+ # ---[ OpenCV
+ if(USE_OPENCV)
+- # OpenCV 3
+- find_package(OpenCV 3 QUIET COMPONENTS core highgui imgproc imgcodecs videoio video)
++ # OpenCV 4
++ find_package(OpenCV 4 QUIET COMPONENTS core highgui imgproc imgcodecs optflow videoio video)
+ if(NOT OpenCV_FOUND)
+- # OpenCV 2
+- find_package(OpenCV QUIET COMPONENTS core highgui imgproc)
++ # OpenCV 3
++ find_package(OpenCV 3 QUIET COMPONENTS core highgui imgproc imgcodecs videoio video)
++ if(NOT OpenCV_FOUND)
++ # OpenCV 2
++ find_package(OpenCV QUIET COMPONENTS core highgui imgproc)
++ endif()
+ endif()
+ if(OpenCV_FOUND)
+ include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})