2021-12-06 16:07:01 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, boost
, cmake
, fftw
, fftwSinglePrec
, hdf5
, ilmbase
, libjpeg
, libpng
, libtiff
, openexr
, python2Packages
} :
2020-04-24 23:36:52 +00:00
let
inherit ( python2Packages ) python numpy ;
# Might want to use `python2.withPackages(ps: [ps.numpy]);` here...
2021-12-06 16:07:01 +00:00
in
stdenv . mkDerivation rec {
2020-04-24 23:36:52 +00:00
pname = " v i g r a " ;
version = " 1 . 1 1 . 1 " ;
2021-12-06 16:07:01 +00:00
src = fetchFromGitHub {
owner = " u k o e t h e " ;
repo = " v i g r a " ;
rev = " V e r s i o n - ${ lib . replaceChars [ " . " ] [ " - " ] version } " ;
sha256 = " s h a 2 5 6 - t D 6 t d o T 4 m W B t z k n 4 X v 3 n N I k B Q m e q N q z I 1 A V x U b P 7 6 M k = " ;
2020-04-24 23:36:52 +00:00
} ;
NIX_CFLAGS_COMPILE = " - I ${ ilmbase . dev } / i n c l u d e / O p e n E X R " ;
# Fixes compilation with clang (on darwin) see https://github.com/ukoethe/vigra/issues/414
patches =
2021-12-06 16:07:01 +00:00
let clangPatch = fetchurl {
url = " h t t p s : / / g i t h u b . c o m / u k o e t h e / v i g r a / c o m m i t / 8 1 9 5 8 d 3 0 2 4 9 4 e 1 3 7 f 9 8 a 8 b 1 d 7 8 6 9 8 4 1 5 3 2 f 9 0 3 8 8 . p a t c h " ;
sha256 = " 1 i 1 w 6 s m i j g b 5 z 8 b g 9 j a q 8 4 c c y 0 0 k 2 s x m 8 7 s 3 7 l g j p y i x 9 0 1 g j l g i " ;
} ;
2020-04-24 23:36:52 +00:00
in [ clangPatch ] ;
2021-01-15 22:18:51 +00:00
nativeBuildInputs = [ cmake ] ;
2021-12-06 16:07:01 +00:00
buildInputs = [
boost
fftw
fftwSinglePrec
hdf5
ilmbase
libjpeg
libpng
libtiff
numpy
openexr
python
] ;
2020-04-24 23:36:52 +00:00
preConfigure = " c m a k e F l a g s + = \" - D V I G R A N U M P Y _ I N S T A L L _ D I R = $ o u t / l i b / ${ python . libPrefix } / s i t e - p a c k a g e s \" " ;
cmakeFlags = [ " - D W I T H _ O P E N E X R = 1 " ]
2021-12-06 16:07:01 +00:00
++ lib . optionals ( stdenv . hostPlatform . system == " x 8 6 _ 6 4 - l i n u x " )
[ " - D C M A K E _ C X X _ F L A G S = - f P I C " " - D C M A K E _ C _ F L A G S = - f P I C " ] ;
2020-04-24 23:36:52 +00:00
# fails with "./test_watersheds3d: error while loading shared libraries: libvigraimpex.so.11: cannot open shared object file: No such file or directory"
doCheck = false ;
2021-02-05 17:12:51 +00:00
meta = with lib ; {
2020-04-24 23:36:52 +00:00
description = " N o v e l c o m p u t e r v i s i o n C + + l i b r a r y w i t h c u s t o m i z a b l e a l g o r i t h m s a n d d a t a s t r u c t u r e s " ;
homepage = " h t t p s : / / h c i . i w r . u n i - h e i d e l b e r g . d e / v i g r a " ;
license = licenses . mit ;
maintainers = [ maintainers . viric ] ;
platforms = platforms . unix ;
} ;
}