summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 367b03f9114a72dbc7237bb4cc55abfbb0cf59c5 (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
# Maintainer: Benjamin Chretien <chretien at lirmm dot fr>
pkgname=libmocap-git
pkgver=r76.99f89be
pkgrel=1
pkgdesc="A simple library to load motion capture data"
arch=('i686' 'x86_64')
url="https://github.com/jrl-umi3218/libmocap"
license=('Modified BSD')
depends=()
optdepends=()
makedepends=('git' 'cmake' 'doxygen')
provides=('libmocap')
conflicts=('libmocap')

# Repository location
_gitroot="git+https://github.com/jrl-umi3218/libmocap.git#branch=master"
_gitname="libmocap"

source=("${_gitname}"::${_gitroot})
md5sums=('SKIP')

# Build type
_buildtype="RelWithDebInfo"

# Build directory
_builddir="${_gitname}-build"

pkgver() {
    cd "$srcdir/${_gitname}"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

# Build the project
build() {
    msg "Updating Git submodules"

    cd "${srcdir}/${_gitname}"
    git submodule init
    git submodule update

    msg "Starting CMake (build type = ${_buildtype})"

    # Create a build directory
    cd "${srcdir}"
    mkdir -p ${_builddir}
    cd "${_builddir}"

    # Run CMake in release
    cmake -DCMAKE_BUILD_TYPE="${_buildtype}" \
          -DCMAKE_INSTALL_PREFIX="/usr" \
          -DENABLE_ROS_VIEWER=OFF \
          "${srcdir}/${_gitname}"

    # Compile the library
    msg "Building the project"
    make --silent

    # Create the documentation
    msg "Creating the documentation"
    make --silent doc
}

# Run unit tests
check() {
    msg "Running unit tests"
    cd "${srcdir}/${_builddir}"
    make test
}

# Create the package
package() {
    cd "${srcdir}/${_builddir}"

    msg "Installing files"
    make --silent DESTDIR="${pkgdir}/" install
}