git.iko.soy/typeable/nixpkgs
on master help sign in
julia: init at 1.5 (#101933)
commit5a5cb550dd75263ee7f2f6b4fc428989aa8b5934 authorChristoph Stich <cstich@users.noreply.github.com> dateFri 13 Nov 2020, 21:43 (6 years ago) parent13a3e50
2 files changed+166
pkgs/development/compilers/julia/1.5.nix+160 pkgs/top-level/all-packages.nix+6
pkgs/development/compilers/julia/1.5.nixnew file+160
@@ -0,0 +1,160 @@
1+{ stdenv, fetchurl, fetchzip, fetchFromGitHub
2+# build tools
3+, gfortran, m4, makeWrapper, patchelf, perl, which, python2
4+, cmake
5+# libjulia dependencies
6+, libunwind, readline, utf8proc, zlib
7+# standard library dependencies
8+, curl, fftwSinglePrec, fftw, libgit2, mpfr, openlibm, openspecfun, pcre2
9+# linear algebra
10+, blas, lapack, arpack
11+# Darwin frameworks
12+, CoreServices, ApplicationServices
13+}:
14+
15+assert (!blas.isILP64) && (!lapack.isILP64);
16+
17+with stdenv.lib;
18+
19+let
20+ majorVersion = "1";
21+ minorVersion = "5";
22+ maintenanceVersion = "3";
23+ src_sha256 = "sha256:0jds8lrhk4hfdv7dg5p2ibzin9ivga7wrx7zwcmz6dqp3x792n1i";
24+ version = "${majorVersion}.${minorVersion}.${maintenanceVersion}";
25+in
26+
27+stdenv.mkDerivation rec {
28+ pname = "julia";
29+ inherit version;
30+
31+ src = fetchzip {
32+ url = "https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
33+ sha256 = src_sha256;
34+ };
35+
36+ patches = [
37+ ./use-system-utf8proc-julia-1.3.patch
38+
39+ # Julia recompiles a precompiled file if the mtime stored *in* the
40+ # .ji file differs from the mtime of the .ji file. This
41+ # doesn't work in Nix because Nix changes the mtime of files in
42+ # the Nix store to 1. So patch Julia to accept mtimes of 1.
43+ ./allow_nix_mtime.patch
44+ ];
45+
46+ postPatch = ''
47+ patchShebangs . contrib
48+ for i in backtrace cmdlineargs; do
49+ mv test/$i.jl{,.off}
50+ touch test/$i.jl
51+ done
52+ rm stdlib/Sockets/test/runtests.jl && touch stdlib/Sockets/test/runtests.jl
53+ rm stdlib/Distributed/test/runtests.jl && touch stdlib/Distributed/test/runtests.jl
54+ # LibGit2 fails with a weird error, so we skip it as well now
55+ rm stdlib/LibGit2/test/runtests.jl && touch stdlib/LibGit2/test/runtests.jl
56+ sed -e 's/Invalid Content-Type:/invalid Content-Type:/g' -i ./stdlib/LibGit2/test/libgit2.jl
57+ sed -e 's/Failed to resolve /failed to resolve /g' -i ./stdlib/LibGit2/test/libgit2.jl
58+ '';
59+
60+ dontUseCmakeConfigure = true;
61+
62+ buildInputs = [
63+ arpack fftw fftwSinglePrec libgit2 libunwind mpfr
64+ pcre2.dev blas lapack openlibm openspecfun readline utf8proc
65+ zlib
66+ ] ++ stdenv.lib.optionals stdenv.isDarwin [CoreServices ApplicationServices];
67+
68+ nativeBuildInputs = [ curl gfortran m4 makeWrapper patchelf perl python2 which cmake ];
69+
70+ makeFlags =
71+ let
72+ arch = head (splitString "-" stdenv.system);
73+ march = {
74+ x86_64 = stdenv.hostPlatform.platform.gcc.arch or "x86-64";
75+ i686 = "pentium4";
76+ aarch64 = "armv8-a";
77+ }.${arch}
78+ or (throw "unsupported architecture: ${arch}");
79+ # Julia requires Pentium 4 (SSE2) or better
80+ cpuTarget = { x86_64 = "x86-64"; i686 = "pentium4"; aarch64 = "generic"; }.${arch}
81+ or (throw "unsupported architecture: ${arch}");
82+ # Julia applies a lot of patches to its dependencies, so for now do not use the system LLVM
83+ # https://github.com/JuliaLang/julia/tree/master/deps/patches
84+ in [
85+ "ARCH=${arch}"
86+ "MARCH=${march}"
87+ "JULIA_CPU_TARGET=${cpuTarget}"
88+ "PREFIX=$(out)"
89+ "prefix=$(out)"
90+ "SHELL=${stdenv.shell}"
91+
92+ "USE_SYSTEM_BLAS=1"
93+ "USE_BLAS64=${if blas.isILP64 then "1" else "0"}"
94+
95+ "USE_SYSTEM_LAPACK=1"
96+
97+ "USE_SYSTEM_ARPACK=1"
98+ "USE_SYSTEM_FFTW=1"
99+ "USE_SYSTEM_GMP=0"
100+ "USE_SYSTEM_LIBGIT2=1"
101+ "USE_SYSTEM_LIBUNWIND=1"
102+
103+ "USE_SYSTEM_MPFR=1"
104+ "USE_SYSTEM_OPENLIBM=1"
105+ "USE_SYSTEM_OPENSPECFUN=1"
106+ "USE_SYSTEM_PATCHELF=1"
107+ "USE_SYSTEM_PCRE=1"
108+ "PCRE_CONFIG=${pcre2.dev}/bin/pcre2-config"
109+ "PCRE_INCL_PATH=${pcre2.dev}/include/pcre2.h"
110+ "USE_SYSTEM_READLINE=1"
111+ "USE_SYSTEM_UTF8PROC=1"
112+ "USE_SYSTEM_ZLIB=1"
113+
114+ "USE_BINARYBUILDER=0"
115+ ];
116+
117+ LD_LIBRARY_PATH = makeLibraryPath [
118+ arpack fftw fftwSinglePrec libgit2 mpfr blas openlibm
119+ openspecfun pcre2 lapack
120+ ];
121+
122+ enableParallelBuilding = true;
123+
124+ # Julia's tests require read/write access to $HOME
125+ preCheck = ''
126+ export HOME="$NIX_BUILD_TOP"
127+ '';
128+
129+ preBuild = ''
130+ sed -e '/^install:/s@[^ ]*/doc/[^ ]*@@' -i Makefile
131+ sed -e '/[$](DESTDIR)[$](docdir)/d' -i Makefile
132+ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
133+ '';
134+
135+ postInstall = ''
136+ # Symlink shared libraries from LD_LIBRARY_PATH into lib/julia,
137+ # as using a wrapper with LD_LIBRARY_PATH causes segmentation
138+ # faults when program returns an error:
139+ # $ julia -e 'throw(Error())'
140+ find $(echo $LD_LIBRARY_PATH | sed 's|:| |g') -maxdepth 1 -name '*.${if stdenv.isDarwin then "dylib" else "so"}*' | while read lib; do
141+ if [[ ! -e $out/lib/julia/$(basename $lib) ]]; then
142+ ln -sv $lib $out/lib/julia/$(basename $lib)
143+ fi
144+ done
145+ '';
146+
147+ passthru = {
148+ inherit majorVersion minorVersion maintenanceVersion;
149+ site = "share/julia/site/v${majorVersion}.${minorVersion}";
150+ };
151+
152+ meta = {
153+ description = "High-level performance-oriented dynamical language for technical computing";
154+ homepage = "https://julialang.org/";
155+ license = stdenv.lib.licenses.mit;
156+ maintainers = with stdenv.lib.maintainers; [ raskin rob garrison ];
157+ platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" "aarch64-linux" ];
158+ broken = stdenv.isi686;
159+ };
160+}
pkgs/top-level/all-packages.nix+6
@@ -9525,6 +9525,12 @@ in
95259525 inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
95269526 };
95279527
9528+julia_15 = callPackage ../development/compilers/julia/1.5.nix {
9529+ inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
9530+ };
9531+
9532+
9533+
95289534 julia_1 = julia_10;
95299535 julia = julia_1;
95309536