summary refs log tree commit diff
path: root/pkgs/development/libraries/aravis/default.nix
blob: eaeddbcad36820a7a5b5fe4d8e0fda69f26f2e70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, gtk-doc, intltool
, audit, glib, libusb, libxml2
, wrapGAppsHook
, gstreamer ? null
, gst-plugins-base ? null
, gst-plugins-good ? null
, gst-plugins-bad ? null
, libnotify ? null
, gnome3 ? null
, gtk3 ? null
, enableUsb ? true
, enablePacketSocket ? true
, enableViewer ? true
, enableGstPlugin ? true
, enableCppTest ? false
, enableFastHeartbeat ? false
, enableAsan ? false
}:

let
  gstreamerAtLeastVersion1 =
    stdenv.lib.all
      (pkg: pkg != null && stdenv.lib.versionAtLeast (stdenv.lib.getVersion pkg) "1.0")
      [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
in
  assert enableGstPlugin -> stdenv.lib.all (pkg: pkg != null) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ];
  assert enableViewer -> enableGstPlugin;
  assert enableViewer -> libnotify != null;
  assert enableViewer -> gnome3 != null;
  assert enableViewer -> gtk3 != null;
  assert enableViewer -> gstreamerAtLeastVersion1;

  stdenv.mkDerivation rec {

    pname = "aravis";
    version = "0.6.4";

    src = fetchFromGitHub {
      owner = "AravisProject";
      repo = pname;
      rev= "ARAVIS_${builtins.replaceStrings ["."] ["_"] version}";
      sha256 = "18fnliks661kzc3g8v08hcaj18hjid8b180d6s9gwn0zgv4g374w";
    };

    outputs = [ "bin" "dev" "out" "lib" ];

    nativeBuildInputs = [
      autoreconfHook
      pkgconfig
      intltool
      gtk-doc
    ] ++ stdenv.lib.optional enableViewer wrapGAppsHook;

    buildInputs =
      [ glib libxml2 ]
      ++ stdenv.lib.optional enableUsb libusb
      ++ stdenv.lib.optional enablePacketSocket audit
      ++ stdenv.lib.optionals (enableViewer || enableGstPlugin) [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad ]
      ++ stdenv.lib.optionals (enableViewer) [ libnotify gtk3 gnome3.adwaita-icon-theme ];

    preAutoreconf = ''./autogen.sh'';

    configureFlags =
      stdenv.lib.optional enableUsb "--enable-usb"
        ++ stdenv.lib.optional enablePacketSocket "--enable-packet-socket"
        ++ stdenv.lib.optional enableViewer "--enable-viewer"
        ++ stdenv.lib.optional enableGstPlugin
        (if gstreamerAtLeastVersion1 then "--enable-gst-plugin" else "--enable-gst-0.10-plugin")
        ++ stdenv.lib.optional enableCppTest "--enable-cpp-test"
        ++ stdenv.lib.optional enableFastHeartbeat "--enable-fast-heartbeat"
        ++ stdenv.lib.optional enableAsan "--enable-asan";

    postPatch = ''
        ln -s ${gtk-doc}/share/gtk-doc/data/gtk-doc.make .
      '';

    doCheck = true;

    meta = {
      description = "Library for video acquisition using GenICam cameras";
      longDescription = ''
        Implements the gigabit ethernet and USB3 protocols used by industrial cameras.
      '';
      homepage = "https://aravisproject.github.io/docs/aravis-0.5";
      license = stdenv.lib.licenses.lgpl2;
      maintainers = [];
      platforms = stdenv.lib.platforms.unix;
    };
  }