1{
2 lib,
3 stdenv,
4 fetchurl,
5 cmake,
6 libsodium,
7 ncurses,
8 libopus,
9 libvpx,
10 check,
11 libconfig,
12 pkg-config,
13}:
14
15let
16 buildToxAV = !stdenv.hostPlatform.isAarch32;
17in
18stdenv.mkDerivation rec {
19 pname = "libtoxcore";
20 version = "0.2.20";
21
22 src =
23 # We need the prepared sources tarball.
24 fetchurl {
25 url = "https://github.com/TokTok/c-toxcore/releases/download/v${version}/c-toxcore-${version}.tar.gz";
26 hash = "sha256-qciaja6nRdU+XXjnqsuZx7R5LEQApaaccSOPRdYWT0w=";
27 };
28
29 cmakeFlags = [
30 "-DDHT_BOOTSTRAP=ON"
31 "-DBOOTSTRAP_DAEMON=ON"
32 ]
33 ++ lib.optional buildToxAV "-DMUST_BUILD_TOXAV=ON";
34
35 buildInputs = [
36 libsodium
37 ncurses
38 libconfig
39 ]
40 ++ lib.optionals buildToxAV [
41 libopus
42 libvpx
43 ];
44
45 nativeBuildInputs = [
46 cmake
47 pkg-config
48 ];
49
50 doCheck = true;
51 nativeCheckInputs = [ check ];
52
53 postInstall = ''
54 substituteInPlace $out/lib/pkgconfig/toxcore.pc \
55 --replace '=''${prefix}/' '=' \
56
57 '';
58 # We might be getting the wrong pkg-config file anyway:
59 # https://github.com/TokTok/c-toxcore/issues/2334
60
61 meta = {
62 description = "P2P FOSS instant messaging application aimed to replace Skype";
63 homepage = "https://tox.chat";
64 license = lib.licenses.gpl3Plus;
65 maintainers = with lib.maintainers; [
66 peterhoeg
67 ehmry
68 ];
69 platforms = lib.platforms.all;
70 };
71}