Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | SUMMARY = "Opencv : The Open Computer Vision Library" |
| 2 | HOMEPAGE = "http://opencv.org/" |
| 3 | SECTION = "libs" |
| 4 | |
| 5 | LICENSE = "BSD-3-Clause" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 6 | LIC_FILES_CHKSUM = "file://LICENSE;md5=6450921bb12a3133c8f5cb2a80343710" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | |
| 8 | ARM_INSTRUCTION_SET_armv4 = "arm" |
| 9 | ARM_INSTRUCTION_SET_armv5 = "arm" |
| 10 | |
| 11 | DEPENDS = "libtool swig-native bzip2 zlib glib-2.0 libwebp" |
| 12 | |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 13 | SRCREV_opencv = "371bba8f54560b374fbcd47e7e02f015ac4969ad" |
| 14 | SRCREV_contrib = "2c32791a9c500343568a21ea34bf2daeac2adae7" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 15 | SRCREV_ipp = "32e315a5b106a7b89dbed51c28f8120a48b368b4" |
| 16 | SRCREV_boostdesc = "34e4206aef44d50e6bbcd0ab06354b52e7466d26" |
| 17 | SRCREV_vgg = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 18 | |
| 19 | def 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 | |
| 27 | def 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 | |
| 35 | IPP_FILENAME = "${@ipp_filename(d)}" |
| 36 | IPP_MD5 = "${@ipp_md5sum(d)}" |
| 37 | |
| 38 | SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg" |
| 39 | SRC_URI = "git://github.com/opencv/opencv.git;name=opencv \ |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 40 | 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 | " |
| 50 | PV = "4.1.0" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 51 | |
| 52 | S = "${WORKDIR}/git" |
| 53 | |
| 54 | do_unpack_extra() { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 55 | 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 | } |
| 59 | addtask unpack_extra after do_unpack before do_patch |
| 60 | |
| 61 | EXTRA_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 | " |
| 71 | EXTRA_OECMAKE_append_x86 = " -DX86=ON" |
| 72 | |
| 73 | PACKAGECONFIG ??= "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 | |
| 77 | PACKAGECONFIG[amdblas] = "-DWITH_OPENCLAMDBLAS=ON,-DWITH_OPENCLAMDBLAS=OFF,libclamdblas," |
| 78 | PACKAGECONFIG[amdfft] = "-DWITH_OPENCLAMDFFT=ON,-DWITH_OPENCLAMDFFT=OFF,libclamdfft," |
| 79 | PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON -DBUILD_PROTOBUF=OFF,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native," |
| 80 | PACKAGECONFIG[eigen] = "-DWITH_EIGEN=ON,-DWITH_EIGEN=OFF,libeigen gflags glog," |
| 81 | PACKAGECONFIG[freetype] = "-DBUILD_opencv_freetype=ON,-DBUILD_opencv_freetype=OFF,freetype," |
| 82 | PACKAGECONFIG[gphoto2] = "-DWITH_GPHOTO2=ON,-DWITH_GPHOTO2=OFF,libgphoto2," |
| 83 | PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER=ON,-DWITH_GSTREAMER=OFF,gstreamer1.0 gstreamer1.0-plugins-base," |
| 84 | PACKAGECONFIG[gtk] = "-DWITH_GTK=ON,-DWITH_GTK=OFF,gtk+3," |
| 85 | PACKAGECONFIG[jasper] = "-DWITH_JASPER=ON,-DWITH_JASPER=OFF,jasper," |
| 86 | PACKAGECONFIG[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," |
| 87 | PACKAGECONFIG[jpeg] = "-DWITH_JPEG=ON,-DWITH_JPEG=OFF,jpeg," |
| 88 | PACKAGECONFIG[libav] = "-DWITH_FFMPEG=ON,-DWITH_FFMPEG=OFF,libav," |
| 89 | PACKAGECONFIG[libv4l] = "-DWITH_LIBV4L=ON,-DWITH_LIBV4L=OFF,v4l-utils," |
| 90 | PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,opencl-headers virtual/opencl-icd," |
| 91 | PACKAGECONFIG[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," |
| 92 | PACKAGECONFIG[png] = "-DWITH_PNG=ON,-DWITH_PNG=OFF,libpng," |
| 93 | PACKAGECONFIG[python2] = "-DPYTHON2_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python-numpy," |
| 94 | PACKAGECONFIG[python3] = "-DPYTHON3_NUMPY_INCLUDE_DIRS:PATH=${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/numpy/core/include,,python3-numpy," |
| 95 | PACKAGECONFIG[samples] = "-DBUILD_EXAMPLES=ON -DINSTALL_PYTHON_EXAMPLES=ON,-DBUILD_EXAMPLES=OFF,," |
| 96 | PACKAGECONFIG[tbb] = "-DWITH_TBB=ON,-DWITH_TBB=OFF,tbb," |
| 97 | PACKAGECONFIG[text] = "-DBUILD_opencv_text=ON,-DBUILD_opencv_text=OFF,tesseract," |
| 98 | PACKAGECONFIG[tiff] = "-DWITH_TIFF=ON,-DWITH_TIFF=OFF,tiff," |
| 99 | PACKAGECONFIG[v4l] = "-DWITH_V4L=ON,-DWITH_V4L=OFF,v4l-utils," |
| 100 | |
| 101 | inherit pkgconfig cmake |
| 102 | |
| 103 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python3', 'distutils3-base', '', d)} |
| 104 | inherit ${@bb.utils.contains('PACKAGECONFIG', 'python2', 'distutils-base', '', d)} |
| 105 | |
| 106 | export PYTHON_CSPEC="-I${STAGING_INCDIR}/${PYTHON_DIR}" |
| 107 | export PYTHON="${STAGING_BINDIR_NATIVE}/${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3', 'python', d)}" |
| 108 | export ORACLE_JAVA_HOME="${STAGING_DIR_NATIVE}/usr/bin/java" |
| 109 | export JAVA_HOME="${STAGING_DIR_NATIVE}/usr/lib/jvm/openjdk-8-native" |
| 110 | export ANT_DIR="${STAGING_DIR_NATIVE}/usr/share/ant/" |
| 111 | |
| 112 | TARGET_CC_ARCH += "-I${S}/include " |
| 113 | |
| 114 | PACKAGES += "${@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 | |
| 121 | python 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 | |
| 149 | PACKAGES_DYNAMIC += "^libopencv-.*" |
| 150 | |
| 151 | FILES_${PN} = "" |
| 152 | FILES_${PN}-dbg += "${datadir}/OpenCV/java/.debug/* ${datadir}/OpenCV/samples/bin/.debug/*" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 153 | FILES_${PN}-dev = "${includedir} ${libdir}/pkgconfig ${libdir}/cmake/opencv4/*.cmake" |
| 154 | FILES_${PN}-staticdev += "${libdir}/opencv4/3rdparty/*.a" |
| 155 | FILES_${PN}-apps = "${bindir}/* ${datadir}/opencv4 ${datadir}/licenses" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 156 | FILES_${PN}-java = "${datadir}/OpenCV/java" |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 157 | FILES_${PN}-samples = "${datadir}/opencv4/samples/" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 158 | |
| 159 | INSANE_SKIP_${PN}-java = "libdir" |
| 160 | INSANE_SKIP_${PN}-dbg = "libdir" |
| 161 | |
| 162 | ALLOW_EMPTY_${PN} = "1" |
| 163 | |
| 164 | SUMMARY_python-opencv = "Python bindings to opencv" |
| 165 | FILES_python-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" |
| 166 | RDEPENDS_python-opencv = "python-core python-numpy" |
| 167 | |
| 168 | SUMMARY_python3-opencv = "Python bindings to opencv" |
| 169 | FILES_python3-opencv = "${PYTHON_SITEPACKAGES_DIR}/*" |
| 170 | RDEPENDS_python3-opencv = "python3-core python3-numpy" |
| 171 | |
Brad Bishop | ba6de43 | 2019-05-21 08:07:33 -0400 | [diff] [blame] | 172 | RDEPENDS_${PN}-apps = "bash" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 173 | |
| 174 | do_install_append() { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 175 | # 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 | } |