1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 autoconf-archive,
7 ocamlPackages,
8 pkg-config,
9 zlib,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "mldonkey";
14 version = "3.2.1";
15
16 src = fetchFromGitHub {
17 owner = "ygrek";
18 repo = "mldonkey";
19 tag = "release-${lib.replaceStrings [ "." ] [ "-" ] version}";
20 hash = "sha256-Dbb7163CdqHY7/FJY2yWBFRudT+hTFT6fO4sFgt6C/A=";
21 };
22
23 patches = [
24 ./gettext-0.25.patch
25 ];
26
27 postPatch = ''
28 substituteInPlace config/Makefile.in \
29 --replace-fail '+camlp4' '${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4'
30 '';
31
32 strictDeps = true;
33
34 nativeBuildInputs = [
35 autoreconfHook
36 autoconf-archive
37 ocamlPackages.camlp4
38 ocamlPackages.findlib
39 ocamlPackages.ocaml
40 pkg-config
41 ];
42
43 buildInputs = [
44 ocamlPackages.num
45 zlib
46 ];
47
48 preAutoreconf = ''
49 cd config
50 '';
51
52 postAutoreconf = ''
53 cd ..
54 '';
55
56 env = {
57 NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
58 }
59 # https://github.com/ygrek/mldonkey/issues/117
60 // lib.optionalAttrs stdenv.cc.isClang {
61 CXXFLAGS = "-std=c++98";
62 }
63 // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
64 NIX_LDFLAGS = "-liconv";
65 };
66
67 meta = {
68 description = "Client for many p2p networks, with multiple frontends";
69 homepage = "https://github.com/ygrek/mldonkey";
70 license = lib.licenses.gpl2Only;
71 platforms = lib.platforms.unix;
72 };
73}