btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / am / amule / package.nix
blob608ce21c999769814068d86a9de7740e80ba0a23
1 { monolithic ? true # build monolithic amule
2 , enableDaemon ? false # build amule daemon
3 , httpServer ? false # build web interface for the daemon
4 , client ? false # build amule remote gui
5 , fetchFromGitHub
6 , fetchpatch
7 , stdenv
8 , lib
9 , cmake
10 , zlib
11 , wxGTK32
12 , perl
13 , cryptopp
14 , libupnp
15 , boost # Not using boost leads to crashes with gtk3
16 , gettext
17 , libpng
18 , pkg-config
19 , makeWrapper
20 , libX11
23 # daemon and client are not build monolithic
24 assert monolithic || (!monolithic && (enableDaemon || client || httpServer));
26 stdenv.mkDerivation rec {
27   pname = "amule"
28     + lib.optionalString httpServer "-web"
29     + lib.optionalString enableDaemon "-daemon"
30     + lib.optionalString client "-gui";
31   version = "2.3.3";
33   src = fetchFromGitHub {
34     owner = "amule-project";
35     repo = "amule";
36     rev = version;
37     sha256 = "1nm4vxgmisn1b6l3drmz0q04x067j2i8lw5rnf0acaapwlp8qwvi";
38   };
40   patches = [
41     (fetchpatch {
42       url = "https://sources.debian.org/data/main/a/amule/1%3A2.3.3-3/debian/patches/wx3.2.patch";
43       hash = "sha256-OX5Ef80bL+dQqHo2OBLZvzMUrU6aOHfsF7AtoE1r7rs=";
44     })
45   ];
47   nativeBuildInputs = [ cmake gettext makeWrapper pkg-config ];
49   buildInputs = [
50     zlib
51     wxGTK32
52     perl
53     cryptopp.dev
54     libupnp
55     boost
56   ] ++ lib.optional httpServer libpng
57   ++ lib.optional client libX11;
59   cmakeFlags = [
60     "-DBUILD_MONOLITHIC=${if monolithic then "ON" else "OFF"}"
61     "-DBUILD_DAEMON=${if enableDaemon then "ON" else "OFF"}"
62     "-DBUILD_REMOTEGUI=${if client then "ON" else "OFF"}"
63     "-DBUILD_WEBSERVER=${if httpServer then "ON" else "OFF"}"
64     # building only the daemon fails when these are not set... this is
65     # due to mistakes in the Amule cmake code, but it does not cause
66     # extra code to be built...
67     "-Dwx_NEED_GUI=ON"
68     "-Dwx_NEED_ADV=ON"
69     "-Dwx_NEED_NET=ON"
70   ];
72   postPatch = ''
73     echo "find_package(Threads)" >> cmake/options.cmake
74   '';
76   # aMule will try to `dlopen' libupnp and libixml, so help it
77   # find them.
78   postInstall = lib.optionalString monolithic ''
79     wrapProgram $out/bin/amule \
80       --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libupnp ]}
81   '';
83   meta = with lib; {
84     description = "Peer-to-peer client for the eD2K and Kademlia networks";
85     longDescription = ''
86       aMule is an eMule-like client for the eD2k and Kademlia
87       networks, supporting multiple platforms.  Currently aMule
88       (officially) supports a wide variety of platforms and operating
89       systems, being compatible with more than 60 different
90       hardware+OS configurations.  aMule is entirely free, its
91       sourcecode released under the GPL just like eMule, and includes
92       no adware or spyware as is often found in proprietary P2P
93       applications.
94     '';
96     homepage = "https://github.com/amule-project/amule";
97     license = licenses.gpl2Plus;
98     maintainers = [ ];
99     platforms = platforms.unix;
100     # Undefined symbols for architecture arm64: "_FSFindFolder"
101     broken = stdenv.hostPlatform.isDarwin;
102   };