1 | # -*- 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 |
---|
2 | # $Id: Portfile 138361 2015-07-06 06:52:04Z jeremyhu@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup cmake 1.0 |
---|
6 | PortGroup compiler_blacklist_versions 1.0 |
---|
7 | |
---|
8 | name opencv |
---|
9 | version 3.0.0 |
---|
10 | revision 0 |
---|
11 | categories graphics science |
---|
12 | platforms darwin |
---|
13 | license BSD |
---|
14 | |
---|
15 | maintainers stromnov openmaintainer |
---|
16 | |
---|
17 | description Intel(R) Open Source Computer Vision Library |
---|
18 | |
---|
19 | long_description OpenCV is a library that is mainly aimed at real time \ |
---|
20 | computer vision. Some example areas would be \ |
---|
21 | Human-Computer Interaction (HCI), Object Identification, \ |
---|
22 | Segmentation and Recognition, Face Recognition, Gesture \ |
---|
23 | Recognition, Motion Tracking, Ego Motion, Motion \ |
---|
24 | Understanding, Structure From Motion (SFM), and Mobile \ |
---|
25 | Robotics. |
---|
26 | |
---|
27 | homepage http://opencv.org |
---|
28 | master_sites sourceforge:project/opencvlibrary/opencv-unix/${version}:opencv \ |
---|
29 | https://github.com/Itseez/opencv_contrib/archive:opencv_contrib |
---|
30 | |
---|
31 | distfiles ${distname}.zip:opencv |
---|
32 | #\ |
---|
33 | #${version}.zip:opencv_contrib |
---|
34 | |
---|
35 | use_zip yes |
---|
36 | |
---|
37 | checksums ${distname}${extract.suffix} \ |
---|
38 | rmd160 7b4dff26502e71e6570c2452c35fd03a1982bc7e \ |
---|
39 | sha256 07094ea2f996f2622d572f0f3a162d698c8a547520341ca9109fbaf9363fb001 \ |
---|
40 | ${version}.zip \ |
---|
41 | rmd160 b257895ab529db2354f17c87b9f02d53625bb5e2 \ |
---|
42 | sha256 77b28692b9e477a8554dd5b2180211dd86b6fd69d98e6896b6a7e1753e5f7e8f |
---|
43 | |
---|
44 | depends_build-append \ |
---|
45 | port:pkgconfig |
---|
46 | |
---|
47 | depends_lib-append port:zlib \ |
---|
48 | port:bzip2 \ |
---|
49 | port:libpng \ |
---|
50 | port:jpeg \ |
---|
51 | port:jasper \ |
---|
52 | port:tiff \ |
---|
53 | port:ilmbase \ |
---|
54 | port:openexr \ |
---|
55 | path:lib/libavcodec.dylib:ffmpeg |
---|
56 | |
---|
57 | patchfiles-append patch-install_name.diff \ |
---|
58 | patch-modules_python_CMakeLists.txt.diff \ |
---|
59 | patch-modules_java_CMakeLists.txt.diff |
---|
60 | |
---|
61 | # TODO: check and adapt those patches |
---|
62 | # patch-modules_core_src_parallel.cpp.diff \ |
---|
63 | # patch-modules-highgui-src-window_cocoa.mm.diff |
---|
64 | |
---|
65 | cmake.out_of_source yes |
---|
66 | |
---|
67 | configure.args-append \ |
---|
68 | -DWITH_1394=OFF \ |
---|
69 | -DWITH_CARBON=OFF \ |
---|
70 | -DWITH_VTK=OFF \ |
---|
71 | -DWITH_CUDA=OFF \ |
---|
72 | -DWITH_CUFFT=OFF \ |
---|
73 | -DWITH_CUBLAS=OFF \ |
---|
74 | -DWITH_NVCUVID=OFF \ |
---|
75 | -DWITH_EIGEN=OFF \ |
---|
76 | -DWITH_FFMPEG=ON \ |
---|
77 | -DWITH_GSTREAMER=OFF \ |
---|
78 | -DWITH_GTK=OFF \ |
---|
79 | -DWITH_GTK_2_X=OFF \ |
---|
80 | -DWITH_IPP=OFF \ |
---|
81 | -DWITH_JASPER=ON \ |
---|
82 | -DWITH_JPEG=ON \ |
---|
83 | -DWITH_WEBP=OFF \ |
---|
84 | -DWITH_OPENEXR=ON \ |
---|
85 | -DWITH_OPENGL=ON \ |
---|
86 | -DWITH_OPENNI=OFF \ |
---|
87 | -DWITH_OPENNI2=OFF \ |
---|
88 | -DWITH_PNG=ON \ |
---|
89 | -DWITH_PVAPI=OFF \ |
---|
90 | -DWITH_GIGEAPI=OFF \ |
---|
91 | -DWITH_QT=OFF \ |
---|
92 | -DWITH_QUICKTIME=OFF \ |
---|
93 | -DWITH_TBB=OFF \ |
---|
94 | -DWITH_OPENMP=OFF \ |
---|
95 | -DWITH_CSTRIPES=OFF \ |
---|
96 | -DWITH_PTHREADS_PF=OFF \ |
---|
97 | -DWITH_TIFF=ON \ |
---|
98 | -DWITH_UNICAP=OFF \ |
---|
99 | -DWITH_V4L=OFF \ |
---|
100 | -DWITH_LIBV4L=OFF \ |
---|
101 | -DWITH_XIMEA=OFF \ |
---|
102 | -DWITH_XINE=OFF \ |
---|
103 | -DWITH_CLP=OFF \ |
---|
104 | -DWITH_OPENCL=OFF \ |
---|
105 | -DWITH_OPENCL_SVM=OFF \ |
---|
106 | -DWITH_OPENCLAMDFFT=OFF \ |
---|
107 | -DWITH_OPENCLAMDBLAS=OFF \ |
---|
108 | -DWITH_INTELPERC=OFF \ |
---|
109 | -DWITH_IPP_A=OFF \ |
---|
110 | -DWITH_GDAL=OFF \ |
---|
111 | -DBUILD_SHARED_LIBS=ON \ |
---|
112 | -DBUILD_opencv_apps=ON \ |
---|
113 | -DBUILD_DOCS=OFF \ |
---|
114 | -DBUILD_EXAMPLES=OFF \ |
---|
115 | -DBUILD_PACKAGE=OFF \ |
---|
116 | -DBUILD_PERF_TESTS=OFF \ |
---|
117 | -DBUILD_TESTS=OFF \ |
---|
118 | -DBUILD_WITH_DYNAMIC_IPP=OFF \ |
---|
119 | -DBUILD_ZLIB=OFF \ |
---|
120 | -DBUILD_TIFF=OFF \ |
---|
121 | -DBUILD_JASPER=OFF \ |
---|
122 | -DBUILD_JPEG=OFF \ |
---|
123 | -DBUILD_PNG=OFF \ |
---|
124 | -DBUILD_OPENEXR=OFF \ |
---|
125 | -DBUILD_TBB=OFF \ |
---|
126 | -DPYTHON_EXECUTABLE=OFF \ |
---|
127 | -DINSTALL_C_EXAMPLES=OFF \ |
---|
128 | -DINSTALL_PYTHON_EXAMPLES=OFF \ |
---|
129 | -DENABLE_PRECOMPILED_HEADERS=ON \ |
---|
130 | -DCMAKE_VERBOSE=ON \ |
---|
131 | -DZLIB_LIBRARY=${prefix}/lib/libz.dylib \ |
---|
132 | -DBZIP2_LIBRARIES=${prefix}/lib/libbz2.dylib |
---|
133 | |
---|
134 | set opencv_linker_libs "" |
---|
135 | |
---|
136 | # gcc-4.0 exits with a bus error |
---|
137 | compiler.blacklist-append gcc-4.0 |
---|
138 | |
---|
139 | # Xcode 3.1.4's and Xcode 3.2.6's gcc-4.2 fails to build opencv-2.4.10 for i386: |
---|
140 | # opencv-2.4.10/modules/core/src/system.cpp: In static member function 'static cv::HWFeatures cv::HWFeatures::initialize()': |
---|
141 | # opencv-2.4.10/modules/core/src/system.cpp:280: error: can't find a register in class 'BREG' while reloading 'asm' |
---|
142 | # opencv-2.4.10/modules/core/src/system.cpp:238: error: 'asm' operand has impossible constraints |
---|
143 | # opencv-2.4.10/modules/core/src/system.cpp:280: error: 'asm' operand has impossible constraints |
---|
144 | compiler.blacklist-append *gcc-4.2* |
---|
145 | |
---|
146 | # llvm-gcc-4.2 appears to be broken on old XCode (#35368) |
---|
147 | compiler.blacklist-append {llvm-gcc-4.2 < 2336.11} |
---|
148 | |
---|
149 | # Older clang also don't work (#36956) |
---|
150 | compiler.blacklist-append {clang < 318} |
---|
151 | |
---|
152 | # TODO: Actually fix this |
---|
153 | if {[string match "*clang*" ${configure.compiler}]} { |
---|
154 | post-patch { |
---|
155 | reinplace "/-Werror=sequence-point/d" ${worksrcpath}/cmake/OpenCVCompilerOptions.cmake |
---|
156 | } |
---|
157 | } |
---|
158 | |
---|
159 | # PCH broken when universal |
---|
160 | if {[variant_isset universal]} { |
---|
161 | configure.args-replace -DENABLE_PRECOMPILED_HEADERS=ON \ |
---|
162 | -DENABLE_PRECOMPILED_HEADERS=OFF |
---|
163 | } |
---|
164 | |
---|
165 | variant eigen description {Enable eigen support.} { |
---|
166 | depends_lib-append port:eigen3 |
---|
167 | configure.args-replace -DWITH_EIGEN=OFF \ |
---|
168 | -DWITH_EIGEN=ON |
---|
169 | configure.args-append -DEIGEN_INCLUDE_PATH=${prefix}/include/eigen3 |
---|
170 | } |
---|
171 | |
---|
172 | variant opencl description {Enable OpenCL support.} { |
---|
173 | pre-configure { |
---|
174 | if {${os.platform} eq "darwin" && ${os.major} < 11} { |
---|
175 | ui_error "The OpenCL variant only works with OS X 10.7 Lion or later." |
---|
176 | return -code error "incompatible OS X version" |
---|
177 | } |
---|
178 | } |
---|
179 | configure.args-replace -DWITH_OPENCL=OFF \ |
---|
180 | -DWITH_OPENCL=ON |
---|
181 | } |
---|
182 | |
---|
183 | variant openni description {Enable OpenNI support.} { |
---|
184 | depends_lib-append port:openni |
---|
185 | patchfiles-append patch-cmake_OpenCVFindOpenNI.cmake.diff |
---|
186 | configure.args-replace -DWITH_OPENNI=OFF \ |
---|
187 | -DWITH_OPENNI=ON |
---|
188 | |
---|
189 | post-patch { |
---|
190 | reinplace "s,@@PREFIX@@,${prefix},g" ${worksrcpath}/cmake/OpenCVFindOpenNI.cmake |
---|
191 | } |
---|
192 | } |
---|
193 | |
---|
194 | variant dc1394 description {Use libdc1394 for FireWire camera. Breaks compatibility with Apple iSight FireWire camera.} { |
---|
195 | depends_lib-append port:libdc1394 |
---|
196 | configure.args-replace -DWITH_1394=OFF \ |
---|
197 | -DWITH_1394=ON |
---|
198 | configure.args-append -DHAVE_DC1394_2=ON |
---|
199 | } |
---|
200 | |
---|
201 | variant qt4 conflicts qt5 description {Build with Qt4 Backend support.} { |
---|
202 | PortGroup qt4 1.0 |
---|
203 | configure.args-replace -DWITH_QT=OFF \ |
---|
204 | -DWITH_QT=ON |
---|
205 | } |
---|
206 | |
---|
207 | variant qt5 conflicts qt4 description {Build with Qt5 Backend support.} { |
---|
208 | PortGroup qt5 1.0 |
---|
209 | configure.args-replace -DWITH_QT=OFF \ |
---|
210 | -DWITH_QT=ON |
---|
211 | } |
---|
212 | |
---|
213 | variant java description {Add Java bindings.} { |
---|
214 | depends_build-append port:apache-ant |
---|
215 | patchfiles-delete patch-modules_java_CMakeLists.txt.diff |
---|
216 | } |
---|
217 | |
---|
218 | if {[variant_isset java] && ![variant_isset python27] && ![variant_isset python34]} { |
---|
219 | configure.args-replace -DPYTHON_EXECUTABLE=OFF \ |
---|
220 | -DPYTHON_EXECUTABLE=/usr/bin/python |
---|
221 | } |
---|
222 | |
---|
223 | variant python27 conflicts python34 description {Add Python 2.7 bindings.} { |
---|
224 | depends_lib-append port:python27 \ |
---|
225 | port:py27-numpy |
---|
226 | patchfiles-delete patch-modules_python_CMakeLists.txt.diff |
---|
227 | configure.args-delete -DINSTALL_PYTHON_EXAMPLES=OFF \ |
---|
228 | -DPYTHON_EXECUTABLE=OFF |
---|
229 | configure.args-append -DINSTALL_PYTHON_EXAMPLES=ON \ |
---|
230 | -DPYTHON2_EXECUTABLE=${prefix}/bin/python2.7 \ |
---|
231 | -DPYTHON_LIBRARIES=${prefix}/lib/libpython2.7.dylib \ |
---|
232 | -DPYTHON2_LIBRARIES=${prefix}/lib/libpython2.7.dylib \ |
---|
233 | -DPYTHON2_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/2.7/Headers \ |
---|
234 | -DPYTHON2_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/2.7/lib/python2.7/site-packages |
---|
235 | } |
---|
236 | |
---|
237 | variant python34 conflicts python27 description {Add Python 3.4 bindings.} { |
---|
238 | depends_lib-append port:python34 \ |
---|
239 | port:py34-numpy |
---|
240 | patchfiles-delete patch-modules_python_CMakeLists.txt.diff |
---|
241 | configure.args-delete -DINSTALL_PYTHON_EXAMPLES=OFF \ |
---|
242 | -DPYTHON_EXECUTABLE=OFF |
---|
243 | configure.args-append -DINSTALL_PYTHON_EXAMPLES=ON \ |
---|
244 | -DPYTHON3_EXECUTABLE=${prefix}/bin/python3.4 \ |
---|
245 | -DPYTHON3_LIBRARY=${prefix}/lib/libpython3.4.dylib \ |
---|
246 | -DPYTHON3_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/3.4/Headers \ |
---|
247 | -DPYTHON3_PACKAGES_PATH=${frameworks_dir}/Python.framework/Versions/3.4/lib/python3.4/site-packages |
---|
248 | } |
---|
249 | |
---|
250 | variant tbb description {Use Intel TBB.} { |
---|
251 | depends_lib-append port:tbb |
---|
252 | configure.args-replace -DWITH_TBB=OFF \ |
---|
253 | -DWITH_TBB=ON |
---|
254 | configure.args-append -DHAVE_TBB=ON \ |
---|
255 | -DTBB_INCLUDE_DIRS=${prefix}/include |
---|
256 | lappend opencv_linker_libs "-ltbb" "-ltbbmalloc" |
---|
257 | } |
---|
258 | |
---|
259 | variant vtk description {Include VTK support.} { |
---|
260 | depends_lib-append port:vtk |
---|
261 | configure.args-replace -DWITH_VTK=OFF \ |
---|
262 | -DWITH_VTK=ON |
---|
263 | } |
---|
264 | |
---|
265 | variant contrib description {Build OpenCV with extra modules.} { |
---|
266 | distfiles-append ${version}.zip:opencv_contrib |
---|
267 | configure.args-append -DOPENCV_EXTRA_MODULES_PATH=${workpath}/opencv_contrib-${version}/modules |
---|
268 | } |
---|
269 | |
---|
270 | platform darwin { |
---|
271 | post-patch { |
---|
272 | if {${os.major} < 10} { |
---|
273 | reinplace "s:HAVE_GCD 1:HAVE_GCD 0:" ${worksrcpath}/cmake/OpenCVFindLibsPerf.cmake |
---|
274 | } |
---|
275 | } |
---|
276 | } |
---|
277 | |
---|
278 | pre-configure { |
---|
279 | configure.args-append -DOPENCV_LINKER_LIBS=\"[join ${opencv_linker_libs} " "]\" |
---|
280 | } |
---|
281 | |
---|
282 | post-destroot { |
---|
283 | # http://trac.macports.org/ticket/42702 |
---|
284 | reinplace {/Libs: /s:\${exec_prefix}/lib/libopencv_:-lopencv_:g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc |
---|
285 | reinplace {/Libs: /s:\.a::g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc |
---|
286 | reinplace {/Libs: /s:\.dylib::g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc |
---|
287 | reinplace {s|Libs: |Libs: -L\${exec_prefix}/lib |g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc |
---|
288 | reinplace {s:-l-framework|-framework::g} ${destroot}${prefix}/lib/pkgconfig/opencv.pc |
---|
289 | } |
---|
290 | |
---|
291 | livecheck.type sourceforge |
---|
292 | livecheck.name opencvlibrary |
---|
293 | livecheck.regex {/[Oo]pen[Cc][Vv]-([0-9.]+)[a-z]?\.[tz]} |
---|