about summary refs log tree commit diff
path: root/pkgs/development/libraries/swiften/default.nix
blob: c779e16cbbb329b739236dbb89175143737332d2 (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
{ stdenv
, lib
, libidn
, lua
, miniupnpc
, expat
, zlib
, fetchurl
, fetchpatch
, openssl
, boost
, sconsPackages
}:

stdenv.mkDerivation rec {
  pname = "swiften";
  version = "4.0.3";

  src = fetchurl {
    url = "http://swift.im/git/swift/snapshot/swift-${version}.tar.bz2";
    hash = "sha256-aj+T6AevtR8birbsj+83nfzFC6cf72q+7nwSM0jaZrA=";
  };

  patches = [
    ./scons.patch
    ./build-fix.patch

    # Fix build with latest boost
    # https://swift.im/git/swift/commit/Swiften/Base/Platform.h?id=3666cbbe30e4d4e25401a5902ae359bc2c24248b
    (fetchpatch {
      name = "3666cbbe30e4d4e25401a5902ae359bc2c24248b.patch";
      url = "https://swift.im/git/swift/patch/Swiften/Base/Platform.h?id=3666cbbe30e4d4e25401a5902ae359bc2c24248b";
      sha256 = "Wh8Nnfm0/EppSJ7aH2vTNObHtodE5tM19kV1oDfm70w=";
    })
  ];

  nativeBuildInputs = [
    sconsPackages.scons_latest
  ];

  buildInputs = [
    libidn
    lua
    miniupnpc
    expat
    zlib
  ];

  propagatedBuildInputs = [
    openssl
    boost
  ];

  sconsFlags = [
    "openssl=${openssl.dev}"
    "boost_includedir=${boost.dev}/include"
    "boost_libdir=${boost.out}/lib"
    "boost_bundled_enable=false"
    "max_jobs=1"
    "optimize=1"
    "debug=0"
    "swiften_dll=1"
  ];

  postPatch = ''
    # Ensure bundled dependencies cannot be used.
    rm -rf 3rdParty

    find . \( \
      -name '*.py' -o -name SConscript -o -name SConstruct \
      \) -exec 2to3 -w {} +
  '';

  installTargets = "${placeholder "out"}";

  installFlags = [
    "SWIFTEN_INSTALLDIR=${placeholder "out"}"
  ];

  enableParallelBuilding = true;

  meta = with lib; {
    description = "An XMPP library for C++, used by the Swift client";
    homepage = "http://swift.im/swiften.html";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;
    maintainers = [ maintainers.twey ];
  };
}