void-packages/srcpkgs/opencv/template
Đoàn Trần Công Danh 2fd8d4df94 srcpkgs/o*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

81 lines
2.3 KiB
Bash

# Template file for 'opencv'
pkgname=opencv
version=3.4.10
revision=2
build_style=cmake
configure_args="-DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_OPENMP=ON
-DWITH_OPENCL=ON -DENABLE_CXX11=ON -DOPENCV_SKIP_PYTHON_LOADER=ON
-DOPENCV_PYTHON3_INSTALL_PATH=/${py3_sitelib}
-DOPENCV_PYTHON_INSTALL_PATH=/${py2_sitelib}"
hostmakedepends="pkg-config eigen python-numpy python3-numpy"
makedepends="ffmpeg-devel libpng-devel libjpeg-turbo-devel tiff-devel
jasper-devel ocl-icd-devel libgomp-devel libopenexr-devel gtk+3-devel
libgphoto2-devel gst-plugins-base1-devel openblas-devel
python-numpy python3-numpy python-devel python3-devel"
short_desc="Computer vision and machine learning software library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://opencv.org"
distfiles="https://github.com/opencv/${pkgname}/archive/${version}.tar.gz"
checksum=1ed6f5b02a7baf14daca04817566e7c98ec668cec381e0edf534fa49f10f58a2
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
makedepends+=" libatomic-devel"
fi
if [ -z "$XBPS_CHECK_PKGS" ]; then
# opencv by default builds tests that only seem to be used in make check
configure_args+=" -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF"
fi
if [ "$CROSS_BUILD" ]; then
# Tell opencv where to find python and numpy
_npincdir="numpy/core/include"
configure_args+=" -DPYTHON2_INCLUDE_PATH=${XBPS_CROSS_BASE}/${py2_inc}
-DPYTHON2_NUMPY_INCLUDE_DIRS=${XBPS_CROSS_BASE}/${py2_sitelib}/${_npincdir}
-DPYTHON3_INCLUDE_PATH=${XBPS_CROSS_BASE}/${py3_inc}
-DPYTHON3_NUMPY_INCLUDE_DIRS=${XBPS_CROSS_BASE}/${py3_sitelib}/${_npincdir}"
fi
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
ppc*) broken="grfmt_jpeg2000.cpp:380:48: error: lvalue required as unary '&' operand";;
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+=" - Python2 bindings"
depends="python-numpy"
pkg_install() {
vmove usr/lib/python2.7
}
}
libopencv-python3_package() {
short_desc+=" - Python3 bindings"
depends="python3-numpy"
pkg_install() {
vmove usr/lib/python3*
}
}