summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1b9a609cf88ec0f92cdcdb218bf3d9262eecfd8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Maintainer: japm48 <japm48gh@gmail.com>
# Adapted from official PKGBUILD in Community repo

_pkgname=pybind11
pkgname=${_pkgname}-git

provides=($_pkgname)
conflicts=($_pkgname)

pkgver=v2.7.0.r22.gdcbda8d7
pkgrel=1

_repo=pybind/$_pkgname

pkgdesc='pybind11 (git version)'
arch=('any')
url='https://pybind11.readthedocs.org/'
license=('BSD')

optdepends=('python: for python bindings')
makedepends=('git' 'cmake' 'boost' 'eigen' 'python' 'python-setuptools' 'python-pytest')

checkdepends=('python-numpy' 'python-scipy')

source=("git+https://github.com/${_repo}.git")
sha256sums=('SKIP')

pkgver() {
  cd "${srcdir}/${_pkgname}"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build () {
    cd "${_pkgname}"
    python setup.py build

    # tests
    cmake \
        -B "${srcdir}/build-cmake" \
        -S "${srcdir}/${_pkgname}" \
        -DCMAKE_BUILD_TYPE:STRING='None' \
        -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
        -Wno-dev
    make -C "${srcdir}/build-cmake" all mock_install

}

check() {
    make -C build-cmake check
}

package() {
    cd "${_pkgname}"
    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}
    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"

    # 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}"
}