3
0
Fork 0
forked from mirrors/nixpkgs

Fix Julia 0.3.0 build (for most purposes). Not making default yet because it is unclear if I missed something important. Failed to make it use external openblas and lapack correctly…

This commit is contained in:
Michael Raskin 2014-08-24 00:24:46 +04:00
parent 252ee7adc9
commit 33ef69390b
6 changed files with 62 additions and 17 deletions

View file

@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
openblas_src = fetchurl {
url = "https://github.com/xianyi/OpenBLAS/tarball/${openblas_ver}";
name = "openblas-${openblas_ver}.tar.gz";
sha256 = "19ffec70f9678f5c159feadc036ca47720681b782910fbaa95aa3867e7e86d8e";
sha256 = "06i0q4qnd5q5xljzrgvda0gjsczc6l2pl9hw6dn2qjpw38al73za";
};
arpack_src = fetchurl rec {
url = "http://forge.scilab.org/index.php/p/arpack-ng/downloads/get/arpack-ng_${arpack_ver}.tar.gz";
@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
lapack_src = fetchurl {
url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz";
name = "lapack-${lapack_ver}.tgz";
sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
sha256 = "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s";
};
lighttpd_src = fetchurl {
url = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${lighttpd_ver}.tar.gz";
@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
];
configurePhase = ''
for i in GMP LLVM PCRE LAPACK OPENBLAS BLAS READLINE FFTW LIBUNWIND SUITESPARSE GLPK LIGHTTPD ZLIB MPFR;
for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK LIGHTTPD ZLIB MPFR;
do
makeFlags="$makeFlags USE_SYSTEM_$i=1 "
done
@ -82,12 +82,13 @@ stdenv.mkDerivation rec {
cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')"
}
for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${patchelf_src}" "${pcre_src}" "${utf8proc_src}"; do
for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${patchelf_src}" \
"${pcre_src}" "${utf8proc_src}" "${lapack_src}" "${openblas_src}"; do
copy_kill_hash "$i" deps
done
${if realGcc ==null then "" else
''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr"''}
''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr -lblas -lopenblas -L$out/lib"''}
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC "
export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia"
@ -105,6 +106,14 @@ stdenv.mkDerivation rec {
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia"
patchShebangs . contrib
export PATH="$PATH:${stdenv.gcc.libc}/sbin"
# ldconfig doesn't seem to ever work on NixOS; system-wide ldconfig cache
# is probably not what we want anyway on non-NixOS
sed -e "s@/sbin/ldconfig@true@" -i src/ccall.*
ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so"
'';
preBuild = ''
@ -126,7 +135,9 @@ stdenv.mkDerivation rec {
done
'';
enableParallelBuilding = false;
dontStrip = true;
enableParallelBuilding = true;
postInstall = ''
rm -f "$out"/lib/julia/sys.{so,dylib,dll}
@ -138,6 +149,6 @@ stdenv.mkDerivation rec {
license = stdenv.lib.licenses.mit;
maintainers = [ stdenv.lib.maintainers.raskin ];
platforms = with stdenv.lib.platforms; linux;
broken = true;
broken = false;
};
}

View file

@ -38,6 +38,7 @@ stdenv.mkDerivation rec {
};
meta = {
inherit version;
description = "Linear Algebra PACKage";
homepage = "http://www.netlib.org/lapack/";
license = "revised-BSD";

View file

@ -2,11 +2,12 @@
let
atlasMaybeShared = atlas.override { inherit shared; };
usedLibExtension = if shared then ".so" else ".a";
version = "3.4.1";
in
stdenv.mkDerivation {
name = "liblapack-3.4.1";
stdenv.mkDerivation rec {
name = "liblapack-${version}";
src = fetchurl {
url = "http://www.netlib.org/lapack/lapack-3.4.1.tgz";
url = "http://www.netlib.org/lapack/lapack-${version}.tgz";
sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
};
@ -37,6 +38,7 @@ stdenv.mkDerivation {
};
meta = {
inherit version;
description = "Linear Algebra PACKage";
homepage = "http://www.netlib.org/lapack/";
license = "revised-BSD";

View file

@ -0,0 +1,32 @@
{ stdenv, fetchurl, gfortran, perl, liblapack }:
stdenv.mkDerivation rec {
version = "0.2.10";
name = "openblas-${version}";
src = fetchurl {
url = "https://github.com/xianyi/OpenBLAS/tarball/v${version}";
sha256 = "06i0q4qnd5q5xljzrgvda0gjsczc6l2pl9hw6dn2qjpw38al73za";
name = "openblas-${version}.tar.gz";
};
preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz";
buildInputs = [gfortran perl];
cpu = builtins.head (stdenv.lib.splitString "-" stdenv.system);
target = if cpu == "i686" then "P2" else
if cpu == "x86_64" then "CORE2" else
# allow autodetect
"";
makeFlags = "${if target != "" then "TARGET=" else ""}${target} FC=gfortran CC=cc PREFIX=\"\$(out)\" INTERFACE64=1";
meta = {
description = "Basic Linear Algebra Subprograms";
license = stdenv.lib.licenses.bsd3;
homepage = "https://github.com/xianyi/OpenBLAS";
platforms = [ "x86_64-linux" ];
};
}

View file

@ -1,12 +1,7 @@
{ stdenv, fetchurl, gfortran, perl }:
{ stdenv, fetchurl, gfortran, perl, liblapack }:
stdenv.mkDerivation rec {
version = "0.2.2";
lapack_version = "3.4.1";
lapack_src = fetchurl {
url = "http://www.netlib.org/lapack/lapack-${lapack_version}.tgz";
sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
};
name = "openblas-${version}";
src = fetchurl {
@ -15,7 +10,7 @@ stdenv.mkDerivation rec {
name = "openblas-${version}.tar.gz";
};
preBuild = "cp ${lapack_src} lapack-${lapack_version}.tgz";
preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz";
buildInputs = [gfortran perl];

View file

@ -3112,6 +3112,7 @@ let
suitesparse = suitesparse.override {
inherit liblapack;
};
openblas = openblas_0_2_10;
llvm = llvm_34;
};
julia = julia021;
@ -10893,6 +10894,9 @@ let
liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { };
openblas = callPackage ../development/libraries/science/math/openblas { };
openblas_0_2_10 = callPackage ../development/libraries/science/math/openblas/0.2.10.nix {
liblapack = liblapack_3_5_0;
};
mathematica = callPackage ../applications/science/math/mathematica { };