aboutsummaryrefslogtreecommitdiffstats
path: root/testing/py-pybind11/APKBUILD
blob: 64c7397754fa9f88c7928ef7ba20f87c352c546a (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
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=py-pybind11
_pkgname=pybind11
pkgver=2.2.4
pkgrel=0
pkgdesc="Seamless operability between C++11 and Python"
url="https://github.com/pybind/pybind11"
arch="noarch"
license="MPL-2.0"
depends=""
makedepends="
	python2-dev
	python3-dev
	py-setuptools
	cmake
	pytest
	boost-dev
	"
subpackages="py3-${pkgname#py-}:_py3 py2-${pkgname#py-}:_py2"
source="$pkgname-$pkgver.tar.gz::https://github.com/pybind/pybind11/archive/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	# fails to build with fortify headers enabled
	# https://github.com/pybind/pybind11/issues/1650
	export CXXFLAGS="$CXXFLAGS -U_FORTIFY_SOURCE"
	local python=
	for python in python2 python3; do
		cd "$builddir"
		$python setup.py build
		mkdir "$builddir"/$python
		cd "$builddir"/$python
		cmake -DPYTHON_EXECUTABLE=/usr/bin/$python \
			-DCMAKE_INSTALL_PREFIX=/usr \
			-DUSE_PYTHON_INCLUDE_DIR=FALSE ..
		make
	done
}

package() {
	mkdir -p "$pkgdir"
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc (for $python)"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir" \
		--install-headers='/usr/include/pybind11' --skip-build
}

sha512sums="6bddf5c885ff92a3e373bcedc6574dfefe8be9ebb6176c6c96d475457466c76bfb982c6df4066cb0fbead4b867f87dbc4fbc1605c80852635016f614330ce041  py-pybind11-2.2.4.tar.gz"