opencv-3.4.3.recipe revision cc567e6b
1SUMMARY="Open Source Computer Vision Library"
2DESCRIPTION="A collection of algorithms and sample code for various \
3computer vision problems."
4HOMEPAGE="https://opencv.org/"
5COPYRIGHT="2000-2016, Intel Corporation
6	2009-2011, Willow Garage Inc.
7	2009-2016, NVIDIA Corporation
8	2010-2013, Advanced Micro Devices, Inc.
9	2015-2016, OpenCV Foundation
10	2015-2016, Itseez Inc."
11LICENSE="BSD (3-clause)"
12REVISION="3"
13SOURCE_URI="https://github.com/opencv/opencv/archive/$portVersion.tar.gz"
14SOURCE_FILENAME="opencv-$portVersion.tar.gz"
15CHECKSUM_SHA256="4eef85759d5450b183459ff216b4c0fa43e87a4f6aa92c8af649f89336f002ec"
16SOURCE_URI_2="https://github.com/opencv/opencv_contrib/archive/$portVersion.tar.gz"
17SOURCE_FILENAME_2="opencv_contrib-$portVersion.tar.gz"
18CHECKSUM_SHA256_2="6dfb51326f3dfeb659128df952edecd45683626a965aa4a8e1e9c970c40fb636"
19
20ARCHITECTURES="?x86 x86_64"
21SECONDARY_ARCHITECTURES="?x86"
22
23# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
24commandSuffix=$secondaryArchSuffix
25if [ "$targetArchitecture" = x86_gcc2 ]; then
26	commandSuffix=
27fi
28
29portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
30libVersion="$portVersion"
31libVersionCompat="$libVersion compat >= ${libVersion%.*}"
32
33PROVIDES="
34	opencv$secondaryArchSuffix = $portVersionCompat
35	lib:libopencv_aruco$secondaryArchSuffix = $libVersionCompat
36	lib:libopencv_bgsegm$secondaryArchSuffix = $libVersionCompat
37	lib:libopencv_bioinspired$secondaryArchSuffix = $libVersionCompat
38	lib:libopencv_calib3d$secondaryArchSuffix = $libVersionCompat
39	lib:libopencv_ccalib$secondaryArchSuffix = $libVersionCompat
40	lib:libopencv_core$secondaryArchSuffix = $libVersionCompat
41	lib:libopencv_cvv$secondaryArchSuffix = $libVersionCompat
42	lib:libopencv_datasets$secondaryArchSuffix = $libVersionCompat
43	lib:libopencv_dnn_objdetect$secondaryArchSuffix = $libVersionCompat
44	lib:libopencv_dnn$secondaryArchSuffix = $libVersionCompat
45	lib:libopencv_dpm$secondaryArchSuffix = $libVersionCompat
46	lib:libopencv_face$secondaryArchSuffix = $libVersionCompat
47	lib:libopencv_features2d$secondaryArchSuffix = $libVersionCompat
48	lib:libopencv_flann$secondaryArchSuffix = $libVersionCompat
49	lib:libopencv_freetype$secondaryArchSuffix = $libVersionCompat
50	lib:libopencv_fuzzy$secondaryArchSuffix = $libVersionCompat
51	lib:libopencv_hdf$secondaryArchSuffix = $libVersionCompat
52	lib:libopencv_hfs$secondaryArchSuffix = $libVersionCompat
53	lib:libopencv_highgui$secondaryArchSuffix = $libVersionCompat
54	lib:libopencv_img_hash$secondaryArchSuffix = $libVersionCompat
55	lib:libopencv_imgcodecs$secondaryArchSuffix = $libVersionCompat
56	lib:libopencv_imgproc$secondaryArchSuffix = $libVersionCompat
57	lib:libopencv_line_descriptor$secondaryArchSuffix = $libVersionCompat
58	lib:libopencv_ml$secondaryArchSuffix = $libVersionCompat
59	lib:libopencv_objdetect$secondaryArchSuffix = $libVersionCompat
60	lib:libopencv_optflow$secondaryArchSuffix = $libVersionCompat
61	lib:libopencv_phase_unwrapping$secondaryArchSuffix = $libVersionCompat
62	lib:libopencv_photo$secondaryArchSuffix = $libVersionCompat
63	lib:libopencv_plot$secondaryArchSuffix = $libVersionCompat
64	lib:libopencv_reg$secondaryArchSuffix = $libVersionCompat
65	lib:libopencv_rgbd$secondaryArchSuffix = $libVersionCompat
66	lib:libopencv_saliency$secondaryArchSuffix = $libVersionCompat
67	lib:libopencv_shape$secondaryArchSuffix = $libVersionCompat
68	lib:libopencv_stereo$secondaryArchSuffix = $libVersionCompat
69	lib:libopencv_stitching$secondaryArchSuffix = $libVersionCompat
70	lib:libopencv_structured_light$secondaryArchSuffix = $libVersionCompat
71	lib:libopencv_superres$secondaryArchSuffix = $libVersionCompat
72	lib:libopencv_surface_matching$secondaryArchSuffix = $libVersionCompat
73	lib:libopencv_text$secondaryArchSuffix = $libVersionCompat
74	lib:libopencv_tracking$secondaryArchSuffix = $libVersionCompat
75	lib:libopencv_video$secondaryArchSuffix = $libVersionCompat
76	lib:libopencv_videoio$secondaryArchSuffix = $libVersionCompat
77	lib:libopencv_videostab$secondaryArchSuffix = $libVersionCompat
78	lib:libopencv_xfeatures2d$secondaryArchSuffix = $libVersionCompat
79	lib:libopencv_ximgproc$secondaryArchSuffix = $libVersionCompat
80	lib:libopencv_xobjdetect$secondaryArchSuffix = $libVersionCompat
81	lib:libopencv_xphoto$secondaryArchSuffix = $libVersionCompat
82	"
83REQUIRES="
84	haiku$secondaryArchSuffix
85	lib:libavcodec$secondaryArchSuffix
86	lib:libavformat$secondaryArchSuffix
87	lib:libavresample$secondaryArchSuffix
88	lib:libavutil$secondaryArchSuffix
89	lib:libfreetype$secondaryArchSuffix
90	lib:libgdal$secondaryArchSuffix
91	lib:libGL$secondaryArchSuffix
92	lib:libglib_2.0$secondaryArchSuffix
93	lib:libGLU$secondaryArchSuffix
94	lib:libgphoto2$secondaryArchSuffix
95	lib:libgstapp_1.0$secondaryArchSuffix
96	lib:libgstreamer_1.0$secondaryArchSuffix
97	lib:libgstvideo_1.0$secondaryArchSuffix
98	lib:libharfbuzz$secondaryArchSuffix
99	lib:libhdf5$secondaryArchSuffix
100	lib:libilmimf$secondaryArchSuffix #openexr
101	lib:libintl$secondaryArchSuffix
102	lib:libjasper$secondaryArchSuffix
103	lib:libjpeg$secondaryArchSuffix
104	lib:liblapack$secondaryArchSuffix
105	lib:libopenblas$secondaryArchSuffix
106	lib:libpng16$secondaryArchSuffix
107	lib:libQt5Concurrent$secondaryArchSuffix
108	lib:libQt5Core$secondaryArchSuffix
109	lib:libQt5Gui$secondaryArchSuffix
110	lib:libQt5Test$secondaryArchSuffix
111	lib:libQt5Widgets$secondaryArchSuffix
112	lib:libswscale$secondaryArchSuffix
113	lib:libtiff$secondaryArchSuffix
114	lib:libwebp$secondaryArchSuffix
115	lib:libz$secondaryArchSuffix
116	"
117
118PROVIDES_devel="
119	opencv${secondaryArchSuffix}_devel = $portVersionCompat
120	devel:libopencv_aruco$secondaryArchSuffix = $libVersionCompat
121	devel:libopencv_bgsegm$secondaryArchSuffix = $libVersionCompat
122	devel:libopencv_bioinspired$secondaryArchSuffix = $libVersionCompat
123	devel:libopencv_calib3d$secondaryArchSuffix = $libVersionCompat
124	devel:libopencv_ccalib$secondaryArchSuffix = $libVersionCompat
125	devel:libopencv_core$secondaryArchSuffix = $libVersionCompat
126	devel:libopencv_cvv$secondaryArchSuffix = $libVersionCompat
127	devel:libopencv_datasets$secondaryArchSuffix = $libVersionCompat
128	devel:libopencv_dnn_objdetect$secondaryArchSuffix = $libVersionCompat
129	devel:libopencv_dnn$secondaryArchSuffix = $libVersionCompat
130	devel:libopencv_dpm$secondaryArchSuffix = $libVersionCompat
131	devel:libopencv_face$secondaryArchSuffix = $libVersionCompat
132	devel:libopencv_features2d$secondaryArchSuffix = $libVersionCompat
133	devel:libopencv_flann$secondaryArchSuffix = $libVersionCompat
134	devel:libopencv_freetype$secondaryArchSuffix = $libVersionCompat
135	devel:libopencv_fuzzy$secondaryArchSuffix = $libVersionCompat
136	devel:libopencv_hdf$secondaryArchSuffix = $libVersionCompat
137	devel:libopencv_hfs$secondaryArchSuffix = $libVersionCompat
138	devel:libopencv_highgui$secondaryArchSuffix = $libVersionCompat
139	devel:libopencv_img_hash$secondaryArchSuffix = $libVersionCompat
140	devel:libopencv_imgcodecs$secondaryArchSuffix = $libVersionCompat
141	devel:libopencv_imgproc$secondaryArchSuffix = $libVersionCompat
142	devel:libopencv_line_descriptor$secondaryArchSuffix = $libVersionCompat
143	devel:libopencv_ml$secondaryArchSuffix = $libVersionCompat
144	devel:libopencv_objdetect$secondaryArchSuffix = $libVersionCompat
145	devel:libopencv_optflow$secondaryArchSuffix = $libVersionCompat
146	devel:libopencv_phase_unwrapping$secondaryArchSuffix = $libVersionCompat
147	devel:libopencv_photo$secondaryArchSuffix = $libVersionCompat
148	devel:libopencv_plot$secondaryArchSuffix = $libVersionCompat
149	devel:libopencv_reg$secondaryArchSuffix = $libVersionCompat
150	devel:libopencv_rgbd$secondaryArchSuffix = $libVersionCompat
151	devel:libopencv_saliency$secondaryArchSuffix = $libVersionCompat
152	devel:libopencv_shape$secondaryArchSuffix = $libVersionCompat
153	devel:libopencv_stereo$secondaryArchSuffix = $libVersionCompat
154	devel:libopencv_stitching$secondaryArchSuffix = $libVersionCompat
155	devel:libopencv_structured_light$secondaryArchSuffix = $libVersionCompat
156	devel:libopencv_superres$secondaryArchSuffix = $libVersionCompat
157	devel:libopencv_surface_matching$secondaryArchSuffix = $libVersionCompat
158	devel:libopencv_text$secondaryArchSuffix = $libVersionCompat
159	devel:libopencv_tracking$secondaryArchSuffix = $libVersionCompat
160	devel:libopencv_video$secondaryArchSuffix = $libVersionCompat
161	devel:libopencv_videoio$secondaryArchSuffix = $libVersionCompat
162	devel:libopencv_videostab$secondaryArchSuffix = $libVersionCompat
163	devel:libopencv_xfeatures2d$secondaryArchSuffix = $libVersionCompat
164	devel:libopencv_ximgproc$secondaryArchSuffix = $libVersionCompat
165	devel:libopencv_xobjdetect$secondaryArchSuffix = $libVersionCompat
166	devel:libopencv_xphoto$secondaryArchSuffix = $libVersionCompat
167	"
168REQUIRES_devel="
169	opencv$secondaryArchSuffix == $portVersion base
170	"
171
172PROVIDES_tools="
173	cmd:opencv_annotation$commandSuffix = $portVersion
174	cmd:opencv_createsamples$commandSuffix = $portVersion
175	cmd:opencv_interactive_calibration$commandSuffix = $portVersion
176	cmd:opencv_traincascade$commandSuffix = $portVersion
177	cmd:opencv_version$commandSuffix = $portVersion
178	cmd:opencv_visualisation$commandSuffix = $portVersion
179	cmd:opencv_waldboost_detector$commandSuffix = $portVersion
180	"
181REQUIRES_tools="
182	haiku$secondaryArchSuffix
183	opencv$secondaryArchSuffix == $portVersion base
184	"
185
186BUILD_REQUIRES="
187	haiku${secondaryArchSuffix}_devel
188	devel:cblas$secondaryArchSuffix
189	devel:eigen$secondaryArchSuffix
190	devel:libavcodec$secondaryArchSuffix
191	devel:libavformat$secondaryArchSuffix
192	devel:libavresample$secondaryArchSuffix
193	devel:libavutil$secondaryArchSuffix
194#	devel:libcaffe$secondaryArchSuffix
195	devel:libexif$secondaryArchSuffix
196	devel:libfreetype$secondaryArchSuffix
197	devel:libgdal$secondaryArchSuffix
198#	devel:libgflags$secondaryArchSuffix
199	devel:libGL$secondaryArchSuffix
200	devel:libglib_2.0$secondaryArchSuffix
201	devel:libglog$secondaryArchSuffix
202	devel:libGLU$secondaryArchSuffix
203	devel:libgphoto2$secondaryArchSuffix
204	devel:libgstapp_1.0$secondaryArchSuffix
205	devel:libgstreamer_1.0$secondaryArchSuffix
206	devel:libgstvideo_1.0$secondaryArchSuffix
207	devel:libharfbuzz$secondaryArchSuffix
208	devel:libhdf5$secondaryArchSuffix
209	devel:libilmimf$secondaryArchSuffix #openexr
210	devel:libintl$secondaryArchSuffix
211	devel:libjasper$secondaryArchSuffix
212	devel:libjpeg$secondaryArchSuffix
213	devel:liblapack$secondaryArchSuffix
214	devel:libopenblas$secondaryArchSuffix
215	devel:libopencl_headers$secondaryArchSuffix
216	devel:liborc_0.4$secondaryArchSuffix
217	devel:libpng16$secondaryArchSuffix
218#	devel:libprotobuf$secondaryArchSuffix
219	devel:libQt5Concurrent$secondaryArchSuffix
220	devel:libQt5Core$secondaryArchSuffix
221	devel:libQt5Gui$secondaryArchSuffix
222	devel:libQt5Test$secondaryArchSuffix
223	devel:libQt5Widgets$secondaryArchSuffix
224	devel:libswscale$secondaryArchSuffix
225#	devel:libtesseract$secondaryArchSuffix
226	devel:libtiff$secondaryArchSuffix
227	devel:libwebp$secondaryArchSuffix
228	devel:libz$secondaryArchSuffix
229	"
230BUILD_PREREQUIRES="
231#	cmd:ant
232	cmd:cmake
233	cmd:doxygen
234	cmd:f2py2
235	cmd:f2py3
236	cmd:gcc$secondaryArchSuffix
237#	cmd:javac
238#	cmd:jni
239	cmd:ld$secondaryArchSuffix
240	cmd:make
241#	cmd:matlab # maybe later
242	cmd:pkg_config$secondaryArchSuffix
243	cmd:python2
244	cmd:python3
245	"
246
247defineDebugInfoPackage opencv$secondaryArchSuffix \
248	$libDir/libopencv_calib3d.so.$libVersion \
249	$libDir/libopencv_core.so.$libVersion \
250	$libDir/libopencv_dnn.so.$libVersion \
251	$libDir/libopencv_features2d.so.$libVersion \
252	$libDir/libopencv_flann.so.$libVersion \
253	$libDir/libopencv_highgui.so.$libVersion \
254	$libDir/libopencv_imgcodecs.so.$libVersion \
255	$libDir/libopencv_imgproc.so.$libVersion \
256	$libDir/libopencv_ml.so.$libVersion \
257	$libDir/libopencv_objdetect.so.$libVersion \
258	$libDir/libopencv_photo.so.$libVersion \
259	$libDir/libopencv_shape.so.$libVersion \
260	$libDir/libopencv_stitching.so.$libVersion \
261	$libDir/libopencv_superres.so.$libVersion \
262	$libDir/libopencv_video.so.$libVersion \
263	$libDir/libopencv_videoio.so.$libVersion \
264	$libDir/libopencv_videostab.so.$libVersion
265
266BUILD()
267{
268	mkdir -p build_haiku && cd build_haiku
269
270	local ARCH_SUBDIR=
271	if [ -n "$secondaryArchSuffix" ]; then
272		ARCH_SUBDIR="$secondaryArchSuffix/"
273	fi
274
275	cmake .. \
276		-DWITH_GDAL=ON \
277		-DWITH_IPP=OFF \
278		-DWITH_OPENGL=OFF \
279		-DWITH_QT=ON \
280		-DWITH_EIGEN=ON \
281		-DCMAKE_BUILD_TYPE=Release \
282		-DCMAKE_SKIP_RPATH=ON \
283		-DENABLE_PIC=OFF \
284		-DOPENCV_ENABLE_NONFREE=ON \
285		-DCMAKE_INSTALL_PREFIX:PATH="$prefix" \
286		-DOPENCV_OTHER_INSTALL_PATH:PATH="$dataDir" \
287		-DOpenBLAS_INCLUDE_DIR="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/headers/$ARCH_SUBDIR" \
288		-DOpenBLAS_LIB="$portPackageLinksDir/openblas${secondaryArchSuffix}_devel/develop/lib/$ARCH_SUBDIR" \
289		-DOPENCV_EXTRA_MODULES_PATH="$sourceDir2/opencv_contrib-$portVersion/modules"
290
291	make $jobArgs
292}
293
294INSTALL()
295{
296	cd build_haiku
297
298	make install
299
300	mkdir -p $developDir $dataDir
301	mv $prefix/include $includeDir
302	mv $prefix/share/* $dataDir
303	rmdir $prefix/share
304
305	mkdir -p $libDir/cmake/OpenCV
306	mv $dataDir/OpenCV/*.cmake $libDir/cmake/OpenCV/
307
308	prepareInstalledDevelLibs libopencv_aruco \
309		libopencv_bgsegm \
310		libopencv_bioinspired \
311		libopencv_calib3d \
312		libopencv_ccalib \
313		libopencv_core \
314		libopencv_cvv \
315		libopencv_datasets \
316		libopencv_dnn_objdetect \
317		libopencv_dnn \
318		libopencv_dpm \
319		libopencv_face \
320		libopencv_features2d \
321		libopencv_flann \
322		libopencv_freetype \
323		libopencv_fuzzy \
324		libopencv_hdf \
325		libopencv_hfs \
326		libopencv_highgui \
327		libopencv_img_hash \
328		libopencv_imgcodecs \
329		libopencv_imgproc \
330		libopencv_line_descriptor \
331		libopencv_ml \
332		libopencv_objdetect \
333		libopencv_optflow \
334		libopencv_phase_unwrapping \
335		libopencv_photo \
336		libopencv_plot \
337		libopencv_reg \
338		libopencv_rgbd \
339		libopencv_saliency \
340		libopencv_shape \
341		libopencv_stereo \
342		libopencv_stitching \
343		libopencv_structured_light \
344		libopencv_superres \
345		libopencv_surface_matching \
346		libopencv_text \
347		libopencv_tracking \
348		libopencv_video \
349		libopencv_videoio \
350		libopencv_videostab \
351		libopencv_xfeatures2d \
352		libopencv_ximgproc \
353		libopencv_xobjdetect \
354		libopencv_xphoto
355
356	# Cleanup
357	# fixPkgconfig don't know about this variables
358	sed -i 's,^includedir_old=\(.*\),includedir_old=${prefix}/'${relativeIncludeDir}'/opencv,' \
359		$libDir/pkgconfig/opencv.pc
360	sed -i 's,^includedir_new=\(.*\),includedir_new=${prefix}/'${relativeIncludeDir}',' \
361		$libDir/pkgconfig/opencv.pc
362
363	fixPkgconfig
364
365	# fixCmake
366	sed -i 's,\/include,/'${relativeIncludeDir}',g' \
367		$libDir/cmake/OpenCV/OpenCVConfig.cmake
368	sed -i 's|/\.\./\.\./|&../|g' \
369		$libDir/cmake/OpenCV/OpenCVConfig.cmake
370	sed -i 's,\/lib\/,\/,g' \
371		$libDir/cmake/OpenCV/OpenCVModules-release.cmake
372
373	# devel package
374	packageEntries devel \
375		$developDir \
376		$libDir/cmake
377
378	# tools package
379	packageEntries tools \
380		$binDir
381}
382
383TEST()
384{
385	LIBRARY_PATH="$sourceDir/build_haiku/lib${LIBRARY_PATH:+:$LIBRARY_PATH}" \
386	make -C build_haiku test $jobArgs
387}
388