# Template file for 'olm'
pkgname=olm
version=2.3.0
revision=1
build_style=gnu-makefile
make_check_target=test
hostmakedepends="python-devel python3-devel"
makedepends="python-devel python3-devel"
short_desc="An implementation of the Double Ratchet cryptographic ratchet"
maintainer="Adam Beckmeyer <adam_gpg@thebeckmeyers.xyz>"
license="Apache-2.0"
homepage="https://git.matrix.org/git/olm/about/"
distfiles="https://git.matrix.org/git/olm/snapshot/${pkgname}-${version}.tar.gz"
checksum=533714fb84860e04c185790d16ef9085f15e902c2105db941d5c7e92b0565ef8

post_configure() {
	# -O0 prevents _FORTIFY_SOURCE working
	for _f in $(find ${wrksrc} -name Makefile); do
		sed -i $_f -e "s; -O0;;"
	done
}

do_install() {
	make DESTDIR=${DESTDIR} PREFIX=/usr install
	for pysl in $py2_sitelib $py3_sitelib; do
		mkdir -p ${DESTDIR}${pysl}
		cp -r ${wrksrc}/python/olm ${DESTDIR}${pysl}
	done
}

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

olm-python_package() {
	noarch=yes
	short_desc+=" - python bindings"
	depends="${sourcepkg}>=${version}_${revision} python"
	pycompile_module=olm
	pkg_install() {
		vmove ${py2_sitelib}
	}
}

olm-python3_package() {
	noarch=yes
	short_desc+=" - python3 bindings"
	depends="${sourcepkg}>=${version}_${revision} python3"
	pycompile_module=olm
	pkg_install() {
		vmove ${py3_sitelib}
	}
}
