# Template file for 'opencv'
pkgname=opencv
version=3.2.0
revision=1
build_style=cmake
configure_args="-DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_OPENMP=ON -WITH_OPENCL=ON"
hostmakedepends="pkg-config python-devel eigen"
makedepends="python-numpy ffmpeg-devel libpng-devel libjpeg-turbo-devel tiff-devel
 jasper-devel ocl-icd-devel libgomp-devel libopenexr-devel gtk+-devel gtk+3-devel
 libgphoto2-devel gst-plugins-base1-devel"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://opencv.org"
license="BSD"
short_desc="Computer vision and machine learning software library"
distfiles="https://github.com/Itseez/${pkgname}/archive/${version}.tar.gz"
checksum=b9d62dfffb8130d59d587627703d5f3e6252dce4a94c1955784998da7a39dd35
nocross=yes

pre_configure() {
	case "$XBPS_TARGET_MACHINE" in
		*-musl)
			sed -i 's|PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP|PTHREAD_MUTEX_INITIALIZER|g' modules/core/src/parallel_pthreads.cpp;;
	esac
}

post_install() {
	vlicense LICENSE
}

libopencv_package() {
	short_desc+=" - library files"
	pkg_install() {
		vmove usr/lib/*.so.*
	}
}

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

libopencv-python_package() {
	short_desc+=" - Python bindings"
	pkg_install() {
		vmove usr/lib/python2.7
	}
}
