opencv3: add enableIpp flag

Intel Integrated Performance Primitives (IPP) speeds up parts of OpenCV
on Intel processors (and compatible). It increases the store path from
220 MiB to 300 MiB, so it defaults to off.

Original patch from Bas van Dijk <v.dijk.bas@gmail.com>.

I tried applying the same change to opencv(2.x). OpenCV 2.x didn't
automatically detect IPP, so I reverted the change.

+16 -3
+16 -3
pkgs/development/libraries/opencv/3.x.nix
··· 1 { lib, stdenv, fetchurl, cmake, gtk, libjpeg, libpng, libtiff, jasper, ffmpeg 2 , fetchpatch, pkgconfig, gstreamer, xineLib, glib, python27, python27Packages, unzip 3 , enableBloat ? false }: 4 5 let v = "3.0.0"; in ··· 12 sha256 = "00dh7wvgkflz22liqd10fma8m3395lb3l3rgawnn5wlnz6i4w287"; 13 }; 14 15 buildInputs = 16 [ unzip libjpeg libpng libtiff ] 17 ++ lib.optionals enableBloat [ gtk glib jasper ffmpeg xineLib gstreamer python27 python27Packages.numpy ]; 18 19 nativeBuildInputs = [ cmake pkgconfig ]; 20 21 - # TODO: Pre-download IPP so that OpenCV doesn't try to download it itself 22 - # (which fails). 23 - cmakeFlags = [ "-DWITH_IPP=OFF" ]; 24 25 enableParallelBuilding = true; 26
··· 1 { lib, stdenv, fetchurl, cmake, gtk, libjpeg, libpng, libtiff, jasper, ffmpeg 2 , fetchpatch, pkgconfig, gstreamer, xineLib, glib, python27, python27Packages, unzip 3 + , enableIpp ? false 4 , enableBloat ? false }: 5 6 let v = "3.0.0"; in ··· 13 sha256 = "00dh7wvgkflz22liqd10fma8m3395lb3l3rgawnn5wlnz6i4w287"; 14 }; 15 16 + postPatch = 17 + let ippicv = fetchurl { 18 + url = "http://sourceforge.net/projects/opencvlibrary/files/3rdparty/ippicv/${ippicvName}"; 19 + md5 = ippicvHash; 20 + }; 21 + ippicvName = "ippicv_linux_20141027.tgz"; 22 + ippicvHash = "8b449a536a2157bcad08a2b9f266828b"; 23 + ippicvArchive = "3rdparty/ippicv/downloads/linux-${ippicvHash}/${ippicvName}"; 24 + in stdenv.lib.optionalString enableIpp 25 + '' 26 + mkdir -p $(dirname ${ippicvArchive}) 27 + ln -s ${ippicv} ${ippicvArchive} 28 + ''; 29 + 30 buildInputs = 31 [ unzip libjpeg libpng libtiff ] 32 ++ lib.optionals enableBloat [ gtk glib jasper ffmpeg xineLib gstreamer python27 python27Packages.numpy ]; 33 34 nativeBuildInputs = [ cmake pkgconfig ]; 35 36 + cmakeFlags = [ "-DWITH_IPP=${if enableIpp then "ON" else "OFF"}" ]; 37 38 enableParallelBuilding = true; 39