opencv: 3.4.1 -> 3.4.2

+31 -30
+18 -30
pkgs/development/libraries/opencv/3.x.nix
··· 35 }: 36 37 let 38 - version = "3.4.1"; 39 40 src = fetchFromGitHub { 41 owner = "opencv"; 42 repo = "opencv"; 43 rev = version; 44 - sha256 = "08yahgf427d2qbs2mw02xww6bv5yjkfc1hihihh7fhqgfz0jnj1h"; 45 }; 46 47 contribSrc = fetchFromGitHub { 48 owner = "opencv"; 49 repo = "opencv_contrib"; 50 rev = version; 51 - sha256 = "00x1x53qv2pnc7i56244b5nf44wm2mp77hj486i5697r6hikk8n3"; 52 }; 53 54 # Contrib must be built in order to enable Tesseract support: ··· 59 src = fetchFromGitHub { 60 owner = "opencv"; 61 repo = "opencv_3rdparty"; 62 - rev = "dfe3162c237af211e98b8960018b564bc209261d"; 63 - sha256 = "1k5xiwdi5r2y3fs5g70lpknxqi4pj32w6l311gfwng3q1cb2crif"; 64 } + "/ippicv"; 65 - files = let name = platform : "ippicv_2017u3_${platform}_general_20170822.tgz"; in 66 if stdenv.system == "x86_64-linux" then 67 - { ${name "lnx_intel64"} = "4e0352ce96473837b1d671ce87f17359"; } 68 else if stdenv.system == "i686-linux" then 69 - { ${name "lnx_ia32"} = "dcdb0ba4b123f240596db1840cd59a76"; } 70 else if stdenv.system == "x86_64-darwin" then 71 - { ${name "mac_intel64"} = "c1ebb5dfa5b7f54b0c44e1917805a463"; } 72 else 73 throw "ICV is not available for this platform (or not yet supported by this package)"; 74 dst = ".cache/ippicv"; ··· 132 ln -s "${extra.src}/${name}" "${extra.dst}/${md5}-${name}" 133 '') extra.files); 134 135 - # See opencv_contrib/modules/dnn_modern/CMakeLists.txt 136 - tinyDnn = rec { 137 - src = fetchurl { 138 - url = "https://github.com/tiny-dnn/tiny-dnn/archive/${name}"; 139 - sha256 = "12x1b984cn0psn6kz1fy75zljgzqvkdyjy8i292adfnyqpl1rip2"; 140 - }; 141 - name = "v1.0.0a3.tar.gz"; 142 - md5 = "adb1c512e09ca2c7a6faef36f9c53e59"; 143 - dst = ".cache/tiny_dnn"; 144 - }; 145 - 146 opencvFlag = name: enabled: "-DWITH_${name}=${printEnabled enabled}"; 147 148 printEnabled = enabled : if enabled then "ON" else "OFF"; ··· 155 postUnpack = lib.optionalString buildContrib '' 156 cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib" 157 ''; 158 159 # This prevents cmake from using libraries in impure paths (which 160 # causes build failure on non NixOS) ··· 174 ${installExtraFiles vgg} 175 ${installExtraFiles boostdesc} 176 ${installExtraFiles face} 177 - 178 - mkdir -p "${tinyDnn.dst}" 179 - ln -s "${tinyDnn.src}" "${tinyDnn.dst}/${tinyDnn.md5}-${tinyDnn.name}" 180 ''); 181 182 buildInputs = ··· 243 ] ++ lib.optionals stdenv.isDarwin [ 244 "-DWITH_OPENCL=OFF" 245 "-DWITH_LAPACK=OFF" 246 - 247 - # On OS X the tiny-dnn-1.0.0a3 dependency of dnn_modern fails to build. 248 - "-DBUILD_opencv_dnn_modern=OFF" 249 ]; 250 251 enableParallelBuilding = true; ··· 273 274 passthru = lib.optionalAttrs enablePython { pythonPath = []; }; 275 276 - meta = { 277 description = "Open Computer Vision Library with more than 500 algorithms"; 278 homepage = https://opencv.org/; 279 - license = with stdenv.lib.licenses; if enableUnfree then unfree else bsd3; 280 - maintainers = with stdenv.lib.maintainers; [viric mdaiter basvandijk]; 281 - platforms = with stdenv.lib.platforms; linux ++ darwin; 282 }; 283 }
··· 35 }: 36 37 let 38 + version = "3.4.2"; 39 40 src = fetchFromGitHub { 41 owner = "opencv"; 42 repo = "opencv"; 43 rev = version; 44 + sha256 = "0q752s1ir6iyqbp3pn425fi215fi7bzjl4aa3arvgh6sridda9lx"; 45 }; 46 47 contribSrc = fetchFromGitHub { 48 owner = "opencv"; 49 repo = "opencv_contrib"; 50 rev = version; 51 + sha256 = "1fbgbf9xdby9a5yy6bmnkzchdsfii0jagfd373y015cjpr1mrlvz"; 52 }; 53 54 # Contrib must be built in order to enable Tesseract support: ··· 59 src = fetchFromGitHub { 60 owner = "opencv"; 61 repo = "opencv_3rdparty"; 62 + rev = "bdb7bb85f34a8cb0d35e40a81f58da431aa1557a"; 63 + sha256 = "1ys9mshfpm8iy8h4ml792gnqrq959dsrcv26axx14niivxyjbji8"; 64 } + "/ippicv"; 65 + files = let name = platform : "ippicv_2017u3_${platform}_general_20180518.tgz"; in 66 if stdenv.system == "x86_64-linux" then 67 + { ${name "lnx_intel64"} = "b7cc351267db2d34b9efa1cd22ff0572"; } 68 else if stdenv.system == "i686-linux" then 69 + { ${name "lnx_ia32"} = "ea72de74dae3c604eb6348395366e78e"; } 70 else if stdenv.system == "x86_64-darwin" then 71 + { ${name "mac_intel64"} = "3ae52b9be0fe73dd45bc5e9429cd3732"; } 72 else 73 throw "ICV is not available for this platform (or not yet supported by this package)"; 74 dst = ".cache/ippicv"; ··· 132 ln -s "${extra.src}/${name}" "${extra.dst}/${md5}-${name}" 133 '') extra.files); 134 135 opencvFlag = name: enabled: "-DWITH_${name}=${printEnabled enabled}"; 136 137 printEnabled = enabled : if enabled then "ON" else "OFF"; ··· 144 postUnpack = lib.optionalString buildContrib '' 145 cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib" 146 ''; 147 + 148 + # TODO: remove the following patch once commit 149 + # https://github.com/opencv/opencv/commit/e2b5d112909b9dfd764f14833b82e38e4bc2f81f 150 + # is released. 151 + patches = [ ./fix-dnn.patch ]; 152 153 # This prevents cmake from using libraries in impure paths (which 154 # causes build failure on non NixOS) ··· 168 ${installExtraFiles vgg} 169 ${installExtraFiles boostdesc} 170 ${installExtraFiles face} 171 ''); 172 173 buildInputs = ··· 234 ] ++ lib.optionals stdenv.isDarwin [ 235 "-DWITH_OPENCL=OFF" 236 "-DWITH_LAPACK=OFF" 237 ]; 238 239 enableParallelBuilding = true; ··· 261 262 passthru = lib.optionalAttrs enablePython { pythonPath = []; }; 263 264 + meta = with stdenv.lib; { 265 description = "Open Computer Vision Library with more than 500 algorithms"; 266 homepage = https://opencv.org/; 267 + license = with licenses; if enableUnfree then unfree else bsd3; 268 + maintainers = with maintainers; [viric mdaiter basvandijk]; 269 + platforms = with platforms; linux ++ darwin; 270 }; 271 }
+13
pkgs/development/libraries/opencv/fix-dnn.patch
···
··· 1 + diff --git a/modules/dnn/src/caffe/caffe_io.cpp b/modules/dnn/src/caffe/caffe_io.cpp 2 + index 730c752ce..abbce0453 100644 3 + --- a/modules/dnn/src/caffe/caffe_io.cpp 4 + +++ b/modules/dnn/src/caffe/caffe_io.cpp 5 + @@ -1120,7 +1120,7 @@ bool ReadProtoFromTextFile(const char* filename, Message* proto) { 6 + std::ifstream fs(filename, std::ifstream::in); 7 + CHECK(fs.is_open()) << "Can't open \"" << filename << "\""; 8 + IstreamInputStream input(&fs); 9 + - return google::protobuf::TextFormat::Parser(true).Parse(&input, proto); 10 + + return google::protobuf::TextFormat::Parser().Parse(&input, proto); 11 + } 12 + 13 + bool ReadProtoFromBinaryFile(const char* filename, Message* proto) {