diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2015-08-20 12:10:52 +0200 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2015-08-31 20:09:30 +0200 |
commit | e5abd3c3fb72556dd6fdce126fe7b81ed1285401 (patch) | |
tree | b74f12bdb3923332316cc15de5fd4136f38dced3 | |
parent | 7f478ed5cb7f8ab22b8c96a2d9d20e60ae230a09 (diff) | |
download | meta-openembedded-e5abd3c3fb72556dd6fdce126fe7b81ed1285401.tar.gz |
Opencv: Add OpenCV 3.0
-Support for new PACKAGECONFIGS
-Merge with opencv-samples
Since it is not backward compatible with 2.x and cannot be installed in
parallel it has a DEFAULT_PREFERENCE of -1.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r-- | meta-oe/recipes-support/opencv/opencv_3.0.bb | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/opencv/opencv_3.0.bb b/meta-oe/recipes-support/opencv/opencv_3.0.bb new file mode 100644 index 000000000..575709c2d --- /dev/null +++ b/meta-oe/recipes-support/opencv/opencv_3.0.bb | |||
@@ -0,0 +1,129 @@ | |||
1 | SUMMARY = "Opencv : The Open Computer Vision Library" | ||
2 | HOMEPAGE = "http://opencv.org/" | ||
3 | SECTION = "libs" | ||
4 | |||
5 | LICENSE = "BSD-3-Clause" | ||
6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=0ea90d28b4de883d7af5e6711f14f7bf" | ||
7 | |||
8 | ARM_INSTRUCTION_SET = "arm" | ||
9 | |||
10 | DEFAULT_PREFERENCE = "-1" | ||
11 | |||
12 | DEPENDS = "python-numpy libtool swig swig-native python bzip2 zlib glib-2.0" | ||
13 | |||
14 | SRCREV_opencv = "424c2bddb39dae97dc4639a24eaa0e0c8fbb8e69" | ||
15 | SRCREV_contrib = "844c30e8b2f2f4b34b96a169fafe9beea3c45e87" | ||
16 | SRCREV_FORMAT = "opencv" | ||
17 | SRC_URI = "git://github.com/Itseez/opencv.git;name=opencv \ | ||
18 | git://github.com/Itseez/opencv_contrib.git;destsuffix=contrib;name=contrib" | ||
19 | |||
20 | PV = "3.0+git${SRCPV}" | ||
21 | |||
22 | S = "${WORKDIR}/git" | ||
23 | |||
24 | EXTRA_OECMAKE = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include \ | ||
25 | -DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \ | ||
26 | -DWITH_1394=OFF \ | ||
27 | -DCMAKE_SKIP_RPATH=ON \ | ||
28 | ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \ | ||
29 | ${@base_conditional("libdir", "/usr/lib64", "-DLIB_SUFFIX=64", "", d)} \ | ||
30 | ${@base_conditional("libdir", "/usr/lib32", "-DLIB_SUFFIX=32", "", d)} \ | ||
31 | " | ||
32 | |||
33 | PACKAGECONFIG ??= "eigen jpeg png tiff v4l libv4l gstreamer samples tbb \ | ||
34 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \ | ||
35 | ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)}" | ||
36 | PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen," | ||
37 | PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3," | ||
38 | PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg," | ||
39 | PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav," | ||
40 | PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng," | ||
41 | PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff," | ||
42 | PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils," | ||
43 | PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils," | ||
44 | PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper," | ||
45 | PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas," | ||
46 | PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft," | ||
47 | PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers," | ||
48 | PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base," | ||
49 | PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native," | ||
50 | PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,," | ||
51 | PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb," | ||
52 | |||
53 | inherit distutils-base pkgconfig cmake | ||
54 | |||
55 | export BUILD_SYS | ||
56 | export HOST_SYS | ||
57 | export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}" | ||
58 | export PYTHON="${STAGING_BINDIR_NATIVE}/python" | ||
59 | export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java" | ||
60 | export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/" | ||
61 | |||
62 | TARGET_CC_ARCH += "-I${S}/include " | ||
63 | |||
64 | PACKAGES += "${PN}-java-dbg ${PN}-java ${PN}-samples-dbg ${PN}-samples ${PN}-apps python-opencv" | ||
65 | |||
66 | python populate_packages_prepend () { | ||
67 | cv_libdir = d.expand('${libdir}') | ||
68 | cv_libdir_dbg = d.expand('${libdir}/.debug') | ||
69 | do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True) | ||
70 | do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') | ||
71 | do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev') | ||
72 | do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True) | ||
73 | |||
74 | pn = d.getVar('PN', 1) | ||
75 | metapkg = pn + '-dev' | ||
76 | d.setVar('ALLOW_EMPTY_' + metapkg, "1") | ||
77 | blacklist = [ metapkg ] | ||
78 | metapkg_rdepends = [ ] | ||
79 | packages = d.getVar('PACKAGES', 1).split() | ||
80 | for pkg in packages[1:]: | ||
81 | if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'): | ||
82 | metapkg_rdepends.append(pkg) | ||
83 | d.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends)) | ||
84 | |||
85 | blacklist = [ metapkg ] | ||
86 | metapkg = pn | ||
87 | metapkg_rdepends = [ ] | ||
88 | for pkg in packages[1:]: | ||
89 | if not pkg in blacklist and not pkg in metapkg_rdepends and not pkg.endswith('-dev') and not pkg.endswith('-dbg') and not pkg.endswith('-doc') : | ||
90 | metapkg_rdepends.append(pkg) | ||
91 | bb.data.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends), d) | ||
92 | |||
93 | } | ||
94 | |||
95 | PACKAGES_DYNAMIC += "^libopencv-.*" | ||
96 | |||
97 | FILES_${PN} = "" | ||
98 | FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV" | ||
99 | FILES_${PN}-dbg += "${libdir}/.debug" | ||
100 | FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig" | ||
101 | FILES_${PN}-doc = "${datadir}/OpenCV/doc" | ||
102 | FILES_${PN}-java = "${datadir}/OpenCV/java" | ||
103 | FILES_${PN}-java-dbg = "${datadir}/OpenCV/java/.debug/" | ||
104 | FILES_${PN}-samples = "${datadir}/OpenCV/samples/" | ||
105 | FILES_${PN}-samples-dbg = "${datadir}/OpenCV/samples/bin/.debug" | ||
106 | |||
107 | INSANE_SKIP_${PN}-apps = "staticdev" | ||
108 | INSANE_SKIP_${PN}-java = "libdir" | ||
109 | INSANE_SKIP_${PN}-java-dbg = "libdir" | ||
110 | |||
111 | ALLOW_EMPTY_${PN} = "1" | ||
112 | |||
113 | SUMMARY_python-opencv = "Python bindings to opencv" | ||
114 | FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" | ||
115 | RDEPENDS_python-opencv = "python-core python-numpy" | ||
116 | |||
117 | do_install_append() { | ||
118 | cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/ | ||
119 | sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h | ||
120 | |||
121 | # Move Python files into correct library folder (for multilib build) | ||
122 | if [ "$libdir" != "/usr/lib" ]; then | ||
123 | mv ${D}/usr/lib/* ${D}/${libdir}/ | ||
124 | rm -rf ${D}/usr/lib | ||
125 | fi | ||
126 | |||
127 | install -d ${D}${datadir}/OpenCV/samples/bin/ | ||
128 | cp -f bin/*-tutorial-* bin/*-example-* ${D}${datadir}/OpenCV/samples/bin/ | ||
129 | } | ||