summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0dc431eeadd62edbd866f68595b6055c4338d1d6 (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
# Contributor: dtag <dtag00@gmail.com>

pkgname=ceres-solver
pkgver=2.0.0
pkgrel=2
pkgdesc="Solver for nonlinear least squares problems"
arch=('i686' 'x86_64')
url="http://ceres-solver.org/"
license=('LGPL')
makedepends=('cmake')
depends=('google-glog>=0.3.4' 'eigen>=3.3.0'
      'suitesparse>=4.4.5')
optdepends=('openmp')
source=("http://ceres-solver.org/ceres-solver-2.0.0.tar.gz" "0001-Fix-FindTBB-version-detection-with-TBB-2021.1.1.patch")
sha256sums=('10298a1d75ca884aa0507d1abb0e0f04800a92871cd400d4c361b56a777a7603'
            '3995ecc44dd32cd00c5708a85f8fa9ca6d1deb6a354e7bc89f00d94f243bab76')
options=('staticlibs')

_cmakeopts=('-D CMAKE_BUILD_TYPE=Release'
            '-D CMAKE_INSTALL_PREFIX=/usr'
            '-D EIGENSPARSE=ON'
            '-D BUILD_SHARED_LIBS=ON'
            '-D BUILD_TESTING=OFF'
            '-D BUILD_EXAMPLES=OFF'
            '-D BUILD_BENCHMARKS=OFF')

prepare() {
    # apply compile fix for tbb (backported from git repo)
    echo $(pwd)
    patch --directory="$pkgname-$pkgver" --forward --strip=1 --input="$srcdir/0001-Fix-FindTBB-version-detection-with-TBB-2021.1.1.patch"
}

build() {
  cd $srcdir/$pkgname-$pkgver
  mkdir -p ./build
  cd ./build
  cmake ${_cmakeopts[@]} ../ -DLIB_SUFFIX=""
  make
}

package ()
{
  cd $srcdir/$pkgname-$pkgver/build/
  make DESTDIR=$pkgdir install
  install -Dm644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # Pin Eigen version preventing version mismatch cmake config after Eigen update.
  index=$(declare -p depends | sed -n "s,.*\[\([^]]*\)\]=\"eigen.*\".*,\1,p")
  depends[$index]=$(pacman -Sp --print-format "%n=%v" eigen|cut -d- -f1)
}