# Template file for 'unicorn'
pkgname=unicorn
version=1.0.2
revision=5
hostmakedepends="python3-devel python3-setuptools"
short_desc="Lightweight multi-platform, multi-architecture CPU emulator framework"
maintainer="Piraty <mail@piraty.dev>"
license="GPL-2.0-only"
homepage="https://www.unicorn-engine.org/"
distfiles="https://github.com/unicorn-engine/unicorn/archive/${version}.tar.gz"
checksum=6400e16f9211486fa5353b1870e6a82f8aa342e429718d1cbca08d609aaadc52

post_patch() {
	# don't build the samples
	echo "clean:" > samples/Makefile
}

do_build() {
	make $makejobs
	make $makejobs -C bindings
	cd bindings/python
	python3 setup.py build
}

do_install() {
	make DESTDIR=${DESTDIR} install
	cd bindings/python
	python3 setup.py build install --prefix=/usr --root=${DESTDIR}
}

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

unicorn-python3_package() {
	depends="${sourcepkg}-devel>=${version}_${revision} python3-setuptools"
	short_desc+=" - Python3 bindings"
	pkg_install() {
		vmove ${py3_sitelib}
	}
}
