My attempts to build mldonkey on the fuloong

svn path=/nixpkgs/branches/stdenv-updates/; revision=24034
This commit is contained in:
Lluís Batlle i Rossell 2010-10-03 09:18:31 +00:00
parent bc92057a17
commit 0c7429f8cc
4 changed files with 28 additions and 6 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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;