Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # $OpenBSD: Makefile,v 1.40 2017/04/19 11:16:03 sthen Exp $
  2. ONLY_FOR_ARCHS = ${GCC4_ARCHS} ${CLANG_ARCHS}
  3. CATEGORIES = graphics devel
  4. COMMENT-docs = OpenCV documentation and examples
  5. COMMENT-main = library of programming functions for real time cv
  6. COMMENT-java = Java bindings for OpenCV
  7. V = 2.4.13
  8. GH_ACCOUNT = Itseez
  9. GH_PROJECT = opencv
  10. GH_TAGNAME = ${V}
  11. PKGNAME-main = ${PKGNAME}
  12. PKGNAME-docs = opencv-docs-$V
  13. PKGNAME-java = opencv-java-$V
  14. .for i in opencv_calib3d opencv_contrib opencv_core opencv_features2d \
  15. opencv_flann opencv_gpu opencv_highgui opencv_imgproc opencv_legacy \
  16. opencv_ml opencv_nonfree opencv_objdetect opencv_photo opencv_stitching \
  17. opencv_superres opencv_ts opencv_video opencv_videostab opencv_ocl
  18. SHARED_LIBS += $i 2.0
  19. .endfor
  20. HOMEPAGE = http://www.opencv.org/
  21. MAINTAINER = Rafael Sadowski <rafael@sizeofvoid.org>
  22. # "patents" means containing some patented algorithms, see
  23. # http://docs.opencv.org/modules/nonfree/doc/nonfree.html
  24. # As some source modules include this functionality, we couldn't
  25. # just subpackage "nonfree". Excluding this, here we have a usual
  26. # BSD license.
  27. PERMIT_PACKAGE_FTP = Yes
  28. PERMIT_PACKAGE_CDROM = patents
  29. PERMIT_PACKAGE_CDROM-docs = Yes
  30. WANTLIB-main += ${MODPY_WANTLIB}
  31. WANTLIB-main += Half Iex IlmImf IlmThread Imath X11 Xcomposite Xcursor
  32. WANTLIB-main += Xdamage Xext Xfixes Xi Xinerama Xrandr Xrender atk-1.0
  33. WANTLIB-main += avcodec avformat avresample avutil bz2 c cairo fontconfig
  34. WANTLIB-main += freetype gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0
  35. WANTLIB-main += gobject-2.0 gstapp-1.0 gstbase-1.0 gstpbutils-1.0 gstreamer-1.0
  36. WANTLIB-main += gstriff-1.0 gstvideo-1.0 gthread-2.0 gtk-x11-2.0 intl
  37. WANTLIB-main += jasper jpeg m pango-1.0 pangocairo-1.0 pangoft2-1.0
  38. WANTLIB-main += png pthread ${LIBCXX} swscale tiff z
  39. WANTLIB-docs =
  40. WANTLIB-java = m pthread ${LIBCXX}
  41. WANTLIB-java += opencv_calib3d opencv_contrib opencv_core opencv_features2d
  42. WANTLIB-java += opencv_flann opencv_gpu opencv_highgui opencv_imgproc
  43. WANTLIB-java += opencv_legacy opencv_ml opencv_nonfree opencv_objdetect
  44. WANTLIB-java += opencv_ocl opencv_photo opencv_video
  45. MULTI_PACKAGES = -main -docs -java
  46. PSEUDO_FLAVORS = no_docs no_java
  47. FLAVOR ?=
  48. .include <bsd.port.arch.mk>
  49. MODULES = devel/cmake \
  50. lang/python
  51. BUILD_DEPENDS = devel/doxygen \
  52. math/py-numpy \
  53. math/eigen3
  54. RUN_DEPENDS-main = math/py-numpy
  55. RUN_DEPENDS-docs = ${BUILD_PKGPATH},-main
  56. RUN_DEPENDS-java = ${MODJAVA_RUN_DEPENDS}
  57. LIB_DEPENDS-main = ${LIB_DEPENDS} \
  58. ${MODPY_LIB_DEPENDS} \
  59. multimedia/gstreamer1/plugins-base \
  60. x11/gtk+2 \
  61. graphics/ffmpeg \
  62. graphics/ilmbase \
  63. graphics/jpeg \
  64. graphics/openexr \
  65. graphics/png \
  66. graphics/tiff
  67. LIB_DEPENDS-docs =
  68. LIB_DEPENDS-java = ${BUILD_PKGPATH},-main=${V}
  69. # ATM opencv requires V4L1 compat, ask them to change it,
  70. # then see WITH_V4L below.
  71. CONFIGURE_ARGS = -DBUILD_opencv_nonfree:Bool=On \
  72. -DBUILD_opencv_python:Bool=On \
  73. -DWITH_1394:Bool=Off \
  74. -DWITH_CUDA:Bool=Off \
  75. -DWITH_EIGEN:Bool=Off \
  76. -DWITH_FFMPEG:Bool=On \
  77. -DWITH_GSTREAMER:Bool=On \
  78. -DWITH_GTK:Bool=On \
  79. -DWITH_JPEG:Bool=On \
  80. -DWITH_PNG:Bool=On \
  81. -DWITH_TIFF:Bool=On \
  82. -DWITH_V4L:Bool=Off \
  83. -DPYTHON_EXECUTABLE:FILEPATH=${MODPY_BIN}
  84. .if ${ARCH:Mi386}
  85. # XXX PIE cannot be produced due to problems with inline assembly.
  86. # Since OpenCV is mostly used as a library, switch to PIC.
  87. CONFIGURE_ENV = CFLAGS="${CFLAGS} -fPIC" \
  88. CXXFLAGS="${CXXFLAGS} -fPIC"
  89. CONFIGURE_ARGS += -DENABLE_SSE3:Bool=Off
  90. .endif
  91. .if ${BUILD_PACKAGES:M-java}
  92. MODULES += java
  93. MODJAVA_VER = 1.8+
  94. BUILD_DEPENDS += devel/apache-ant
  95. .else
  96. # Safe: Java will be detected, if present, but won't be used
  97. CONFIGURE_ARGS += -DBUILD_opencv_java:Bool=Off
  98. .endif
  99. .if ${BUILD_PACKAGES:M-docs}
  100. BUILD_DEPENDS += textproc/py-sphinx
  101. ALL_TARGET = all html_docs
  102. CONFIGURE_ARGS += -DBUILD_DOCS:Bool=On \
  103. -DBUILD_EXAMPLES:Bool=On \
  104. -DINSTALL_C_EXAMPLES:Bool=On \
  105. -DINSTALL_PYTHON_EXAMPLES:Bool=On
  106. .else
  107. CONFIGURE_ARGS += -DBUILD_DOCS:Bool=Off \
  108. -DBUILD_EXAMPLES:Bool=Off \
  109. -DINSTALL_PYTHON_EXAMPLES:Bool=Off
  110. .endif
  111. CONFIG_ADJ_CMD = perl -pi
  112. .for _l _v in ${SHARED_LIBS}
  113. CONFIG_ADJ_CMD += -e 's,lib${_l}.so([^.]),lib${_l}.so.${_v}$$1,g;'
  114. .endfor
  115. DOCDIR = ${PREFIX}/share/doc/OpenCV
  116. post-patch:
  117. perl -pi -e 's@^.*(#\s*include)@$$1@' \
  118. ${WRKSRC}/samples/cpp/tutorial_code/core/how_to_scan_images/how_to_scan_images.cpp
  119. post-install:
  120. ${CONFIG_ADJ_CMD} ${PREFIX}/share/OpenCV/OpenCVConfig.cmake
  121. ${MODPY_BIN} ${MODPY_LIBDIR}/compileall.py ${WRKINST}${MODPY_SITEPKG}
  122. .if ${BUILD_PACKAGES:M-docs}
  123. rm -Rf ${DOCDIR}
  124. mv ${PREFIX}/share/OpenCV/doc ${DOCDIR}
  125. cp -R ${WRKBUILD}/doc/_html ${DOCDIR}/html
  126. .endif
  127. do-test:
  128. cd ${WRKBUILD}; \
  129. ${MODPY_BIN} ${WRKSRC}/modules/ts/misc/run.py
  130. .include <bsd.port.mk>