summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: decc4067e3393b93e584d24337a81951164000b6 (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
# Maintainer: Eric Berquist <eric dot berquist at gmail dot com>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Damir Perisa <damir.perisa@bluewin.ch>

pkgname=openbabel-git
_name=openbabel
pkgver=2.4.90.r5252.722b2134
pkgrel=1
pkgdesc="A library designed to interconvert between many file formats used in molecular modeling and computational chemistry (git version, builds Python bindings)"
arch=("x86_64")
url="https://github.com/openbabel/openbabel"
license=("GPL")
depends=("libxml2" "libsm" "python" "wxgtk")
makedepends=("git" "cmake" "eigen" "boost" "swig")
provides=("${_name}")
conflicts=("${_name}" "python-${_name}")
source=("${_name}::git+https://github.com/openbabel/openbabel.git#branch=master")
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/${_name}"
  _parent_ver=$(git tag --sort=version:refname | tail -n 1 | cut -d "-" -f 2- | tr - .)
  _parent_major_ver=$(echo "${_parent_ver}" | cut -d "." -f 1)
  _parent_minor_ver=$(echo "${_parent_ver}" | cut -d "." -f 2)
  _parent_patch_ver=$(echo "${_parent_ver}" | cut -d "." -f 3)
  # Git patch versions always start with 90. Don't use the patch
  # version of the parent tag.
  _git_patch_ver=90
  printf "%s.%s.%s.r%s.%s" \
         "${_parent_major_ver}" \
         "${_parent_minor_ver}" \
         "${_git_patch_ver}" \
         "$(git rev-list --count HEAD)" \
         "$(git rev-parse --short HEAD)"
}

prepare() {
  mkdir -p "${srcdir}/build"
  cd "${srcdir}/build"
}

build() {
  cd "${srcdir}/build"

  cmake "${srcdir}/${_name}" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DENABLE_OPENMP=ON \
    -DRUN_SWIG=ON \
    -DPYTHON_BINDINGS=ON

  make
}

check() {
  NCPUS=$(nproc)
  cd "${srcdir}/build"
  ctest -j${NCPUS}
}

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