diff --git a/pkgs/development/compilers/julia/0001-use-system-utf8proc.patch b/pkgs/development/compilers/julia/0001-use-system-utf8proc.patch new file mode 100644 index 000000000000..b93654a88965 --- /dev/null +++ b/pkgs/development/compilers/julia/0001-use-system-utf8proc.patch @@ -0,0 +1,29 @@ +From 54a66b5728ec98f44a1768f064509be4fd3f2ef6 Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel +Date: Sat, 10 Oct 2015 13:09:48 -0500 +Subject: [PATCH 1/3] use system utf8proc + +--- + src/flisp/Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/flisp/Makefile b/src/flisp/Makefile +index bec8624..5437b5c 100644 +--- a/src/flisp/Makefile ++++ b/src/flisp/Makefile +@@ -24,9 +24,9 @@ DOBJS = $(SRCS:%.c=$(BUILDDIR)/%.dbg.obj) + LLTDIR = ../support + LLT_release = $(BUILDDIR)/$(LLTDIR)/libsupport.a + LLT_debug = $(BUILDDIR)/$(LLTDIR)/libsupport-debug.a +-LIBFILES_release = $(LLT_release) $(LIBUV) $(LIBUTF8PROC) +-LIBFILES_debug = $(LLT_debug) $(LIBUV) $(LIBUTF8PROC) +-LIBS = ++LIBFILES_release = $(LLT_release) $(LIBUV) ++LIBFILES_debug = $(LLT_debug) $(LIBUV) ++LIBS = $(LIBUTF8PROC) + ifneq ($(OS),WINNT) + LIBS += -lpthread + endif +-- +2.5.2 + diff --git a/pkgs/development/compilers/julia/0002-use-system-suitesparse.patch b/pkgs/development/compilers/julia/0002-use-system-suitesparse.patch new file mode 100644 index 000000000000..17f49ad5ca9f --- /dev/null +++ b/pkgs/development/compilers/julia/0002-use-system-suitesparse.patch @@ -0,0 +1,25 @@ +From e2b0ed6664fe4adfd0f9ce8fa14732d47b30ab5c Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel +Date: Sat, 10 Oct 2015 16:18:53 -0500 +Subject: [PATCH 2/3] use system suitesparse + +--- + base/sparse/cholmod.jl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl +index ec7e980..f834cc1 100644 +--- a/base/sparse/cholmod.jl ++++ b/base/sparse/cholmod.jl +@@ -151,7 +151,7 @@ function __init__() + + # Register gc tracked allocator if CHOLMOD is new enough + if current_version >= v"3.0.0" +- cnfg = cglobal((:SuiteSparse_config, :libsuitesparseconfig), Ptr{Void}) ++ cnfg = cglobal((:SuiteSparse_config, :libsuitesparse), Ptr{Void}) + unsafe_store!(cnfg, cglobal(:jl_malloc, Ptr{Void}), 1) + unsafe_store!(cnfg, cglobal(:jl_calloc, Ptr{Void}), 2) + unsafe_store!(cnfg, cglobal(:jl_realloc, Ptr{Void}), 3) +-- +2.5.2 + diff --git a/pkgs/development/compilers/julia/0003-no-ldconfig.patch b/pkgs/development/compilers/julia/0003-no-ldconfig.patch new file mode 100644 index 000000000000..d490b7049278 --- /dev/null +++ b/pkgs/development/compilers/julia/0003-no-ldconfig.patch @@ -0,0 +1,29 @@ +From 8802fe583eda93a928739cb3bc3517e19d1a6fa1 Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel +Date: Sun, 11 Oct 2015 07:19:42 -0500 +Subject: [PATCH 3/3] no ldconfig + +--- + src/ccall.cpp | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/src/ccall.cpp b/src/ccall.cpp +index 22015ff..2821192 100644 +--- a/src/ccall.cpp ++++ b/src/ccall.cpp +@@ -13,11 +13,7 @@ extern "C" DLLEXPORT void jl_read_sonames(void) + { + char *line=NULL; + size_t sz=0; +-#if defined(__linux__) +- FILE *ldc = popen("/sbin/ldconfig -p", "r"); +-#else +- FILE *ldc = popen("/sbin/ldconfig -r", "r"); +-#endif ++ FILE *ldc = popen("true", "r"); + + while (!feof(ldc)) { + ssize_t n = getline(&line, &sz, ldc); +-- +2.5.2 + diff --git a/pkgs/development/compilers/julia/default.nix b/pkgs/development/compilers/julia/default.nix new file mode 100644 index 000000000000..5df0a35aae8e --- /dev/null +++ b/pkgs/development/compilers/julia/default.nix @@ -0,0 +1,157 @@ +{ stdenv, fetchgit, fetchurl +# build tools +, gfortran, m4, makeWrapper, patchelf, perl, which, python2 +# libjulia dependencies +, libunwind, llvm, readline, utf8proc, zlib +# standard library dependencies +, curl, fftwSinglePrec, fftw, gmp, libgit2, mpfr, openlibm, openspecfun, pcre2 +# linear algebra +, openblas, arpack, suitesparse +}: + +with stdenv.lib; + +# All dependencies must use the same OpenBLAS. +let + arpack_ = arpack; + suitesparse_ = suitesparse; +in +let + arpack = arpack_.override { inherit openblas; }; + suitesparse = suitesparse_.override { inherit openblas; }; +in + +let + dsfmtVersion = "2.2.3"; + dsfmt = fetchurl { + url = "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-${dsfmtVersion}.tar.gz"; + sha256 = "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42"; + }; + + libuvVersion = "28f5f06b5ff6f010d666ec26552e0badaca5cdcd"; + libuv = fetchurl { + url = "https://api.github.com/repos/JuliaLang/libuv/tarball/${libuvVersion}"; + sha256 = "1ksns0aiayxmxffvq2kc96904mxlmbkfc30xxck69xnidr2jvr4a"; + }; + + rmathVersion = "0.1"; + rmath-julia = fetchurl { + url = "https://api.github.com/repos/JuliaLang/Rmath-julia/tarball/v${rmathVersion}"; + sha256 = "0ai5dhjc43zcvangz123ryxmlbm51s21rg13bllwyn98w67arhb4"; + }; +in + +stdenv.mkDerivation rec { + pname = "julia"; + version = "0.4.0"; + name = "${pname}-${version}"; + + src = fetchurl { + url = "https://github.com/JuliaLang/${pname}/releases/download/v${version}/${name}.tar.gz"; + sha256 = "00k53hzbawpqvmkkyzcvbmf1d0ycshzdqk19nwsifv1rmiwjj7ss"; + }; + + prePatch = '' + cp "${dsfmt}" "./deps/dsfmt-${dsfmtVersion}.tar.gz" + cp "${rmath-julia}" "./deps/Rmath-julia-${rmathVersion}.tar.gz" + cp "${libuv}" "./deps/libuv-${libuvVersion}.tar.gz" + ''; + + patches = [ + ./0001-use-system-utf8proc.patch + ./0002-use-system-suitesparse.patch + ./0003-no-ldconfig.patch + ]; + + postPatch = '' + patchShebangs . contrib + ''; + + buildInputs = [ + arpack fftw fftwSinglePrec gmp libgit2 libunwind llvm mpfr + pcre2 openblas openlibm openspecfun readline suitesparse utf8proc + zlib + ]; + + nativeBuildInputs = [ curl gfortran m4 makeWrapper patchelf perl python2 which ]; + + makeFlags = + let + arch = head (splitString "-" stdenv.system); + march = { "x86_64" = "x86-64"; "i686" = "i686"; }."${arch}" + or (throw "unsupported architecture: ${arch}"); + # Julia requires Pentium 4 (SSE2) or better + cpuTarget = { "x86_64" = "x86-64"; "i686" = "pentium4"; }."${arch}" + or (throw "unsupported architecture: ${arch}"); + in [ + "ARCH=${arch}" + "MARCH=${march}" + "JULIA_CPU_TARGET=${cpuTarget}" + "PREFIX=$(out)" + "prefix=$(out)" + "SHELL=${stdenv.shell}" + + "USE_SYSTEM_BLAS=1" + "USE_BLAS64=${if openblas.blas64 then "1" else "0"}" + "LIBBLAS=-lopenblas" + "LIBBLASNAME=libopenblas" + + "USE_SYSTEM_LAPACK=1" + "LIBLAPACK=-lopenblas" + "LIBLAPACKNAME=libopenblas" + + "USE_SYSTEM_SUITESPARSE=1" + "SUITESPARSE_LIB=-lsuitesparse" + "SUITESPARSE_INC=-I${suitesparse}/include" + + "USE_SYSTEM_ARPACK=1" + "USE_SYSTEM_FFTW=1" + "USE_SYSTEM_GMP=1" + "USE_SYSTEM_LIBGIT2=1" + "USE_SYSTEM_LIBUNWIND=1" + "USE_SYSTEM_LLVM=1" + "USE_SYSTEM_MPFR=1" + "USE_SYSTEM_OPENLIBM=1" + "USE_SYSTEM_OPENSPECFUN=1" + "USE_SYSTEM_PATCHELF=1" + "USE_SYSTEM_PCRE=1" + "USE_SYSTEM_READLINE=1" + "USE_SYSTEM_UTF8PROC=1" + "USE_SYSTEM_ZLIB=1" + ]; + + NIX_CFLAGS_COMPILE = [ "-fPIC" ]; + + LD_LIBRARY_PATH = makeSearchPath "lib" [ + arpack fftw fftwSinglePrec gmp libgit2 mpfr openblas openlibm + openspecfun pcre2 suitesparse + ]; + + dontStrip = true; + dontPatchELF = true; + + enableParallelBuilding = true; + + doCheck = true; + checkTarget = "testall"; + # Julia's tests require read/write access to $HOME + preCheck = '' + export HOME="$NIX_BUILD_TOP" + ''; + + postInstall = '' + for prog in "$out/bin/julia" "$out/bin/julia-debug"; do + wrapProgram "$prog" \ + --prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \ + --prefix PATH : "${curl}/bin" + done + ''; + + meta = { + description = "High-level performance-oriented dynamical language for technical computing"; + homepage = "http://julialang.org/"; + license = stdenv.lib.licenses.mit; + maintainers = with stdenv.lib.maintainers; [ raskin ttuegel ]; + platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8216deecf079..033552d3f481 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4145,7 +4145,12 @@ let julia03 = callPackage ../development/compilers/julia/0.3.nix { llvm = llvm_33; }; - julia = julia03; + + julia = callPackage ../development/compilers/julia { + gmp = gmp6; + llvm = llvm_33; + openblas = openblasCompat; + }; lazarus = callPackage ../development/compilers/fpc/lazarus.nix { fpc = fpc;