diff --git a/pkgs/applications/networking/p2p/mldonkey/default.nix b/pkgs/applications/networking/p2p/mldonkey/default.nix index 6bc6dce38f8..3dab78eaebf 100644 --- a/pkgs/applications/networking/p2p/mldonkey/default.nix +++ b/pkgs/applications/networking/p2p/mldonkey/default.nix @@ -1,11 +1,11 @@ {stdenv, fetchurl, ocaml, zlib, bzip2, ncurses, file, gd, libpng }: stdenv.mkDerivation (rec { - name = "mldonkey-3.0.2"; + name = "mldonkey-3.0.4"; src = fetchurl { url = "mirror://sourceforge/mldonkey/${name}.tar.bz2"; - sha256 = "0l1gcgsn603l2lv5jxjjr44r7kq2hpfcy98w3y2gf5n9d4fhja84"; + sha256 = "0wnyi2m7126dq6r5zbqplgknnypzcx0p3q2mxcdfhp94ln7vn3f6"; }; meta = { @@ -13,6 +13,8 @@ stdenv.mkDerivation (rec { homepage = http://mldonkey.sourceforge.net/; }; + patches = [ ./gcc44mips64_2.patch ]; + buildInputs = [ ocaml zlib ncurses bzip2 file gd libpng ]; configureFlags = [ "--disable-gui" ]; } // (if (stdenv.system != "i686-linux" && stdenv.system != "x86_64-linux") then diff --git a/pkgs/applications/networking/p2p/mldonkey/gcc44mips64_2.patch b/pkgs/applications/networking/p2p/mldonkey/gcc44mips64_2.patch new file mode 100644 index 00000000000..f48d2551109 --- /dev/null +++ b/pkgs/applications/networking/p2p/mldonkey/gcc44mips64_2.patch @@ -0,0 +1,16 @@ +diff --git a/src/utils/lib/CryptoPP.cc b/src/utils/lib/CryptoPP.cc +index 9208e1c..788df83 100644 +--- a/src/utils/lib/CryptoPP.cc ++++ b/src/utils/lib/CryptoPP.cc +@@ -1880,7 +1880,10 @@ public: + #elif defined(__x86_64__) + __asm__("mulq %3" : "=d" (r.m_halfs.high), "=a" (r.m_halfs.low) : "a" (a), "rm" (b) : "cc"); + #elif defined(__mips64) +- __asm__("dmultu %2,%3" : "=h" (r.m_halfs.high), "=l" (r.m_halfs.low) : "r" (a), "r" (b)); ++ typedef unsigned int uint128_t __attribute__((mode(TI))); ++ uint128_t tmp = (uint128_t) a * b; ++ r.m_halfs.high = tmp >> 64; ++ r.m_halfs.low = (tmp << 64) >> 64; + #elif defined(_M_IX86) + // for testing + word64 t = (word64)a * b; diff --git a/pkgs/development/compilers/ocaml/3.11.1.nix b/pkgs/development/compilers/ocaml/3.11.1.nix index 66c8319600f..48265f9aa3d 100644 --- a/pkgs/development/compilers/ocaml/3.11.1.nix +++ b/pkgs/development/compilers/ocaml/3.11.1.nix @@ -1,8 +1,8 @@ { stdenv, fetchurl, ncurses, x11 }: let - useX11 = stdenv.system != "armv5tel-linux"; - useNativeCompilers = stdenv.system != "armv5tel-linux"; + useX11 = stdenv.isi686 || stdenv.isx86_64; + useNativeCompilers = stdenv.isi686 || stdenv.isx86_64 || stdenv.isMips; inherit (stdenv.lib) optionals optionalString; in @@ -15,14 +15,18 @@ stdenv.mkDerivation rec { sha256 = "8c36a28106d4b683a15c547dfe4cb757a53fa9247579d1cc25bd06a22cc62e50"; }; + # Needed to avoid a SIGBUS on the final executable on mips + NIX_CFLAGS_COMPILE = if stdenv.isMips then "-fPIC" else ""; + prefixKey = "-prefix "; configureFlags = ["-no-tk"] ++ optionals useX11 [ "-x11lib" x11 ]; buildFlags = "world" + optionalString useNativeCompilers " bootstrap world.opt"; buildInputs = [ncurses] ++ optionals useX11 [ x11 ]; installTargets = "install" + optionalString useNativeCompilers " installopt"; - patchPhase = '' + prePatch = '' CAT=$(type -tp cat) sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang + patch -p1 -l < ${./mips64.patch} ''; postBuild = '' ensureDir $out/include diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 813043027a1..ce77ad815de 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -821,7 +821,7 @@ let mktemp = callPackage ../tools/security/mktemp { }; - mldonkey = callPackage ../applications/networking/p2p/mldonkey { }; + mldonkey = misc.debugVersion (callPackage ../applications/networking/p2p/mldonkey { }); monit = builderDefsPackage ../tools/system/monit { flex = flex2535;