From 1ec6d4a86ec5d3b39611cb9738df5c5d3a126df0 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Tue, 20 Nov 2018 00:50:29 +0000 Subject: [PATCH] added community/pybind11 --- community/pybind11/PKGBUILD | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 community/pybind11/PKGBUILD diff --git a/community/pybind11/PKGBUILD b/community/pybind11/PKGBUILD new file mode 100644 index 000000000..e3461141b --- /dev/null +++ b/community/pybind11/PKGBUILD @@ -0,0 +1,89 @@ +# Maintainer : Daniel Bermond < gmail-com: danielbermond > +# Maintainer : Santiago Torres-Arias +# Contributor: Matthew Ellison + +# ALARM: Kevin Mihelich +# - 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}" +}