blob: 6b80eb298d716e357c4b99f0ad2b3f73877e54ac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
# Created by: Marc Abramowitz (http://marc.abramowitz.info)
# $FreeBSD$
PORTNAME?= opencv
PORTVERSION= 2.4.9
PORTREVISION?= 3
CATEGORIES= graphics
MASTER_SITES= SF/${PORTNAME}library/${PORTNAME}-unix/${PORTVERSION}
MAINTAINER= jhale@FreeBSD.org
COMMENT= Open Source Computer Vision library
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= cmake pkgconfig zip
USE_LDCONFIG= yes
WANT_GSTREAMER= yes
MAKE_JOBS_UNSAFE= yes
NOT_FOR_ARCHS= sparc64
NOT_FOR_ARCHS_REASON_sparc64= does not compile on sparc64
DATADIR= ${PREFIX}/share/OpenCV
PLIST_SUB+= VERSION=${DISTVERSION}
CMAKE_ARGS+= -DWITH_CUDA:BOOL=Off \
-DWITH_PVAPI:BOOL=Off \
-DWITH_UNICAP:BOOL=Off \
-DBUILD_TESTS:BOOL=Off \
-DBUILD_DOCS:BOOL=Off \
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_CMD}
SUB_FILES= FindOpenCVCore.cmake
SUB_LIST= OCV_VERSION=${PORTVERSION}
OCV_CORE_MODS= core imgproc
OCV_MODS= calib3d contrib features2d flann gpu \
highgui legacy ml ocl objdetect photo \
stitching superres ts video videostab
OCV_NONFREE_MODS= nonfree
OCV_JAVA_MODS= java
OCV_PYTHON_MODS= python
OPTIONS_DEFINE= DC1394 EXAMPLES NONFREE OPENGL
OPTIONS_GROUP= IMAGE PERFORMANCE VIDEO
OPTIONS_GROUP_IMAGE= JASPER JPEG OPENEXR PNG TIFF
OPTIONS_GROUP_PERFORMANCE= EIGEN3 TBB
OPTIONS_GROUP_VIDEO= FFMPEG GSTREAMER V4L XINE
OPTIONS_RADIO= GUI
OPTIONS_RADIO_GUI= GTK2 QT4
OPTIONS_DEFAULT= EIGEN3 JASPER JPEG PNG TIFF V4L
OPTIONS_SUB= yes
.if defined(OCV_CORE)
OPTIONS_EXCLUDE= DC1394 EXAMPLES GTK2 QT4 JASPER JPEG NONFREE OPENEXR \
OPENGL PNG TIFF FFMPEG GSTREAMER V4L XINE
.endif
DC1394_DESC= IEEE 1394 camera support
EIGEN3_DESC= Eigen 3 support
IMAGE_DESC= Image format support
NONFREE_DESC= Build functionality that has possible limitations of use
PERFORMANCE_DESC= Performance enhancing libraries
TBB_DESC= TBB support
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MDC1394}
LIB_DEPENDS+= libdc1394.so:${PORTSDIR}/multimedia/libdc1394
CMAKE_ARGS+= -DWITH_1394:BOOL=On
.else
CMAKE_ARGS+= -DWITH_1394:BOOL=Off
.endif
.if ${PORT_OPTIONS:MEIGEN3}
BUILD_DEPENDS+= ${LOCALBASE}/include/eigen3/Eigen/Eigen:${PORTSDIR}/math/eigen3
CMAKE_ARGS+= -DWITH_EIGEN:BOOL=On
.else
CMAKE_ARGS= -DWITH_EIGEN:BOOL=Off
.endif
.if ${PORT_OPTIONS:MEXAMPLES}
PORTEXAMPLES= *
. if !defined(OCV_SLAVE)
CMAKE_ARGS+= -DBUILD_EXAMPLES:BOOL=On \
-DINSTALL_C_EXAMPLES:BOOL=On
. endif
.endif
.if ${PORT_OPTIONS:MFFMPEG}
LIB_DEPENDS+= libavcodec.so:${PORTSDIR}/multimedia/ffmpeg
CMAKE_ARGS+= -DWITH_FFMPEG:BOOL=On
.else
CMAKE_ARGS+= -DWITH_FFMPEG:BOOL=Off
.endif
.if ${PORT_OPTIONS:MGSTREAMER}
USE_GSTREAMER= yes
CMAKE_ARGS+= -DWITH_GSTREAMER:BOOL=On
.else
CMAKE_ARGS+= -DWITH_GSTREAMER:BOOL=Off
.endif
.if ${PORT_OPTIONS:MGTK2}
USE_GNOME+= gtk20
CMAKE_ARGS+= -DWITH_GTK:BOOL=On
. if ${PORT_OPTIONS:MOPENGL}
LIB_DEPENDS+= libgtkglext-x11-1.0.so:${PORTSDIR}/x11-toolkits/gtkglext
. endif
.else
CMAKE_ARGS+= -DWITH_GTK:BOOL=Off
.endif
.if ${PORT_OPTIONS:MJASPER}
LIB_DEPENDS+= libjasper.so:${PORTSDIR}/graphics/jasper
CMAKE_ARGS+= -DWITH_JASPER:BOOL=On
.else
CMAKE_ARGS+= -DWITH_JASPER:BOOL=Off
.endif
.if ${PORT_OPTIONS:MJPEG}
LIB_DEPENDS+= libjpeg.so:${PORTSDIR}/graphics/jpeg
CMAKE_ARGS+= -DWITH_JPEG:BOOL=On
.else
CMAKE_ARGS+= -DWITH_JPEG:BOOL=Off
.endif
.if ${PORT_OPTIONS:MNONFREE}
CMAKE_ARGS+= -DBUILD_opencv_nonfree:BOOL=On
.else
CMAKE_ARGS+= -DBUILD_opencv_nonfree:BOOL=Off
.endif
.if ${PORT_OPTIONS:MOPENEXR}
LIB_DEPENDS+= libIlmImf.so:${PORTSDIR}/graphics/OpenEXR
CMAKE_ARGS+= -DWITH_OPENEXR:BOOL=On
.else
CMAKE_ARGS+= -DWITH_OPENEXR:BOOL=Off
.endif
.if ${PORT_OPTIONS:MOPENGL}
CMAKE_ARGS+= -DWITH_OPENGL:BOOL=On
.else
CMAKE_ARGS+= -DWITH_OPENGL:BOOL=Off
.endif
.if ${PORT_OPTIONS:MPNG}
LIB_DEPENDS+= libpng.so:${PORTSDIR}/graphics/png
CMAKE_ARGS+= -DWITH_PNG:BOOL=On
.else
CMAKE_ARGS+= -DWITH_PNG:BOOL=Off
.endif
.if ${PORT_OPTIONS:MQT4}
USE_QT4+= gui moc_build qmake_build rcc_build uic_build qtestlib
CMAKE_ARGS+= -DWITH_QT:STRING="4"
. if ${PORT_OPTIONS:MOPENGL}
USE_QT4+= opengl
. endif
.else
CMAKE_ARGS+= -DWITH_QT:BOOL=Off
.endif
.if ${PORT_OPTIONS:MTBB}
LIB_DEPENDS+= libtbb.so:${PORTSDIR}/devel/tbb
CMAKE_ARGS+= -DWITH_TBB:BOOL=On \
-DTBB_INCLUDE_DIR:STRING="${LOCALBASE}/include"
.else
CMAKE_ARGS+= -DWITH_TBB:BOOL=Off
.endif
.if ${PORT_OPTIONS:MTIFF}
LIB_DEPENDS+= libtiff.so:${PORTSDIR}/graphics/tiff
CMAKE_ARGS+= -DWITH_TIFF:BOOL=On
.else
CMAKE_ARGS+= -DWITH_TIFF:BOOL=Off
.endif
.if ${PORT_OPTIONS:MV4L}
LIB_DEPENDS+= libv4l2.so:${PORTSDIR}/multimedia/libv4l
BUILD_DEPENDS+= ${LOCALBASE}/include/linux/videodev2.h:${PORTSDIR}/multimedia/v4l_compat
CMAKE_ARGS+= -DWITH_V4L:BOOL=On \
-DCMAKE_REQUIRED_INCLUDES:STRING="${LOCALBASE}/include"
.else
CMAKE_ARGS+= -DWITH_V4L:BOOL=Off
.endif
.if ${PORT_OPTIONS:MXINE}
LIB_DEPENDS+= libxine.so:${PORTSDIR}/multimedia/libxine
CMAKE_ARGS+= -DWITH_XINE:BOOL=On
.else
CMAKE_ARGS+= -DWITH_XINE:BOOL=Off
.endif
.if defined(OCV_CORE)
. for module in ${OCV_MODS} ${OCV_JAVA_MODS} ${OCV_PYTHON_MODS}
CMAKE_ARGS+= -DBUILD_opencv_${module}:BOOL=Off
. endfor
.elif defined(OCV_PYTHON)
LIB_DEPENDS+= libopencv_legacy.so:${PORTSDIR}/graphics/opencv
BUILD_DEPENDS+= ${PYNUMPY}
RUN_DEPENDS+= ${PYNUMPY}
USES+= python
CMAKE_ARGS+= -DBUILD_opencv_python:BOOL=On
. for module in apps java stitching superres videostab
CMAKE_ARGS+= -DBUILD_opencv_${module}:BOOL=Off
. endfor
INSTALL_WRKSRC= ${WRKSRC}/modules/python
.elif defined(OCV_JAVA)
BUILD_DEPENDS+= ant:${PORTSDIR}/devel/apache-ant
LIB_DEPENDS+= libopencv_legacy.so:${PORTSDIR}/graphics/opencv
USES+= python:build
USE_JAVA= yes
CMAKE_ARGS+= -DBUILD_opencv_java:BOOL=On
. for module in apps python stitching superres videostab
CMAKE_ARGS+= -DBUILD_opencv_${module}:BOOL=Off
. endfor
CMAKE_ENV+= JAVA_HOME="${JAVA_HOME}"
INSTALL_WRKSRC= ${WRKSRC}/modules/java
.else
LIB_DEPENDS+= libopencv_core.so:${PORTSDIR}/graphics/opencv-core
. for module in ${OCV_JAVA_MODS} ${OCV_PYTHON_MODS}
CMAKE_ARGS+= -DBUILD_opencv_${module}:BOOL=Off
. endfor
.endif
post-patch:
@${MKDIR} ${CONFIGURE_WRKSRC}
@${REINPLACE_CMD} -e '/pkgconfig/s|$${OPENCV_LIB_INSTALL_PATH}|libdata|' \
${WRKSRC}/cmake/OpenCVGenPkgconfig.cmake
@${REINPLACE_CMD} -e 's|share/OpenCV/doc|${DOCSDIR_REL}|g' \
-e 's|share/OpenCV/samples|${EXAMPLESDIR_REL}|g' \
${WRKSRC}/CMakeLists.txt
@${FIND} ${WRKSRC} -name '*.orig' -exec ${RM} {} \;
.if defined(OCV_CORE)
@${REINPLACE_CMD} -e 's|opencv.pc|opencv-core.pc|g' \
${WRKSRC}/cmake/OpenCVGenPkgconfig.cmake
@${REINPLACE_CMD} -e 's|Name:.*|Name: OpenCV-core|' \
${WRKSRC}/cmake/templates/opencv-XXX.pc.in
.endif
.if defined(OCV_SLAVE)
@${REINPLACE_CMD} -e 's|add_subdirectory(data)||g' \
${WRKSRC}/CMakeLists.txt
.endif
post-install:
.if !defined(OCV_SLAVE)
(cd ${STAGEDIR}${PREFIX} && \
${RM} -r include/opencv2/core include/opencv2/imgproc \
lib/libopencv_core* lib/libopencv_imgproc*)
.endif
.if defined(OCV_CORE)
${RM} -r ${STAGEDIR}${PREFIX}/include/opencv
${RM} -r ${STAGEDIR}${DATADIR}
${MKDIR} ${STAGEDIR}${PREFIX}/share/cmake/Modules
${INSTALL_DATA} ${WRKDIR}/FindOpenCVCore.cmake ${STAGEDIR}${PREFIX}/share/cmake/Modules
.endif
.if defined(OCV_PYTHON)
(cd ${STAGEDIR}${PREFIX} && \
${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py \
-d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S|${PREFIX}/||} && \
${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py \
-d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S|${PREFIX}/||})
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
. if defined(PYTHON_REL) && ${PYTHON_REL} >= 300
cd ${WRKSRC}/samples/python && \
${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}/python
. else
cd ${WRKSRC}/samples/python2 && \
${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}/python2
. endif
.endif
.if defined(OCV_JAVA)
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
cd ${WRKSRC}/samples/java && \
${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}/java
.endif
.include <bsd.port.mk>
|