PKGBUILDs/extra/pybind11/PKGBUILD

76 lines
3.1 KiB
Bash
Raw Normal View History

2019-06-21 18:51:56 +00:00
# Maintainer : Daniel Bermond <dbermond@archlinux.org>
2018-11-20 00:50:29 +00:00
# Maintainer : Santiago Torres-Arias <santiago@archlinux.org>
# Contributor: Matthew Ellison <matt+aur@arroyonetworks.com>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
2020-10-29 14:04:52 +00:00
# - disable lto via -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF
2018-11-20 00:50:29 +00:00
pkgname=pybind11
2024-06-27 22:06:38 +00:00
pkgver=2.13.1
2024-07-20 10:27:20 +00:00
pkgrel=2
2018-11-20 00:50:29 +00:00
pkgdesc='A lightweight header-only library that exposes C++ types in Python and vice versa'
arch=('any')
url='https://pybind11.readthedocs.org/'
2024-04-03 12:49:14 +00:00
license=('BSD-3-Clause')
2023-03-01 01:06:27 +00:00
optdepends=('python-setuptools: for python bindings')
2023-12-08 14:57:37 +00:00
makedepends=('cmake' 'boost' 'eigen' 'python-build' 'python-installer'
2023-07-16 14:51:54 +00:00
'python-setuptools' 'python-pytest' 'python-wheel')
2020-10-29 02:10:18 +00:00
#'python-sphinx' 'python-sphinx_rtd_theme' 'python-breathe')
2024-06-26 09:18:12 +00:00
checkdepends=('python-numpy') # 'python-scipy')
2023-07-16 14:51:54 +00:00
source=("https://github.com/pybind/pybind11/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz"
2024-07-20 10:27:20 +00:00
'https://github.com/pybind/pybind11/commit/51c2aa16de5b50fe4be6a0016d6090d4a831899e.patch'
2023-07-16 14:51:54 +00:00
'010-pybind11-remove-unwanted-pip-build-deps.patch')
2024-06-27 22:06:38 +00:00
sha256sums=('51631e88960a8856f9c497027f55c9f2f9115cafb08c0005439838a05ba17bfc'
2024-07-20 10:27:20 +00:00
'cf1001cf7faccf0d9a7181d676ee4895f2fe5677a672c0344ded71e49e6ab378'
2023-07-16 14:51:54 +00:00
'27f13a9b32ef344223d70f7340cc32d181ed1de0beb9ce8b6779271f7abd15c9')
prepare() {
2024-07-20 10:27:20 +00:00
patch -d "${pkgname}-${pkgver}" -Np1 \
-i "${srcdir}/010-pybind11-remove-unwanted-pip-build-deps.patch"
patch -d "${pkgname}-${pkgver}" -Np1 \
-i "${srcdir}/51c2aa16de5b50fe4be6a0016d6090d4a831899e.patch"
2023-07-16 14:51:54 +00:00
}
2018-11-20 00:50:29 +00:00
build () {
cd "${pkgname}-${pkgver}"
2023-07-16 14:51:54 +00:00
python -m build --wheel --no-isolation
2018-11-20 00:50:29 +00:00
2020-10-29 02:10:18 +00:00
# tests
cmake \
2023-03-01 01:06:27 +00:00
-G 'Unix Makefiles' \
2023-07-16 14:51:54 +00:00
-B "${srcdir}/build-tests" \
-S "${srcdir}/${pkgname}-${pkgver}" \
2020-10-29 02:10:18 +00:00
-DCMAKE_BUILD_TYPE:STRING='None' \
-DCMAKE_INSTALL_PREFIX:PATH='/usr' \
2023-12-08 14:57:37 +00:00
-DDOWNLOAD_CATCH:BOOL='ON' \
2020-10-29 14:04:52 +00:00
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
2020-10-29 02:10:18 +00:00
-Wno-dev
2023-07-16 14:51:54 +00:00
cmake --build "${srcdir}/build-tests"
2018-11-20 00:50:29 +00:00
2021-07-18 21:25:48 +00:00
# manpage (needs python-sphinxcontrib-{moderncmakedomain,svg2pdfconverter})
2020-10-29 02:10:18 +00:00
# make -C "${srcdir}/${pkgname}-${pkgver}/docs" man
2018-11-20 00:50:29 +00:00
}
check() {
2023-07-16 14:51:54 +00:00
make -C build-tests check
2018-11-20 00:50:29 +00:00
}
package() {
2023-07-16 14:51:54 +00:00
python -m installer --destdir="$pkgdir" "${pkgname}-${pkgver}/dist"/*.whl
2018-11-20 00:50:29 +00:00
2020-10-29 02:10:18 +00:00
# symlinks
local _pyver
_pyver="$(python -c 'import sys; print("%s.%s" %sys.version_info[0:2])')"
2023-03-01 01:06:27 +00:00
install -d -m755 "${pkgdir}/usr"/{include,lib/{cmake,pkgconfig}}
2020-10-29 02:10:18 +00:00
ln -s "../lib/python${_pyver}/site-packages/pybind11/include/pybind11" "${pkgdir}/usr/include/pybind11"
2021-04-17 19:29:41 +00:00
ln -s "../../lib/python${_pyver}/site-packages/pybind11/share/cmake/pybind11" "${pkgdir}/usr/lib/cmake/pybind11"
2023-03-01 01:06:27 +00:00
ln -s "../../lib/python${_pyver}/site-packages/pybind11/share/pkgconfig/pybind11.pc" "${pkgdir}/usr/lib/pkgconfig/pybind11.pc"
2018-11-20 00:50:29 +00:00
2019-06-21 18:51:56 +00:00
# man page
2020-10-29 02:10:18 +00:00
# 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"
2018-11-20 00:50:29 +00:00
# license
2023-07-16 14:51:54 +00:00
install -D -m644 "${pkgname}-${pkgver}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
2018-11-20 00:50:29 +00:00
}