summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 419832f5c5c24539a789398b616950b59f02098c (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
pkgname=openvr-git
pkgver=1.0.16.r0.g6aacebd
pkgrel=1
pkgdesc="API and runtime that allows access to VR hardware from multiple vendors. Contains API and samples. The runtime is under SteamVR in Tools on Steam."
arch=('x86_64')
url="https://github.com/ValveSoftware/openvr"
license=('custom')
depends=('libgl' 'sdl2' 'glew')
optdepends=('oculus-udev: Udev rule to make the rift sensors usable to the "plugdev" group'
            'steam: For SteamVR (Duh)'
            'vive-udev: Udev rule to make the Vive sensors usable to the "plugdev" group')
makedepends=('git' 'cmake' 'qt5-base') #qt5 for the overlayexample
provides=("openvr")
options=('!strip' 'staticlibs')

source=("git+https://github.com/ValveSoftware/openvr.git"
        'https://github.com/ValveSoftware/openvr/commit/0fa21ba17748efcca1816536e27bdca70141b074.patch'
        'https://github.com/ValveSoftware/openvr/commit/4f9149928e29e9f92e6d8dc39f984d1a557a42b3.patch'
        '0001-fix-VREvent_Data_t-union-in-c-header-and-add-pragma-.patch')
md5sums=('SKIP'
         '7350517830b1a0038d30c6ad33b4bb39'
         'dfb4306bb93633e467862cd8990e6e79'
         '97bc5ddeee3f2005afdc32b689711131')

pkgver() {
  cd "$srcdir/openvr"
  #echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
  git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}


prepare() {
  cd "$srcdir/openvr"
  git apply ../0fa21ba17748efcca1816536e27bdca70141b074.patch #https://github.com/ValveSoftware/openvr/pull/594
  git apply ../4f9149928e29e9f92e6d8dc39f984d1a557a42b3.patch #https://github.com/ValveSoftware/openvr/pull/805 
  git apply ../0001-fix-VREvent_Data_t-union-in-c-header-and-add-pragma-.patch # autogenerated, so no pull request
}

build() {
  #export CXX=clang++
  #export CC=clang

  cd openvr
  cmake -DBUILD_SHARED=0 -DCMAKE_INSTALL_PREFIX=/usr/ -DCMAKE_BUILD_TYPE=Release .
  make

  # Valve's build of libopenvr_api.so contains symbols that have no source code available
  # See: https://github.com/ValveSoftware/openvr/issues/425
  #cmake -DBUILD_SHARED=1 -DCMAKE_INSTALL_PREFIX=/usr/ -DCMAKE_BUILD_TYPE=Release .
  #make

  cd samples
  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/ -Wno-dev .
  make
}

package() {
  #make install DESTDIR="$pkgdir"
  #make install DESTDIR="$pkgdir"
  install -d "$pkgdir"/usr/lib
  install -m 555 openvr/bin/linux64/libopenvr_api.so "$pkgdir/usr/lib"
  install -m 555 openvr/bin/linux64/libopenvr_api.a "$pkgdir/usr/lib"

  #make install DESTDIR="$pkgdir" #There is no installer for the samples
  install -d "$pkgdir/usr/bin"
  install -d "$pkgdir/usr/shaders"


  install -m 755 "$srcdir/openvr/samples/bin/linux64/hellovr_vulkan" "$pkgdir/usr/bin"
  for shader in "$srcdir/openvr/samples/bin/shaders/"*.spv
  do
    install -m 755 "$shader" "$pkgdir/usr/shaders"
  done

  install -m 755 "$srcdir/openvr/samples/bin/linux64/hellovr_opengl" "$pkgdir/usr/bin"
  install -m 755 "$srcdir/openvr/samples/bin/cube_texture.png" "$pkgdir/usr/" #TODO: fix source code to look in proper place
  install -m 755 "$srcdir/openvr/samples/bin/linux64/helloworldoverlay" "$pkgdir/usr/bin"
  install -m 755 "$srcdir/openvr/samples/bin/linux64/tracked_camera_openvr_sample" "$pkgdir/usr/bin"
  
  #install -m 755 "$srcdir/build/samples/hellovr_opengl/run_hellovr.sh" "$pkgdir/usr/bin/run_hellovr.sh"
  
  install -d "$pkgdir/usr/include/"
  cp -ra "$srcdir/openvr/headers"/* "$pkgdir/usr/include/"
  #install "$srcdir/openvr/headers"/* "$pkgdir/usr/include/"
  
}

# vim:set ts=2 sw=2 et: