# Template file for 'python3-protobuf'
pkgname=python3-protobuf
version=4.25.2
revision=2
build_style=python3-module
build_wrksrc=python
hostmakedepends="python3-setuptools python3-wheel protobuf"
depends="python3-setuptools python3-six"
checkdepends="python3-numpy"
short_desc="Python3 bindings for Google Protocol Buffers"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://developers.google.com/protocol-buffers/"
# PyPi release does not have bits for cppext
distfiles="https://github.com/protocolbuffers/protobuf/releases/download/v${version#*.}/protobuf-${version#*.}.tar.gz"
checksum=8ff511a64fc46ee792d3fe49a5a1bcad6f7dc50dfbba5a28b0e5b979c17f9871
make_check=no # ImportError: cannot import name 'unittest_retention_pb2' from 'google.protobuf'

build_options="cppext"
build_options_default="cppext"
desc_option_cppext="Build C++ extension to improve performance"

if [ "$build_option_cppext" ]; then
	make_build_args="--cpp_implementation"
	make_install_args="--cpp_implementation"
	makedepends+=" python3-devel protobuf-devel"
fi

post_install() {
	sed -n 1,29p google/protobuf/__init__.py >LICENSE
	vlicense LICENSE
}
