aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-pybind11/APKBUILD
blob: 67f0225dd82789ac99433c668e38d2acb1e359fe (plain) (blame)
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
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=py3-pybind11
_pkgname=pybind11
pkgver=2.6.1
pkgrel=2
pkgdesc="Seamless operability between C++11 and Python"
url="https://github.com/pybind/pybind11"
arch="noarch"
license="MPL-2.0"
makedepends="
	python3-dev
	py3-setuptools
	cmake
	boost-dev
	"
checkdepends="
	py3-pytest
	"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/pybind/pybind11/archive/v$pkgver.tar.gz
	fix.patch"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-pybind11" # Backwards compatibility
provides="py-pybind11=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	# fails to build with fortify headers enabled
	# https://github.com/pybind/pybind11/issues/1650
	export CXXFLAGS="$CXXFLAGS -U_FORTIFY_SOURCE"

	python3 setup.py build

	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build . \
		-DCMAKE_BUILD_TYPE=None \
		-DPYTHON_EXECUTABLE=/usr/bin/python3 \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DUSE_PYTHON_INCLUDE_DIR=FALSE \
		$CMAKE_CROSSOPTS .
	make -C build
}

check() {
	make -C build check
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir" \
		--install-headers=/usr/include/pybind11 --skip-build

	make -C build DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/lib
	mv "$pkgdir"/usr/share/cmake "$pkgdir"/usr/lib
}

dev() {
	depends_dev="$pkgname"
	default_dev
}

sha512sums="8730efec82eef8dc09a58ca3e3b28fca45880cef85d32aa5524a8fe64e23d5f6dff4ca1b48b3034a287199bd56f4db4d6806c5358bef66fde84ed0fbf80ec264  py3-pybind11-2.6.1.tar.gz
f71c2ab76ad7a60fc6a5e5eca127a725452d5cc8464b02562ac8419f8397d5453e18261dca3659b4821477e76e87e7c44cbf917e1a7c915cce07ef9a1652d2a2  fix.patch"