# Template file for 'libsearpc'
# WARNING: upstream sometimes retag source. Wait for official announcement
pkgname=libsearpc
# 3.2-latest (as of 2021-04-10)
version=3.2.0.20200318
revision=1
_gitrev=50ff08b03c7cec8e10b35ba438633b9fe08a8d90
wrksrc="${pkgname}-${_gitrev}"
build_style=gnu-configure
configure_args="--with-python3 --disable-static --disable-compile-demo"
hostmakedepends="automake libtool pkg-config python3 glib-devel"
makedepends="libglib-devel jansson-devel"
short_desc="Seafile RPC library"
maintainer="yopito <pierre.bourgin@free.fr>"
license="LGPL-3.0-or-later, Apache-2.0"
homepage="https://seafile.com"
distfiles="https://github.com/haiwen/libsearpc/archive/${_gitrev}.tar.gz"
checksum=2a58894cefbc1d7398581fc58103261688c93a9cf63f11afc5e92142ed948c00
python_version=3

pre_configure() {
	./autogen.sh
}

post_install() {
	vdoc AUTHORS
	vdoc README.markdown
}

libsearpc-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision} ${makedepends}"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}

libsearpc-codegen_package() {
	short_desc+=" - code generator"
	depends="python3"
	python_version=3
	pkg_install() {
		vdoc AUTHORS
		vdoc README.markdown
		vmove usr/bin/searpc-codegen.py
	}
}

libsearpc-python3_package() {
	short_desc+=" - Python3 bindings"
	depends="python3"
	pkg_install() {
		vmove usr/lib/python3*
	}
}