summaryrefslogtreecommitdiff
path: root/~lukeshu/openni-git/PKGBUILD
blob: 95d2052e47aa14bce19fb5c2797652c20a592382 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Contributor: Sven Schneider <archlinux.sandmann@googlemail.com>
# Contributor: bugix
# Contributor: Lubosz Sarnecki <lubosz at gmail>

# unfortunately we can't use $_suf in function names, but sed makes it ok
_suf='-git'
pkgname=(
    openni$_suf
    openni$_suf-docs

    openni$_suf-core
    openni$_suf-core-samples
    openni$_suf-core-samples-source
    
    openni$_suf-mono
    openni$_suf-mono-samples
    openni$_suf-mono-samples-source

    openni$_suf-java
    openni$_suf-java-samples
    openni$_suf-java-samples-source
    )
pkgver=20111121
pkgrel=3
arch=('i686' 'x86_64')
url="http://www.openni.org/"
license=('GPL')
makedepends=('git' 'doxygen' 'graphviz')
source=()
md5sums=()

_gitroot="git://github.com/OpenNI/OpenNI.git"
_gitname="openni"
#_gitbranch="unstable"
_gitbranch="master"

case "${CARCH}" in
'x86_64') _platform=Linux-x86;;
'i686')   _platform=Linux-x86;;
'arm')    _platform=Linux-Arm;; # untested
*)        _platform=UNSUPPORTED_ARCH;;
esac

export MAKEFLAGS+=' -j1 '

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

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

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

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

  # PATCH
  sed -i 's/python /python2 /' "Platform/${_platform}/CreateRedist/RedistMaker"
  echo '
abs_core: $(ALL_MODULES) $(ALL_UTILS)
abs_core_samples: $(CORE_SAMPLES)
abs_java: $(ALL_JAVA_PROJS)
abs_java_samples: $(JAVA_SAMPLES)
abs_mono: $(ALL_MONO_PROJS)
abs_mono_samples: $(MONO_SAMPLES) $(MONO_FORMS_SAMPLES)
' >> "Platform/${_platform}/Build/Makefile"

  
  # BUILD
  cd "Platform/${_platform}/Build"
  make -j1 \
      abs_core abs_core_samples \
      abs_java abs_java_samples \
      abs_mono abs_mono_samples || return 1

  cd '../../../Source/DoxyGen'
  mkdir html
  doxygen Doxyfile
  rm -rf html/*.map html*.md5 html/*.hhc html/*.hhp
}

package_openni-git() {
  pkgdesc="Open Natural Interface framework"
  depends=("openni$_suf-core")
  optdepends=("openni$_suf-docs: programmer documentation")
  provides=('openni')
  conflicts=('openni')
}

package_openni-git-docs() {
  pkgdesc="OpenNI programmer documentation"
  arch=('any')
  provides=('openni-docs')
  conflicts=('openni-docs')

  cd "${srcdir}/${_gitname}-build/Source/DoxyGen/"
  install -d "${pkgdir}/usr/share/openni"
  cp -r html "${pkgdir}/usr/share/openni"
}

package_openni-git-core() {
  pkgdesc="OpenNI core libraries"
  depends=('libusb' 'freeglut')
  install="openni.install"
  provides=('openni-core')
  conflicts=('openni-core')

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Bin/Release"

  LIB_FILES='
    libnimCodecs.so
    libnimMockNodes.so
    libnimRecorder.so
    libOpenNI.so
    '
  install -d "${pkgdir}/usr/lib"
  install -m755 $LIB_FILES "${pkgdir}/usr/lib"

  BIN_FILES='niReg niLicense'
  install -d "${pkgdir}/usr/bin"
  install -m755 $BIN_FILES "${pkgdir}/usr/bin"

  cd "${srcdir}/${_gitname}-build/Include"
  install -d "${pkgdir}/usr/include/ni"
  install -m644 *.h "${pkgdir}/usr/include/ni"
  cp -r "${_platform}" "${pkgdir}/usr/include/ni"

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Build"
  install -d "${pkgdir}/usr/share"
  cp -r Common "${pkgdir}/usr/share/common"
}

package_openni-git-java() {
  pkgdesc="OpenNI java wrapper"
  depends=("openni$_suf" 'java-environment')
  provides=('openni-java')
  conflicts=('openni-java')

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Bin/Release"

  install -d "${pkgdir}/usr/lib"
  install -m755 libOpenNI.jni.so "${pkgdir}/usr/lib"
  
  install -d "${pkgdir}/usr/share/openni/java"
  install -m755 org.OpenNI.jar "${pkgdir}/usr/share/openni/java"
}

package_openni-git-mono() {
  pkgdesc="OpenNI mono wrapper"
  depends=("openni$_suf" 'mono')
  provides=('openni-mono')
  conflicts=('openni-mono')

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Bin/Release"
  
  install -d "${pkgdir}/usr/share/openni/mono"
  install -m755 OpenNI.net.dll "${pkgdir}/usr/share/openni/mono"
}

# SAMPLES

_install_sample_source() {
  sample=$1
  makefile="Platform/${_platform}/Build/Samples/$sample/Makefile"
  install -d                "${pkgdir}/usr/share/openni/samples"
  cp -r "Samples/$sample"   "${pkgdir}/usr/share/openni/samples/$sample"
  install -m644 "$makefile" "${pkgdir}/usr/share/openni/samples/$sample"
}

# Leave out NiViewer, it's set up wrong
CORE_SAMPLES='
  AudioSample
  BackRecorder
  CRead
  ConvertXToONI
  RecordSynthetic
  SimpleCreate
              SimpleRead SimpleViewer UserTracker'
MONO_SAMPLES='SimpleRead SimpleViewer UserTracker'
JAVA_SAMPLES='SimpleRead SimpleViewer UserTracker'

package_openni-git-core-samples() {
  pkgdesc="OpenNI sample programs"
  depends=("openni$_suf-core")
  optdepends=('openni-core-samples-source: source code for the samples')
  provides=('openni-core-samples')
  conflicts=('openni-core-samples')

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Bin/Release"
  install -d "${pkgdir}/usr/bin"
  install -m755 NiViewer "${pkgdir}/usr/bin/niSample-Viewer"
  for sample in $CORE_SAMPLES; do
    install -m766 Sample-Ni$sample "${pkgdir}/usr/bin/niSample-$sample"
  done
}
package_openni-git-core-samples-source() {
  pkgdesc="OpenNI sample programs source code"
  depends=("openni$_suf-core")
  provides=('openni-core-samples-source')
  conflicts=('openni-core-samples-source')
  options+=('!strip')

  cd "${srcdir}/${_gitname}-build"
  for sample in Viewer $CORE_SAMPLES; do
    _install_sample_source Ni$sample
  done
}

package_openni-git-java-samples() {
  pkgdesc="OpenNI java wrapper sample programs"
  depends=("openni$_suf-java")
  optdepends=("openni$_suf-java-samples-source: source code for the samples")
  arch=('any')
  provides=('openni-java-samples')
  conflicts=('openni-java-samples')

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Bin/Release"
  install -d "${pkgdir}/usr/bin"
  install -d "${pkgdir}/usr/share/openni/java"
  for sample in $JAVA_SAMPLES; do
    install -m644 org.OpenNI.Samples.$sample.jar "${pkgdir}/usr/share/openni/java"
    echo "#/bin/sh
java -jar /usr/share/openni/java/org.OpenNI.Samples.$sample.jar $@
" > "${pkgdir}/usr/bin/niSample-$sample.jar"
    chmod 755 "${pkgdir}/usr/bin/niSample-$sample.jar"
  done
}
package_openni-git-java-samples-source() {
  pkgdesc="OpenNI java wrapper sample programs source code"
  depends=("openni$_suf-java")
  provides=('openni-java-samples-source')
  conflicts=('openni-java-samples-source')
  options+=('!strip')

  cd "${srcdir}/${_gitname}-build"
  for sample in $JAVA_SAMPLES; do
    _install_sample_source $sample.java
  done
}

package_openni-git-mono-samples() {
  pkgdesc="OpenNI java wrapper sample programs"
  depends=("openni$_suf-mono")
  optdepends=("openni$_suf-mono-samples-source: source code for the samples")
  provides=('openni-mono-samples')
  conflicts=('openni-mono-samples')

  cd "${srcdir}/${_gitname}-build/Platform/${_platform}/Bin/Release"
  install -d "${pkgdir}/usr/bin"
  install -d "${pkgdir}/usr/share/openni/mono"
  for sample in $MONO_SAMPLES; do
    install -m755 $sample.net.exe "${pkgdir}/usr/share/openni/mono"
    echo "#/bin/sh
cd /usr/share/openni/mono
mono $sample.net.exe $@
" > "${pkgdir}/usr/bin/niSample-$sample.net"
    chmod 755 "${pkgdir}/usr/bin/niSample-$sample.net"
  done
}
package_openni-git-mono-samples-source() {
  pkgdesc="OpenNI mono wrapper sample programs source code"
  depends=("openni$_suf-mono")
  provides=('openni-mono-samples-source')
  conflicts=('openni-mono-samples-source')
  options+=('!strip')

  cd "${srcdir}/${_gitname}-build"
  for sample in $MONO_SAMPLES; do
    _install_sample_source $sample.net
  done
}