summaryrefslogtreecommitdiff
path: root/libre/arrayfire/PKGBUILD
blob: 8db884e03c84d1b347495b888f9d9a166b769a37 (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
91
# 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.1.2
arch=('i686' 'x86_64')
pkgrel=1.parabola1
license=('BSD')
makedepends=('cmake' 'graphviz' 'doxygen' 'opencl-headers' 'glfw' 'glew' 'boost' 'git')
depends=('cblas' 'fftw' 'boost-libs' 'lapack' 'forge' 'freeimage')
optdepends=('libclc: Required for using OpenCL backend'
            'glfw: Required for running the examples'
            'glew: Required for running the examples')
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=('c60b10a5ad66ca363ab0732fd9438c15')
md5sums=('39c4c2dbb0e0dd7460d357210fee1ead'
         'bb0ef2b34ee09af4c85c9cb13c0ee485')

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/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
}