AbysmalBiscuit

2018-03-12-AUR-python-dlib-cuda-updated-and-fixed

Mar 12th, 2018
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Maintainer: Adam Gradzki <adam at mm dot st>
  2. # Contributor: Flávio Zavan <flavio dot zavan at gmail dot com>
  3. # Contributor: pingplug
  4. # Contributor: perlawk
  5. # Contributor: xsmile
  6.  
  7. pkgname=('python-dlib-cuda' 'python2-dlib-cuda')
  8. _pkgname='dlib'
  9. pkgver=19.9
  10. pkgrel=1
  11. pkgdesc="Dlib is a general purpose cross-platform C++ library designed using contract programming and modern C++ techniques."
  12. arch=('any')
  13. url="http://www.dlib.net/"
  14. license=('Boost Software License')
  15. makedepends=('cmake' 'boost' 'cuda' 'gcc6' 'python' 'python2')
  16. optdepends=('cblas: for BLAS support'
  17.             'lapack: for LAPACK support'
  18.             'libjpeg-turbo: for JPEG support'
  19.             'libpng: for PNG support'
  20.             'sqlite: for sqlite support')
  21. source=('http://dlib.net/files/dlib-19.9.tar.bz2')
  22. md5sums=('4a3868a1e88721b68ccfb0567eaac87b')
  23.  
  24. # Detecting whether certain cpu optimisations can be made
  25. avx_available=()
  26. if grep -q avx /proc/cpuinfo; then
  27.   avx_available=( '--yes' 'USE_AVX_INSTRUCTIONS' )
  28. fi
  29.  
  30. sse2_available=()
  31. if grep -q sse2 /proc/cpuinfo; then
  32.   sse2_available=( '--yes' 'USE_SSE2_INSTRUCTIONS' )
  33. fi
  34.  
  35. sse4_available=()
  36. if grep -q sse4 /proc/cpuinfo; then
  37.   sse4_available=( '--yes' 'USE_SSE4_INSTRUCTIONS' )
  38. fi
  39.  
  40. build() {
  41.   cd "${srcdir}/${_pkgname}-${pkgver}"
  42.  
  43.   # Exporting compiler environment variables
  44.   # This is necessary to get cuda support
  45.   export CC=`which gcc-6`
  46.   export CXX=`which g++-6`
  47.  
  48.   # Compiling for Python 3
  49.   python setup.py build -j $(nproc) "${avx_available[@]}" "${sse2_available[@]}" "${sse4_available[@]}"
  50.  
  51.   # Compiling for Python 2
  52.   python2 setup.py build "${avx_available[@]}" "${sse2_available[@]}" "${sse4_available[@]}"
  53. }
  54.  
  55. package_python-dlib-cuda() {
  56.   depends=('python')
  57.  
  58.   cd "${srcdir}/${_pkgname}-${pkgver}"
  59.   python setup.py install --skip-build --prefix=/usr --root="$pkgdir" --optimize=1
  60. }
  61.  
  62. package_python2-dlib-cuda() {
  63.   depends=('python2')
  64.  
  65.   cd "${srcdir}/${_pkgname}-${pkgver}"
  66.   python2 setup.py install --skip-build --prefix=/usr --root="$pkgdir" --optimize=1
  67. }
RAW Paste Data