blob: 77b5dd60c44f8782bc720c3dacbb1e865e601b4c [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "Opencv : The Open Computer Vision Library"
2HOMEPAGE = "http://opencv.org/"
3SECTION = "libs"
4
5LICENSE = "BSD-3-Clause"
Brad Bishop26bdd442019-08-16 17:08:17 -04006LIC_FILES_CHKSUM = "file://LICENSE;md5=6450921bb12a3133c8f5cb2a80343710"
Brad Bishop19323692019-04-05 15:28:33 -04007
8ARM_INSTRUCTION_SET_armv4 = "arm"
9ARM_INSTRUCTION_SET_armv5 = "arm"
10
11DEPENDS = "libtool swig-native bzip2 zlib glib-2.0 libwebp"
12
Brad Bishop26bdd442019-08-16 17:08:17 -040013SRCREV_opencv = "371bba8f54560b374fbcd47e7e02f015ac4969ad"
14SRCREV_contrib = "2c32791a9c500343568a21ea34bf2daeac2adae7"
Brad Bishop19323692019-04-05 15:28:33 -040015SRCREV_ipp = "32e315a5b106a7b89dbed51c28f8120a48b368b4"
16SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26"
17SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"
Brad Bishop19323692019-04-05 15:28:33 -040018
19def ipp_filename(d):
20 import re
21 arch = d.getVar('TARGET_ARCH')
22 if re.match("i.86$", arch):
23 return "ippicv_2019_lnx_ia32_general_20180723.tgz"
24 else:
25 return "ippicv_2019_lnx_intel64_general_20180723.tgz"
26
27def ipp_md5sum(d):
28 import re
29 arch = d.getVar('TARGET_ARCH')
30 if re.match("i.86$", arch):
31 return "4f38432c30bfd6423164b7a24bbc98a0"
32 else:
33 return "c0bd78adb4156bbf552c1dfe90599607"
34
35IPP_FILENAME = "${@ipp_filename(d)}"
36IPP_MD5 = "${@ipp_md5sum(d)}"
37
38SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg"
39SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \
Brad Bishop26bdd442019-08-16 17:08:17 -040040 git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib \
41 git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20180723;destsuffix=ipp;name=ipp \
42 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc \
43 git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg \
44 file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
45 file://0002-Make-opencv-ts-create-share-library-intead-of-static.patch \
46 file://0003-To-fix-errors-as-following.patch \
47 file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
48 file://0001-Dont-use-isystem.patch \
49 "
50PV = "4.1.0"
Brad Bishop19323692019-04-05 15:28:33 -040051
52S = "${WORKDIR}/git"
53
54do_unpack_extra() {
Brad Bishop19323692019-04-05 15:28:33 -040055 tar xzf ${WORKDIR}/ipp/ippicv/${IPP_FILENAME} -C ${WORKDIR}
56 cp ${WORKDIR}/vgg/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src
57 cp ${WORKDIR}/boostdesc/*.i ${WORKDIR}/contrib/modules/xfeatures2d/src
58}
59addtask unpack_extra after do_unpack before do_patch
60
61EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \
62 -DWITH_1394=OFF \
63 -DENABLE_PRECOMPILED_HEADERS=OFF \
64 -DCMAKE_SKIP_RPATH=ON \
65 -DOPENCV_ICV_HASH=${IPP_MD5} \
66 -DIPPROOT=${WORKDIR}/ippicv_lnx \
67 ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1", "", d)} \
68 ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1", "", d)} \
69 ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DENABLE_SSE=1 -DENABLE_SSE2=1 -DENABLE_SSE3=1 -DENABLE_SSSE3=1 -DENABLE_SSE41=1 -DENABLE_SSE42=1", "", d)} \
70"
71EXTRA_OECMAKE_append_x86 = " -DX86=ON"
72
73PACKAGECONFIG ??= "python3 eigen jpeg png tiff v4l libv4l gstreamer samples tbb gphoto2 \
74 ${@bb.utils.contains("DISTRO_FEATURES", "x11", "gtk", "", d)} \
75 ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libav", "", d)}"
76
77PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas,"
78PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft,"
79PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native,"
80PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog,"
81PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype,"
82PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2,"
83PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base,"
84PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3,"
85PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper,"
86PACKAGECONFIG[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 fastjar-native openjdk-8-native,"
87PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg,"
88PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav,"
89PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils,"
90PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/opencl-icd,"
91PACKAGECONFIG[oracle-java] = "-DJAVA_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_INCLUDE_PATH2=${ORACLE_JAVA_HOME}/include/linux -DJAVA_AWT_INCLUDE_PATH=${ORACLE_JAVA_HOME}/include -DJAVA_AWT_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/libjawt.so -DJAVA_JVM_LIBRARY=${ORACLE_JAVA_HOME}/lib/amd64/server/libjvm.so,,ant-native oracle-jse-jdk oracle-jse-jdk-native,"
92PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng,"
93PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy,"
94PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy,"
95PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,,"
96PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb,"
97PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract,"
98PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff,"
99PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils,"
100
101inherit pkgconfig cmake
102
103inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'distutils3-base', '', d)}
104inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)}
105
106export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}"
107export PYTHON="${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}"
108export ORACLE_JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java"
109export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native"
110export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/"
111
112TARGET_CC_ARCH += "-I${S}/include "
113
114PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'samples', '${PN}-samples', '', d)} \
115 ${@bb.utils.contains('PACKAGECONFIG', 'oracle-java', '${PN}-java', '', d)} \
116 ${@bb.utils.contains('PACKAGECONFIG', 'java', '${PN}-java', '', d)} \
117 ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'python-${BPN}', '', d)} \
118 ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3-${BPN}', '', d)} \
119 ${PN}-apps"
120
121python populate_packages_prepend () {
122 cv_libdir = d.expand('${libdir}')
123 do_split_packages(d, cv_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev', allow_links=True)
124 do_split_packages(d, cv_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
125 do_split_packages(d, cv_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'OpenCV %s development package', extra_depends='${PN}-dev')
126 do_split_packages(d, cv_libdir, '^lib(.*)\.so\.*', 'lib%s', 'OpenCV %s library', extra_depends='', allow_links=True)
127
128 pn = d.getVar('PN')
129 metapkg = pn + '-dev'
130 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
131 blacklist = [ metapkg ]
132 metapkg_rdepends = [ ]
133 packages = d.getVar('PACKAGES').split()
134 for pkg in packages[1:]:
135 if not pkg in blacklist and not pkg in metapkg_rdepends and pkg.endswith('-dev'):
136 metapkg_rdepends.append(pkg)
137 d.setVar('RRECOMMENDS_' + metapkg, ' '.join(metapkg_rdepends))
138
139 metapkg = pn
140 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
141 blacklist = [ metapkg, "libopencv-ts" ]
142 metapkg_rdepends = [ ]
143 for pkg in packages[1:]:
144 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') and not pkg.endswith('-locale') and not pkg.endswith('-staticdev'):
145 metapkg_rdepends.append(pkg)
146 d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
147}
148
149PACKAGES_DYNAMIC += "^libopencv-.*"
150
151FILES_${PN} = ""
152FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*"
Brad Bishop26bdd442019-08-16 17:08:17 -0400153FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${libdir}/cmake/opencv4/*.cmake"
154FILES_${PN}-staticdev += "${libdir}/opencv4/3rdparty/*.a"
155FILES_${PN}-apps = "${bindir}/* ${datadir}/opencv4 ${datadir}/licenses"
Brad Bishop19323692019-04-05 15:28:33 -0400156FILES_${PN}-java = "${datadir}/OpenCV/java"
Brad Bishop26bdd442019-08-16 17:08:17 -0400157FILES_${PN}-samples = "${datadir}/opencv4/samples/"
Brad Bishop19323692019-04-05 15:28:33 -0400158
159INSANE_SKIP_${PN}-java = "libdir"
160INSANE_SKIP_${PN}-dbg = "libdir"
161
162ALLOW_EMPTY_${PN} = "1"
163
164SUMMARY_python-opencv = "Python bindings to opencv"
165FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
166RDEPENDS_python-opencv = "python-core python-numpy"
167
168SUMMARY_python3-opencv = "Python bindings to opencv"
169FILES_python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*"
170RDEPENDS_python3-opencv = "python3-core python3-numpy"
171
Brad Bishopba6de432019-05-21 08:07:33 -0400172RDEPENDS_${PN}-apps = "bash"
Brad Bishop19323692019-04-05 15:28:33 -0400173
174do_install_append() {
Brad Bishop19323692019-04-05 15:28:33 -0400175 # Move Python files into correct library folder (for multilib build)
176 if [ "$libdir" != "/usr/lib" -a -d ${D}/usr/lib ]; then
177 mv ${D}/usr/lib/* ${D}/${libdir}/
178 rm -rf ${D}/usr/lib
179 fi
180}