Skip to content

Commit

Permalink
Merge pull request #33225 from LumiGuide/opencv-3.4.0
Browse files Browse the repository at this point in the history
opencv: 3.3.1 -> 3.4.0
  • Loading branch information
orivej committed Jan 11, 2018
2 parents 8753b10 + 9bafe42 commit 2f6b885
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 52 deletions.
29 changes: 8 additions & 21 deletions pkgs/applications/graphics/digikam/default.nix
@@ -1,4 +1,4 @@
{ mkDerivation, lib, fetchurl, cmake, doxygen, extra-cmake-modules, wrapGAppsHook, fetchpatch
{ mkDerivation, lib, fetchFromGitHub, cmake, doxygen, extra-cmake-modules, wrapGAppsHook, fetchpatch

# For `digitaglinktree`
, perl, sqlite
Expand Down Expand Up @@ -50,11 +50,13 @@

mkDerivation rec {
name = "digikam-${version}";
version = "5.7.0";
version = "5.8.0";

src = fetchurl {
url = "mirror://kde/stable/digikam/${name}.tar.xz";
sha256 = "1xah079g47fih8l9qy1ifppfvmq5yms5y1z54nvxdyz8nsszy19n";
src = fetchFromGitHub {
owner = "KDE";
repo = "digikam";
rev = "v${version}";
sha256 = "1bvidg0fn92xvw5brhb34lm7m4iy4jb5xpvnhbgh8vik2m4n41w1";
};

nativeBuildInputs = [ cmake doxygen extra-cmake-modules kdoctools wrapGAppsHook ];
Expand Down Expand Up @@ -83,8 +85,7 @@ mkDerivation rec {
qtsvg
qtwebkit

# https://bugs.kde.org/show_bug.cgi?id=387960
#kcalcore
kcalcore
kconfigwidgets
kcoreaddons
kfilemetadata
Expand Down Expand Up @@ -112,20 +113,6 @@ mkDerivation rec {
--replace "/usr/bin/sqlite3" "${sqlite}/bin/sqlite3"
'';

patches = [
# fix Qt-5.9.3 empty album problem
(fetchpatch {
url = "https://cgit.kde.org/digikam.git/patch/?id=855ba5b7d4bc6337234720a72ea824ddd3b32e5b";
sha256 = "0zk8p182piy6xn9v0mhwawya9ciq596vql1qc3lgnx371a97mmni";
})
];

patchFlags = "-d core -p1";

# `en make -f core/utilities/assistants/expoblending/CMakeFiles/expoblending_src.dir/build.make core/utilities/assistants/expoblending/CMakeFiles/expoblending_src.dir/manager/expoblendingthread.cpp.o`:
# digikam_version.h:37:24: fatal error: gitversion.h: No such file or directory
enableParallelBuilding = false;

meta = with lib; {
description = "Photo Management Program";
license = licenses.gpl2;
Expand Down
46 changes: 46 additions & 0 deletions pkgs/development/libraries/ogre/1.9.x.nix
@@ -0,0 +1,46 @@
{ fetchFromGitHub, stdenv, lib
, cmake, mesa
, freetype, freeimage, zziplib, randrproto, libXrandr
, libXaw, freeglut, libXt, libpng, boost, ois
, xproto, libX11, libXmu, libSM, pkgconfig
, libXxf86vm, xf86vidmodeproto, libICE
, renderproto, libXrender
, withNvidiaCg ? false, nvidia_cg_toolkit
, withSamples ? false }:

stdenv.mkDerivation rec {
pname = "ogre";
version = "1.9.1";
name = "${pname}-${version}";

src = fetchFromGitHub {
owner = "OGRECave";
repo = "ogre";
rev = "v${version}";
sha256 = "11lfgzqaps3728dswrq3cbwk7aicigyz08q4hfyy6ikc6m35r4wg";
};

cmakeFlags = [ "-DOGRE_BUILD_SAMPLES=${toString withSamples}" ]
++ map (x: "-DOGRE_BUILD_PLUGIN_${x}=on")
([ "BSP" "OCTREE" "PCZ" "PFX" ] ++ lib.optional withNvidiaCg "CG")
++ map (x: "-DOGRE_BUILD_RENDERSYSTEM_${x}=on") [ "GL" ];

enableParallelBuilding = true;

buildInputs =
[ cmake mesa
freetype freeimage zziplib randrproto libXrandr
libXaw freeglut libXt libpng boost ois
xproto libX11 libXmu libSM pkgconfig
libXxf86vm xf86vidmodeproto libICE
renderproto libXrender
] ++ lib.optional withNvidiaCg nvidia_cg_toolkit;

meta = {
description = "A 3D engine";
homepage = http://www.ogre3d.org/;
maintainers = [ stdenv.lib.maintainers.raskin ];
platforms = stdenv.lib.platforms.linux;
license = stdenv.lib.licenses.mit;
};
}
6 changes: 3 additions & 3 deletions pkgs/development/libraries/ogre/default.nix
Expand Up @@ -9,11 +9,11 @@
, withSamples ? false }:

stdenv.mkDerivation {
name = "ogre-1.9-hg-20160322";
name = "ogre-1.10.11";

src = fetchurl {
url = "https://bitbucket.org/sinbad/ogre/get/v1-9.tar.gz";
sha256 = "0w3argjy1biaxwa3c80zxxgll67wjp8czd83p87awlcvwzdk5mz9";
url = "https://bitbucket.org/sinbad/ogre/get/v1-10-11.tar.gz";
sha256 = "1zwvlx5dz9nwjazhnrhzb0w8ilpa84r0hrxrmmy69pgr1p1yif5a";
};

cmakeFlags = [ "-DOGRE_BUILD_SAMPLES=${toString withSamples}" ]
Expand Down
19 changes: 18 additions & 1 deletion pkgs/development/libraries/ogrepaged/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, cmake, pkgconfig, ois, ogre, libX11, boost }:
{ stdenv, fetchurl, fetchpatch, cmake, pkgconfig, ois, ogre, libX11, boost }:

stdenv.mkDerivation rec {
name = "ogre-paged-${version}";
Expand All @@ -9,6 +9,23 @@ stdenv.mkDerivation rec {
sha256 = "17j7rw9wbkynxbhm2lay3qgjnnagb2vd5jn9iijnn2lf8qzbgy82";
};

patches = [
# These patches come from https://github.com/RigsOfRods/ogre-pagedgeometry/pull/6
# and make ogre-paged build with ogre-1.10.
(fetchpatch {
url = "https://github.com/RigsOfRods/ogre-pagedgeometry/commit/2d4df577decba37ec3cdafc965deae0f6d31fe45.patch";
sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73";
})
(fetchpatch {
url = "https://github.com/RigsOfRods/ogre-pagedgeometry/commit/4d81789ec6f55e294a5ad040ea7abe2b415cbc92.patch";
sha256 = "17q8djdz2y3g46azxc3idhyvi6vf0sqkxld4bbyp3l9zn7dq76rp";
})
(fetchpatch {
url = "https://github.com/RigsOfRods/ogre-pagedgeometry/commit/10f7c5ce5b422e9cbac59d466f3567a24c8831a4.patch";
sha256 = "1kk0dbadzg73ai99l3w04q51sil36vzbkaqc79mdwy0vjrn4ardb";
})
];

buildInputs = [ ois ogre libX11 boost ];
nativeBuildInputs = [ cmake pkgconfig ];

Expand Down
80 changes: 55 additions & 25 deletions pkgs/development/libraries/opencv/3.x.nix
@@ -1,6 +1,7 @@
{ lib, stdenv
, fetchurl, fetchFromGitHub
, fetchurl, fetchFromGitHub, fetchpatch
, cmake, pkgconfig, unzip, zlib, pcre, hdf5
, caffe, glog, boost, google-gflags, protobuf
, config

, enableJPEG ? true, libjpeg
Expand All @@ -14,34 +15,39 @@

, enableCuda ? (config.cudaSupport or false), cudatoolkit

, enableUnfree ? false
, enableIpp ? false
, enableContrib ? false #, caffe, glog, boost, google-gflags
, enableContrib ? false
, enablePython ? false, pythonPackages
, enableGtk2 ? false, gtk2
, enableGtk3 ? false, gtk3
, enableVtk ? false, vtk
, enableFfmpeg ? false, ffmpeg
, enableGStreamer ? false, gst_all_1
, enableTesseract ? false, tesseract, leptonica
, enableOvis ? false, ogre
, enableGPhoto2 ? false, libgphoto2
, enableDC1394 ? false, libdc1394
, enableDocs ? false, doxygen, graphviz-nox

, AVFoundation, Cocoa, QTKit, VideoDecodeAcceleration, bzip2
}:

let
version = "3.3.1";
version = "3.4.0";

src = fetchFromGitHub {
owner = "opencv";
repo = "opencv";
rev = version;
sha256 = "1jq8nny78gp54yjgsnb2rdp5rwhp78b3r2i36b2vyx6xk6h6wwji";
sha256 = "1nc14kvsjwaisv7d1r6f0hn7na9zr2cm2zh3hd3r9qwm3g78xnac";
};

contribSrc = fetchFromGitHub {
owner = "opencv";
repo = "opencv_contrib";
rev = version;
sha256 = "0q5vsa8dpa3mdhzas0ckagwh2sbckpm1kxsp0i3yfknsr5ampyi2";
sha256 = "1cxw7nra3f1hng057c6hi1ynsyqdazd69irjdgn8xjg6q9h76br0";
};

# Contrib must be built in order to enable Tesseract support:
Expand Down Expand Up @@ -104,6 +110,20 @@ let
dst = ".cache/xfeatures2d/boostdesc";
};

# See opencv_contrib/modules/face/CMakeLists.txt
face = {
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv_3rdparty";
rev = "8afa57abc8229d611c4937165d20e2a2d9fc5a12";
sha256 = "061lsvqdidq9xa2hwrcvwi9ixflr2c2lfpc8drr159g68zi8bp4v";
};
files = {
"face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05";
};
dst = ".cache/data";
};

# See opencv/cmake/OpenCVDownload.cmake
installExtraFiles = extra : with lib; ''
mkdir -p "${extra.dst}"
Expand All @@ -122,14 +142,23 @@ let
dst = ".cache/tiny_dnn";
};

opencvFlag = name: enabled: "-DWITH_${name}=${if enabled then "ON" else "OFF"}";
opencvFlag = name: enabled: "-DWITH_${name}=${printEnabled enabled}";

printEnabled = enabled : if enabled then "ON" else "OFF";
in

stdenv.mkDerivation rec {
name = "opencv-${version}";
inherit version src;

patches = [
# Fix for: https://github.com/opencv/opencv/issues/10474
(fetchpatch {
url = "https://github.com/opencv/opencv/commit/ea5a3e557f93844fdb5e54e3e8acfc5f61c6fd9f.patch";
sha256 = "1w7jmqlrx73ydh9jjsnnic5xz8r04kxbjpzkcfyb91v3az9132r1";
})
];

postUnpack = lib.optionalString buildContrib ''
cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib"
'';
Expand All @@ -151,16 +180,19 @@ stdenv.mkDerivation rec {
${installExtraFiles vgg}
${installExtraFiles boostdesc}
${installExtraFiles face}
mkdir -p "${tinyDnn.dst}"
ln -s "${tinyDnn.src}" "${tinyDnn.dst}/${tinyDnn.md5}-${tinyDnn.name}"
'');

buildInputs =
[ zlib pcre hdf5 ]
[ zlib pcre hdf5 glog boost google-gflags protobuf ]
++ lib.optional (!stdenv.isDarwin) caffe
++ lib.optional enablePython pythonPackages.python
++ lib.optional enableGtk2 gtk2
++ lib.optional enableGtk3 gtk3
++ lib.optional enableVtk vtk
++ lib.optional enableJPEG libjpeg
++ lib.optional enablePNG libpng
++ lib.optional enableTIFF libtiff
Expand All @@ -171,19 +203,17 @@ stdenv.mkDerivation rec {
++ lib.optionals (enableFfmpeg && stdenv.isDarwin)
[ VideoDecodeAcceleration bzip2 ]
++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base ])
++ lib.optional enableOvis ogre
++ lib.optional enableGPhoto2 libgphoto2
++ lib.optional enableDC1394 libdc1394
++ lib.optional enableEigen eigen
++ lib.optional enableOpenblas openblas
# There is seemingly no compile-time flag for Tesseract. It's
# simply enabled automatically if contrib is built, and it detects
# tesseract & leptonica.
++ lib.optionals enableTesseract [ tesseract leptonica ]
++ lib.optional enableCuda cudatoolkit

# These are only needed for the currently disabled
# cnn_3dobj and dnn_modern modules
# ++ lib.optionals buildContrib [ caffe glog boost google-gflags ]

++ lib.optionals stdenv.isDarwin [ AVFoundation Cocoa QTKit ]
++ lib.optionals stdenv.isDarwin [ AVFoundation Cocoa QTKit VideoDecodeAcceleration bzip2 ]
++ lib.optionals enableDocs [ doxygen graphviz-nox ];

propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy;
Expand All @@ -194,6 +224,9 @@ stdenv.mkDerivation rec {

cmakeFlags = [
"-DWITH_OPENMP=ON"
"-DBUILD_PROTOBUF=OFF"
"-DPROTOBUF_UPDATE_FILES=ON"
"-DOPENCV_ENABLE_NONFREE=${printEnabled enableUnfree}"
(opencvFlag "IPP" enableIpp)
(opencvFlag "TIFF" enableTIFF)
(opencvFlag "JASPER" enableJPEG2K)
Expand All @@ -206,17 +239,14 @@ stdenv.mkDerivation rec {
] ++ lib.optionals enableCuda [
"-DCUDA_FAST_MATH=ON"
"-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/gcc"
] ++ lib.optionals buildContrib [
# the cnn_3dobj module fails to build
"-DBUILD_opencv_cnn_3dobj=OFF"

# the dnn_modern module causes:
# https://github.com/opencv/opencv_contrib/issues/823
#
# On OS X its dependency tiny-dnn-1.0.0a3 also fails to build.
"-DBUILD_opencv_dnn_modern=OFF"
]
++ lib.optionals stdenv.isDarwin ["-DWITH_OPENCL=OFF" "-DWITH_LAPACK=OFF"];
]
++ lib.optionals stdenv.isDarwin [
"-DWITH_OPENCL=OFF"
"-DWITH_LAPACK=OFF"

# On OS X the tiny-dnn-1.0.0a3 dependency of dnn_modern fails to build.
"-DBUILD_opencv_dnn_modern=OFF"
];

enableParallelBuilding = true;

Expand All @@ -231,7 +261,7 @@ stdenv.mkDerivation rec {
meta = {
description = "Open Computer Vision Library with more than 500 algorithms";
homepage = http://opencv.org/;
license = stdenv.lib.licenses.bsd3;
license = with stdenv.lib.licenses; if enableUnfree then unfree else bsd3;
maintainers = with stdenv.lib.maintainers; [viric mdaiter basvandijk];
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
Expand Down
15 changes: 13 additions & 2 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -10205,7 +10205,9 @@ with pkgs;

mygpoclient = pythonPackages.mygpoclient;

mygui = callPackage ../development/libraries/mygui {};
mygui = callPackage ../development/libraries/mygui {
ogre = ogre1_9;
};

mysocketw = callPackage ../development/libraries/mysocketw { };

Expand Down Expand Up @@ -10280,6 +10282,7 @@ with pkgs;
ode = callPackage ../development/libraries/ode { };

ogre = callPackage ../development/libraries/ogre {};
ogre1_9 = callPackage ../development/libraries/ogre/1.9.x.nix {};

ogrepaged = callPackage ../development/libraries/ogrepaged { };

Expand Down Expand Up @@ -18084,6 +18087,7 @@ with pkgs;
digikam = libsForQt5.callPackage ../applications/graphics/digikam {
inherit (plasma5) oxygen;
inherit (kdeApplications) kcalcore;
opencv3 = opencv3.override { enableContrib = true; };
};

displaycal = (newScope pythonPackages) ../applications/graphics/displaycal {};
Expand Down Expand Up @@ -18299,7 +18303,9 @@ with pkgs;

openarena = callPackage ../games/openarena { };

opendungeons = callPackage ../games/opendungeons { };
opendungeons = callPackage ../games/opendungeons {
ogre = ogre1_9;
};

openlierox = callPackage ../games/openlierox { };

Expand Down Expand Up @@ -18383,6 +18389,10 @@ with pkgs;

rigsofrods = callPackage ../games/rigsofrods {
angelscript = angelscript_2_22;
ogre = ogre1_9;
ogrepaged = ogrepaged.override {
ogre = ogre1_9;
};
mygui = mygui.override {
withOgre = true;
};
Expand Down Expand Up @@ -18477,6 +18487,7 @@ with pkgs;
};

stuntrally = callPackage ../games/stuntrally {
ogre = ogre1_9;
mygui = mygui.override {
withOgre = true;
};
Expand Down

0 comments on commit 2f6b885

Please sign in to comment.