added community/pybind11

This commit is contained in:
Kevin Mihelich 2018-11-20 00:50:29 +00:00
parent df38ed9760
commit 1ec6d4a86e

View file

@ -0,0 +1,89 @@
# Maintainer : Daniel Bermond < gmail-com: danielbermond >
# Maintainer : Santiago Torres-Arias <santiago@archlinux.org>
# Contributor: Matthew Ellison <matt+aur@arroyonetworks.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - disable lto via -DPYBIND11_LTO_CXX_FLAGS=""
pkgname=pybind11
pkgver=2.2.4
pkgrel=5
pkgdesc='A lightweight header-only library that exposes C++ types in Python and vice versa'
arch=('any')
url='https://pybind11.readthedocs.org/'
license=('BSD')
optdepends=('python: to target bindings supporting python 3'
'python2: to target bindings supporting python 2')
makedepends=('cmake' 'boost' 'eigen' 'python' 'python-setuptools' 'python-pytest'
'python-sphinx' 'python2' 'python2-setuptools' 'python2-pytest' 'python-breathe')
checkdepends=('python-numpy' 'python-scipy' 'python2-numpy' 'python2-scipy')
source=("${pkgname}-${pkgver}.tar.gz"::"https://github.com/pybind/pybind11/archive/v${pkgver}.tar.gz")
sha256sums=('b69e83658513215b8d1443544d0549b7d231b9f201f6fc787a2b2218b408181e')
prepare() {
cd "${pkgname}-${pkgver}"
mkdir -p build-cmake{,-py2}
}
build () {
local _pythonver
_pythonver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
# python modules
cd "${pkgname}-${pkgver}"
python setup.py build
# cmake files and tests
cd build-cmake
cmake \
-DCMAKE_INSTALL_PREFIX='/usr' \
-DPYBIND11_LTO_CXX_FLAGS="" \
-DPYTHON_EXECUTABLE:FILEPATH="/usr/bin/python${_pythonver}" \
-Wno-dev \
..
make all mock_install
cd "${srcdir}/${pkgname}-${pkgver}/build-cmake-py2"
cmake \
-DCMAKE_INSTALL_PREFIX='/usr' \
-DPYBIND11_LTO_CXX_FLAGS="" \
-DPYTHON_EXECUTABLE:FILEPATH='/usr/bin/python2.7' \
-Wno-dev \
..
make all mock_install
# manpage
cd "${srcdir}/${pkgname}-${pkgver}/docs"
make man
}
check() {
cd "${pkgname}-${pkgver}"
make -C build-cmake check # python3 tests
make -C build-cmake-py2 check # python2 tests
}
package() {
cd "${pkgname}-${pkgver}"
local _pythonver
_pythonver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
# python modules
python setup.py install --root="$pkgdir" --install-headers='/usr/include/pybind11' --skip-build --optimize='1'
python2 setup.py install --root="$pkgdir" --install-headers='/usr/include/pybind11' --skip-build --optimize='1'
# cmake files
mkdir -p "${pkgdir}/usr/share/cmake/${pkgname}"
cd build-cmake/mock_install/share/cmake/pybind11
install -m644 *.cmake "${pkgdir}/usr/share/cmake/${pkgname}"
# manpage
cd "${srcdir}/${pkgname}-${pkgver}/docs/.build/man"
install -D -m644 "${pkgname}.1" -t "${pkgdir}/usr/share/man/man1"
# license
cd "${srcdir}/${pkgname}-${pkgver}"
install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}