1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 boost,
6 cmake,
7 fftw,
8 fftwSinglePrec,
9 hdf5,
10 libjpeg,
11 libpng,
12 libtiff,
13 openexr,
14 python3,
15}:
16
17let
18 python = python3.withPackages (py: with py; [ numpy ]);
19in
20stdenv.mkDerivation (finalAttrs: {
21 pname = "vigra";
22 version = "1.12.1";
23
24 src = fetchFromGitHub {
25 owner = "ukoethe";
26 repo = "vigra";
27 tag = "Version-${lib.replaceStrings [ "." ] [ "-" ] finalAttrs.version}";
28 hash = "sha256-ZmHj1BSyoMBCuxI5hrRiBEb5pDUsGzis+T5FSX27UN8=";
29 };
30
31 patches = [
32 # Patches to fix compiling on LLVM 19 from https://github.com/ukoethe/vigra/pull/592
33 ./fix-llvm-19-1.patch
34 ./fix-llvm-19-2.patch
35 ];
36
37 nativeBuildInputs = [ cmake ];
38 buildInputs = [
39 boost
40 fftw
41 fftwSinglePrec
42 hdf5
43 libjpeg
44 libpng
45 libtiff
46 openexr
47 python
48 ];
49
50 postPatch = ''
51 chmod +x config/run_test.sh.in
52 patchShebangs --build config/run_test.sh.in
53 '';
54
55 cmakeFlags = [
56 "-DWITH_OPENEXR=1"
57 "-DVIGRANUMPY_INSTALL_DIR=${placeholder "out"}/${python.sitePackages}"
58 ]
59 ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
60 "-DCMAKE_CXX_FLAGS=-fPIC"
61 "-DCMAKE_C_FLAGS=-fPIC"
62 ];
63
64 enableParallelBuilding = true;
65
66 passthru = {
67 tests = {
68 check = finalAttrs.finalPackage.overrideAttrs (previousAttrs: {
69 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
70 });
71 };
72 };
73
74 meta = with lib; {
75 description = "Novel computer vision C++ library with customizable algorithms and data structures";
76 mainProgram = "vigra-config";
77 homepage = "https://hci.iwr.uni-heidelberg.de/vigra";
78 license = licenses.mit;
79 maintainers = with maintainers; [ ShamrockLee ];
80 platforms = platforms.unix;
81 };
82})