summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 760da5d032eee69194211315f85fd351ada91fe9 (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: Benjamin Chretien <chretien@lirmm.fr>
# Contributor: Thomas Moulard <thomas.moulard@gmail.com>

pkgname=roboptim-trajectory-git
pkgver=20130322
pkgrel=1
pkgdesc="Trajectory optimization for robotics"
arch=('i686' 'x86_64')
url="http://roboptim.net/"
license=('(L)GPL2')
depends=('roboptim-core-git' 'roboptim-core-plugin-ipopt-git' 'boost>=1.41'
         'doxygen' 'pkg-config' 'libltdl')
makedepends=('git' 'cmake')
provides=('roboptim-trajectory')
conflicts=('roboptim-trajectory')
optdepends=()

# Repository location
_gitroot="git://github.com/roboptim/roboptim-trajectory.git"
_gitname="roboptim-trajectory"

# Build type
_buildtype="RELWITHDEBINFO"

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

# Build the project
build() {
    msg "Connecting to Git server..."

    if [ -d ${srcdir}/${_gitname} ] ; then
        # Update local files (including submodules)
        cd ${srcdir}/${_gitname} && git pull origin && git submodule update || return 1
        msg "The local files are updated."
    else
        # Clone repository and submodules
        git clone --recursive ${_gitroot} ${srcdir}/${_gitname} || return 1
    fi

    msg "Git checkout done or server timeout"

    cd "${srcdir}/${_gitname}" || return 1

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

    # Create a build directory
    if [ -d ${_builddir} ]
    then
        cd ${_builddir}
    else
        mkdir ${_builddir}
        cd ${_builddir}
    fi

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

    # Compile the library
    msg "Building the project..."
    make --silent || return 1

    # Create the documentation
    msg "Creating the documentation..."
    make --silent doc || return 1
}

# Run unit tests
check() {
    msg "Running unit tests..."
    cd "${srcdir}/${_gitname}-${pkgver}-build"

    # Need to update LD_LIBRARY_PATH else tests fail
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${_builddir}/src"
    make test || return 1
}

# Create the package
package() {
    # Install in /opt/roboptim
    cd "${srcdir}/${_gitname}-${pkgver}-build"

    msg "Installing files..."
    make --silent DESTDIR="${pkgdir}/" install || return 1
}