summary refs log tree commit diff
path: root/pkgs/development/libraries/openzwave/default.nix
blob: a9dbcf9ffb27c51021fa79ebc3e75bc1a615dd52 (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
{ stdenv, fetchFromGitHub
, doxygen, fontconfig, graphviz-nox, libxml2, pkgconfig, which
, systemd }:

let
  version = "2019-12-08";

in stdenv.mkDerivation {
  pname = "openzwave";
  inherit version;

  # Use fork by Home Assistant because this package is mainly used for python.pkgs.homeassistant-pyozw.
  # See https://github.com/OpenZWave/open-zwave/compare/master...home-assistant:hass for the difference.
  src = fetchFromGitHub {
    owner = "home-assistant";
    repo = "open-zwave";
    rev = "2cd2137025c529835e4893a7b87c3d56605b2681";
    sha256 = "04g8fb4f4ihakvvsmzcnncgfdd2ikmki7s22i9c6layzdwavbwf1";
  };

  nativeBuildInputs = [ doxygen fontconfig graphviz-nox libxml2 pkgconfig which ];

  buildInputs = [ systemd ];

  hardeningDisable = [ "format" ];

  enableParallelBuilding = true;

  installPhase = ''
    runHook preInstall

    DESTDIR=$out PREFIX= pkgconfigdir=lib/pkgconfig make install $installFlags

    runHook postInstall
  '';

  FONTCONFIG_FILE="${fontconfig.out}/etc/fonts/fonts.conf";
  FONTCONFIG_PATH="${fontconfig.out}/etc/fonts/";

  postPatch = ''
    substituteInPlace cpp/src/Options.cpp \
      --replace /etc/openzwave $out/etc/openzwave
  '';

  fixupPhase = ''
    substituteInPlace $out/lib/pkgconfig/libopenzwave.pc \
      --replace prefix= prefix=$out \
      --replace dir=    dir=$out

    substituteInPlace $out/bin/ozw_config \
      --replace pcfile=${pkgconfig} pcfile=$out
  '';

  meta = with stdenv.lib; {
    description = "C++ library to control Z-Wave Networks via a USB Z-Wave Controller";
    homepage = http://www.openzwave.net/;
    license = licenses.gpl3;
    maintainers = with maintainers; [ etu ];
    platforms = platforms.linux;
  };
}