about summary refs log tree commit diff
path: root/pkgs/development/compilers/julia
diff options
context:
space:
mode:
authorGaetan Lepage <gaetan@glepage.com>2023-05-09 23:58:07 +0200
committerGaetan Lepage <gaetan@glepage.com>2023-05-12 15:50:31 +0200
commit242173b0f2e7a155f912cd44b50002a5afa433a4 (patch)
tree74031244329d98d48f4d98e311c3f34061b9382f /pkgs/development/compilers/julia
parent24833dd608c1572374568786b650a9e219ae403e (diff)
julia-bin: 1.8.5 -> 1.9.0
Diffstat (limited to 'pkgs/development/compilers/julia')
-rw-r--r--pkgs/development/compilers/julia/1.9-bin.nix104
-rw-r--r--pkgs/development/compilers/julia/patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch50
2 files changed, 154 insertions, 0 deletions
diff --git a/pkgs/development/compilers/julia/1.9-bin.nix b/pkgs/development/compilers/julia/1.9-bin.nix
new file mode 100644
index 0000000000000..f80b5aaaa2b08
--- /dev/null
+++ b/pkgs/development/compilers/julia/1.9-bin.nix
@@ -0,0 +1,104 @@
+{ autoPatchelfHook, fetchurl, lib, stdenv }:
+
+let
+  skip_tests = [
+    # Test flaky on ofborg
+    "channels"
+
+    # Test flaky because of our RPATH patching
+    # https://github.com/NixOS/nixpkgs/pull/230965#issuecomment-1545336489
+    "compiler/codegen"
+  ] ++ lib.optionals stdenv.isDarwin [
+    # Test flaky on ofborg
+    "FileWatching"
+    # Test requires pbcopy
+    "InteractiveUtils"
+    # Test requires network access
+    "Sockets"
+  ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
+    # Test Failed at $out/share/julia/stdlib/v1.8/LinearAlgebra/test/blas.jl:702
+    "LinearAlgebra/blas"
+    # Test Failed at $out/share/julia/test/misc.jl:724
+    "misc"
+  ];
+in
+stdenv.mkDerivation rec {
+  pname = "julia-bin";
+  version = "1.9.0";
+
+  src = {
+    x86_64-linux = fetchurl {
+      url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
+      hash = "sha256-AMYURm75gJwusjSA440ZaixXf/8nMMT4PRNbkT1HM1k=";
+    };
+    aarch64-linux = fetchurl {
+      url = "https://julialang-s3.julialang.org/bin/linux/aarch64/${lib.versions.majorMinor version}/julia-${version}-linux-aarch64.tar.gz";
+      hash = "sha256-ChQxW1Os2X8i0m1Kj9LCN+Uk6Vw77JjS14tU2Awrw2Q=";
+    };
+    x86_64-darwin = fetchurl {
+      url = "https://julialang-s3.julialang.org/bin/mac/x64/${lib.versions.majorMinor version}/julia-${version}-mac64.tar.gz";
+      hash = "sha256-ALxMJ+6xvr01BZcxL/CRkXYxX9MZnGPslj+0HjsEv68=";
+    };
+    aarch64-darwin = fetchurl {
+      url = "https://julialang-s3.julialang.org/bin/mac/aarch64/${lib.versions.majorMinor version}/julia-${version}-macaarch64.tar.gz";
+      hash = "sha256-U+YncKaZDVqJ56AB72iqJd4lEmo76DggDEyacF2uo3w=";
+    };
+  }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
+
+  patches = [
+    # https://github.com/JuliaLang/julia/commit/f5eeba35d9bf20de251bb9160cc935c71e8b19ba
+    ./patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch
+  ];
+
+  postPatch = ''
+    # Julia fails to pick up our Certification Authority root certificates, but
+    # it provides its own so we can simply disable the test. Patching in the
+    # dynamic path to ours require us to rebuild the Julia system image.
+    substituteInPlace share/julia/stdlib/v${lib.versions.majorMinor version}/NetworkOptions/test/runtests.jl \
+      --replace '@test ca_roots_path() != bundled_ca_roots()' \
+        '@test_skip ca_roots_path() != bundled_ca_roots()'
+  '';
+
+  nativeBuildInputs = lib.optionals stdenv.isLinux [
+    autoPatchelfHook
+    # https://github.com/JuliaLang/julia/blob/v1.9.0/NEWS.md#external-dependencies
+    stdenv.cc.cc
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    cp -r . $out
+    runHook postInstall
+  '';
+
+  # Breaks backtraces, etc.
+  dontStrip = true;
+
+  doInstallCheck = true;
+  preInstallCheck = ''
+    export JULIA_TEST_USE_MULTIPLE_WORKERS=true
+    # Some tests require read/write access to $HOME.
+    export HOME="$TMPDIR"
+  '';
+  installCheckPhase = ''
+    runHook preInstallCheck
+    # Command lifted from `test/Makefile`.
+    $out/bin/julia \
+      --check-bounds=yes \
+      --startup-file=no \
+      --depwarn=error \
+      $out/share/julia/test/runtests.jl \
+      --skip internet_required ${toString skip_tests}
+    runHook postInstallCheck
+  '';
+
+  meta = {
+    description = "High-level, high-performance, dynamic language for technical computing";
+    homepage = "https://julialang.org";
+    # Bundled and linked with various GPL code, although Julia itself is MIT.
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [ raskin nickcao wegank ];
+    platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
+    mainProgram = "julia";
+  };
+}
diff --git a/pkgs/development/compilers/julia/patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch b/pkgs/development/compilers/julia/patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch
new file mode 100644
index 0000000000000..fc7d40a54d49b
--- /dev/null
+++ b/pkgs/development/compilers/julia/patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch
@@ -0,0 +1,50 @@
+diff --git a/share/julia/test/choosetests.jl b/share/julia/test/choosetests.jl
+index 334ef05..db5f795 100644
+--- a/share/julia/test/choosetests.jl
++++ b/share/julia/test/choosetests.jl
+@@ -31,6 +31,19 @@ const TESTNAMES = [
+         "smallarrayshrink", "opaque_closure", "filesystem", "download",
+ ]
+ 
++const INTERNET_REQUIRED_LIST = [
++    "Artifacts",
++    "Downloads",
++    "LazyArtifacts",
++    "LibCURL",
++    "LibGit2",
++    "Pkg",
++    "download",
++    "TOML",
++]
++
++const NETWORK_REQUIRED_LIST = vcat(INTERNET_REQUIRED_LIST, ["Sockets"])
++
+ """
+ `(; tests, net_on, exit_on_error, seed) = choosetests(choices)` selects a set of tests to be
+ run. `choices` should be a vector of test names; if empty or set to
+@@ -149,6 +162,7 @@ function choosetests(choices = [])
+     filtertests!(tests, "compiler/EscapeAnalysis", [
+         "compiler/EscapeAnalysis/local", "compiler/EscapeAnalysis/interprocedural"])
+     filtertests!(tests, "stdlib", STDLIBS)
++    filtertests!(tests, "internet_required", INTERNET_REQUIRED_LIST)
+     # do ambiguous first to avoid failing if ambiguities are introduced by other tests
+     filtertests!(tests, "ambiguous")
+ 
+@@ -164,16 +178,7 @@ function choosetests(choices = [])
+         filter!(x -> x != "rounding", tests)
+     end
+ 
+-    net_required_for = filter!(in(tests), [
+-        "Artifacts",
+-        "Downloads",
+-        "LazyArtifacts",
+-        "LibCURL",
+-        "LibGit2",
+-        "Sockets",
+-        "download",
+-        "TOML",
+-    ])
++    net_required_for = filter!(in(tests), NETWORK_REQUIRED_LIST)
+     net_on = true
+     JULIA_TEST_NETWORKING_AVAILABLE = get(ENV, "JULIA_TEST_NETWORKING_AVAILABLE", "") |>
+                                       strip |>