summaryrefslogtreecommitdiff
path: root/~lukeshu/libfreenect-git/PKGBUILD
blob: 8377ab4bf73238c745952ef26d43f5a7a8036900 (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
# Contributor: Sven Schneider <archlinux.sandmann@googlemail.com>
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>

_pkgname=libfreenect
pkgname=${_pkgname}-git
pkgver=20111115
pkgrel=3
pkgdesc="OpenKinect drivers and libraries for the Xbox Kinect device"
arch=('i686' 'x86_64')
url="http://openkinect.org"
license=('GPL')
depends=('libusb' 'freeglut' 'libxmu')
makedepends=('cmake' 'git' 'python2')
provides=($_pkgname)
conflicts=($_pkgname)
source=()
md5sums=()

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

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin
    msg "The local files are updated."
  else
    git clone "$_gitroot" "$_gitname"
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting build..."

  rm -rf "$srcdir/$_gitname-build"
  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build"

  #
  # BUILD HERE
  #

  # Install "libfreenect.hpp" to "/usr/include/libfreenect"
  sed 's/DESTINATION include/DESTINATION include\/${projectNameLower}/g' -i "wrappers/cpp/CMakeLists.txt"
  
  export DYLD_FRAMEWORK_PATH=/usr/lib/python2.7/site-packages
  
  mkdir build
  cd build
  cmake \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DLIB_SUFFIX="" \
      -DBUILD_AUDIO=ON \
      -DBUILD_PYTHON=OFF \
      -DPYTHON_EXECUTABLE="`which python2`" \
      ..
  make
}

package() {
  # Make install
  cd "${srcdir}/${_gitname}-build/build"
  make DESTDIR="${pkgdir}" install

  # Move audio firmware file to proper location
  mkdir -p "${pkgdir}/usr/share/libfreenect"
  mv "${pkgdir}/usr/share/audios.bin" "${pkgdir}/usr/share/libfreenect/audios.bin" 

  # Install udev rules
  cd "${srcdir}/${_gitname}-build/"
  install -d "${pkgdir}/etc/udev/rules.d"
  install -m644 platform/linux/udev/51-kinect.rules "${pkgdir}/etc/udev/rules.d"
  
  # Patch include files
  sed 's/<libfreenect.h>/<libfreenect\/libfreenect.h>/g' -i "${pkgdir}/usr/include/libfreenect/libfreenect.hpp"
}