2012-09-04 07:32:59 +02:00
|
|
|
{ stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib
|
2012-04-05 14:22:55 +02:00
|
|
|
, readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl
|
2012-08-01 17:03:52 +02:00
|
|
|
, ncurses, libunistring, lighttpd, patchelf, openblas, liblapack
|
2013-06-11 13:44:39 +02:00
|
|
|
, tcl, tk, xproto, libX11, git, mpfr
|
2012-04-05 14:22:55 +02:00
|
|
|
} :
|
|
|
|
let
|
2014-12-17 19:11:30 +01:00
|
|
|
realGcc = stdenv.cc.gcc;
|
2012-04-05 14:22:55 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "julia";
|
2014-03-28 11:39:26 +01:00
|
|
|
version = "0.2.1";
|
|
|
|
name = "${pname}-${version}";
|
2012-04-05 14:22:55 +02:00
|
|
|
|
2012-08-01 17:03:52 +02:00
|
|
|
grisu_ver = "1.1.1";
|
2012-09-23 03:10:42 +02:00
|
|
|
dsfmt_ver = "2.2";
|
2012-08-01 17:03:52 +02:00
|
|
|
openblas_ver = "v0.2.2";
|
|
|
|
lapack_ver = "3.4.1";
|
2013-06-11 13:44:39 +02:00
|
|
|
arpack_ver = "3.1.3";
|
2012-04-05 14:22:55 +02:00
|
|
|
clp_ver = "1.14.5";
|
|
|
|
lighttpd_ver = "1.4.29";
|
2012-11-28 13:19:26 +01:00
|
|
|
patchelf_ver = "0.6";
|
2013-02-05 08:24:00 +01:00
|
|
|
pcre_ver = "8.31";
|
2012-04-05 14:22:55 +02:00
|
|
|
|
|
|
|
grisu_src = fetchurl {
|
|
|
|
url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz";
|
2012-08-01 17:03:52 +02:00
|
|
|
sha256 = "e1cabb73fd69e74f145aea91100cde483aef8b79dc730fcda0a34466730d4d1d";
|
2012-04-05 14:22:55 +02:00
|
|
|
};
|
|
|
|
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";
|
2012-09-23 03:10:42 +02:00
|
|
|
sha256 = "bc3947a9b2253a869fcbab8ff395416cb12958be9dba10793db2cd7e37b26899";
|
2012-04-05 14:22:55 +02:00
|
|
|
};
|
2012-08-01 17:03:52 +02:00
|
|
|
openblas_src = fetchurl {
|
|
|
|
url = "https://github.com/xianyi/OpenBLAS/tarball/${openblas_ver}";
|
|
|
|
name = "openblas-${openblas_ver}.tar.gz";
|
|
|
|
sha256 = "19ffec70f9678f5c159feadc036ca47720681b782910fbaa95aa3867e7e86d8e";
|
|
|
|
};
|
2012-04-05 14:22:55 +02:00
|
|
|
arpack_src = fetchurl {
|
2013-06-11 13:44:39 +02:00
|
|
|
url = "http://forge.scilab.org/index.php/p/arpack-ng/downloads/607/get/";
|
|
|
|
name = "arpack-ng-${arpack_ver}.tar.gz";
|
|
|
|
sha256 = "039w7j3dr1xy35a3hp92zg2g92gmjq6xsv0g4awlb4cffy09nr2d";
|
2012-08-01 17:03:52 +02:00
|
|
|
};
|
|
|
|
lapack_src = fetchurl {
|
|
|
|
url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz";
|
|
|
|
name = "lapack-${lapack_ver}.tgz";
|
|
|
|
sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f";
|
2012-04-05 14:22:55 +02:00
|
|
|
};
|
|
|
|
clp_src = fetchurl {
|
|
|
|
url = "http://www.coin-or.org/download/source/Clp/Clp-${clp_ver}.tgz";
|
|
|
|
name = "clp-${clp_ver}.tar.gz";
|
|
|
|
sha256 = "e6cabe8b4319c17a9bbe6fe172194ab6cd1fe6e376f5e9969d3040636ea3a817";
|
|
|
|
};
|
|
|
|
lighttpd_src = fetchurl {
|
|
|
|
url = "http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${lighttpd_ver}.tar.gz";
|
|
|
|
sha256 = "ff9f4de3901d03bb285634c5b149191223d17f1c269a16c863bac44238119c85";
|
|
|
|
};
|
2012-11-28 13:19:26 +01:00
|
|
|
patchelf_src = fetchurl {
|
|
|
|
url = "http://hydra.nixos.org/build/1524660/download/2/patchelf-${patchelf_ver}.tar.bz2";
|
|
|
|
sha256 = "00bw29vdsscsili65wcb5ay0gvg1w0ljd00sb5xc6br8bylpyzpw";
|
|
|
|
};
|
2013-02-05 08:24:00 +01:00
|
|
|
pcre_src = fetchurl {
|
|
|
|
url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${pcre_ver}.tar.bz2";
|
|
|
|
sha256 = "0g4c0z4h30v8g8qg02zcbv7n67j5kz0ri9cfhgkpwg276ljs0y2p";
|
|
|
|
};
|
2012-04-05 14:22:55 +02:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://github.com/JuliaLang/julia.git";
|
2014-11-14 16:05:33 +01:00
|
|
|
rev = "refs/tags/v${version}";
|
2014-03-28 11:39:26 +01:00
|
|
|
sha256 = "7ee0f267bc1ae286764ced3c0c695c335a6f8d67bd7b3ca7e4de259333c9426a";
|
2012-04-05 14:22:55 +02:00
|
|
|
};
|
|
|
|
|
2012-09-04 07:32:59 +02:00
|
|
|
buildInputs = [ gfortran perl m4 gmp pcre llvm readline zlib
|
2012-05-02 05:14:05 +02:00
|
|
|
fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf
|
2013-06-11 13:44:39 +02:00
|
|
|
openblas liblapack tcl tk xproto libX11 git mpfr
|
2012-04-05 14:22:55 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
2014-03-28 11:39:26 +01:00
|
|
|
for i in GMP LLVM PCRE LAPACK OPENBLAS BLAS READLINE FFTW LIBUNWIND SUITESPARSE GLPK LIGHTTPD ZLIB MPFR;
|
|
|
|
do
|
2012-12-08 23:51:06 +01:00
|
|
|
makeFlags="$makeFlags USE_SYSTEM_$i=1 "
|
2012-04-05 14:22:55 +02:00
|
|
|
done
|
2014-11-14 16:05:33 +01:00
|
|
|
makeFlags="$makeFlags JULIA_CPU_TARGET=core2";
|
2012-04-05 14:22:55 +02:00
|
|
|
|
|
|
|
copy_kill_hash(){
|
|
|
|
cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')"
|
|
|
|
}
|
|
|
|
|
2013-02-05 08:24:00 +01:00
|
|
|
for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${clp_src}" "${patchelf_src}" "${pcre_src}" ; do
|
2012-05-02 05:14:05 +02:00
|
|
|
copy_kill_hash "$i" deps
|
2012-04-05 14:22:55 +02:00
|
|
|
done
|
2012-05-02 05:14:05 +02:00
|
|
|
copy_kill_hash "${dsfmt_src}" deps/random
|
2012-04-05 14:22:55 +02:00
|
|
|
|
2012-04-05 21:07:14 +02:00
|
|
|
${if realGcc ==null then "" else
|
2013-06-11 13:44:39 +02:00
|
|
|
''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr"''}
|
2012-11-28 13:19:26 +01:00
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC "
|
2012-04-05 14:22:55 +02:00
|
|
|
|
2012-11-22 14:30:33 +01:00
|
|
|
export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia"
|
2012-05-02 05:14:05 +02:00
|
|
|
|
2012-08-01 17:03:52 +02:00
|
|
|
export GLPK_PREFIX="${glpk}/include"
|
|
|
|
|
2012-05-02 05:14:05 +02:00
|
|
|
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
|
2012-11-22 14:30:33 +01:00
|
|
|
|
2012-11-06 19:35:51 +01:00
|
|
|
export makeFlags="$makeFlags PREFIX=$out SHELL=${stdenv.shell}"
|
2012-05-02 05:14:05 +02:00
|
|
|
|
|
|
|
export dontPatchELF=1
|
2012-11-22 14:30:33 +01:00
|
|
|
|
|
|
|
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia"
|
2012-04-05 14:22:55 +02:00
|
|
|
'';
|
|
|
|
|
2012-08-01 17:03:52 +02:00
|
|
|
preBuild = ''
|
2012-11-28 13:19:26 +01:00
|
|
|
mkdir -p usr/lib
|
2013-06-11 13:44:39 +02:00
|
|
|
|
|
|
|
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
|
2012-08-01 17:03:52 +02:00
|
|
|
'';
|
2012-04-10 16:53:39 +02:00
|
|
|
|
2012-12-09 17:06:34 +01:00
|
|
|
preInstall = ''
|
2012-04-05 14:22:55 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2013-10-06 11:49:53 +02:00
|
|
|
description = "High-level performance-oriented dynamical language for technical computing";
|
2012-04-05 14:22:55 +02:00
|
|
|
homepage = "http://julialang.org/";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.raskin ];
|
|
|
|
platforms = with stdenv.lib.platforms; linux;
|
|
|
|
};
|
|
|
|
}
|