2015-06-04 19:18:45 +01:00
|
|
|
{ stdenv, fetchgit, fetchurl
|
|
|
|
# build tools
|
|
|
|
, gfortran, git, m4, patchelf, perl, which
|
|
|
|
# libjulia dependencies
|
|
|
|
, libunwind, llvm, readline, utf8proc, zlib
|
|
|
|
# standard library dependencies
|
|
|
|
, double_conversion, fftwSinglePrec, fftw, glpk, gmp, mpfr, pcre
|
|
|
|
, openblas, arpack, suitesparse
|
2015-06-04 00:15:08 +01:00
|
|
|
}:
|
2014-11-02 20:51:25 +00:00
|
|
|
|
2015-06-04 00:15:08 +01:00
|
|
|
with stdenv.lib;
|
2014-11-02 20:51:25 +00:00
|
|
|
|
2015-06-04 00:15:08 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "julia";
|
2015-06-04 18:36:34 +01:00
|
|
|
version = "0.3.9";
|
2015-06-04 00:15:08 +01:00
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
2014-11-02 20:51:25 +00:00
|
|
|
src = fetchgit {
|
|
|
|
url = "git://github.com/JuliaLang/julia.git";
|
|
|
|
rev = "refs/tags/v${version}";
|
2015-06-04 18:36:34 +01:00
|
|
|
sha256 = "ad0820affefd04eb6fba7deb2603756974711846a251900a9202b8d2665a37cf";
|
2014-11-02 20:51:25 +00:00
|
|
|
name = "julia-git-v${version}";
|
|
|
|
};
|
|
|
|
|
2015-06-04 18:36:34 +01:00
|
|
|
patches = [ ./0001-work-around-buggy-wcwidth.patch ];
|
|
|
|
|
2015-06-04 17:07:44 +01:00
|
|
|
extraSrcs =
|
|
|
|
let
|
|
|
|
dsfmt_ver = "2.2";
|
|
|
|
|
|
|
|
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";
|
|
|
|
md5 = "cb61be3be7254eae39684612c524740d";
|
|
|
|
};
|
2015-06-04 19:18:45 +01:00
|
|
|
in [ dsfmt_src ];
|
2015-06-04 17:07:44 +01:00
|
|
|
|
2015-06-04 19:31:15 +01:00
|
|
|
prePatch = ''
|
|
|
|
copy_kill_hash(){
|
|
|
|
cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')"
|
|
|
|
}
|
|
|
|
|
|
|
|
for i in $extraSrcs; do
|
|
|
|
copy_kill_hash "$i" deps
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i deps/Makefile \
|
|
|
|
-e "s@/usr/local/lib@$out/lib@g" \
|
|
|
|
-e "s@/usr/lib@$out/lib@g" \
|
|
|
|
-e "s@/usr/include/double-conversion@${double_conversion}/include/double-conversion@g"
|
|
|
|
|
|
|
|
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.*
|
|
|
|
'';
|
|
|
|
|
2015-06-04 00:15:08 +01:00
|
|
|
buildInputs =
|
2015-06-04 19:18:45 +01:00
|
|
|
[ libunwind llvm readline utf8proc zlib
|
|
|
|
double_conversion fftw fftwSinglePrec glpk gmp mpfr pcre
|
|
|
|
openblas arpack suitesparse
|
2015-06-04 00:15:08 +01:00
|
|
|
];
|
|
|
|
|
2015-06-04 19:18:45 +01:00
|
|
|
nativeBuildInputs = [ gfortran git m4 patchelf perl which ];
|
2015-06-04 18:38:36 +01:00
|
|
|
|
2015-06-04 00:15:08 +01:00
|
|
|
makeFlags =
|
2015-06-04 17:07:44 +01:00
|
|
|
let
|
|
|
|
arch = head (splitString "-" stdenv.system);
|
|
|
|
march =
|
2015-06-04 19:18:45 +01:00
|
|
|
{ "x86_64-linux" = "x86-64";
|
|
|
|
"x86_64-darwin" = "x86-64";
|
2015-06-04 17:07:44 +01:00
|
|
|
"i686-linux" = "i686";
|
|
|
|
}."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
|
|
|
|
in [
|
2015-06-04 00:15:08 +01:00
|
|
|
"ARCH=${arch}"
|
|
|
|
"MARCH=${march}"
|
|
|
|
"JULIA_CPU_TARGET=${march}"
|
|
|
|
"PREFIX=$(out)"
|
|
|
|
"prefix=$(out)"
|
|
|
|
"SHELL=${stdenv.shell}"
|
2015-06-04 17:07:44 +01:00
|
|
|
|
|
|
|
"USE_SYSTEM_BLAS=1"
|
|
|
|
"LIBBLAS=-lopenblas"
|
|
|
|
"LIBBLASNAME=libopenblas"
|
|
|
|
|
|
|
|
"USE_SYSTEM_LAPACK=1"
|
|
|
|
"LIBLAPACK=-lopenblas"
|
|
|
|
"LIBLAPACKNAME=libopenblas"
|
|
|
|
|
|
|
|
"USE_SYSTEM_ARPACK=1"
|
2015-06-04 19:31:15 +01:00
|
|
|
"USE_SYSTEM_FFTW=1"
|
|
|
|
"USE_SYSTEM_GLPK=1"
|
|
|
|
"USE_SYSTEM_GMP=1"
|
2015-06-04 19:18:45 +01:00
|
|
|
"USE_SYSTEM_GRISU=1"
|
2015-06-04 19:31:15 +01:00
|
|
|
"USE_SYSTEM_LIBUNWIND=1"
|
|
|
|
"USE_SYSTEM_LLVM=1"
|
|
|
|
"USE_SYSTEM_MPFR=1"
|
2015-06-04 19:18:45 +01:00
|
|
|
"USE_SYSTEM_PATCHELF=1"
|
2015-06-04 19:31:15 +01:00
|
|
|
"USE_SYSTEM_PCRE=1"
|
|
|
|
"USE_SYSTEM_READLINE=1"
|
|
|
|
"USE_SYSTEM_SUITESPARSE=1"
|
2015-06-04 18:38:36 +01:00
|
|
|
"USE_SYSTEM_UTF8PROC=1"
|
2015-06-04 19:31:15 +01:00
|
|
|
"USE_SYSTEM_ZLIB=1"
|
2014-11-02 20:51:25 +00:00
|
|
|
];
|
|
|
|
|
2015-06-04 00:15:08 +01:00
|
|
|
GLPK_PREFIX = "${glpk}/include";
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = [ "-fPIC" ];
|
|
|
|
|
2015-06-04 17:07:44 +01:00
|
|
|
# Julia tries to load these libraries dynamically at runtime, but they can't be found.
|
|
|
|
# Easier by far to link against them as usual.
|
|
|
|
# These go in LDFLAGS, where they affect only Julia itself, and not NIX_LDFLAGS,
|
|
|
|
# where they would also be used for all the private libraries Julia builds.
|
|
|
|
LDFLAGS = [
|
|
|
|
"-larpack"
|
|
|
|
"-lfftw3_threads"
|
|
|
|
"-lfftw3f_threads"
|
|
|
|
"-lglpk"
|
|
|
|
"-lgmp"
|
|
|
|
"-lmpfr"
|
|
|
|
"-lopenblas"
|
|
|
|
"-lpcre"
|
|
|
|
"-lsuitesparse"
|
|
|
|
"-lz"
|
|
|
|
];
|
|
|
|
|
2014-11-02 20:51:25 +00:00
|
|
|
dontStrip = true;
|
2015-06-04 00:15:08 +01:00
|
|
|
dontPatchELF = true;
|
2014-11-02 20:51:25 +00:00
|
|
|
|
|
|
|
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;
|
2015-06-04 00:15:08 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ raskin ttuegel ];
|
|
|
|
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
|
2014-11-02 20:51:25 +00:00
|
|
|
broken = false;
|
|
|
|
};
|
|
|
|
}
|