New Paste

 

Recent Pastes

Administrate




Pastebin on paste.luisaranguren.com

PasteID: 1zc
Pasted by Anonymous, 2020-02-27 09:54:14 GMT
Expires Never
Paste size 3.49 Kb
Tools Raw   Download
 
  1. # Maintainer: Alex Dewar <alex.dewar@gmx.co.uk> 
  2. # Contributor: Ray Rashif <schiv@archlinux.org> 
  3. # Contributor: Tobias Powalowski <tpowa@archlinux.org> 
  4.  
  5. pkgname=opencv-cuda 
  6. pkgver=4.2.0 
  7. pkgrel=1 
  8. provides=(opencv opencv-samples) 
  9. conflicts=(opencv opencv-samples) 
  10. pkgdesc="Open Source Computer Vision Library with CUDA support" 
  11. arch=(x86_64) 
  12. license=(BSD) 
  13. url="http://opencv.org/" 
  14. options=(staticlibs) 
  15. depends=(intel-tbb openexr gst-plugins-base libdc1394 cblas lapack libgphoto2 jasper cuda) 
  16. makedepends=(cmake python-numpy python2-numpy mesa eigen hdf5 lapacke gtk3 nvidia-sdk) 
  17. optdepends=('opencv-samples: samples' 
  18.             'gtk3: for the HighGUI module' 
  19.             'hdf5: support for HDF5 format' 
  20.             'opencl-icd-loader: For coding with OpenCL' 
  21.             'python-numpy: Python 3 interface' 
  22.             'python2-numpy: Python 2 interface') 
  23. source=("opencv-$pkgver.tar.gz::https://github.com/opencv/opencv/archive/$pkgver.zip" 
  24.         "opencv_contrib-$pkgver.tar.gz::https://github.com/opencv/opencv_contrib/archive/$pkgver.tar.gz" 
  25.         "fix-cuda-10.1.patch" 
  26.         "fix-build-error.patch::https://github.com/opencv/opencv_contrib/commit/00e60f0d578651540b709730aa284af54055ae97.patch") 
  27. sha256sums=('SKIP' 
  28.             'SKIP' 
  29.             '4e1640f37ee357d38551a65d3dbfc03a5d7589bffaa3cde92a64c5ea62f55aef' 
  30.             '805166b77b0c38e9e9f69b5b285d2b5313e54f0419a71155f4d9f2d5e6b5d2cc') 
  31.  
  32. prepare() { 
  33.   msg2 "Patching sources for CUDA v10" 
  34.   sed -i 's|nvcuvid.h|nvidia-sdk/nvcuvid.h|' opencv_contrib-$pkgver/modules/cud*/src/*.hpp 
  35.  
  36.   mkdir -p build 
  37.  
  38.   cd opencv-$pkgver 
  39.   patch --forward --strip=1 < ../fix-cuda-10.1.patch 
  40.  
  41.   cd ../opencv_contrib-$pkgver 
  42. #  patch --forward --strip=1 < ../fix-build-error.patch 
  43.  
  44. build() { 
  45.   cd build 
  46.   # cmake's FindLAPACK doesn't add cblas to LAPACK_LIBRARIES, so we need to specify them manually 
  47.   _pythonpath=`python -c "from sysconfig import get_path; print(get_path('platlib'))"` 
  48.   cmake ../opencv-$pkgver \ 
  49.     -DWITH_OPENCL=ON \ 
  50.     -DWITH_OPENGL=ON \ 
  51.     -DWITH_TBB=ON \ 
  52.     -DOpenGL_GL_PREFERENCE=GLVND \ 
  53.     -DBUILD_WITH_DEBUG_INFO=OFF \ 
  54.     -DBUILD_TESTS=OFF \ 
  55.     -DBUILD_PERF_TESTS=OFF \ 
  56.     -DBUILD_EXAMPLES=ON \ 
  57.     -DINSTALL_C_EXAMPLES=ON \ 
  58.     -DINSTALL_PYTHON_EXAMPLES=ON \ 
  59.     -DCMAKE_INSTALL_PREFIX=/usr \ 
  60.     -DCMAKE_INSTALL_LIBDIR=lib \ 
  61.     -DCPU_BASELINE_DISABLE=SSE3 \ 
  62.     -DCPU_BASELINE_REQUIRE=SSE2 \ 
  63.     -DWITH_NVCUVID=ON \ 
  64.     -DWITH_CUDA=ON \ 
  65.     -DWITH_CUDNN=ON \ 
  66.     -DOPENCV_DNN_CUDA=ON \ 
  67.     -DCUDA_FAST_MATH=ON \ 
  68.     -DCUDA_ARCH_BIN=6.1 \ 
  69.     -DWITH_CUBLAS=ON \ 
  70.     -DCUDA_HOST_COMPILER=/usr/bin/gcc-8 \ 
  71.     -DOPENCV_EXTRA_MODULES_PATH="$srcdir/opencv_contrib-$pkgver/modules" \ 
  72.     -DOPENCV_SKIP_PYTHON_LOADER=ON \ 
  73.     -DEIGEN_INCLUDE_PATH=/usr/include/eigen3 \ 
  74.     -DOPENCV_PYTHON3_INSTALL_PATH=$_pythonpath \ 
  75.     -DLAPACK_LIBRARIES="/usr/lib/liblapack.so;/usr/lib/libblas.so;/usr/lib/libcblas.so" \ 
  76.     -DLAPACK_CBLAS_H="/usr/include/cblas.h" \ 
  77.     -DLAPACK_LAPACKE_H="/usr/include/lapacke.h" \ 
  78.     -DOPENCV_GENERATE_PKGCONFIG=ON 
  79.   make 
  80.  
  81. package() { 
  82.   cd build 
  83.   make DESTDIR="$pkgdir" install 
  84.  
  85.   # install license file 
  86.   install -Dm644 "$srcdir"/opencv-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname 
  87.  
  88.   cd "$pkgdir"/usr/share 
  89.  
  90.   # separate samples package; also be -R friendly 
  91.   if [[ -d opencv4/samples ]]; then 
  92.     mv opencv4 $pkgname # otherwise folder naming is inconsistent 
  93.   elif [[ ! -d opencv4 ]]; then 
  94.     warning "Directory naming issue; samples package may not be built!" 
  95.   fi 
  96.  
 
 
 
 
Written by Xan Manning, 2010.