From f8cd4f094a6ab185034d95a77201f87064c55d62 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 26 Jul 2019 10:43:54 -0700 Subject: [PATCH] opencv: Update to 4.1.1 Update Makefile to modern standards. Switched to local tarballs..xz archives are smaller. The .gz archive that codeload comes with is 85MB. Replaced PKG_INSTALL with CMAKE_INSTALL to get rid of Build/InstallDev. Added PKG_BUILD_PARALLEL for faster compilation. Removed inactive maintainer. Added uClibc-ng patches to fix compilation. Signed-off-by: Rosen Penev --- libs/opencv/Makefile | 37 +++++++++----------- libs/opencv/patches/010-fix-url.patch | 11 ------ libs/opencv/patches/010-uclibc-ng.patch | 46 +++++++++++++++++++++++++ libs/opencv/patches/020-l_tmpnam.patch | 13 +++++++ 4 files changed, 76 insertions(+), 31 deletions(-) delete mode 100644 libs/opencv/patches/010-fix-url.patch create mode 100644 libs/opencv/patches/010-uclibc-ng.patch create mode 100644 libs/opencv/patches/020-l_tmpnam.patch diff --git a/libs/opencv/Makefile b/libs/opencv/Makefile index b110787a2..79707f9ba 100644 --- a/libs/opencv/Makefile +++ b/libs/opencv/Makefile @@ -9,16 +9,23 @@ include $(TOPDIR)/rules.mk PKG_NAME:=opencv -PKG_VERSION:=3.1.0 -PKG_RELEASE:=3 +PKG_VERSION:=4.1.1 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip -PKG_SOURCE_URL:=http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$(PKG_VERSION)/ -PKG_HASH:=1f6990249fdb82804fff40e96fa6d99949023ab0e3277eae4bd459b374e622a4 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/opencv/opencv +PKG_SOURCE_VERSION:=$(PKG_VERSION) +PKG_MIRROR_HASH:=c8587820421d2f22acdafe4712d068ae490897dc445bdb4aa128ecaa8e65d3a1 +PKG_MAINTAINER:= PKG_LICENSE:=BSD-3-Clause PKG_LICENSE_FILES:=LICENSE +CMAKE_INSTALL:=1 +CMAKE_BINARY_SUBDIR:=build +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -35,14 +42,12 @@ define Package/opencv SECTION:=libs CATEGORY:=Libraries TITLE:=OpenCV - URL:=http://opencv.org/ - MAINTAINER:=WRTnode Team - DEPENDS:=+libpthread +librt +libstdcpp +zlib +libjpeg + URL:=https://opencv.org/ + DEPENDS:=+libpthread +librt +libatomic +libstdcpp +zlib +libjpeg endef -PKG_INSTALL:=1 - -CMAKE_OPTIONS += -DBUILD_opencv_gpu:BOOL=OFF \ +CMAKE_OPTIONS += \ + -DBUILD_opencv_gpu:BOOL=OFF \ -DWITH_1394:BOOL=OFF -DBUILD_opencv_stitching:BOOL=OFF \ -DBUILD_opencv_superres:BOOL=OFF -DBUILD_opencv_ts:BOOL=OFF \ -DBUILD_opencv_highgui:BOOL=OFF \ @@ -56,15 +61,7 @@ CMAKE_OPTIONS += -DBUILD_opencv_gpu:BOOL=OFF \ -DCMAKE_VERBOSE:BOOL=OFF \ -DENABLE_PRECOMPILED_HEADERS=OFF -define Build/InstallDev - $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/opencv $(1)/usr/include/ - $(CP) $(PKG_INSTALL_DIR)/usr/include/opencv2 $(1)/usr/include/ - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopencv* $(1)/usr/lib/ - $(INSTALL_DIR) $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/opencv.pc $(1)/usr/lib/pkgconfig/ -endef +TARGET_LDFLAGS += -latomic define Package/opencv/install $(INSTALL_DIR) $(1)/usr/lib diff --git a/libs/opencv/patches/010-fix-url.patch b/libs/opencv/patches/010-fix-url.patch deleted file mode 100644 index cad061b80..000000000 --- a/libs/opencv/patches/010-fix-url.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/3rdparty/ippicv/downloader.cmake -+++ b/3rdparty/ippicv/downloader.cmake -@@ -64,7 +64,7 @@ function(_icv_downloader) - if(DEFINED ENV{OPENCV_ICV_URL}) - set(OPENCV_ICV_URL $ENV{OPENCV_ICV_URL}) - else() -- set(OPENCV_ICV_URL "https://raw.githubusercontent.com/Itseez/opencv_3rdparty/${IPPICV_BINARIES_COMMIT}/ippicv") -+ set(OPENCV_ICV_URL "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_BINARIES_COMMIT}/ippicv") - endif() - endif() - diff --git a/libs/opencv/patches/010-uclibc-ng.patch b/libs/opencv/patches/010-uclibc-ng.patch new file mode 100644 index 000000000..52e9fd004 --- /dev/null +++ b/libs/opencv/patches/010-uclibc-ng.patch @@ -0,0 +1,46 @@ +--- a/modules/gapi/include/opencv2/gapi/core.hpp ++++ b/modules/gapi/include/opencv2/gapi/core.hpp +@@ -392,8 +392,8 @@ namespace core { + { + GAPI_Assert(fx != 0. && fy != 0.); + return in.withSize +- (Size(static_cast(std::round(in.size.width * fx)), +- static_cast(std::round(in.size.height * fy)))); ++ (Size(static_cast(round(in.size.width * fx)), ++ static_cast(round(in.size.height * fy)))); + } + } + }; +--- a/modules/gapi/include/opencv2/gapi/own/saturate.hpp ++++ b/modules/gapi/include/opencv2/gapi/own/saturate.hpp +@@ -81,8 +81,8 @@ static inline DST saturate(SRC x, R round) + // explicit suffix 'd' for double type + inline double ceild(double x) { return std::ceil(x); } + inline double floord(double x) { return std::floor(x); } +-inline double roundd(double x) { return std::round(x); } +-inline double rintd(double x) { return std::rint(x); } ++inline double roundd(double x) { return round(x); } ++inline double rintd(double x) { return rint(x); } + + } //namespace own + } //namespace gapi +--- a/modules/gapi/src/backends/fluid/gfluidcore.cpp ++++ b/modules/gapi/src/backends/fluid/gfluidcore.cpp +@@ -389,7 +389,7 @@ static void run_arithm_s1(uchar out[], const float in[], int width, const float + cv::util::suppress_unused_warning(v_op); + for (; w < width; w++) + { +- out[w] = saturate(s_op(in[w], scalar[0]), std::roundf); ++ out[w] = saturate(s_op(in[w], scalar[0]), roundf); + } + } + +@@ -1954,7 +1954,7 @@ GAPI_FLUID_KERNEL(GFluidCartToPolar, cv::gapi::core::GCartToPolar, false) + { + float x = in1[l]; + float y = in2[l]; +- float magnitude = std::hypot(y, x); ++ float magnitude = hypot(y, x); + float angle_rad = std::atan2(y, x); + float angle = angleInDegrees? + angle_rad * static_cast(180 / CV_PI): diff --git a/libs/opencv/patches/020-l_tmpnam.patch b/libs/opencv/patches/020-l_tmpnam.patch new file mode 100644 index 000000000..31a2bc286 --- /dev/null +++ b/libs/opencv/patches/020-l_tmpnam.patch @@ -0,0 +1,13 @@ +--- a/3rdparty/libjasper/jas_stream.c ++++ b/3rdparty/libjasper/jas_stream.c +@@ -86,6 +86,10 @@ + #include + #endif + ++#ifndef L_tmpnam ++#define L_tmpnam 20 ++#endif ++ + #include "jasper/jas_types.h" + #include "jasper/jas_stream.h" + #include "jasper/jas_malloc.h"