template 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Template file for 'opencv4'
  2. pkgname=opencv4
  3. version=4.3.0
  4. revision=4
  5. wrksrc=opencv-${version}
  6. build_style=cmake
  7. configure_args="-DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_OPENMP=ON -DWITH_OPENCL=ON
  8. -DOPENCV_GENERATE_PKGCONFIG=YES
  9. -DWITH_EIGEN=ON -DENABLE_CXX11=ON -DOPENCV_SKIP_PYTHON_LOADER=ON
  10. -DOPENCV_PYTHON3_INSTALL_PATH=/${py3_sitelib}
  11. -DOPENCV_PYTHON_INSTALL_PATH=/${py2_sitelib}
  12. -DOPENCV_EXTRA_MODULES_PATH=${XBPS_BUILDDIR}/opencv_contrib-${version}/modules
  13. -DBUILD_opencv_rgbd=OFF"
  14. hostmakedepends="pkg-config eigen python-numpy python3-numpy"
  15. makedepends="ffmpeg-devel libpng-devel libjpeg-turbo-devel tiff-devel
  16. jasper-devel ocl-icd-devel libgomp-devel libopenexr-devel gtk+3-devel
  17. libgphoto2-devel gst-plugins-base1-devel openblas-devel
  18. python-numpy python3-numpy python-devel python3-devel"
  19. short_desc="Computer vision and machine learning software library, version 4.x"
  20. maintainer="Hazel Levine <me@qtp2t.club>"
  21. license="BSD-3-Clause"
  22. homepage="https://opencv.org"
  23. distfiles="https://github.com/opencv/opencv/archive/${version}.tar.gz
  24. https://github.com/opencv/opencv_contrib/archive/${version}.tar.gz>contrib.tar.gz"
  25. checksum="68bc40cbf47fdb8ee73dfaf0d9c6494cd095cf6294d99de445ab64cf853d278a
  26. acb8e89c9e7d1174e63e40532125b60d248b00e517255a98a419d415228c6a55"
  27. if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
  28. makedepends+=" libatomic-devel"
  29. fi
  30. if [ -z "$XBPS_CHECK_PKGS" ]; then
  31. # opencv by default builds tests that only seem to be used in make check
  32. configure_args+=" -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF"
  33. fi
  34. if [ "$CROSS_BUILD" ]; then
  35. # Tell opencv where to find python and numpy
  36. _npincdir="numpy/core/include"
  37. configure_args+=" -DPYTHON2_INCLUDE_PATH=${XBPS_CROSS_BASE}/${py2_inc}
  38. -DPYTHON2_NUMPY_INCLUDE_DIRS=${XBPS_CROSS_BASE}/${py2_sitelib}/${_npincdir}
  39. -DPYTHON3_INCLUDE_PATH=${XBPS_CROSS_BASE}/${py3_inc}
  40. -DPYTHON3_NUMPY_INCLUDE_DIRS=${XBPS_CROSS_BASE}/${py3_sitelib}/${_npincdir}"
  41. fi
  42. # Liberation
  43. # Some of the code is taken from:
  44. # https://git.parabola.nu/abslibre.git/tree/libre/opencv/PKGBUILD
  45. post_patch() {
  46. # remove nonfree Milky icons
  47. rm -rv modules/highgui/src/files_Qt/Milky
  48. # remove nonfree lena.png and lena.jpg images
  49. rm -v $(find . -iname '*lena*')
  50. cd "${XBPS_BUILDDIR}/opencv_contrib-${version}"
  51. # remove nonfree SIFT and SURF algorithms that are patented in some countries and have some other limitations on the use
  52. rm -rv modules/xfeatures2d
  53. }
  54. post_install() {
  55. vlicense LICENSE
  56. }
  57. libopencv4_package() {
  58. short_desc+=" - library files"
  59. pkg_install() {
  60. vmove usr/lib/*.so.*
  61. }
  62. }
  63. libopencv4-devel_package() {
  64. short_desc+=" - development files"
  65. depends="libopencv4>=${version}_${revision}"
  66. pkg_install() {
  67. vmove usr/include
  68. vmove usr/lib/cmake
  69. vmove usr/lib/pkgconfig
  70. vmove usr/lib/*.so
  71. vmove usr/share/opencv4
  72. }
  73. }
  74. libopencv4-python_package() {
  75. short_desc+=" - Python2 bindings"
  76. depends="python-numpy"
  77. pkg_install() {
  78. vmove ${py2_sitelib}
  79. }
  80. }
  81. libopencv4-python3_package() {
  82. short_desc+=" - Python3 bindings"
  83. depends="python3-numpy"
  84. pkg_install() {
  85. vmove ${py3_sitelib}
  86. }
  87. }