PKGBUILDs/community/pybind11/PKGBUILD
2023-03-01 01:06:27 +00:00

63 lines
2.4 KiB
Bash

# Maintainer : Daniel Bermond <dbermond@archlinux.org>
# Maintainer : Santiago Torres-Arias <santiago@archlinux.org>
# Contributor: Matthew Ellison <matt+aur@arroyonetworks.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - disable lto via -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
pkgname=pybind11
pkgver=2.10.3
pkgrel=3
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-setuptools: for python bindings')
makedepends=('cmake' 'boost' 'catch2' 'eigen' 'python-setuptools' 'python-pytest')
#'python-sphinx' 'python-sphinx_rtd_theme' 'python-breathe')
checkdepends=('python-numpy' 'python-scipy')
source=("https://github.com/pybind/pybind11/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('5d8c4c5dda428d3a944ba3d2a5212cb988c2fae4670d58075a5a49075a6ca315')
build () {
cd "${pkgname}-${pkgver}"
python setup.py build
# tests
cmake \
-B "${srcdir}/build-cmake" \
-S "${srcdir}/${pkgname}-${pkgver}" \
-G 'Unix Makefiles' \
-DCMAKE_BUILD_TYPE:STRING='None' \
-DCMAKE_INSTALL_PREFIX:PATH='/usr' \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-Wno-dev
make -C "${srcdir}/build-cmake" all mock_install
# manpage (needs python-sphinxcontrib-{moderncmakedomain,svg2pdfconverter})
# make -C "${srcdir}/${pkgname}-${pkgver}/docs" man
}
check() {
make -C build-cmake check
}
package() {
cd "${pkgname}-${pkgver}"
python setup.py install --root="$pkgdir" --skip-build --optimize='1'
# symlinks
local _pyver
_pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
install -d -m755 "${pkgdir}/usr"/{include,lib/{cmake,pkgconfig}}
ln -s "../lib/python${_pyver}/site-packages/pybind11/include/pybind11" "${pkgdir}/usr/include/pybind11"
ln -s "../../lib/python${_pyver}/site-packages/pybind11/share/cmake/pybind11" "${pkgdir}/usr/lib/cmake/pybind11"
ln -s "../../lib/python${_pyver}/site-packages/pybind11/share/pkgconfig/pybind11.pc" "${pkgdir}/usr/lib/pkgconfig/pybind11.pc"
# man page
# install -D -m644 "docs/.build/man/${pkgname}.1" "${pkgdir}/usr/share/man/man7/${pkgname}.7"
# sed -i '/^\.TH/s/"1"/"7"/' "${pkgdir}/usr/share/man/man7/${pkgname}.7"
# license
install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}