summaryrefslogtreecommitdiff
path: root/libre/arrayfire/PKGBUILD
blob: 6601ded8f53251409966ce60f4fde2055de3af50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Maintainer (Arch): Sven-Hendrik Haase <sh@lutzhaase.com>
# Maintainer: André Silva <emulatorman@parabola.nu>
pkgname=arrayfire
pkgdesc="High performance software library for parallel computing with an easy-to-use API, without nonfree cuda and nvidia-utils support and nonfree SIFT algorithm"
url='http://arrayfire.com'
pkgver=3.4.0
arch=('i686' 'x86_64' 'armv7h')
pkgrel=1.parabola1
license=('BSD')
makedepends=('cmake' 'graphviz' 'doxygen' 'opencl-headers' 'glfw' 'glew' 'boost' 'git' 'python')
depends=('cblas' 'fftw' 'boost-libs' 'lapacke' 'forge' 'freeimage' 'glfw' 'glew')
optdepends=('libclc: Required for using OpenCL backend')
mksource=(http://arrayfire.com/arrayfire_source/arrayfire-full-${pkgver}.tar.bz2)
source=(https://repo.parabola.nu/other/${pkgname}-libre/${pkgname}-libre-full-${pkgver}.tar.bz2
        remove-nonfree-references.patch)
mkmd5sums=('f9330906c122007287e092c9282c0f97')
md5sums=('830fab3295a7c682be63a43eaf2bdf92'
         '5b6a5dcb4461aa2b7b5369294836fe7c')

check() {
  cd "${srcdir}/arrayfire-full-${pkgver}/build"

  # Some tests fail :(
  #make test
}

mksource() {
  cd "${srcdir}/arrayfire-full-${pkgver}/"

  # remove nonfree SIFT algorithm that is patented in some countries and have some other limitations on the use
  rm -v src/backend/cuda/kernel/sift_nonfree.hpp
  rm -v src/backend/opencl/kernel/sift_nonfree.cl
  rm -v src/backend/opencl/kernel/sift_nonfree.hpp
  rm -v src/backend/cpu/kernel/sift_nonfree.hpp
}

prepare() {
  cd "${srcdir}/arrayfire-full-${pkgver}/"

  # remove nonfree reference/recommendation stuff
  rm -rv CMakeModules/osx_install
  rm -rv src/backend/cuda
  rm -rv test/data/sift
  rm -v CMakeModules/CUDACheckCompute.cmake
  rm -v CMakeModules/cuda_compute_capability.cpp
  rm -v assets/CUDA.png
  rm -v docs/pages/INSTALL.md
  rm -v docs/pages/using_on_osx.md
  rm -v docs/pages/using_on_windows.md
  rm -v include/af/cuda.h
  rm -v src/api/cpp/sift.cpp
  rm -v src/api/c/sift.cpp
  rm -v src/backend/opencl/sift.cpp
  rm -v src/backend/opencl/sift.hpp
  rm -v src/backend/cpu/sift.cpp
  rm -v src/backend/cpu/sift.hpp
  rm -v test/sift_nonfree.cpp
  patch -Np1 -i "${srcdir}/remove-nonfree-references.patch"
}

build() {
  cd "${srcdir}/arrayfire-full-${pkgver}/"

  rm -rf build
  mkdir build && cd build

  cmake .. \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DUSE_SYSTEM_FORGE=ON \
      -DCOMPUTES_DETECTED_LIST="20;30;32;35;50;52;53" \
      -DBUILD_CPU=ON \
      -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_EXAMPLES=ON \
      -DBUILD_DOCS=ON \
      -DBUILD_NONFREE=OFF \
      -DBUILD_SIFT=OFF \
      -DBUILD_CUDA=OFF

  make
}

package() {
  cd "${srcdir}/arrayfire-full-${pkgver}"

  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE

  cd build

  make DESTDIR="${pkgdir}/" install
}