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