diff --git a/extra/opencv/PKGBUILD b/extra/opencv/PKGBUILD index 82c3135c9..5c6d39da6 100644 --- a/extra/opencv/PKGBUILD +++ b/extra/opencv/PKGBUILD @@ -6,8 +6,8 @@ pkgbase=opencv pkgname=(opencv opencv-samples) -pkgver=3.4.4 -pkgrel=1 +pkgver=4.0.0 +pkgrel=4 pkgdesc="Open Source Computer Vision Library" arch=(x86_64) license=(BSD) @@ -22,8 +22,8 @@ optdepends=('opencv-samples: samples' 'python-numpy: Python interface') source=("$pkgbase-$pkgver.tar.gz::https://github.com/opencv/opencv/archive/$pkgver.zip" "opencv_contrib-$pkgver.tar.gz::https://github.com/opencv/opencv_contrib/archive/$pkgver.tar.gz") -sha256sums=('b5755384cbadf67f55838c6cfd9ae1aad0ebad2c7cfe4c1174417c80d2ed15a9' - '765446d994713363554978d1da447fef77a2cdf9e38742f0a98b13b92652626d') +sha256sums=('86fd08fc02893e05e2944fa7b0daa7d02643232450f020b475e1b2f24587b99a' + '4fb0681414df4baedce6e3f4a01318d6f4fcde6ee14854d761fd4e397a397763') prepare() { mkdir -p build @@ -32,6 +32,7 @@ prepare() { build() { cd build # cmake's FindLAPACK doesn't add cblas to LAPACK_LIBRARIES, so we need to specify them manually + _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"` cmake ../$pkgname-$pkgver \ -DWITH_OPENCL=ON \ -DWITH_OPENGL=ON \ @@ -46,31 +47,31 @@ build() { -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib \ -DOPENCV_EXTRA_MODULES_PATH="$srcdir/opencv_contrib-$pkgver/modules" \ + -DOPENCV_SKIP_PYTHON_LOADER=ON \ + -DOPENCV_PYTHON3_INSTALL_PATH=$_pythonpath \ -DLAPACK_LIBRARIES="/usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libcblas.so" \ -DLAPACK_CBLAS_H="/usr/include/cblas.h" \ - -DLAPACK_LAPACKE_H="/usr/include/lapacke.h" + -DLAPACK_LAPACKE_H="/usr/include/lapacke.h" \ + -DOPENCV_GENERATE_PKGCONFIG=ON make } package_opencv() { - options=(staticlibs) - cd build make DESTDIR="$pkgdir" install # install license file install -Dm644 "$srcdir"/$pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname - # install python bindings - cd python_loader - python setup.py install --root="$pkgdir" - rm -r "$pkgdir"/usr/python - - cd "$pkgdir"/usr/share - # separate samples package - mv OpenCV/samples "$srcdir/$pkgname-samples" - mv OpenCV $pkgname # otherwise folder naming is inconsistent + cd "$pkgdir"/usr/share + mv opencv4/samples "$srcdir"/$pkgname-samples + + # install missing headers https://github.com/opencv/opencv/issues/13201 + for _module in imgcodecs videoio photo; do + cp -r "$srcdir"/$pkgname-$pkgver/modules/$_module/include/opencv2/$_module/legacy \ + "$pkgdir"/usr/include/opencv4/opencv2/$_module + done } package_opencv-samples() { diff --git a/extra/opencv/opencv-legacy-headers.patch b/extra/opencv/opencv-legacy-headers.patch new file mode 100644 index 000000000..3a6c8db55 --- /dev/null +++ b/extra/opencv/opencv-legacy-headers.patch @@ -0,0 +1,12 @@ +diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt +index d771224d4..dc9587927 100644 +--- a/modules/imgcodecs/CMakeLists.txt ++++ b/modules/imgcodecs/CMakeLists.txt +@@ -102,6 +102,7 @@ file(GLOB imgcodecs_ext_hdrs + "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp" + "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h" ++ "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*/*.h" + ) + + if(IOS)