# http://git.salome-platform.org/gitweb/

# Contributor: Xyne
# Contributor: mauritiusdadd (boost patch)

_gitname='KERNEL_SRC'
_gitbranch='V6_main'
pkgname=salome-kernel-git
pkgver=36.2b8b973
pkgrel=1
pkgdesc="generic platform for Pre and Post-Processing for numerical simulation (KERNEL Module)"
url="http://www.salome-platform.org"
depends=('python2' 'python2-numpy' 'boost' 'omniorb' 'omniorbpy' 'omninotify' 'swig' 'hdf5' 'graphviz' 'libxml2' 'cppunit' 'sed' 'openmpi')
makedepends=('git' 'doxygen' 'python2-sphinx' 'python-docutils')
arch=('i686' 'x86_64')
conflicts=('salome-kernel')
provides=('salome-kernel')
license=('LGPL')
source=("git://git.salome-platform.org/$_gitname.git#branch=$_gitbranch" 'boost.patch')
sha256sums=('SKIP'
            'db8b20698d8f9b6a61a7d80b072ff58658b52169c5903e3fb18d381f35b92cd4')


pkgver() {
  cd "$srcdir/$_gitname"
  printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/$_gitname"
  patch -p0 -t -i "$srcdir/boost.patch"
}

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

#   cmake ../"$_gitname" \
#     -DCMAKE_INSTALL_PREFIX="/usr" \
#     -DCMAKE_DESTDIR="$pkgdir" \
#     -DPYTHON_EXECUTABLE=/usr/bin/python2 \
#     -DOMNIORBPY_ROOT_DIR=/usr/lib/python2.7/site-packages/omniORB \
#     -DMPI_LIB_mpi=/usr/lib/openmpi/libmpi.so \
#     -DMPI_LIB_mpi_cxx=/usr/lib/openmpi/libmpi_cxx.so \
#     -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build2
#     -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
#     -DPYTHON_LIB=/usr/lib/python2.7 \
#     -DPYTHON_LIB=/usr/lib/libpython2.7.so \

  export PYTHON=/usr/bin/python2
  export SPHINX=/usr/bin/sphinx-build2

  ./build_configure
  ./configure \
    --prefix=/usr \
    --with-python-site=/usr/lib/python2.7

  # TODO
  # Deal with this warning (V6_main):
  #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
  make
}

package() {
  cd "$srcdir/$_gitname"
  make DESTDIR="$pkgdir/" install-exec
  # Add missing __init__.py file to ensure that the modules are detected.
  find "$pkgdir/usr/lib/python2.7/site-packages/salome" -type d -exec touch '{}'/__init__.py \;
}

# vim: set ts=2 sw=2 et: