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