From 3436c78fc38719ab2d2b5641760188afdcf22381 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 9 Oct 2015 19:02:01 -0500 Subject: [PATCH 01/15] openlibm: init at 0.4.1 --- .../science/math/openlibm/default.nix | 22 +++++++++++++++++++ .../math/openlibm/openlibm-prefix.patch | 13 +++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 37 insertions(+) create mode 100644 pkgs/development/libraries/science/math/openlibm/default.nix create mode 100644 pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch diff --git a/pkgs/development/libraries/science/math/openlibm/default.nix b/pkgs/development/libraries/science/math/openlibm/default.nix new file mode 100644 index 000000000000..ad0eab88c51d --- /dev/null +++ b/pkgs/development/libraries/science/math/openlibm/default.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + name = "openlibm-0.4.1"; + src = fetchurl { + url = "https://github.com/JuliaLang/openlibm/archive/v0.4.1.tar.gz"; + sha256 = "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"; + }; + + patches = [ ./openlibm-prefix.patch ]; + postPatch = '' + substituteAllInPlace Make.inc + ''; + + meta = { + description = "High quality system independent, portable, open source libm implementation"; + homepage = "http://www.openlibm.org/"; + license = stdenv.lib.licenses.mit; + maintainers = [ stdenv.lib.maintainers.ttuegel ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch b/pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch new file mode 100644 index 000000000000..0c000497994c --- /dev/null +++ b/pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch @@ -0,0 +1,13 @@ +diff --git a/Make.inc b/Make.inc +index 83d9612..e951c56 100644 +--- a/Make.inc ++++ b/Make.inc +@@ -7,7 +7,7 @@ VERSION = 0.4 + SOMAJOR = 1 + SOMINOR = 0 + DESTDIR = +-prefix = /usr/local ++prefix = @out@ + bindir = $(prefix)/bin + libdir = $(prefix)/lib + includedir = $(prefix)/include diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ae18eea69498..f6363adfeb2f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14266,6 +14266,8 @@ let # standard BLAS and LAPACK. openblasCompat = openblas.override { blas64 = false; }; + openlibm = callPackage ../development/libraries/science/math/openlibm {}; + mathematica = callPackage ../applications/science/math/mathematica { }; mathematica9 = callPackage ../applications/science/math/mathematica/9.nix { }; From 7061b6819a27632fc0f4ca240a43369b8b683f5e Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 9 Oct 2015 19:08:25 -0500 Subject: [PATCH 02/15] pcre2: init at 10.20 --- pkgs/development/libraries/pcre2/default.nix | 17 +++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 pkgs/development/libraries/pcre2/default.nix diff --git a/pkgs/development/libraries/pcre2/default.nix b/pkgs/development/libraries/pcre2/default.nix new file mode 100644 index 000000000000..71435b6d0ba1 --- /dev/null +++ b/pkgs/development/libraries/pcre2/default.nix @@ -0,0 +1,17 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation { + name = "pcre2-10.20"; + src = fetchurl { + url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.20.tar.bz2"; + sha256 = "0yj8mm9ll9zj3v47rvmmqmr1ybxk72rr2lym3rymdsf905qjhbik"; + }; + + meta = { + description = "Perl Compatible Regular Expressions"; + homepage = "http://www.pcre.org/"; + license = stdenv.lib.licenses.bsd3; + maintainers = [ stdenv.lib.maintainers.ttuegel ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f6363adfeb2f..63e0cf17a6f2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7824,6 +7824,8 @@ let unicodeSupport = config.pcre.unicode or true; }; + pcre2 = callPackage ../development/libraries/pcre2 { }; + pdf2xml = callPackage ../development/libraries/pdf2xml {} ; phonon = callPackage ../development/libraries/phonon/qt4 {}; From 1d32078b226d6cef9b16b0caa794c7b9a8b8d185 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 9 Oct 2015 19:08:33 -0500 Subject: [PATCH 03/15] gmp6: add top-level attribute --- pkgs/top-level/all-packages.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 63e0cf17a6f2..81c8021e207b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6356,6 +6356,7 @@ let gmp4 = callPackage ../development/libraries/gmp/4.3.2.nix { }; # required by older GHC versions gmp5 = callPackage ../development/libraries/gmp/5.1.x.nix { }; + gmp6 = callPackage ../development/libraries/gmp/6.x.nix { }; gmp = gmp5; gmpxx = appendToName "with-cxx" (gmp.override { cxx = true; }); From f9e701162672114d6c86dcd7841e916b91f10dd5 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 10 Oct 2015 12:55:08 -0500 Subject: [PATCH 04/15] fixup! openlibm: init at 0.4.1 --- .../libraries/science/math/openlibm/default.nix | 5 +---- .../science/math/openlibm/openlibm-prefix.patch | 13 ------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch diff --git a/pkgs/development/libraries/science/math/openlibm/default.nix b/pkgs/development/libraries/science/math/openlibm/default.nix index ad0eab88c51d..e38e6c9e31f2 100644 --- a/pkgs/development/libraries/science/math/openlibm/default.nix +++ b/pkgs/development/libraries/science/math/openlibm/default.nix @@ -7,10 +7,7 @@ stdenv.mkDerivation { sha256 = "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"; }; - patches = [ ./openlibm-prefix.patch ]; - postPatch = '' - substituteAllInPlace Make.inc - ''; + makeFlags = [ "prefix=$(out)" ]; meta = { description = "High quality system independent, portable, open source libm implementation"; diff --git a/pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch b/pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch deleted file mode 100644 index 0c000497994c..000000000000 --- a/pkgs/development/libraries/science/math/openlibm/openlibm-prefix.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/Make.inc b/Make.inc -index 83d9612..e951c56 100644 ---- a/Make.inc -+++ b/Make.inc -@@ -7,7 +7,7 @@ VERSION = 0.4 - SOMAJOR = 1 - SOMINOR = 0 - DESTDIR = --prefix = /usr/local -+prefix = @out@ - bindir = $(prefix)/bin - libdir = $(prefix)/lib - includedir = $(prefix)/include From cd2c0e4e86d3eddeb701ee08ea5794517f5ff369 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 10 Oct 2015 12:55:30 -0500 Subject: [PATCH 05/15] openspecfun: init at 0.4 --- .../science/math/openspecfun/default.nix | 21 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/development/libraries/science/math/openspecfun/default.nix diff --git a/pkgs/development/libraries/science/math/openspecfun/default.nix b/pkgs/development/libraries/science/math/openspecfun/default.nix new file mode 100644 index 000000000000..1988c0c07af5 --- /dev/null +++ b/pkgs/development/libraries/science/math/openspecfun/default.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchurl, gfortran }: + +stdenv.mkDerivation { + name = "openspecfun-0.4"; + src = fetchurl { + url = "https://github.com/JuliaLang/openspecfun/archive/v0.4.tar.gz"; + sha256 = "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"; + }; + + makeFlags = [ "prefix=$(out)" ]; + + nativeBuildInputs = [ gfortran ]; + + meta = { + description = "A collection of special mathematical functions"; + homepage = "https://github.com/JuliaLang/openspecfun"; + license = stdenv.lib.licenses.mit; + maintainers = [ stdenv.lib.maintainers.ttuegel ]; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 81c8021e207b..b4c0b61c4a34 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14271,6 +14271,8 @@ let openlibm = callPackage ../development/libraries/science/math/openlibm {}; + openspecfun = callPackage ../development/libraries/science/math/openspecfun {}; + mathematica = callPackage ../applications/science/math/mathematica { }; mathematica9 = callPackage ../applications/science/math/mathematica/9.nix { }; From 70bdb61fcc6dce55d84b94610561618e0e4d2eec Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 10 Oct 2015 12:55:43 -0500 Subject: [PATCH 06/15] move sage attribute --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b4c0b61c4a34..8216deecf079 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14276,10 +14276,10 @@ let mathematica = callPackage ../applications/science/math/mathematica { }; mathematica9 = callPackage ../applications/science/math/mathematica/9.nix { }; - sage = callPackage ../applications/science/math/sage { }; - metis = callPackage ../development/libraries/science/math/metis {}; + sage = callPackage ../applications/science/math/sage { }; + suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { }; suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {}; suitesparse = suitesparse_4_4; From 32bef7253d54c7d66f539e45fc2fd8dfe9d561aa Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 10 Oct 2015 12:56:43 -0500 Subject: [PATCH 07/15] utf8proc: 1.2 -> 1.3 --- pkgs/development/libraries/utf8proc/default.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/utf8proc/default.nix b/pkgs/development/libraries/utf8proc/default.nix index c8a2fd6a4e99..4b7d06fe8c77 100644 --- a/pkgs/development/libraries/utf8proc/default.nix +++ b/pkgs/development/libraries/utf8proc/default.nix @@ -1,14 +1,12 @@ -{ stdenv, fetchFromGitHub }: +{ stdenv, fetchurl }: stdenv.mkDerivation rec { name = "utf8proc-${version}"; - version = "v1.2"; + version = "1.3"; - src = fetchFromGitHub { - owner = "JuliaLang"; - repo = "utf8proc"; - rev = "${version}"; - sha256 = "1ryjlcnpfm7fpkq6444ybi576hbnh2l0w7kjhbqady5lxwjyg3pf"; + src = fetchurl { + url = "https://github.com/JuliaLang/utf8proc/archive/v${version}.tar.gz"; + sha256 = "07r7djkmd399wl9cn0s2iqjhmm7l5iifp5h1yf2in9s366mlhkkg"; }; makeFlags = [ "prefix=$(out)" ]; From d2a855b6063dd5ad8b65fd6ade2ae806e4ab897b Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 10 Oct 2015 13:56:24 -0500 Subject: [PATCH 08/15] pcre2: enable JIT --- pkgs/development/libraries/pcre2/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/libraries/pcre2/default.nix b/pkgs/development/libraries/pcre2/default.nix index 71435b6d0ba1..77e91a60175a 100644 --- a/pkgs/development/libraries/pcre2/default.nix +++ b/pkgs/development/libraries/pcre2/default.nix @@ -7,6 +7,10 @@ stdenv.mkDerivation { sha256 = "0yj8mm9ll9zj3v47rvmmqmr1ybxk72rr2lym3rymdsf905qjhbik"; }; + configureFlags = [ + "--enable-jit" + ]; + meta = { description = "Perl Compatible Regular Expressions"; homepage = "http://www.pcre.org/"; From 840f4b0b550e1c7a75c60aec6469528343c071a7 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sat, 10 Oct 2015 13:56:34 -0500 Subject: [PATCH 09/15] pcre2: enable alternate character widths --- pkgs/development/libraries/pcre2/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/pcre2/default.nix b/pkgs/development/libraries/pcre2/default.nix index 77e91a60175a..4f8d5cf1aaa8 100644 --- a/pkgs/development/libraries/pcre2/default.nix +++ b/pkgs/development/libraries/pcre2/default.nix @@ -8,6 +8,8 @@ stdenv.mkDerivation { }; configureFlags = [ + "--enable-pcre2-16" + "--enable-pcre2-32" "--enable-jit" ]; From 384b828642e534b24eb3d54f4cb7053113b862b9 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 Oct 2015 09:15:50 -0500 Subject: [PATCH 10/15] julia: 0.3.11 -> 0.4.0 --- .../julia/0001-use-system-utf8proc.patch | 29 ++++ .../julia/0002-use-system-suitesparse.patch | 25 +++ .../compilers/julia/0003-no-ldconfig.patch | 29 ++++ pkgs/development/compilers/julia/default.nix | 157 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 +- 5 files changed, 246 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/compilers/julia/0001-use-system-utf8proc.patch create mode 100644 pkgs/development/compilers/julia/0002-use-system-suitesparse.patch create mode 100644 pkgs/development/compilers/julia/0003-no-ldconfig.patch create mode 100644 pkgs/development/compilers/julia/default.nix 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; From 708c8ff2405527058248557a2b2d8043dfe30982 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 Oct 2015 09:16:06 -0500 Subject: [PATCH 11/15] llvm33: patches from julia-0.4.0 --- pkgs/development/compilers/llvm/3.3/llvm.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/llvm/3.3/llvm.nix b/pkgs/development/compilers/llvm/3.3/llvm.nix index 8dca8b43bc2c..d4305ac1f6e3 100644 --- a/pkgs/development/compilers/llvm/3.3/llvm.nix +++ b/pkgs/development/compilers/llvm/3.3/llvm.nix @@ -14,9 +14,17 @@ in stdenv.mkDerivation rec { ./no-rule-aarch64.patch # http://llvm.org/bugs/show_bug.cgi?id=16625 # Patch needed for Julia, backports fixes from LLVM 3.5 (fetchurl { - url = "https://raw.githubusercontent.com/JuliaLang/julia/3bdda3750efc4ebf8ce7eda8a0888ffef3851605/deps/llvm-3.3.patch"; + url = "https://raw.githubusercontent.com/JuliaLang/julia/release-0.4/deps/llvm-3.3.patch"; sha256 = "0j6chyx4k8zr1qha5dks8lqlcraqrj4q1hwnk2kj3qi6cajsd8k3"; }) + (fetchurl { + url = "https://raw.githubusercontent.com/JuliaLang/julia/release-0.4/deps/instcombine-llvm-3.3.patch"; + sha256 = "161frq3wxrkxah78krb24hp4zkcnphzcgnvkwfq1abq2vjx3f8sn"; + }) + (fetchurl { + url = "https://raw.githubusercontent.com/JuliaLang/julia/release-0.4/deps/int128-vector.llvm-3.3.patch"; + sha256 = "0lzkv6hvsdaalwsyf6sq0vdrf8x5nk58qg6nn5dlw7n3hxaxpm4m"; + }) ]; buildInputs = [ perl groff cmake python libffi ]; From eb300443f04a8679e58157f5eb73a944541685f9 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 Oct 2015 09:16:27 -0500 Subject: [PATCH 12/15] openblas: run tests --- .../libraries/science/math/openblas/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index a4bf1efbb731..7a1a860b9e4c 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -6,6 +6,8 @@ with stdenv.lib; +let blas64_ = blas64; in + let local = config.openblas.preferLocalBuild or false; binary = { i686-linux = "32"; @@ -18,11 +20,11 @@ let local = config.openblas.preferLocalBuild or false; ]; localFlags = config.openblas.flags or optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ]; - blas64Orig = blas64; -in -stdenv.mkDerivation rec { - version = "0.2.14"; + blas64 = if blas64_ != null then blas64_ else hasPrefix "x86_64" stdenv.system; + version = "0.2.14"; +in +stdenv.mkDerivation { name = "openblas-${version}"; src = fetchurl { url = "https://github.com/xianyi/OpenBLAS/tarball/v${version}"; @@ -30,6 +32,8 @@ stdenv.mkDerivation rec { name = "openblas-${version}.tar.gz"; }; + inherit blas64; + preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz"; nativeBuildInputs = optionals stdenv.isDarwin [coreutils] ++ [gfortran perl]; @@ -50,7 +54,8 @@ stdenv.mkDerivation rec { "INTERFACE64=${if blas64 then "1" else "0"}" ]; - blas64 = if blas64Orig != null then blas64Orig else hasPrefix "x86_64" stdenv.system; + doCheck = true; + checkTarget = "tests"; meta = with stdenv.lib; { description = "Basic Linear Algebra Subprograms"; From 0daee71b1ca734d82ae5c35cc7eee7ead49dbadb Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 Oct 2015 09:16:34 -0500 Subject: [PATCH 13/15] suitesparse: link shared library against openblas --- pkgs/development/libraries/science/math/suitesparse/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index f30db472b0de..e32b8b344267 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation { for i in "$out"/lib/lib*.a; do ar -x $i done - gcc *.o --shared -o "$out/lib/libsuitesparse.so" + gcc *.o --shared -o "$out/lib/libsuitesparse.so" -lopenblas ) for i in umfpack cholmod amd camd colamd spqr; do ln -s libsuitesparse.so "$out"/lib/lib$i.so; From d5326814a837765182834454e2a880d326e69ca6 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 Oct 2015 10:06:27 -0500 Subject: [PATCH 14/15] remove julia02 --- pkgs/development/compilers/julia/0.2.nix | 143 ----------------------- pkgs/top-level/all-packages.nix | 5 - 2 files changed, 148 deletions(-) delete mode 100644 pkgs/development/compilers/julia/0.2.nix diff --git a/pkgs/development/compilers/julia/0.2.nix b/pkgs/development/compilers/julia/0.2.nix deleted file mode 100644 index 9d585e07fe1a..000000000000 --- a/pkgs/development/compilers/julia/0.2.nix +++ /dev/null @@ -1,143 +0,0 @@ -{ stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib - , readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl - , ncurses, libunistring, lighttpd, patchelf, openblas - , tcl, tk, xproto, libX11, git, mpfr - } : -let - realGcc = stdenv.cc.cc; -in -stdenv.mkDerivation rec { - pname = "julia"; - version = "0.2.1"; - name = "${pname}-${version}"; - - grisu_ver = "1.1.1"; - dsfmt_ver = "2.2"; - openblas_ver = "v0.2.2"; - lapack_ver = "3.4.1"; - arpack_ver = "3.1.3"; - clp_ver = "1.14.5"; - lighttpd_ver = "1.4.29"; - patchelf_ver = "0.6"; - pcre_ver = "8.31"; - - grisu_src = fetchurl { - url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; - sha256 = "e1cabb73fd69e74f145aea91100cde483aef8b79dc730fcda0a34466730d4d1d"; - }; - 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"; - sha256 = "bc3947a9b2253a869fcbab8ff395416cb12958be9dba10793db2cd7e37b26899"; - }; - openblas_src = fetchurl { - url = "https://github.com/xianyi/OpenBLAS/tarball/${openblas_ver}"; - name = "openblas-${openblas_ver}.tar.gz"; - sha256 = "19ffec70f9678f5c159feadc036ca47720681b782910fbaa95aa3867e7e86d8e"; - }; - arpack_src = fetchurl { - url = "http://forge.scilab.org/index.php/p/arpack-ng/downloads/607/get/"; - name = "arpack-ng-${arpack_ver}.tar.gz"; - sha256 = "039w7j3dr1xy35a3hp92zg2g92gmjq6xsv0g4awlb4cffy09nr2d"; - }; - lapack_src = fetchurl { - url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz"; - name = "lapack-${lapack_ver}.tgz"; - sha256 = "93b910f94f6091a2e71b59809c4db4a14655db527cfc5821ade2e8c8ab75380f"; - }; - 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"; - }; - patchelf_src = fetchurl { - url = "http://hydra.nixos.org/build/1524660/download/2/patchelf-${patchelf_ver}.tar.bz2"; - sha256 = "00bw29vdsscsili65wcb5ay0gvg1w0ljd00sb5xc6br8bylpyzpw"; - }; - pcre_src = fetchurl { - url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${pcre_ver}.tar.bz2"; - sha256 = "0g4c0z4h30v8g8qg02zcbv7n67j5kz0ri9cfhgkpwg276ljs0y2p"; - }; - - src = fetchgit { - url = "git://github.com/JuliaLang/julia.git"; - rev = "refs/tags/v${version}"; - sha256 = "7ee0f267bc1ae286764ced3c0c695c335a6f8d67bd7b3ca7e4de259333c9426a"; - }; - - buildInputs = [ gfortran perl m4 gmp pcre llvm readline zlib - fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf - openblas tcl tk xproto libX11 git mpfr - ]; - - configurePhase = '' - for i in GMP LLVM PCRE LAPACK OPENBLAS BLAS READLINE FFTW LIBUNWIND SUITESPARSE GLPK LIGHTTPD ZLIB MPFR; - do - makeFlags="$makeFlags USE_SYSTEM_$i=1 " - done - makeFlags="$makeFlags JULIA_CPU_TARGET=core2"; - - copy_kill_hash(){ - cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')" - } - - for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${clp_src}" "${patchelf_src}" "${pcre_src}" ; do - copy_kill_hash "$i" deps - done - copy_kill_hash "${dsfmt_src}" deps/random - - ${if realGcc ==null then "" else - ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -lopenblas -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr"''} - 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" - - 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}" - - export dontPatchELF=1 - - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia" - ''; - - preBuild = '' - mkdir -p usr/lib - - mkdir -p "$out/lib" - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/liblapack.so" - - echo "$out" - ( - 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 - ''; - - preInstall = '' - ''; - - 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; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 033552d3f481..9600b518a604 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4137,11 +4137,6 @@ let jikes = callPackage ../development/compilers/jikes { }; - julia02 = callPackage ../development/compilers/julia/0.2.nix { - llvm = llvm_33; - suitesparse = suitesparse_4_2; - }; - julia03 = callPackage ../development/compilers/julia/0.3.nix { llvm = llvm_33; }; From a8353b27ff009e50ce0266f82b2a23e34de36bb8 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 11 Oct 2015 10:06:39 -0500 Subject: [PATCH 15/15] remove julia03 --- pkgs/development/compilers/julia/0.3.nix | 154 ----------------------- pkgs/top-level/all-packages.nix | 4 - 2 files changed, 158 deletions(-) delete mode 100644 pkgs/development/compilers/julia/0.3.nix diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix deleted file mode 100644 index 710ddec9c105..000000000000 --- a/pkgs/development/compilers/julia/0.3.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ stdenv, fetchgit, fetchurl -# build tools -, gfortran, git, m4, patchelf, perl, which, python2 -# libjulia dependencies -, libunwind, llvm, readline, utf8proc, zlib -# standard library dependencies -, double_conversion, fftwSinglePrec, fftw, glpk, gmp, mpfr, pcre -# linear algebra -, openblas, arpack, suitesparse -}: - -with stdenv.lib; - -# All dependencies should use the same OpenBLAS. -let - arpack_ = arpack; - suitesparse_ = suitesparse; -in -let - arpack = arpack_.override { inherit openblas; }; - suitesparse = suitesparse_.override { inherit openblas; }; -in - -stdenv.mkDerivation rec { - pname = "julia"; - version = "0.3.11"; - name = "${pname}-${version}"; - - src = fetchgit { - url = "git://github.com/JuliaLang/julia.git"; - rev = "refs/tags/v${version}"; - sha256 = "06xmv2l8hskdh1s5y2dh28vpb5pc0gzmfl5a03yp0qjjsl5cb284"; - name = "julia-git-v${version}"; - }; - - patches = [ ./0001-work-around-buggy-wcwidth.patch ]; - - 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"; - }; - - in [ dsfmt_src ]; - - 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.* - ''; - - buildInputs = [ - arpack double_conversion fftw fftwSinglePrec glpk gmp libunwind - llvm mpfr pcre openblas readline suitesparse utf8proc zlib - ]; - - nativeBuildInputs = [ gfortran git m4 patchelf perl python2 which ]; - - makeFlags = - let - arch = head (splitString "-" stdenv.system); - march = { "x86_64" = "x86-64"; "i686" = "i686"; }."${arch}" - or (throw "unsupported architecture: ${arch}"); - in [ - "ARCH=${arch}" - "MARCH=${march}" - "JULIA_CPU_TARGET=${march}" - "PREFIX=$(out)" - "prefix=$(out)" - "SHELL=${stdenv.shell}" - - "USE_SYSTEM_BLAS=1" - "LIBBLAS=-lopenblas" - "LIBBLASNAME=libopenblas" - - "USE_SYSTEM_LAPACK=1" - "LIBLAPACK=-lopenblas" - "LIBLAPACKNAME=libopenblas" - - "USE_SYSTEM_ARPACK=1" - "USE_SYSTEM_FFTW=1" - "USE_SYSTEM_GLPK=1" - "USE_SYSTEM_GMP=1" - "USE_SYSTEM_GRISU=1" - "USE_SYSTEM_LIBUNWIND=1" - "USE_SYSTEM_LLVM=1" - "USE_SYSTEM_MPFR=1" - "USE_SYSTEM_PATCHELF=1" - "USE_SYSTEM_PCRE=1" - "USE_SYSTEM_READLINE=1" - "USE_SYSTEM_SUITESPARSE=1" - "USE_SYSTEM_UTF8PROC=1" - "USE_SYSTEM_ZLIB=1" - ]; - - GLPK_PREFIX = "${glpk}/include"; - - NIX_CFLAGS_COMPILE = [ "-fPIC" ]; - - # 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" - ]; - - dontStrip = true; - dontPatchELF = true; - - enableParallelBuilding = true; - - # Test fail on i686 (julia version 0.3.10) - doCheck = !stdenv.isi686; - checkTarget = "testall"; - - 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 9600b518a604..036aec6983dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4137,10 +4137,6 @@ let jikes = callPackage ../development/compilers/jikes { }; - julia03 = callPackage ../development/compilers/julia/0.3.nix { - llvm = llvm_33; - }; - julia = callPackage ../development/compilers/julia { gmp = gmp6; llvm = llvm_33;