summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2012-07-13 09:12:08 +0000
committerEric Bénard <eric@eukrea.com>2012-07-13 11:28:29 +0200
commit2a5b460500192b1be6f44d1283cc96aac8377d18 (patch)
treee4401d5a2fc0e42297ec4991f3a196e3212101cf
parente619902629a55302884e01391b8b6c8845a619de (diff)
downloadmeta-openembedded-2a5b460500192b1be6f44d1283cc96aac8377d18.tar.gz
opencv, opencv-samples: add 2.4.2
Libav is easier to get right than gstreamer, so switch back. Also enable libv4l for better v4l(2) support Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Eric Bénard <eric@eukrea.com>
-rw-r--r--meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch36
-rw-r--r--meta-oe/recipes-support/opencv/opencv-samples_2.4.bb42
-rw-r--r--meta-oe/recipes-support/opencv/opencv_2.4.bb77
3 files changed, 155 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch b/meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch
new file mode 100644
index 000000000..43f03d31f
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv-2.4.2/0001-Fix-CMakeLists.txt-numpy-detection.patch
@@ -0,0 +1,36 @@
1From 965616bdc73247448b8f07572a9a479235dd092d Mon Sep 17 00:00:00 2001
2From: Connor Abbott <cwabbott0@gmail.com>
3Date: Wed, 11 Jul 2012 13:55:38 +0200
4Subject: [PATCH] Fix CMakeLists.txt numpy detection
5
6Right now, the code opencv uses to detect where the numpy include files are doesn't work with cross-compiling because it uses the native python to determine the environment. To make this a little better, allow the user to explictly specify the path using -DPYTHON_NUMPY_INCLUDE_DIRS=path/to/numpy/include/dir .
7
8Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9---
10 cmake/OpenCVDetectPython.cmake | 8 ++++++--
11 1 file changed, 6 insertions(+), 2 deletions(-)
12
13diff --git a/cmake/OpenCVDetectPython.cmake b/cmake/OpenCVDetectPython.cmake
14index 8be94ca..5825a04 100644
15--- a/cmake/OpenCVDetectPython.cmake
16+++ b/cmake/OpenCVDetectPython.cmake
17@@ -74,10 +74,14 @@ if(PYTHON_EXECUTABLE)
18
19 if(NOT PYTHON_NUMPY_INCLUDE_DIR)
20 # Attempt to discover the NumPy include directory. If this succeeds, then build python API with NumPy
21- execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
22+ if(NOT DEFINED PYTHON_NUMPY_INCLUDE_DIRS)
23+ execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
24 RESULT_VARIABLE PYTHON_NUMPY_PROCESS
25- OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIR
26+ OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_DIRS
27 OUTPUT_STRIP_TRAILING_WHITESPACE)
28+ else()
29+ set(PYTHON_NUMPY_PROCESS 0)
30+ endif()
31
32 if(PYTHON_NUMPY_PROCESS EQUAL 0)
33 file(TO_CMAKE_PATH "${PYTHON_NUMPY_INCLUDE_DIR}" _PYTHON_NUMPY_INCLUDE_DIR)
34--
351.7.10
36
diff --git a/meta-oe/recipes-support/opencv/opencv-samples_2.4.bb b/meta-oe/recipes-support/opencv/opencv-samples_2.4.bb
new file mode 100644
index 000000000..90f7536ce
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv-samples_2.4.bb
@@ -0,0 +1,42 @@
1DESCRIPTION = "Opencv : The Open Computer Vision Library"
2HOMEPAGE = "http://opencv.willowgarage.com/wiki/"
3SECTION = "libs"
4LICENSE = "BSD"
5
6DEPENDS = "opencv"
7
8LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14 \
9"
10
11SRC_URI = "svn://code.opencv.org/svn/opencv/branches/2.4;module=opencv;proto=http \
12 "
13
14SRCREV = "8988"
15
16PV = "2.4.2"
17
18S = "${WORKDIR}/opencv"
19
20do_install() {
21 cd samples/c
22 install -d ${D}/${bindir}
23 install -d ${D}/${datadir}/opencv/samples
24
25 cp * ${D}/${datadir}/opencv/samples || true
26
27 for i in *.c; do
28 echo "compiling $i"
29 ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv` || true
30 install -m 0755 `basename $i .c` ${D}/${bindir} || true
31 rm ${D}/${datadir}/opencv/samples/`basename $i .c` || true
32 done
33 for i in *.cpp; do
34 echo "compiling $i"
35 ${CXX} ${CFLAGS} ${LDFLAGS} -ggdb `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv` || true
36 install -m 0755 `basename $i .cpp` ${D}/${bindir} || true
37 rm ${D}/${datadir}/opencv/samples/`basename $i .cpp` || true
38 done
39}
40
41FILES_${PN}-dev += "${datadir}/opencv/samples/*.c* ${datadir}/opencv/samples/*.vcp* ${datadir}/opencv/samples/build*"
42FILES_${PN} += "${bindir} ${datadir}/opencv"
diff --git a/meta-oe/recipes-support/opencv/opencv_2.4.bb b/meta-oe/recipes-support/opencv/opencv_2.4.bb
new file mode 100644
index 000000000..e56eacdc2
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv_2.4.bb
@@ -0,0 +1,77 @@
1DESCRIPTION = "Opencv : The Open Computer Vision Library"
2HOMEPAGE = "http://opencv.willowgarage.com/wiki/"
3SECTION = "libs"
4
5LICENSE = "BSD"
6LIC_FILES_CHKSUM = "file://include/opencv2/opencv.hpp;endline=41;md5=6d690d8488a6fca7a2c192932466bb14"
7
8ARM_INSTRUCTION_SET = "arm"
9
10DEPENDS = "python-numpy v4l-utils libav gtk+ libtool swig swig-native python jpeg bzip2 zlib libpng tiff glib-2.0"
11
12SRC_URI = "svn://code.opencv.org/svn/opencv/branches/2.4;module=opencv;proto=http \
13 file://0001-Fix-CMakeLists.txt-numpy-detection.patch \
14 "
15
16SRCREV = "8988"
17
18PV = "2.4.2"
19
20S = "${WORKDIR}/opencv"
21
22EXTRA_OECMAKE = "-DPYTHON_NUMPY_INCLUDE_DIRS=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include \
23 -DBUILD_PYTHON_SUPPORT=ON \
24 -DWITH_FFMPEG=ON \
25 -DWITH_GSTREAMER=OFF \
26 -DWITH_V4L=ON \
27 -DWITH_GTK=ON \
28 "
29
30inherit distutils-base pkgconfig cmake
31
32export BUILD_SYS
33export HOST_SYS
34export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
35export PYTHON="${STAGING_BINDIR_NATIVE}/python"
36
37TARGET_CC_ARCH += "-I${S}/include "
38
39PACKAGES += "${PN}-apps python-opencv"
40
41python populate_packages_prepend () {
42 cv_libdir = bb.data.expand('${libdir}', d)
43 cv_libdir_dbg = bb.data.expand('${libdir}/.debug', d)
44 do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
45 do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
46 do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
47 do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True)
48
49 pn = bb.data.getVar('PN', d, 1)
50 metapkg = pn + '-dev'
51 bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d)
52 blacklist = [ metapkg ]
53 metapkg_rdepends = [ ]
54 packages = bb.data.getVar('PACKAGES', d, 1).split()
55 for pkg in packages[1:]:
56 if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'):
57 metapkg_rdepends.append(pkg)
58 bb.data.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends), d)
59}
60
61FILES_${PN} = ""
62FILES_${PN}-apps = "${bindir}/* ${datadir}/OpenCV"
63FILES_${PN}-dbg += "${libdir}/.debug"
64FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig"
65FILES_${PN}-doc = "${datadir}/OpenCV/doc"
66
67ALLOW_EMPTY_${PN} = "1"
68
69INSANE_SKIP_python-opencv = "True"
70DESCRIPTION_python-opencv = "Python bindings to opencv"
71FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
72RDEPENDS_python-opencv = "python-core python-numpy"
73
74do_install_append() {
75 cp ${S}/include/opencv/*.h ${D}${includedir}/opencv/
76 sed -i '/blobtrack/d' ${D}${includedir}/opencv/cvaux.h
77}