2014-11-02 21:51:25 +01:00
|
|
|
{ stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib
|
2015-06-04 01:15:08 +02:00
|
|
|
, readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl
|
2015-06-04 14:17:38 +02:00
|
|
|
, ncurses, libunistring, patchelf, openblas, arpack
|
2015-06-04 01:15:08 +02:00
|
|
|
, tcl, tk, xproto, libX11, git, mpfr, which
|
|
|
|
}:
|
2014-11-02 21:51:25 +01:00
|
|
|
|
2015-06-04 01:15:08 +02:00
|
|
|
with stdenv.lib;
|
2014-11-02 21:51:25 +01:00
|
|
|
|
|
|
|
let
|
2015-01-15 05:25:26 +01:00
|
|
|
realGcc = stdenv.cc.cc;
|
2015-06-04 01:15:08 +02:00
|
|
|
arch = head (splitString "-" stdenv.system);
|
|
|
|
march =
|
|
|
|
{
|
|
|
|
"x86_64-linux" = "x86-64";
|
|
|
|
"i686-linux" = "i686";
|
|
|
|
}."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
|
2014-11-02 21:51:25 +01:00
|
|
|
|
|
|
|
dsfmt_ver = "2.2";
|
|
|
|
grisu_ver = "1.1.1";
|
|
|
|
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 17:24:25 +01:00
|
|
|
md5 = "cb61be3be7254eae39684612c524740d";
|
2014-11-02 21:51:25 +01:00
|
|
|
};
|
|
|
|
grisu_src = fetchurl {
|
|
|
|
url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz";
|
2014-11-25 17:24:25 +01:00
|
|
|
md5 = "29b533ed4311161267bff1a9a97e2953";
|
2014-11-02 21:51:25 +01: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 17:24:25 +01:00
|
|
|
md5 = "2462346301fac2994c34f5574d6c3ca7";
|
2014-11-02 21:51:25 +01:00
|
|
|
};
|
2015-06-04 01:15:08 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "julia";
|
|
|
|
version = "0.3.6";
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
2015-06-04 14:17:38 +02:00
|
|
|
extraSrcs = [ dsfmt_src grisu_src utf8proc_src ];
|
2014-11-02 21:51:25 +01:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://github.com/JuliaLang/julia.git";
|
|
|
|
rev = "refs/tags/v${version}";
|
2015-02-19 09:07:20 +01:00
|
|
|
md5 = "d28e8f428485219f756d80c011d5dd32";
|
2014-11-02 21:51:25 +01:00
|
|
|
name = "julia-git-v${version}";
|
|
|
|
};
|
|
|
|
|
2015-06-04 01:15:08 +02:00
|
|
|
buildInputs =
|
|
|
|
[
|
|
|
|
gfortran perl m4 gmp pcre llvm readline zlib
|
|
|
|
fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf
|
2015-06-04 14:17:38 +02:00
|
|
|
arpack openblas tcl tk xproto libX11 git mpfr which
|
2015-06-04 01:15:08 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
makeFlags =
|
|
|
|
[
|
|
|
|
"USE_SYSTEM_PATCHELF=1"
|
|
|
|
"USE_SYSTEM_BLAS=1"
|
|
|
|
"USE_SYSTEM_LAPACK=1"
|
2015-06-04 14:17:38 +02:00
|
|
|
"USE_SYSTEM_ARPACK=1"
|
2015-06-04 01:15:08 +02:00
|
|
|
"ARCH=${arch}"
|
|
|
|
"MARCH=${march}"
|
|
|
|
"JULIA_CPU_TARGET=${march}"
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"prefix=$(out)"
|
|
|
|
"SHELL=${stdenv.shell}"
|
2014-11-02 21:51:25 +01:00
|
|
|
];
|
|
|
|
|
2015-06-04 01:15:08 +02:00
|
|
|
GLPK_PREFIX = "${glpk}/include";
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = [ "-fPIC" ];
|
|
|
|
NIX_LDFLAGS =
|
|
|
|
optionals
|
|
|
|
(realGcc != null)
|
|
|
|
[
|
|
|
|
"-L${realGcc}/lib"
|
|
|
|
"-L${realGcc}/lib64"
|
|
|
|
"-lpcre" "-lm" "-lfftw3f" "-lfftw3" "-lglpk"
|
|
|
|
"-lunistring" "-lz" "-lgmp" "-lmpfr" "-lopenblas"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile
|
|
|
|
sed -e "s@/usr/lib@$out/lib@g" -i deps/Makefile
|
|
|
|
|
|
|
|
patchShebangs . contrib
|
|
|
|
|
|
|
|
# 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.*
|
|
|
|
'';
|
|
|
|
|
2014-11-02 21:51:25 +01:00
|
|
|
configurePhase = ''
|
2014-11-25 17:24:25 +01:00
|
|
|
for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK ZLIB MPFR;
|
2014-11-02 21:51:25 +01:00
|
|
|
do
|
|
|
|
makeFlags="$makeFlags USE_SYSTEM_$i=1 "
|
|
|
|
done
|
|
|
|
|
|
|
|
copy_kill_hash(){
|
|
|
|
cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')"
|
|
|
|
}
|
|
|
|
|
2015-06-04 01:15:08 +02:00
|
|
|
for i in $extraSrcs; do
|
2014-11-02 21:51:25 +01:00
|
|
|
copy_kill_hash "$i" deps
|
|
|
|
done
|
|
|
|
|
2015-06-04 01:15:08 +02:00
|
|
|
${if realGcc ==null then "" else ''export NIX_LDFLAGS="$NIX_LDFLAGS -L$out/lib"''}
|
2014-11-02 21:51:25 +01:00
|
|
|
|
|
|
|
export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia"
|
|
|
|
|
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia"
|
|
|
|
|
2014-12-26 18:28:15 +01:00
|
|
|
export PATH="$PATH:${stdenv.cc.libc}/sbin"
|
2014-11-02 21:51:25 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preBuild = ''
|
2015-06-04 14:09:29 +02:00
|
|
|
# Link dynamically loaded shared libraries into output so they are found at runtime.
|
2015-06-04 15:35:54 +02:00
|
|
|
mkdir -p "$out/lib/julia"
|
|
|
|
ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/libblas.so"
|
|
|
|
ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/liblapack.so"
|
|
|
|
ln -s "${suitesparse}/lib/libsuitesparse.so" "$out/lib/julia/libsuitesparse.so"
|
2015-06-04 14:17:38 +02:00
|
|
|
ln -s "${arpack}/lib/libarpack.so" "$out/lib/julia/libarpack.so"
|
2014-11-02 21:51:25 +01:00
|
|
|
for i in umfpack cholmod amd camd colamd spqr; do
|
2015-06-04 15:35:54 +02:00
|
|
|
ln -s libsuitesparse.so "$out/lib/julia/lib$i.so";
|
2014-11-02 21:51:25 +01:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
2015-06-04 01:15:08 +02:00
|
|
|
dontPatchELF = true;
|
2014-11-02 21:51:25 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2015-01-19 17:52:26 +01:00
|
|
|
doCheck = true;
|
|
|
|
checkTarget = "testall";
|
|
|
|
|
2014-11-02 21:51:25 +01:00
|
|
|
meta = {
|
|
|
|
description = "High-level performance-oriented dynamical language for technical computing";
|
|
|
|
homepage = "http://julialang.org/";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
2015-06-04 01:15:08 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ raskin ttuegel ];
|
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
2014-11-02 21:51:25 +01:00
|
|
|
broken = false;
|
|
|
|
};
|
|
|
|
}
|