2016-06-07 16:08:20 +02:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, pkgconfig, unzip
|
|
|
|
, zlib
|
|
|
|
, enablePython ? false, pythonPackages
|
|
|
|
, enableGtk2 ? false, gtk2
|
|
|
|
, enableJPEG ? true, libjpeg
|
|
|
|
, enablePNG ? true, libpng
|
|
|
|
, enableTIFF ? true, libtiff
|
|
|
|
, enableEXR ? true, openexr, ilmbase
|
|
|
|
, enableJPEG2K ? true, jasper
|
|
|
|
, enableFfmpeg ? false, ffmpeg
|
|
|
|
, enableGStreamer ? false, gst_all
|
|
|
|
, enableEigen ? false, eigen
|
|
|
|
}:
|
2011-09-24 22:40:58 +02:00
|
|
|
|
2016-06-07 16:08:20 +02:00
|
|
|
let
|
|
|
|
opencvFlag = name: enabled: "-DWITH_${name}=${if enabled then "ON" else "OFF"}";
|
|
|
|
|
|
|
|
in
|
2010-01-16 22:26:10 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2016-06-07 16:08:20 +02:00
|
|
|
name = "opencv-${version}";
|
|
|
|
version = "2.4.13";
|
2010-01-16 22:26:10 +01:00
|
|
|
|
2016-06-07 16:08:20 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Itseez";
|
|
|
|
repo = "opencv";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "1k29rxlvrhgc5hadg2nc50wa3d2ls9ndp373257p756a0aividxh";
|
2010-01-16 22:26:10 +01:00
|
|
|
};
|
|
|
|
|
2014-07-22 12:01:01 +02:00
|
|
|
buildInputs =
|
2016-06-07 16:08:20 +02:00
|
|
|
[ zlib ]
|
2016-06-07 20:26:33 +02:00
|
|
|
++ lib.optional enablePython pythonPackages.python
|
2016-06-07 16:08:20 +02:00
|
|
|
++ lib.optional enableGtk2 gtk2
|
|
|
|
++ lib.optional enableJPEG libjpeg
|
|
|
|
++ lib.optional enablePNG libpng
|
|
|
|
++ lib.optional enableTIFF libtiff
|
|
|
|
++ lib.optionals enableEXR [ openexr ilmbase ]
|
|
|
|
++ lib.optional enableJPEG2K jasper
|
|
|
|
++ lib.optional enableFfmpeg ffmpeg
|
|
|
|
++ lib.optionals enableGStreamer (with gst_all; [ gstreamer gst-plugins-base ])
|
|
|
|
++ lib.optional enableEigen eigen
|
|
|
|
;
|
|
|
|
|
2016-06-07 20:26:33 +02:00
|
|
|
propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy;
|
|
|
|
|
2016-06-07 16:08:20 +02:00
|
|
|
nativeBuildInputs = [ cmake pkgconfig unzip ];
|
2011-09-24 22:40:58 +02:00
|
|
|
|
2016-06-07 16:08:20 +02:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optional enableEXR "-I${ilmbase}/include/OpenEXR";
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
(opencvFlag "TIFF" enableTIFF)
|
|
|
|
(opencvFlag "JASPER" enableJPEG2K)
|
|
|
|
(opencvFlag "JPEG" enableJPEG)
|
|
|
|
(opencvFlag "PNG" enablePNG)
|
|
|
|
(opencvFlag "OPENEXR" enableEXR)
|
|
|
|
];
|
2010-01-16 22:26:10 +01:00
|
|
|
|
2011-07-20 15:24:26 +02:00
|
|
|
enableParallelBuilding = true;
|
2010-01-16 22:26:10 +01:00
|
|
|
|
2016-02-26 18:38:15 +01:00
|
|
|
hardeningDisable = [ "bindnow" "relro" ];
|
2016-02-07 20:18:57 +01:00
|
|
|
|
2016-06-07 16:08:20 +02:00
|
|
|
passthru = lib.optionalAttrs enablePython { pythonPath = []; };
|
|
|
|
|
2010-01-16 22:26:10 +01:00
|
|
|
meta = {
|
|
|
|
description = "Open Computer Vision Library with more than 500 algorithms";
|
2014-12-16 16:10:18 +01:00
|
|
|
homepage = http://opencv.org/;
|
2014-12-21 00:00:35 +01:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2014-12-16 16:10:18 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [viric flosse];
|
2010-07-14 09:50:06 +02:00
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
2010-01-16 22:26:10 +01:00
|
|
|
};
|
|
|
|
}
|