opencv4: 4.7.0 -> 4.9.0

https://github.com/opencv/opencv/wiki/ChangeLog#version490

+119 -83
+119 -83
pkgs/development/libraries/opencv/4.x.nix
··· 2 , stdenv 3 , fetchurl 4 , fetchFromGitHub 5 - , fetchpatch 6 , cmake 7 , pkg-config 8 , unzip 9 , zlib 10 - , pcre 11 , hdf5 12 , boost 13 , gflags 14 , protobuf_21 15 , config ··· 35 , eigen 36 , enableBlas ? true 37 , blas 38 , enableContrib ? true 39 40 , enableCuda ? config.cudaSupport ··· 58 , enableFfmpeg ? true 59 , ffmpeg 60 , enableGStreamer ? true 61 , gst_all_1 62 , enableTesseract ? false 63 , tesseract 64 , leptonica ··· 85 }@inputs: 86 87 let 88 - version = "4.7.0"; 89 90 # It's necessary to consistently use backendStdenv when building with CUDA 91 # support, otherwise we get libstdc++ errors downstream ··· 96 owner = "opencv"; 97 repo = "opencv"; 98 rev = version; 99 - sha256 = "sha256-jUeGsu8+jzzCnIFbVMCW8DcUeGv/t1yCY/WXyW+uGDI="; 100 }; 101 102 contribSrc = fetchFromGitHub { 103 owner = "opencv"; 104 repo = "opencv_contrib"; 105 rev = version; 106 - sha256 = "sha256-meya0J3RdOIeMM46e/6IOVwrKn3t/c0rhwP2WQaybkE="; 107 }; 108 109 testDataSrc = fetchFromGitHub { 110 owner = "opencv"; 111 repo = "opencv_extra"; 112 rev = version; 113 - sha256 = "sha256-6hAdJdaUgtRGQanQKuY/q6fcXWXFZ3K/oLbGxvksry0="; 114 }; 115 116 # Contrib must be built in order to enable Tesseract support: ··· 121 src = fetchFromGitHub { 122 owner = "opencv"; 123 repo = "opencv_3rdparty"; 124 - rev = "a56b6ac6f030c312b2dce17430eef13aed9af274"; 125 - sha256 = "1msbkc3zixx61rcg6a04i1bcfhw1phgsrh93glq1n80hgsk3nbjq"; 126 } + "/ippicv"; 127 - files = let name = platform: "ippicv_2019_${platform}_general_20180723.tgz"; in 128 if effectiveStdenv.hostPlatform.system == "x86_64-linux" then 129 - { ${name "lnx_intel64"} = "c0bd78adb4156bbf552c1dfe90599607"; } 130 else if effectiveStdenv.hostPlatform.system == "i686-linux" then 131 - { ${name "lnx_ia32"} = "4f38432c30bfd6423164b7a24bbc98a0"; } 132 else if effectiveStdenv.hostPlatform.system == "x86_64-darwin" then 133 - { ${name "mac_intel64"} = "fe6b2bb75ae0e3f19ad3ae1a31dfa4a2"; } 134 else 135 throw "ICV is not available for this platform (or not yet supported by this package)"; 136 dst = ".cache/ippicv"; ··· 142 owner = "opencv"; 143 repo = "opencv_3rdparty"; 144 rev = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"; 145 - sha256 = "0r9fam8dplyqqsd3qgpnnfgf9l7lj44di19rxwbm8mxiw0rlcdvy"; 146 }; 147 files = { 148 "vgg_generated_48.i" = "e8d0dcd54d1bcfdc29203d011a797179"; ··· 179 owner = "opencv"; 180 repo = "opencv_3rdparty"; 181 rev = "8afa57abc8229d611c4937165d20e2a2d9fc5a12"; 182 - sha256 = "061lsvqdidq9xa2hwrcvwi9ixflr2c2lfpc8drr159g68zi8bp4v"; 183 }; 184 files = { 185 "face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05"; ··· 191 ade = rec { 192 src = fetchurl { 193 url = "https://github.com/opencv/ade/archive/${name}"; 194 - sha256 = "sha256-TjLRbFbC7MDY9PxIy560ryviBI58cbQwqgc7A7uOHkg="; 195 }; 196 - name = "v0.1.2a.zip"; 197 - md5 = "fa4b3e25167319cb0fa9432ef8281945"; 198 dst = ".cache/ade"; 199 }; 200 ··· 204 owner = "opencv"; 205 repo = "opencv_3rdparty"; 206 rev = "a8b69ccc738421293254aec5ddb38bd523503252"; 207 - sha256 = "sha256-/n6zHwf0Rdc4v9o4rmETzow/HTv+81DnHP+nL56XiTY="; 208 }; 209 files = { 210 "detect.caffemodel" = "238e2b2d6f3c18d6c3a30de0c31e23cf"; ··· 260 patches = [ 261 ./cmake-don-t-use-OpenCVFindOpenEXR.patch 262 ] ++ lib.optionals enableContrib [ 263 - (fetchpatch { 264 - name = "CVE-2023-2617.patch"; 265 - url = "https://github.com/opencv/opencv_contrib/commit/ccc277247ac1a7aef0a90353edcdec35fbc5903c.patch"; 266 - stripLen = 2; 267 - extraPrefix = [ "opencv_contrib/" ]; 268 - sha256 = "sha256-drZ+DVn+Pk4zAZJ+LgX5u3Tz7MU0AEI/73EVvxDP3AU="; 269 - }) 270 - (fetchpatch { 271 - name = "CVE-2023-2618.patch"; 272 - url = "https://github.com/opencv/opencv_contrib/commit/ec406fa4748fb4b0630c1b986469e7918d5e8953.patch"; 273 - stripLen = 2; 274 - extraPrefix = [ "opencv_contrib/" ]; 275 - sha256 = "sha256-cB5Tsh2fDOsc0BNtSzd6U/QoCjkd9yMW1QutUU69JJ0="; 276 - }) 277 ] ++ lib.optional enableCuda ./cuda_opt_flow.patch; 278 279 # This prevents cmake from using libraries in impure paths (which ··· 300 echo '"(build info elided)"' > modules/core/version_string.inc 301 ''; 302 303 - buildInputs = [ zlib pcre boost gflags protobuf_21 ] 304 - ++ lib.optional enablePython pythonPackages.python 305 - ++ lib.optional (effectiveStdenv.buildPlatform == effectiveStdenv.hostPlatform) hdf5 306 - ++ lib.optional enableGtk2 gtk2 307 - ++ lib.optional enableGtk3 gtk3 308 - ++ lib.optional enableVtk vtk 309 - ++ lib.optional enableJPEG libjpeg 310 - ++ lib.optional enablePNG libpng 311 - ++ lib.optional enableTIFF libtiff 312 - ++ lib.optional enableWebP libwebp 313 - ++ lib.optionals enableEXR [ openexr ilmbase ] 314 - ++ lib.optional enableJPEG2000 openjpeg 315 - ++ lib.optional enableFfmpeg ffmpeg 316 - ++ lib.optionals (enableFfmpeg && effectiveStdenv.isDarwin) 317 - [ VideoDecodeAcceleration bzip2 ] 318 - ++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base gst-plugins-good ]) 319 - ++ lib.optional enableOvis ogre 320 - ++ lib.optional enableGPhoto2 libgphoto2 321 - ++ lib.optional enableDC1394 libdc1394 322 - ++ lib.optional enableEigen eigen 323 - ++ lib.optional enableBlas blas.provider 324 # There is seemingly no compile-time flag for Tesseract. It's 325 # simply enabled automatically if contrib is built, and it detects 326 # tesseract & leptonica. 327 - ++ lib.optionals enableTesseract [ tesseract leptonica ] 328 - ++ lib.optional enableTbb tbb 329 - ++ lib.optionals effectiveStdenv.isDarwin [ 330 - bzip2 AVFoundation Cocoa VideoDecodeAcceleration CoreMedia MediaToolbox Accelerate 331 - ] 332 - ++ lib.optionals enableDocs [ doxygen graphviz-nox ] 333 - ++ lib.optionals enableCuda (with cudaPackages; [ 334 - cuda_cudart.lib 335 - cuda_cudart.dev 336 - cuda_cccl.dev # <thrust/*> 337 - libnpp.dev # npp.h 338 - libnpp.lib 339 - libnpp.static 340 - nvidia-optical-flow-sdk 341 - ] ++ lib.optionals enableCublas [ 342 - # May start using the default $out instead once 343 - # https://github.com/NixOS/nixpkgs/issues/271792 344 - # has been addressed 345 - libcublas.static 346 - libcublas.lib 347 - libcublas.dev # cublas_v2.h 348 - ] ++ lib.optionals enableCudnn [ 349 - cudnn.dev # cudnn.h 350 - cudnn.lib 351 - cudnn.static 352 - ] ++ lib.optionals enableCufft [ 353 - libcufft.dev # cufft.h 354 - libcufft.lib 355 - libcufft.static 356 - ]); 357 358 propagatedBuildInputs = lib.optionals enablePython [ pythonPackages.numpy ]; 359
··· 2 , stdenv 3 , fetchurl 4 , fetchFromGitHub 5 , cmake 6 , pkg-config 7 , unzip 8 , zlib 9 + , pcre2 10 , hdf5 11 , boost 12 + , glib 13 , gflags 14 , protobuf_21 15 , config ··· 35 , eigen 36 , enableBlas ? true 37 , blas 38 + , enableVA ? !stdenv.isDarwin 39 + , libva 40 , enableContrib ? true 41 42 , enableCuda ? config.cudaSupport ··· 60 , enableFfmpeg ? true 61 , ffmpeg 62 , enableGStreamer ? true 63 + , elfutils 64 , gst_all_1 65 + , orc 66 + , libunwind 67 + , zstd 68 , enableTesseract ? false 69 , tesseract 70 , leptonica ··· 91 }@inputs: 92 93 let 94 + version = "4.9.0"; 95 96 # It's necessary to consistently use backendStdenv when building with CUDA 97 # support, otherwise we get libstdc++ errors downstream ··· 102 owner = "opencv"; 103 repo = "opencv"; 104 rev = version; 105 + hash = "sha256-3qqu4xlRyMbPKHHTIT+iRRGtpFlcv0NU8GNZpgjdi6k="; 106 }; 107 108 contribSrc = fetchFromGitHub { 109 owner = "opencv"; 110 repo = "opencv_contrib"; 111 rev = version; 112 + hash = "sha256-K74Ghk4uDqj4OWEzDxT2R3ERi+jkAWZszzezRenfuZ8="; 113 }; 114 115 testDataSrc = fetchFromGitHub { 116 owner = "opencv"; 117 repo = "opencv_extra"; 118 rev = version; 119 + hash = "sha256-pActKi7aN5EOZq2Fpf5mALnZq71c037/R3Q6wJ4uCfQ="; 120 }; 121 122 # Contrib must be built in order to enable Tesseract support: ··· 127 src = fetchFromGitHub { 128 owner = "opencv"; 129 repo = "opencv_3rdparty"; 130 + rev = "0cc4aa06bf2bef4b05d237c69a5a96b9cd0cb85a"; 131 + hash = "sha256-/kHivOgCkY9YdcRRaVgytXal3ChE9xFfGAB0CfFO5ec="; 132 } + "/ippicv"; 133 + files = let name = platform: "ippicv_2021.10.0_${platform}_20230919_general.tgz"; in 134 if effectiveStdenv.hostPlatform.system == "x86_64-linux" then 135 + { ${name "lnx_intel64"} = "606a19b207ebedfe42d59fd916cc4850"; } 136 else if effectiveStdenv.hostPlatform.system == "i686-linux" then 137 + { ${name "lnx_ia32"} = "ea08487b810baad2f68aca87b74a2db9"; } 138 else if effectiveStdenv.hostPlatform.system == "x86_64-darwin" then 139 + { ${name "mac_intel64"} = "14f01c5a4780bfae9dde9b0aaf5e56fc"; } 140 else 141 throw "ICV is not available for this platform (or not yet supported by this package)"; 142 dst = ".cache/ippicv"; ··· 148 owner = "opencv"; 149 repo = "opencv_3rdparty"; 150 rev = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d"; 151 + hash = "sha256-fjdGM+CxV1QX7zmF2AiR9NDknrP2PjyaxtjT21BVLmU="; 152 }; 153 files = { 154 "vgg_generated_48.i" = "e8d0dcd54d1bcfdc29203d011a797179"; ··· 185 owner = "opencv"; 186 repo = "opencv_3rdparty"; 187 rev = "8afa57abc8229d611c4937165d20e2a2d9fc5a12"; 188 + hash = "sha256-m9yF4kfmpRJybohdRwUTmboeU+SbZQ6F6gm32PDWNBg="; 189 }; 190 files = { 191 "face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05"; ··· 197 ade = rec { 198 src = fetchurl { 199 url = "https://github.com/opencv/ade/archive/${name}"; 200 + hash = "sha256-WG/GudVpkO10kOJhoKXFMj672kggvyRYCIpezal3wcE="; 201 }; 202 + name = "v0.1.2d.zip"; 203 + md5 = "dbb095a8bf3008e91edbbf45d8d34885"; 204 dst = ".cache/ade"; 205 }; 206 ··· 210 owner = "opencv"; 211 repo = "opencv_3rdparty"; 212 rev = "a8b69ccc738421293254aec5ddb38bd523503252"; 213 + hash = "sha256-/n6zHwf0Rdc4v9o4rmETzow/HTv+81DnHP+nL56XiTY="; 214 }; 215 files = { 216 "detect.caffemodel" = "238e2b2d6f3c18d6c3a30de0c31e23cf"; ··· 266 patches = [ 267 ./cmake-don-t-use-OpenCVFindOpenEXR.patch 268 ] ++ lib.optionals enableContrib [ 269 ] ++ lib.optional enableCuda ./cuda_opt_flow.patch; 270 271 # This prevents cmake from using libraries in impure paths (which ··· 292 echo '"(build info elided)"' > modules/core/version_string.inc 293 ''; 294 295 + buildInputs = [ 296 + boost 297 + gflags 298 + glib 299 + pcre2 300 + protobuf_21 301 + zlib 302 + ] ++ lib.optionals enablePython [ 303 + pythonPackages.python 304 + ] ++ lib.optionals (effectiveStdenv.buildPlatform == effectiveStdenv.hostPlatform) [ 305 + hdf5 306 + ] ++ lib.optionals enableGtk2 [ 307 + gtk2 308 + ] ++ lib.optionals enableGtk3 [ 309 + gtk3 310 + ] ++ lib.optionals enableVtk [ 311 + vtk 312 + ] ++ lib.optionals enableJPEG [ 313 + libjpeg 314 + ] ++ lib.optionals enablePNG [ 315 + libpng 316 + ] ++ lib.optionals enableTIFF [ 317 + libtiff 318 + ] ++ lib.optionals enableWebP [ 319 + libwebp 320 + ] ++ lib.optionals enableEXR [ 321 + openexr 322 + ilmbase 323 + ] ++ lib.optionals enableJPEG2000 [ 324 + openjpeg 325 + ] ++ lib.optionals enableFfmpeg [ 326 + ffmpeg 327 + ] ++ lib.optionals (enableFfmpeg && effectiveStdenv.isDarwin) [ 328 + bzip2 329 + VideoDecodeAcceleration 330 + ] ++ lib.optionals (enableGStreamer && effectiveStdenv.isLinux) (with gst_all_1; [ 331 + elfutils 332 + gst-plugins-base 333 + gst-plugins-good 334 + gstreamer 335 + libunwind 336 + orc 337 + zstd 338 + ]) ++ lib.optionals enableOvis [ 339 + ogre 340 + ] ++ lib.optionals enableGPhoto2 [ 341 + libgphoto2 342 + ] ++ lib.optionals enableDC1394 [ 343 + libdc1394 344 + ] ++ lib.optionals enableEigen [ 345 + eigen 346 + ] ++ lib.optionals enableVA [ 347 + libva 348 + ] ++ lib.optionals enableBlas [ 349 + blas.provider 350 + ] ++ lib.optionals enableTesseract [ 351 # There is seemingly no compile-time flag for Tesseract. It's 352 # simply enabled automatically if contrib is built, and it detects 353 # tesseract & leptonica. 354 + tesseract 355 + leptonica 356 + ] ++ lib.optionals enableTbb [ 357 + tbb 358 + ] ++ lib.optionals effectiveStdenv.isDarwin [ 359 + bzip2 360 + AVFoundation 361 + Cocoa 362 + VideoDecodeAcceleration 363 + CoreMedia 364 + MediaToolbox 365 + Accelerate 366 + ] ++ lib.optionals enableDocs [ 367 + doxygen 368 + graphviz-nox 369 + ] ++ lib.optionals enableCuda (with cudaPackages; [ 370 + cuda_cudart.lib 371 + cuda_cudart.dev 372 + cuda_cccl.dev # <thrust/*> 373 + libnpp.dev # npp.h 374 + libnpp.lib 375 + libnpp.static 376 + nvidia-optical-flow-sdk 377 + ] ++ lib.optionals enableCublas [ 378 + # May start using the default $out instead once 379 + # https://github.com/NixOS/nixpkgs/issues/271792 380 + # has been addressed 381 + libcublas.static 382 + libcublas.lib 383 + libcublas.dev # cublas_v2.h 384 + ] ++ lib.optionals enableCudnn [ 385 + cudnn.dev # cudnn.h 386 + cudnn.lib 387 + cudnn.static 388 + ] ++ lib.optionals enableCufft [ 389 + libcufft.dev # cufft.h 390 + libcufft.lib 391 + libcufft.static 392 + ]); 393 394 propagatedBuildInputs = lib.optionals enablePython [ pythonPackages.numpy ]; 395