summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6d7333f0ab4be07841bf8c1d9ef81d97a70bf95a (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
# Maintainer: Benjamin Chretien <chretien at lirmm dot fr>
pkgname=rbdl-hg
_name=rbdl
pkgrel=1
pkgver=574.10633e9d9e84
pkgver() {
    cd ${_name}
    echo $(hg identify -n).$(hg identify -i)
}
pkgdesc="RBDL - Rigid Body Dynamics Library. Mercurial version."
url="http://rbdl.bitbucket.org"
arch=('x86_64' 'i686')
license=('GPLv3')
makedepends=('cmake' 'eigen3' 'mercurial')
optdepends=('lua51: Lua model add-on'
            'unittestpp: unit tests')
provides=('rbdl')
conflicts=('rbdl')
source=("${_name}::hg+https://bitbucket.org/rbdl/rbdl")
sha1sums=('SKIP')

# TODO:
#  - urdfreader support (depends on ROS)
_has_lua=OFF
_has_unittestpp=OFF
_has_rosurdf=OFF
_lua_param=""
_unittestpp_param=""
_rosurdf_param=""

check_optdepends() {
    # Check if lua is installed
    if (pacman -Q lua51 >/dev/null) ; then
        _has_lua=ON
        _lua_param="-DBUILD_ADDON_LUAMODEL=ON -DLUA_LIBRARIES=lua5.1 -DLUA_INCLUDE_DIR=/usr/include/lua5.1"
    fi

    # Check if UnitTest++ is installed
    if (pacman -Q unittestpp >/dev/null) ; then
        _has_unittestpp=ON
        _unittestcpp_param="-DBUILD_TESTS=ON"
    fi
}


build() {
    # Check optional dependencies
    check_optdepends

    mkdir -p build
    cd build

    cmake ../${_name} -DCMAKE_INSTALL_PREFIX=/usr \
                      -DCMAKE_BUILD_TYPE=Release \
                      -DBUILD_ADDON_BENCHMARK=ON \
                      ${_lua_param} ${_unittestpp_param} ${_rosurdf_param}

    make
}

check() {
    if [ ${_has_unittestpp} = ON ]; then
        cd build
        ./tests/runtests
    fi
}

package() {
    cd build
    make DESTDIR="${pkgdir}" install
}