3
0
Fork 0
forked from mirrors/nixpkgs

opencv-4: 4.3.0 -> 4.5.2

- Updated to 4.5.2
- Removed glog from buildInputs because of this error on python-opencv:
```
python -c "import cv2"
/nix/store/slfzk1gk74nfx3ky2vpdf9nb7b8nvdf2-opencv-4.5.2/lib/libopencv_sfm.so.4.5: error: symbol lookup error: undefined symbol: _ZN6google21kLogSiteUninitializedE (fatal)
```
- Enabled ffmpeg and gstreamer to open more video formats
- nixpkg-fmt
This commit is contained in:
Thiago Franco de Moraes 2021-04-11 19:01:59 -03:00
parent e23957211c
commit cab40572d7
No known key found for this signature in database
GPG key ID: 1B96996EE6559B7A
2 changed files with 135 additions and 107 deletions

View file

@ -1,54 +1,91 @@
{ lib, stdenv
, fetchurl, fetchFromGitHub, fetchpatch
, cmake, pkg-config, unzip, zlib, pcre, hdf5
, glog, boost, gflags, protobuf
{ lib
, stdenv
, fetchurl
, fetchFromGitHub
, cmake
, pkg-config
, unzip
, zlib
, pcre
, hdf5
, boost
, gflags
, protobuf
, config
, enableJPEG ? true, libjpeg
, enablePNG ? true, libpng
, enableTIFF ? true, libtiff
, enableWebP ? true, libwebp
, enableEXR ? !stdenv.isDarwin, openexr, ilmbase
, enableEigen ? true, eigen
, enableOpenblas ? true, openblas, blas, lapack
, enableJPEG ? true
, libjpeg
, enablePNG ? true
, libpng
, enableTIFF ? true
, libtiff
, enableWebP ? true
, libwebp
, enableEXR ? !stdenv.isDarwin
, openexr
, ilmbase
, enableEigen ? true
, eigen
, enableOpenblas ? true
, openblas
, enableContrib ? true
, enableCuda ? (config.cudaSupport or false) &&
stdenv.hostPlatform.isx86_64, cudatoolkit, nvidia-optical-flow-sdk
, enableCuda ? (config.cudaSupport or false) && stdenv.hostPlatform.isx86_64
, cudatoolkit
, nvidia-optical-flow-sdk
, enableUnfree ? false
, enableIpp ? false
, enablePython ? false, pythonPackages
, enableGtk2 ? false, gtk2
, enableGtk3 ? false, gtk3
, enableVtk ? false, vtk
, enableFfmpeg ? false, ffmpeg_3
, enableGStreamer ? false, gst_all_1
, enableTesseract ? false, tesseract, leptonica
, enableTbb ? false, tbb
, enableOvis ? false, ogre
, enableGPhoto2 ? false, libgphoto2
, enableDC1394 ? false, libdc1394
, enableDocs ? false, doxygen, graphviz-nox
, enablePython ? false
, pythonPackages
, enableGtk2 ? false
, gtk2
, enableGtk3 ? false
, gtk3
, enableVtk ? false
, vtk
, enableFfmpeg ? true
, ffmpeg_3
, enableGStreamer ? true
, gst_all_1
, enableTesseract ? false
, tesseract
, leptonica
, enableTbb ? false
, tbb
, enableOvis ? false
, ogre
, enableGPhoto2 ? false
, libgphoto2
, enableDC1394 ? false
, libdc1394
, enableDocs ? false
, doxygen
, graphviz-nox
, AVFoundation, Cocoa, VideoDecodeAcceleration, CoreMedia, MediaToolbox, bzip2
, AVFoundation
, Cocoa
, VideoDecodeAcceleration
, CoreMedia
, MediaToolbox
, bzip2
}:
let
version = "4.3.0";
version = "4.5.2";
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv";
rev = version;
sha256 = "1r9bq9p1x99g2y8jvj9428sgqvljz75dm5vrfsma7hh5wjhz9775";
sha256 = "sha256-pxi1VBF4txvRqspdqvCsAQ3XKzl633/o3wyOgD9wid4=";
};
contribSrc = fetchFromGitHub {
owner = "opencv";
repo = "opencv_contrib";
rev = version;
sha256 = "068b4f95rlryab3mffxs2w6dnbmbhrnpsdgl007rxk4bwnz29y49";
sha256 = "sha256-iMenRTY+qeL7WRgnRuQbsHflYDakE7pWWSHeIjrg0Iw=";
};
# Contrib must be built in order to enable Tesseract support:
@ -136,6 +173,23 @@ let
dst = ".cache/ade";
};
# See opencv/modules/wechat_qrcode/CMakeLists.txt
wechat_qrcode = {
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv_3rdparty";
rev = "a8b69ccc738421293254aec5ddb38bd523503252";
sha256 = "sha256-/n6zHwf0Rdc4v9o4rmETzow/HTv+81DnHP+nL56XiTY=";
};
files = {
"detect.caffemodel" = "238e2b2d6f3c18d6c3a30de0c31e23cf";
"detect.prototxt" = "6fb4976b32695f9f5c6305c19f12537d";
"sr.caffemodel" = "cbfcd60361a73beb8c583eea7e8e6664";
"sr.prototxt" = "69db99927a70df953b471daaba03fbef";
};
dst = ".cache/wechat_qrcode";
};
# See opencv/cmake/OpenCVDownload.cmake
installExtraFiles = extra: with lib; ''
mkdir -p "${extra.dst}"
@ -178,7 +232,9 @@ stdenv.mkDerivation {
${installExtraFiles vgg}
${installExtraFiles boostdesc}
${installExtraFiles face}
'');
${installExtraFiles wechat_qrcode}
''
);
postConfigure = ''
[ -e modules/core/version_string.inc ]
@ -186,7 +242,7 @@ stdenv.mkDerivation {
'';
buildInputs =
[ zlib pcre hdf5 glog boost gflags protobuf ]
[ zlib pcre hdf5 boost gflags protobuf ]
++ lib.optional enablePython pythonPackages.python
++ lib.optional enableGtk2 gtk2
++ lib.optional enableGtk3 gtk3
@ -274,8 +330,6 @@ stdenv.mkDerivation {
"$out/lib/pkgconfig/opencv4.pc"
'';
hardeningDisable = [ "bindnow" "relro" ];
passthru = lib.optionalAttrs enablePython { pythonPath = [ ]; };
meta = with lib; {

View file

@ -1,40 +1,17 @@
From 6d988c08e852379a163ecd20df8639196d84d014 Mon Sep 17 00:00:00 2001
From: Bernardo Meurer <meurerbernardo@gmail.com>
Date: Sun, 26 Apr 2020 14:50:25 -0700
Subject: [PATCH] cmake: don't use OpenCVFindOpenEXR
Use find_package for this.
---
CMakeLists.txt | 2 ++
cmake/OpenCVFindLibsGrfmt.cmake | 15 +++------------
2 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c0b3880fc..0360469350 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,8 @@ FATAL: In-source builds are not allowed.
")
endif()
+# the future!
+include(FindPkgConfig)
include(cmake/OpenCVMinDepVersions.cmake)
diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake
index 0beaf19317..4c5e46e615 100644
index 23a6ca6959..27e121943a 100644
--- a/cmake/OpenCVFindLibsGrfmt.cmake
+++ b/cmake/OpenCVFindLibsGrfmt.cmake
@@ -227,20 +227,11 @@ endif()
@@ -255,21 +255,12 @@ endif()
# --- OpenEXR (optional) ---
if(WITH_OPENEXR)
ocv_clear_vars(HAVE_OPENEXR)
- if(NOT BUILD_OPENEXR)
- ocv_clear_internal_cache_vars(OPENEXR_INCLUDE_PATHS OPENEXR_LIBRARIES OPENEXR_ILMIMF_LIBRARY OPENEXR_VERSION)
- include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenEXR.cmake")
- endif()
-
+ pkg_check_modules(OPENEXR OpenEXR)
if(OPENEXR_FOUND)
set(HAVE_OPENEXR YES)
- else()
@ -50,6 +27,3 @@ index 0beaf19317..4c5e46e615 100644
endif()
endif()
--
2.26.1