summaryrefslogtreecommitdiff
path: root/libre/arrayfire/PKGBUILD
blob: 653c21e695c4ad91c044f93a30d19e30a7fb0e1a (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
# 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.3.2
arch=('i686' 'x86_64')
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=('01d8d3d498291cf77da9461e34d3671c')
md5sums=('8f3e13dfb0fd8ce8aa7874762c53cdc3'
         'a826b39647d3b48295dd727a2d74fb6a')

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

  #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 -j1
}

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

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

  cd build

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