2014-11-02 20:51:25 +00:00
|
|
|
{ stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib
|
|
|
|
, readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl
|
2014-11-25 16:24:25 +00:00
|
|
|
, ncurses, libunistring, patchelf, openblas, liblapack
|
2015-01-10 06:37:01 +00:00
|
|
|
, tcl, tk, xproto, libX11, git, mpfr, which, wget
|
2014-11-02 20:51:25 +00:00
|
|
|
} :
|
|
|
|
|
|
|
|
assert stdenv.isLinux;
|
|
|
|
|
|
|
|
let
|
2015-01-15 04:25:26 +00:00
|
|
|
realGcc = stdenv.cc.cc;
|
2014-11-02 20:51:25 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "julia";
|
2015-02-19 08:07:20 +00:00
|
|
|
version = "0.3.6";
|
2014-11-02 20:51:25 +00:00
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
|
|
|
dsfmt_ver = "2.2";
|
|
|
|
grisu_ver = "1.1.1";
|
2015-01-11 22:46:38 +00:00
|
|
|
openblas_ver = "v0.2.13";
|
2014-11-02 20:51:25 +00:00
|
|
|
lapack_ver = "3.5.0";
|
|
|
|
arpack_ver = "3.1.5";
|
2014-11-25 16:24:25 +00:00
|
|
|
patchelf_ver = "0.8";
|
|
|
|
pcre_ver = "8.36";
|
2014-11-02 20:51:25 +00:00
|
|
|
utf8proc_ver = "1.1.6";
|
|
|
|
|
|
|
|
dsfmt_src = fetchurl {
|
|
|
|
url = "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-${dsfmt_ver}.tar.gz";
|
|
|
|
name = "dsfmt-${dsfmt_ver}.tar.gz";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "cb61be3be7254eae39684612c524740d";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
grisu_src = fetchurl {
|
|
|
|
url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "29b533ed4311161267bff1a9a97e2953";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
openblas_src = fetchurl {
|
|
|
|
url = "https://github.com/xianyi/OpenBLAS/tarball/${openblas_ver}";
|
|
|
|
name = "openblas-${openblas_ver}.tar.gz";
|
2015-01-11 22:46:38 +00:00
|
|
|
md5 = "74adf4c0d0d82bff4774be5bf2134183";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
arpack_src = fetchurl rec {
|
|
|
|
url = "https://github.com/opencollab/arpack-ng/archive/${arpack_ver}.tar.gz";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "d84e1b6108d9ee67c0d21aba7099e953";
|
2014-11-02 20:51:25 +00:00
|
|
|
name = "arpack-ng-${arpack_ver}.tar.gz";
|
|
|
|
};
|
|
|
|
lapack_src = fetchurl {
|
|
|
|
url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz";
|
|
|
|
name = "lapack-${lapack_ver}.tgz";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "b1d3e3e425b2e44a06760ff173104bdf";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
patchelf_src = fetchurl {
|
|
|
|
url = "http://hydra.nixos.org/build/1524660/download/2/patchelf-${patchelf_ver}.tar.bz2";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "5087261514b4b5814a39c3d3a36eb6ef";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
pcre_src = fetchurl {
|
|
|
|
url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${pcre_ver}.tar.bz2";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "b767bc9af0c20bc9c1fe403b0d41ad97";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
utf8proc_src = fetchurl {
|
|
|
|
url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz";
|
2014-11-25 16:24:25 +00:00
|
|
|
md5 = "2462346301fac2994c34f5574d6c3ca7";
|
2014-11-02 20:51:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://github.com/JuliaLang/julia.git";
|
|
|
|
rev = "refs/tags/v${version}";
|
2015-02-19 08:07:20 +00:00
|
|
|
md5 = "d28e8f428485219f756d80c011d5dd32";
|
2014-11-02 20:51:25 +00:00
|
|
|
name = "julia-git-v${version}";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ gfortran perl m4 gmp pcre llvm readline zlib
|
|
|
|
fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf
|
2015-01-10 06:37:01 +00:00
|
|
|
openblas liblapack tcl tk xproto libX11 git mpfr which wget
|
2014-11-02 20:51:25 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
2014-11-25 16:24:25 +00:00
|
|
|
for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK ZLIB MPFR;
|
2014-11-02 20:51:25 +00:00
|
|
|
do
|
|
|
|
makeFlags="$makeFlags USE_SYSTEM_$i=1 "
|
|
|
|
done
|
2014-11-14 15:05:33 +00:00
|
|
|
makeFlags="$makeFlags JULIA_CPU_TARGET=core2";
|
2014-11-02 20:51:25 +00:00
|
|
|
|
|
|
|
copy_kill_hash(){
|
|
|
|
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}" "${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 -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"
|
|
|
|
|
|
|
|
export GLPK_PREFIX="${glpk}/include"
|
|
|
|
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile
|
|
|
|
sed -e "s@/usr/lib@$out/lib@g" -i deps/Makefile
|
|
|
|
|
|
|
|
export makeFlags="$makeFlags PREFIX=$out SHELL=${stdenv.shell} prefix=$out"
|
|
|
|
|
|
|
|
export dontPatchELF=1
|
|
|
|
|
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia"
|
|
|
|
|
|
|
|
patchShebangs . contrib
|
|
|
|
|
2014-12-26 17:28:15 +00:00
|
|
|
export PATH="$PATH:${stdenv.cc.libc}/sbin"
|
2014-11-02 20:51:25 +00:00
|
|
|
|
|
|
|
# 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 = ''
|
|
|
|
mkdir -p usr/lib
|
|
|
|
|
|
|
|
echo "$out"
|
|
|
|
mkdir -p "$out/lib"
|
|
|
|
(
|
|
|
|
cd "$(mktemp -d)"
|
|
|
|
for i in "${suitesparse}"/lib/lib*.a; do
|
|
|
|
ar -x $i
|
|
|
|
done
|
|
|
|
gcc *.o --shared -o "$out/lib/libsuitesparse.so"
|
|
|
|
)
|
|
|
|
cp "$out/lib/libsuitesparse.so" usr/lib
|
|
|
|
for i in umfpack cholmod amd camd colamd spqr; do
|
|
|
|
ln -s libsuitesparse.so "$out"/lib/lib$i.so;
|
|
|
|
ln -s libsuitesparse.so "usr"/lib/lib$i.so;
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2015-01-19 16:52:26 +00:00
|
|
|
doCheck = true;
|
|
|
|
checkTarget = "testall";
|
|
|
|
|
2014-11-02 20:51:25 +00:00
|
|
|
meta = {
|
|
|
|
description = "High-level performance-oriented dynamical language for technical computing";
|
|
|
|
homepage = "http://julialang.org/";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.raskin ];
|
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
|
|
|
broken = false;
|
|
|
|
};
|
|
|
|
}
|