summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: beed4c3a3b8664a0c2b7865e280ed8f4344249f2 (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
# Maintainer: Sven Schneider <archlinux.sandmann@googlemail.com>

pkgname=libfreenect-git
pkgver=20130103
pkgrel=1
pkgdesc="Drivers and libraries for the Xbox Kinect device on Linux"
arch=('i686' 'x86_64')
url="http://openkinect.org"
license=('GPL')
depends=('libusb' 'glu' 'freeglut' 'bash' 'python2')
makedepends=('cmake' 'git' 'libxmu' 'python2-numpy')
optdepends=('opencv: support for python demos'
            'python2-matplotlib: support for python demos')
provides=('libfreenect')
conflicts=('libfreenect')
source=()
md5sums=()

_gitroot="https://github.com/OpenKinect/libfreenect.git"
_gitname=libfreenect

build() {
  cd "${srcdir}"

  if [ ! -d "${srcdir}/${_gitname}" ]; then
    git clone ${_gitroot}
  else
    cd ${_gitname} && git pull origin
  fi

  msg "GIT checkout done."

  cd "${srcdir}"
  cp -rf "${_gitname}" "${_gitname}-build"
  cd "${_gitname}-build"

  # Install "libfreenect.hpp" to "/usr/include/libfreenect"
  sed 's/DESTINATION include/DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR}/g' -i "wrappers/cpp/CMakeLists.txt"

  cmake -DCMAKE_INSTALL_PREFIX=/usr \
    -DPROJECT_INCLUDE_INSTALL_DIR=/usr/include -DLIB_SUFFIX="" \
    -DBUILD_AUDIO=ON -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python2 \
    -DPython_ADDITIONAL_VERSIONS="2.7;2.6;2.5;2.4;2.3;2.2;2.1;2.0".

  make
}

package() {
  cd "${srcdir}/${_gitname}-build"

  make DESTDIR="${pkgdir}" install
  install -Dm644 platform/linux/udev/51-kinect.rules "${pkgdir}/etc/udev/rules.d/51-kinect.rules"

  # Patch include files
  sed 's/<libfreenect.h>/<libfreenect\/libfreenect.h>/g' -i "${pkgdir}/usr/include/libfreenect/libfreenect.hpp"
}