pkgbase=opencv pkgname=('opencv' 'opencv-samples') pkgver=3.1.0 pkgrel=8 pkgdesc="Open Source Computer Vision Library" arch=('x86_64') license=('BSD') url="http://opencv.org" depends=('gst-plugins-base' 'intel-tbb' 'libcl' 'libgphoto2' 'xine-lib' 'libdc1394' 'openexr' 'v4l-utils' 'ffmpeg' 'qt5-base' 'glu' 'python3') makedepends=('pkgconfig' 'cmake' 'python2-numpy' 'mesa' 'python3-numpy' 'eigen3' 'hdf5') optdepends=('python2-numpy: Python 2.x interface' 'python3-numpy: Python 3.x interface' 'eigen3' 'hdf5: For hdf5 plugin to work') source=("opencv-$pkgver.zip::https://github.com/Itseez/opencv/archive/${pkgver}.zip" "opencv_contrib-$pkgver.zip::https://github.com/Itseez/opencv_contrib/archive/${pkgver}.zip") sha1sums=('8c932b68fe2e1575e88dde759ab1ed1d53d6f41b' '4c64e698fcf9c1a2e3720446bab4d7fc5f487064') _cmakeopts=('-D CMAKE_BUILD_TYPE=Release' '-D CMAKE_INSTALL_PREFIX=/usr' '-D CMAKE_SKIP_RPATH=ON' '-D BUILD_SHARED_LIBS=ON' '-D BUILD_TESTS=OFF' '-D BUILD_EXAMPLES=ON' '-D INSTALL_C_EXAMPLES=ON' '-D INSTALL_PYTHON_EXAMPLES=ON' '-D WITH_XINE=ON' '-D WITH_OPENGL=ON' '-D WITH_OPENCL=ON' '-D WITH_QT=5' '-D WITH_GTK=OFF' '-D WITH_GSTREAMER=ON' '-D ENABLE_SSE3=OFF' '-D ENABLE_SSSE3=OFF' '-D ENABLE_FAST_MATH=OFF') prepare() { mkdir build } build() { cd build cmake ${_cmakeopts[@]} ../$pkgbase-$pkgver -DOPENCV_EXTRA_MODULES_PATH="$srcdir/opencv_contrib-${pkgver}/modules" make } package_opencv() { provides=('opencv-qt5') conflicts=('opencv-qt5') replaces=('opencv-qt5') cd build make DESTDIR="$pkgdir" install # install license file install -Dm644 "$srcdir/$pkgbase-$pkgver/LICENSE" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" # fix -lippicv not found cd "$pkgdir/usr/share" ln -s /usr/share/opencv/3rdparty/lib/libippicv.a "$pkgdir/usr/lib" # separate samples package; also be -R friendly if [[ -d OpenCV/samples ]]; then mv OpenCV/samples "$srcdir/$pkgname-samples" mv OpenCV $pkgname # otherwise folder naming is inconsistent elif [[ ! -d OpenCV ]]; then warning "Directory naming issue; samples package may not be built!" fi } package_opencv-samples() { pkgdesc+=" (samples)" depends=("opencv=$pkgver") unset optdepends mkdir -p "$pkgdir/usr/share/opencv" cp -r "$srcdir/opencv-samples" "$pkgdir/usr/share/opencv/samples" # install license file install -Dm644 "$srcdir/opencv-$pkgver/LICENSE" \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" }