summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e04968ae88454a3fd58edefe27646bc973aaee4b (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
# Maintainer: Franck Lucien Duriez <franck.lucien.duriez@gmail.com>

pkgname="openpose"
pkgver="1.3.0"
pkgrel="1"
pkgdesc="OpenPose represents the first real-time multi-person system to jointly detect human body, hand, and facial keypoints (in total 135 keypoints) on single images."
arch=("any")
url="https://github.com/CMU-Perceptual-Computing-Lab/openpose"
license=("ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY")
depends=("caffe" "intel-mkl" "libgl" "glu" "lilv" "boost")
makedepends=("cmake" "doxygen" "graphviz" "wget")
source=(
  "https://github.com/CMU-Perceptual-Computing-Lab/openpose/archive/v${pkgver}.tar.gz"
  "GLU.patch"
  "models.patch"
)
sha256sums=(
  "5ef834e603dc207c249f49ba672c8bd1895e5a2ffc0ff5548037402a80398bd0"
  "d2e3ad3dd350e494d1e90d595f6b0d4daa76ed9744f7730c22b1803390f1f021"
  "6dfa55f1876778950ed04cbf98f032c4b4129c56c396209837403398e9815f31"
)

prepare() {
  cd "$pkgname-$pkgver"
  patch -p1 -i "${srcdir}/GLU.patch"
  patch -p1 -i "${srcdir}/models.patch"
}

build() {
  cd "$pkgname-$pkgver"
  mkdir -p build
  cd build
  cmake \
    -DCMAKE_BUILD_TYPE:STRING="Release" \
    -DBUILD_CAFFE:BOOL=OFF \
    -DBUILD_EXAMPLES:BOOL=ON \
    -DBUILD_DOCS:BOOL=ON \
    -DBUILD_SHARED_LIBS:BOOL=ON \
    -DDOWNLOAD_BODY_25_MODEL:BOOL=ON \
    -DDOWNLOAD_BODY_COCO_MODEL:BOOL=ON \
    -DDOWNLOAD_BODY_MPI_MODEL:BOOL=ON \
    -DDOWNLOAD_FACE_MODEL:BOOL=ON \
    -DDOWNLOAD_HAND_MODEL:BOOL=ON \
    -DGPU_MODE:STRING=CPU_ONLY \
    -DWITH_3D_RENDERER:BOOL=ON \
    -DCMAKE_CXX_FLAGS:STRING="-I/opt/intel/compilers_and_libraries_2018.3.222/linux/mkl/include" \
    -DCMAKE_C_FLAGS:STRING="-I/opt/intel/compilers_and_libraries_2018.3.222/linux/mkl/include" \
    -DCaffe_INCLUDE_DIRS:PATH="/usr/include" \
    -DCaffe_LIBS:PATH="/usr/lib/libcaffe.so" \
    -DCMAKE_INSTALL_PREFIX:PATH="$pkgdir/usr" \
    ..
  make
}

package() {
  cd "$pkgname-$pkgver/build"

  # Install libraries.
  make install

  # Install the examples.
  _destdir="$pkgdir/usr/share/OpenPose/examples"
  mkdir -p "$_destdir"
  find "./examples" -type f -executable \
    -not -path './examples/tests/*' \
    -not -path './examples/openpose/*' \
    -exec install -D -m755 '{}' "$_destdir" ';'

  # Install main executable.
  _destdir="$pkgdir/usr/bin"
  mkdir -p "$_destdir"
  install -D -m755 \
    "./examples/openpose/openpose.bin" \
    "$_destdir/openpose"

  cd ..

  # Install documentation.
  _destdir="$pkgdir/usr/share/doc/OpenPose"
  mkdir -p "$(dirname "$_destdir")"
  cp -r "./doc/doxygen/html" "$_destdir"
  find "$_destdir" -type f -exec chmod 644 '{}' ';'

  # Install the models.
  _destdir="$pkgdir/usr/lib/OpenPose"
  cp -r "models" "$_destdir"
  find "$_destdir" -type f -exec chmod 644 '{}' ';'
}