# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 # $Id$ PortSystem 1.0 PortGroup cmake 1.0 PortGroup compiler_blacklist_versions 1.0 name opencv version 3.1.0 revision 3 categories graphics science platforms darwin license BSD maintainers stromnov openmaintainer description Intel(R) Open Source Computer Vision Library long_description OpenCV is a library that is mainly aimed at real time \ computer vision. Some example areas would be \ Human-Computer Interaction (HCI), Object Identification, \ Segmentation and Recognition, Face Recognition, Gesture \ Recognition, Motion Tracking, Ego Motion, Motion \ Understanding, Structure From Motion (SFM), and Mobile \ Robotics. homepage http://opencv.org master_sites sourceforge:project/opencvlibrary/opencv-unix/${version}:opencv \ https://github.com/Itseez/opencv_contrib/archive:opencv_contrib distfiles ${distname}.zip:opencv use_zip yes checksums ${distname}${extract.suffix} \ rmd160 d7a811c67cfb16243470822150760252d5770165 \ sha256 1f6990249fdb82804fff40e96fa6d99949023ab0e3277eae4bd459b374e622a4 \ ${version}.zip \ rmd160 91266cae464ab0f9c00f0f764ba9025a6765d83a \ sha256 5082b5df7179ff71f4681747c482169f0d5d5b77605816cfe5b93c588021fbb4 depends_build-append \ port:pkgconfig depends_lib-append port:zlib \ port:bzip2 \ port:libpng \ port:jpeg \ port:jasper \ port:tiff \ port:webp \ port:ilmbase \ port:openexr \ path:lib/libavcodec.dylib:ffmpeg patchfiles-append patch-install_name.diff \ patch-modules_python_CMakeLists.txt.diff \ patch-modules_java_CMakeLists.txt.diff # TODO: check and adapt those patches # patch-modules_imgcodecs_src_grfmt_tiff.cpp.diff # patch-modules_core_src_parallel.cpp.diff # patch-modules-highgui-src-window_cocoa.mm.diff cmake.out_of_source yes configure.args-append \ -DWITH_1394=OFF \ -DWITH_CARBON=OFF \ -DWITH_VTK=OFF \ -DWITH_CUDA=OFF \ -DWITH_CUFFT=OFF \ -DWITH_CUBLAS=OFF \ -DWITH_NVCUVID=OFF \ -DWITH_EIGEN=OFF \ -DWITH_FFMPEG=ON \ -DWITH_GSTREAMER=OFF \ -DWITH_GTK=OFF \ -DWITH_GTK_2_X=OFF \ -DWITH_IPP=OFF \ -DWITH_JASPER=ON \ -DWITH_JPEG=ON \ -DWITH_WEBP=ON \ -DWITH_OPENEXR=ON \ -DWITH_OPENGL=ON \ -DWITH_OPENNI=OFF \ -DWITH_OPENNI2=OFF \ -DWITH_PNG=ON \ -DWITH_PVAPI=OFF \ -DWITH_GIGEAPI=OFF \ -DWITH_QT=OFF \ -DWITH_QUICKTIME=OFF \ -DWITH_TBB=OFF \ -DWITH_OPENMP=OFF \ -DWITH_CSTRIPES=OFF \ -DWITH_PTHREADS_PF=OFF \ -DWITH_TIFF=ON \ -DWITH_UNICAP=OFF \ -DWITH_V4L=OFF \ -DWITH_LIBV4L=OFF \ -DWITH_XIMEA=OFF \ -DWITH_XINE=OFF \ -DWITH_CLP=OFF \ -DWITH_OPENCL=OFF \ -DWITH_OPENCL_SVM=OFF \ -DWITH_OPENCLAMDFFT=OFF \ -DWITH_OPENCLAMDBLAS=OFF \ -DWITH_INTELPERC=OFF \ -DWITH_IPP_A=OFF \ -DWITH_VA=OFF \ -DWITH_VA_INTEL=OFF \ -DWITH_GDAL=OFF \ -DWITH_GPHOTO2=OFF \ \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_opencv_apps=ON \ -DBUILD_DOCS=OFF \ -DBUILD_EXAMPLES=OFF \ -DBUILD_PACKAGE=OFF \ -DBUILD_PERF_TESTS=OFF \ -DBUILD_TESTS=OFF \ -DBUILD_WITH_DYNAMIC_IPP=OFF \ \ -DBUILD_ZLIB=OFF \ -DBUILD_TIFF=OFF \ -DBUILD_JASPER=OFF \ -DBUILD_JPEG=OFF \ -DBUILD_PNG=OFF \ -DBUILD_OPENEXR=OFF \ -DBUILD_TBB=OFF \ \ -DPYTHON_EXECUTABLE=OFF \ -DINSTALL_C_EXAMPLES=OFF \ -DINSTALL_PYTHON_EXAMPLES=OFF \ -DENABLE_PRECOMPILED_HEADERS=ON \ -DCMAKE_VERBOSE=ON \ -DZLIB_LIBRARY=${prefix}/lib/libz.dylib \ -DBZIP2_LIBRARIES=${prefix}/lib/libbz2.dylib set opencv_linker_libs "" # gcc-4.0 exits with a bus error compiler.blacklist-append gcc-4.0 # Xcode 3.1.4's and Xcode 3.2.6's gcc-4.2 fails to build opencv-2.4.10 for i386: # opencv-2.4.10/modules/core/src/system.cpp: In static member function 'static cv::HWFeatures cv::HWFeatures::initialize()': # opencv-2.4.10/modules/core/src/system.cpp:280: error: can't find a register in class 'BREG' while reloading 'asm' # opencv-2.4.10/modules/core/src/system.cpp:238: error: 'asm' operand has impossible constraints # opencv-2.4.10/modules/core/src/system.cpp:280: error: 'asm' operand has impossible constraints compiler.blacklist-append *gcc-4.2* # llvm-gcc-4.2 appears to be broken on old XCode (#35368) compiler.blacklist-append {llvm-gcc-4.2 < 2336.11} # Older clang also don't work (#36956) compiler.blacklist-append {clang < 318} # TODO: Actually fix this if {[string match "*clang*" ${configure.compiler}]} { post-patch { reinplace "/-Werror=sequence-point/d" ${worksrcpath}/cmake/OpenCVCompilerOptions.cmake } } # PCH broken when universal if {[variant_isset universal]} { configure.args-replace -DENABLE_PRECOMPILED_HEADERS=ON \ -DENABLE_PRECOMPILED_HEADERS=OFF } variant eigen description {Enable eigen support.} { depends_lib-append port:eigen3 configure.args-replace -DWITH_EIGEN=OFF \ -DWITH_EIGEN=ON configure.args-append -DEIGEN_INCLUDE_PATH=${prefix}/include/eigen3 } variant opencl description {Enable OpenCL support.} { patchfiles-append patch-opencl-PR6052.diff pre-configure { if {${os.platform} eq "darwin" && ${os.major} < 11} { ui_error "The OpenCL variant only works with OS X 10.7 Lion or later." return -code error "incompatible OS X version" } } configure.args-replace -DWITH_OPENCL=OFF \ -DWITH_OPENCL=ON } variant openni description {Enable OpenNI support.} { depends_lib-append port:openni patchfiles-append patch-cmake_OpenCVFindOpenNI.cmake.diff configure.args-replace -DWITH_OPENNI=OFF \ -DWITH_OPENNI=ON post-patch { reinplace "s,@@PREFIX@@,${prefix},g" ${worksrcpath}/cmake/OpenCVFindOpenNI.cmake } } variant dc1394 description {Use libdc1394 for FireWire camera. Breaks compatibility with Apple iSight FireWire camera.} { depends_lib-append port:libdc1394 configure.args-replace -DWITH_1394=OFF \ -DWITH_1394=ON configure.args-append -DHAVE_DC1394_2=ON } variant qt4 conflicts qt5 description {Build with Qt4 Backend support.} { PortGroup qt4 1.0 configure.args-replace -DWITH_QT=OFF \ -DWITH_QT=ON } variant qt5 conflicts qt4 description {Build with Qt5 Backend support.} { PortGroup qt5 1.0 configure.args-replace -DWITH_QT=OFF \ -DWITH_QT=ON } variant java description {Add Java bindings.} { depends_build-append port:apache-ant patchfiles-delete patch-modules_java_CMakeLists.txt.diff } if {[variant_isset java] && ![variant_isset python27] && ![variant_isset python34]} { configure.args-replace -DPYTHON_EXECUTABLE=OFF \ -DPYTHON_EXECUTABLE=/usr/bin/python } variant python27 conflicts python34 python35 description {Add Python 2.7 bindings.} { depends_lib-append port:python27 \ port:py27-numpy patchfiles-delete patch-modules_python_CMakeLists.txt.diff configure.args-delete -DINSTALL_PYTHON_EXAMPLES=OFF \ -DPYTHON_EXECUTABLE=OFF configure.args-append -DINSTALL_PYTHON_EXAMPLES=ON \ -DPYTHON2_EXECUTABLE=${prefix}/bin/python2.7 \ -DPYTHON_LIBRARIES=${prefix}/lib/libpython2.7.dylib \ -DPYTHON2_LIBRARIES=${prefix}/lib/libpython2.7.dylib \ -DPYTHON2_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.7/Headers \ -DPYTHON2_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages } variant python34 conflicts python27 python35 description {Add Python 3.4 bindings.} { depends_lib-append port:python34 \ port:py34-numpy patchfiles-delete patch-modules_python_CMakeLists.txt.diff configure.args-delete -DINSTALL_PYTHON_EXAMPLES=OFF \ -DPYTHON_EXECUTABLE=OFF configure.args-append -DINSTALL_PYTHON_EXAMPLES=ON \ -DPYTHON3_EXECUTABLE=${prefix}/bin/python3.4 \ -DPYTHON3_LIBRARY=${prefix}/lib/libpython3.4.dylib \ -DPYTHON3_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/3.4/Headers \ -DPYTHON3_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/3.4/lib/python3.4/site-packages } variant python35 conflicts python27 python34 description {Add Python 3.5 bindings.} { depends_lib-append port:python35 \ port:py35-numpy patchfiles-delete patch-modules_python_CMakeLists.txt.diff configure.args-delete -DINSTALL_PYTHON_EXAMPLES=OFF \ -DPYTHON_EXECUTABLE=OFF configure.args-append -DINSTALL_PYTHON_EXAMPLES=ON \ -DPYTHON3_EXECUTABLE=${prefix}/bin/python3.5 \ -DPYTHON3_LIBRARY=${prefix}/lib/libpython3.5.dylib \ -DPYTHON3_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/3.5/Headers \ -DPYTHON3_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/3.5/lib/python3.5/site-packages } variant tbb description {Use Intel TBB.} { depends_lib-append port:tbb configure.args-replace -DWITH_TBB=OFF \ -DWITH_TBB=ON configure.args-append -DHAVE_TBB=ON \ -DTBB_INCLUDE_DIRS=${prefix}/include lappend opencv_linker_libs "-ltbb" "-ltbbmalloc" } variant vtk description {Include VTK support.} { depends_lib-append port:vtk configure.args-replace -DWITH_VTK=OFF \ -DWITH_VTK=ON } variant gdal description {Include GDAL support.} { depends_lib-append port:gdal configure.args-replace -DWITH_GDAL=OFF \ -DWITH_GDAL=ON } variant contrib description {Build OpenCV with extra modules.} { distfiles-append ${version}.zip:opencv_contrib configure.args-append -DOPENCV_EXTRA_MODULES_PATH=${workpath}/opencv_contrib-${version}/modules depends_lib-append port:protobuf-cpp } platform darwin { post-patch { if {${os.major} < 10} { reinplace "s:HAVE_GCD 1:HAVE_GCD 0:" ${worksrcpath}/cmake/OpenCVFindLibsPerf.cmake } } } pre-configure { configure.args-append -DOPENCV_LINKER_LIBS=\"[join ${opencv_linker_libs} " "]\" } post-destroot { # http://trac.macports.org/ticket/42702 reinplace {/Libs: /s:\${exec_prefix}/lib/libopencv_:-lopencv_:g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc reinplace {/Libs: /s:\.a::g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc reinplace {/Libs: /s:\.dylib::g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc reinplace {s|Libs: |Libs: -L\${exec_prefix}/lib |g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc reinplace {s:-l-framework|-framework::g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc } livecheck.type sourceforge livecheck.name opencvlibrary livecheck.regex {/[Oo]pen[Cc][Vv]-([0-9.]+)[a-z]?\.[tz]}