1{
2 lib,
3 mkDerivation,
4 fetchFromGitHub,
5 fetchpatch2,
6 qmake,
7 cmake,
8 pkg-config,
9 miniupnpc,
10 bzip2,
11 speex,
12 libmicrohttpd,
13 libxml2,
14 libxslt,
15 sqlcipher,
16 rapidjson,
17 libXScrnSaver,
18 qtbase,
19 qtx11extras,
20 qtmultimedia,
21 libgnome-keyring,
22}:
23
24mkDerivation rec {
25 pname = "retroshare";
26 version = "0.6.7.2";
27
28 src = fetchFromGitHub {
29 owner = "RetroShare";
30 repo = "RetroShare";
31 rev = "v${version}";
32 hash = "sha256-1A1YvOWIiWlP1JPUTg5Z/lxVGCBv4tCPf5sZdPogitU=";
33 fetchSubmodules = true;
34 };
35
36 patches = [
37 # The build normally tries to get git sub-modules during build
38 # but we already have them checked out
39 ./no-submodules.patch
40
41 # Support the miniupnpc-2.2.8 API change
42 (fetchpatch2 {
43 url = "https://github.com/RetroShare/libretroshare/commit/f1b89c4f87d77714571b4135c301bf0429096a20.patch?full_index=1";
44 hash = "sha256-UiZMsUFaOZTLj/dx1rLr5bTR1CQ6nt2+IygQdvwJqwc=";
45 stripLen = 1;
46 extraPrefix = "libretroshare/";
47 })
48 ];
49
50 nativeBuildInputs = [
51 pkg-config
52 qmake
53 cmake
54 ];
55 buildInputs = [
56 speex
57 miniupnpc
58 qtmultimedia
59 qtx11extras
60 qtbase
61 libgnome-keyring
62 bzip2
63 libXScrnSaver
64 libxml2
65 libxslt
66 sqlcipher
67 libmicrohttpd
68 rapidjson
69 ];
70
71 qmakeFlags = [
72 # Upnp library autodetection doesn't work
73 "RS_UPNP_LIB=miniupnpc"
74
75 # These values are normally found from the .git folder
76 "RS_MAJOR_VERSION=${lib.versions.major version}"
77 "RS_MINOR_VERSION=${lib.versions.minor version}"
78 "RS_MINI_VERSION=${lib.versions.patch version}"
79 "RS_EXTRA_VERSION="
80 ];
81
82 postPatch = ''
83 # Build libsam3 as C, not C++. No, I have no idea why it tries to
84 # do that, either.
85 substituteInPlace libretroshare/src/libretroshare.pro \
86 --replace-fail \
87 "LIBSAM3_MAKE_PARAMS =" \
88 "LIBSAM3_MAKE_PARAMS = CC=$CC AR=$AR"
89 '';
90
91 postInstall = ''
92 # BT DHT bootstrap
93 cp libbitdht/src/bitdht/bdboot.txt $out/share/retroshare
94 '';
95
96 meta = with lib; {
97 description = "Decentralized peer to peer chat application";
98 homepage = "https://retroshare.cc/";
99 license = licenses.gpl2Plus;
100 platforms = platforms.linux;
101 maintainers = with maintainers; [ StijnDW ];
102 };
103}