summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bdf998ce3a8def99da7079c579c2703dc53c86ca (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
# Maintainer: bartus szczepaniak <aur@bartus.33mail.com>
name=colmap
fragment=dev
pkgname=${name}-git
pkgver=3.1.r84.g3c7fd57
pkgrel=1
pkgdesc="COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface."
arch=('i686' 'x86_64')
url="https://colmap.github.io/"
license=('GPL')
groups=()
depends=('gflags' 'suitesparse' 'freeglut' 'glew' 'google-glog' 'freeimage' 'boost-libs' 'qt5-base')
makedepends=('ceres-solver' 'boost' 'git' 'cmake' 'eigen' 'cuda')
optdepends=('cuda: for cuda sfm/mvs acceleration')
provides=()
# Fix: -fno-plt flag not supported by cuda host compiler (gcc5)
options=(!buildflags)
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong"
CXXFLAGS="${CFLAGS}"
install=${pkgname}.install
source=("${pkgname}::git+https://github.com/colmap/colmap.git#branch=${fragment}"
        "nvm-export.patch"
        "${pkgname}.install"
        "${name}.desktop"
        "vocabulary-tree-64K.bin::https://demuc.de/colmap/vocab_tree-65536.bin"
        "vocabulary-tree-256K.bin::https://demuc.de/colmap/vocab_tree-262144.bin"
        "vocabulary-tree-1M.bin::https://demuc.de/colmap/vocab_tree-1048576.bin"
        )
md5sums=('SKIP'
         '8a9f76c21ae93e5f5571f372f5401423'
         'ebb1dc43e014a1e720a06422c6248a40'
         '55d81534d969cf706719007462f20443'
         '3521ff3c601596473c6ce5256772f606'
         'e423daecc45d56b749d25eeace9de1c8'
         '7ec70d4137d9b7ca9f076df34808ccc7')

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

prepare() {
  cd ${srcdir}/${pkgname}
  patch -Np1 -i ../nvm-export.patch
}


build() {
  cd ${srcdir}
  
  # determine whether we can precompile CUDA kernels
    _CUDA_PKG=`pacman -Qq cuda 2>/dev/null` || true
    if [ "$_CUDA_PKG" != "" ]; then
      _EXTRAOPTS="-DCUDA_ENABLED=ON -DCUDA_HOST_COMPILER=/opt/cuda/bin/gcc -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda"
    fi

  mkdir -p build
  cd build
  cmake -DTESTS_ENABLED=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ${_EXTRAOPTS} -DCUDA_NVCC_FLAGS="--compiler-options -fPIC" ../${pkgname}
  make
}


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

  # install desktop entry
  install -d -m755 "${pkgdir}/usr/share/applications"
  install -m644 "${srcdir}/${name}.desktop" "${pkgdir}/usr/share/applications"
  sed -i "s#Version=.*#Version=$pkgver#" "${pkgdir}/usr/share/applications/${name}.desktop"
  
  # install vocabulary trees for sequential,vocabulary matching
  install -d -m755 ${pkgdir}/usr/share/${name}
  for vocab_tree in ${srcdir}/vocabulary-tree-*.bin ; do
    install -m644 ${vocab_tree} ${pkgdir}/usr/share/${name}/${vocab_tree##*/}
  done
}
# vim:set ts=2 sw=2 et: