summary refs log tree commit diff
path: root/pkgs/tools/networking/p2p/amule/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/networking/p2p/amule/default.nix')
-rw-r--r--pkgs/tools/networking/p2p/amule/default.nix83
1 files changed, 51 insertions, 32 deletions
diff --git a/pkgs/tools/networking/p2p/amule/default.nix b/pkgs/tools/networking/p2p/amule/default.nix
index b9a4360abfb..7f6aeace7b8 100644
--- a/pkgs/tools/networking/p2p/amule/default.nix
+++ b/pkgs/tools/networking/p2p/amule/default.nix
@@ -1,29 +1,54 @@
 { monolithic ? true # build monolithic amule
-, daemon ? false # build amule daemon
+, enableDaemon ? false # build amule daemon
 , httpServer ? false # build web interface for the daemon
 , client ? false # build amule remote gui
-, fetchurl, stdenv, zlib, wxGTK, perl, cryptopp, libupnp, gettext, libpng ? null
-, pkgconfig, makeWrapper, libX11 ? null }:
+, fetchFromGitHub, fetchpatch, stdenv, lib, zlib, wxGTK, perl, cryptopp, libupnp, gettext, libpng ? null
+, autoreconfHook, pkgconfig, makeWrapper, libX11 ? null }:
 
 assert httpServer -> libpng != null;
 assert client -> libX11 != null;
-with stdenv;
 
-mkDerivation rec {
-  name = "aMule-2.3.2";
+stdenv.mkDerivation rec {
+  pname = "amule";
+  version = "2.3.2";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/amule/${name}.tar.xz";
-    sha256 = "0a1rd33hjl30qyzgb5y8m7dxs38asci3kjnlvims1ky6r3yj0izn";
+  src = fetchFromGitHub {
+    owner = "amule-project";
+    repo = "amule";
+    rev = version;
+    sha256 = "010wxm6g9f92x6fympj501zbnjka32rzbx0sk3a2y4zpih5d2nsn";
   };
 
-  buildInputs =
-    [ zlib wxGTK perl cryptopp libupnp gettext pkgconfig makeWrapper ]
-    ++ lib.optional httpServer libpng
-    ++ lib.optional client libX11;
+  patches = [
+    (fetchpatch {
+      url = "https://patch-diff.githubusercontent.com/raw/amule-project/amule/pull/135.patch";
+      sha256 = "1n24r1j28083b8ipbnh1nf6i4j6vx59pdkfl1c0g6bb4psx9wvvi";
+      name = "libupnp_18.patch";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace src/libs/ec/file_generator.pl \
+      --replace /usr/bin/perl ${perl}/bin/perl
+
+    # autotools expects these to be in the root
+    cp docs/{AUTHORS,README} .
+    cp docs/Changelog ./ChangeLog
+    cp docs/Changelog ./NEWS
+  '';
+
+  preAutoreconf = ''
+    pushd src/pixmaps/flags_xpm >/dev/null
+    ./makeflags.sh
+    popd >/dev/null
+  '';
 
-  # See: https://github.com/amule-project/amule/issues/126
-  patches = [ ./upnp-1.8.patch ];
+  nativeBuildInputs = [ autoreconfHook gettext makeWrapper pkgconfig ];
+
+  buildInputs = [
+    zlib wxGTK perl cryptopp libupnp
+  ] ++ lib.optional httpServer libpng
+    ++ lib.optional client libX11;
 
   enableParallelBuilding = true;
 
@@ -31,27 +56,21 @@ mkDerivation rec {
     "--with-crypto-prefix=${cryptopp}"
     "--disable-debug"
     "--enable-optimize"
-    (stdenv.lib.enableFeature monolithic "monolithic")
-    (stdenv.lib.enableFeature daemon "amule-daemon")
-    (stdenv.lib.enableFeature client "amule-gui")
-    (stdenv.lib.enableFeature httpServer "webserver")
+    (lib.enableFeature monolithic   "monolithic")
+    (lib.enableFeature enableDaemon "amule-daemon")
+    (lib.enableFeature client       "amule-gui")
+    (lib.enableFeature httpServer   "webserver")
   ];
 
-  postConfigure = ''
-    sed -i "src/libs/ec/file_generator.pl"     \
-        -es'|/usr/bin/perl|${perl}/bin/perl|g'
-  '';
-
   # aMule will try to `dlopen' libupnp and libixml, so help it
   # find them.
   postInstall = lib.optionalString monolithic ''
-    wrapProgram "$out/bin/amule" --prefix LD_LIBRARY_PATH ":" "${libupnp}/lib"
+    wrapProgram $out/bin/amule \
+      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libupnp ]}
   '';
 
-  meta = {
-    homepage = http://amule.org/;
+  meta = with lib; {
     description = "Peer-to-peer client for the eD2K and Kademlia networks";
-
     longDescription = ''
       aMule is an eMule-like client for the eD2k and Kademlia
       networks, supporting multiple platforms.  Currently aMule
@@ -63,9 +82,9 @@ mkDerivation rec {
       applications.
     '';
 
-    license = stdenv.lib.licenses.gpl2Plus;
-
-    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
-    maintainers = [ stdenv.lib.maintainers.phreedom ];
+    homepage = "https://amule.org/";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ phreedom ];
+    platforms = platforms.unix;
   };
 }