summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 795a6dbc651a7efd9245587310175fa650524418 (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
# Maintainer: Benjamin Chretien <chretien at lirmm dot fr>
pkgname=roboptim-core-plugin-ipopt-git
_name="roboptim-core-plugin-ipopt"
pkgver=3.1.r1.g24b0a48
pkgrel=1
pkgdesc="Ipopt interface for RobOptim Core"
arch=('i686' 'x86_64')
url="http://roboptim.net/"
license=('(L)GPL2')
depends=('roboptim-core-git' 'boost>=1.41' 'doxygen' 'eigen3' 'libltdl' 'ipopt')
makedepends=('git' 'cmake')
provides=('roboptim-core-plugin-ipopt')
conflicts=('roboptim-core-plugin-ipopt')

# Repository location
_gitroot="git+https://github.com/roboptim/${_name}.git"
source=("${_name}::${_gitroot}#branch=master")
md5sums=('SKIP')

# Build type
_buildtype="RelWithDebInfo"

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

pkgver() {
  cd "${srcdir}/${_name}"
  git describe --tags --match="v*.*" --long \
    | sed -r 's/([^-]*-g)/r\1/;s/-/./g' \
    | sed -r 's/^.{1}//'
}

# Build the project
build() {
  # Update submodules
  msg "Updating submodules"
  cd ${srcdir}/${_name}
  git submodule init && git submodule update

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

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

  # Run CMake in release
  cmake -DCMAKE_BUILD_TYPE="${_buildtype}" \
    -DCMAKE_INSTALL_PREFIX="/usr" \
    -DDISABLE_TESTS=ON \
    "${srcdir}/${_name}"

  # 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
}