about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/sflphone/default.nix
blob: 8b259c90fe508fd9bfb95a87d7283cfc4806ade6 (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
{ stdenv, fetchurl, libyaml, alsaLib, openssl, libuuid, pkgconfig, libpulseaudio, libsamplerate
, commoncpp2, ccrtp, libzrtpcpp, dbus, dbus_cplusplus, expat, pcre, gsm, speex, ilbc, libopus
, autoconf, automake, libtool, gettext, perl
, cmake, qt4
, gtk, glib, dbus_glib, libnotify, intltool, makeWrapper }:

let
  name = "sflphone-1.2.3";

  src = fetchurl {
    url = "https://projects.savoirfairelinux.com/attachments/download/6423/${name}.tar.gz";
    sha256 = "0aiwlky7mp5l51a7kkhkmaz7ivapypar291kdxzdxl1s3qy0x6fd";
  };

  meta = {
    homepage = http://sflphone.org/;
    license = stdenv.lib.licenses.gpl3Plus;
    description = "Free software enterprise-class softphone for GNU/Linux";
    platforms = with stdenv.lib.platforms; linux;
    maintainers = with stdenv.lib.maintainers; [viric];
  };

in
rec {
  daemon = stdenv.mkDerivation {
    name = name + "-daemon";

    inherit src;

    patches = [ ./libzrtpcpp-cflags.patch ];

    preConfigure = ''
      cd daemon

      # Post patch, required
      autoreconf -vfi

      cd libs
      bash ./compile_pjsip.sh
      cd ..
    '';

    configureFlags = "--with-expat --with-expat-inc=${expat}/include " +
      "--with-expat-lib=-lexpat --with-opus ";

    buildInputs = [ libyaml alsaLib openssl libuuid pkgconfig libpulseaudio libsamplerate
      commoncpp2 ccrtp libzrtpcpp dbus dbus_cplusplus expat pcre gsm speex ilbc libopus
      autoconf automake libtool gettext perl ];
  };

  # This fails still.
  # I don't know the best way to make this a KDE program (with switchable kde
  # libs, like digikam for example)
  /*
  kde = stdenv.mkDerivation {
    name = name + "-kde";

    inherit src;

    preConfigure = ''
      cd kde
    '';

    buildInputs = [ daemon cmake qt4 pkgconfig ];
  };
  */

  gnome = stdenv.mkDerivation {
    name = name + "-gnome";

    inherit src;

    preConfigure = ''
      cd gnome
    '';

    # gtk3 programs have the runtime dependency on XDG_DATA_DIRS
    preFixup = ''
      for f in "$out/bin/sflphone" "$out/bin/sflphone-client-gnome"; do
        wrapProgram $f --prefix XDG_DATA_DIRS ":" "${gtk}/share:$GSETTINGS_SCHEMAS_PATH"
      done
    '';

    buildInputs = [ daemon pkgconfig gtk glib dbus_glib libnotify intltool makeWrapper ];
  };
}