Merge pull request #117881 from ninjin/juliaclean

julia: cleanup/reorganisation
This commit is contained in:
Michael Raskin 2021-04-28 23:39:38 +00:00 committed by GitHub
commit ae96c292c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 39 additions and 260 deletions

View File

@ -88,13 +88,7 @@ stdenv.mkDerivation rec {
;
patches = [
# Julia recompiles a precompiled file if the mtime stored *in* the
# .ji file differs from the mtime of the .ji file. This
# doesn't work in Nix because Nix changes the mtime of files in
# the Nix store to 1. So patch Julia to accept mtimes of 1.
./allow_nix_mtime.patch
./diagonal-test.patch
./use-system-utf8proc-julia-1.0.patch
./patches/1.0/use-system-utf8proc-julia-1.0.patch
];
postPatch = ''
@ -184,6 +178,8 @@ stdenv.mkDerivation rec {
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
'';
enableParallelBuilding = true;
postInstall = ''
# Symlink shared libraries from LD_LIBRARY_PATH into lib/julia,
# as using a wrapper with LD_LIBRARY_PATH causes segmentation

View File

@ -1,161 +0,0 @@
{ lib, stdenv, fetchurl, fetchzip, fetchFromGitHub
# build tools
, gfortran, m4, makeWrapper, patchelf, perl, which, python2
, cmake
# libjulia dependencies
, libunwind, readline, utf8proc, zlib
# standard library dependencies
, curl, fftwSinglePrec, fftw, gmp, libgit2, mpfr, openlibm, openspecfun, pcre2
# linear algebra
, blas, lapack, arpack
# Darwin frameworks
, CoreServices, ApplicationServices
}:
assert (!blas.isILP64) && (!lapack.isILP64);
with lib;
let
majorVersion = "1";
minorVersion = "3";
maintenanceVersion = "1";
src_sha256 = "0q9a7yc3b235psrwl5ghyxgwly25lf8n818l8h6bkf2ymdbsv5p6";
version = "${majorVersion}.${minorVersion}.${maintenanceVersion}";
in
stdenv.mkDerivation rec {
pname = "julia";
inherit version;
src = fetchzip {
url = "https://github.com/JuliaLang/julia/releases/download/v${majorVersion}.${minorVersion}.${maintenanceVersion}/julia-${majorVersion}.${minorVersion}.${maintenanceVersion}-full.tar.gz";
sha256 = src_sha256;
};
prePatch = ''
export PATH=$PATH:${cmake}/bin
'';
patches = [
./use-system-utf8proc-julia-1.3.patch
# Julia recompiles a precompiled file if the mtime stored *in* the
# .ji file differs from the mtime of the .ji file. This
# doesn't work in Nix because Nix changes the mtime of files in
# the Nix store to 1. So patch Julia to accept mtimes of 1.
./allow_nix_mtime.patch
];
postPatch = ''
patchShebangs . contrib
for i in backtrace cmdlineargs; do
mv test/$i.jl{,.off}
touch test/$i.jl
done
rm stdlib/Sockets/test/runtests.jl && touch stdlib/Sockets/test/runtests.jl
rm stdlib/Distributed/test/runtests.jl && touch stdlib/Distributed/test/runtests.jl
sed -e 's/Invalid Content-Type:/invalid Content-Type:/g' -i ./stdlib/LibGit2/test/libgit2.jl
sed -e 's/Failed to resolve /failed to resolve /g' -i ./stdlib/LibGit2/test/libgit2.jl
'';
buildInputs = [
arpack fftw fftwSinglePrec gmp libgit2 libunwind mpfr
pcre2.dev blas lapack openlibm openspecfun readline utf8proc
zlib
]
++ lib.optionals stdenv.isDarwin [CoreServices ApplicationServices]
;
nativeBuildInputs = [ curl gfortran m4 makeWrapper patchelf perl python2 which ];
makeFlags =
let
arch = head (splitString "-" stdenv.system);
march = {
x86_64 = stdenv.hostPlatform.gcc.arch or "x86-64";
i686 = "pentium4";
aarch64 = "armv8-a";
}.${arch}
or (throw "unsupported architecture: ${arch}");
# Julia requires Pentium 4 (SSE2) or better
cpuTarget = { x86_64 = "x86-64"; i686 = "pentium4"; aarch64 = "generic"; }.${arch}
or (throw "unsupported architecture: ${arch}");
in [
"ARCH=${arch}"
"MARCH=${march}"
"JULIA_CPU_TARGET=${cpuTarget}"
"PREFIX=$(out)"
"prefix=$(out)"
"SHELL=${stdenv.shell}"
(lib.optionalString (!stdenv.isDarwin) "USE_SYSTEM_BLAS=1")
"USE_BLAS64=${if blas.isILP64 then "1" else "0"}"
"USE_SYSTEM_LAPACK=1"
"USE_SYSTEM_ARPACK=1"
"USE_SYSTEM_FFTW=1"
"USE_SYSTEM_GMP=1"
"USE_SYSTEM_LIBGIT2=1"
"USE_SYSTEM_LIBUNWIND=1"
"USE_SYSTEM_MPFR=1"
"USE_SYSTEM_OPENLIBM=1"
"USE_SYSTEM_OPENSPECFUN=1"
"USE_SYSTEM_PATCHELF=1"
"USE_SYSTEM_PCRE=1"
"PCRE_CONFIG=${pcre2.dev}/bin/pcre2-config"
"PCRE_INCL_PATH=${pcre2.dev}/include/pcre2.h"
"USE_SYSTEM_READLINE=1"
"USE_SYSTEM_UTF8PROC=1"
"USE_SYSTEM_ZLIB=1"
"USE_BINARYBUILDER=0"
];
LD_LIBRARY_PATH = makeLibraryPath [
arpack fftw fftwSinglePrec gmp libgit2 mpfr blas openlibm
openspecfun pcre2 lapack
];
# Other versions of Julia pass the tests, but we are not sure why these fail.
doCheck = false;
checkTarget = "testall";
# Julia's tests require read/write access to $HOME
preCheck = ''
export HOME="$NIX_BUILD_TOP"
'';
preBuild = ''
sed -e '/^install:/s@[^ ]*/doc/[^ ]*@@' -i Makefile
sed -e '/[$](DESTDIR)[$](docdir)/d' -i Makefile
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
'';
postInstall = ''
# Symlink shared libraries from LD_LIBRARY_PATH into lib/julia,
# as using a wrapper with LD_LIBRARY_PATH causes segmentation
# faults when program returns an error:
# $ julia -e 'throw(Error())'
find $(echo $LD_LIBRARY_PATH | sed 's|:| |g') -maxdepth 1 -name '*.${if stdenv.isDarwin then "dylib" else "so"}*' | while read lib; do
if [[ ! -e $out/lib/julia/$(basename $lib) ]]; then
ln -sv $lib $out/lib/julia/$(basename $lib)
fi
done
'';
passthru = {
inherit majorVersion minorVersion maintenanceVersion;
site = "share/julia/site/v${majorVersion}.${minorVersion}";
};
meta = {
description = "High-level performance-oriented dynamical language for technical computing";
homepage = "https://julialang.org/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ raskin rob garrison ];
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
broken = stdenv.isi686;
};
}

View File

@ -33,13 +33,7 @@ stdenv.mkDerivation rec {
};
patches = [
./use-system-utf8proc-julia-1.3.patch
# Julia recompiles a precompiled file if the mtime stored *in* the
# .ji file differs from the mtime of the .ji file. This
# doesn't work in Nix because Nix changes the mtime of files in
# the Nix store to 1. So patch Julia to accept mtimes of 1.
./allow_nix_mtime.patch
./patches/1.5/use-system-utf8proc-julia-1.3.patch
];
postPatch = ''
@ -129,6 +123,8 @@ stdenv.mkDerivation rec {
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
'';
enableParallelBuilding = true;
postInstall = ''
# Symlink shared libraries from LD_LIBRARY_PATH into lib/julia,
# as using a wrapper with LD_LIBRARY_PATH causes segmentation

View File

@ -0,0 +1,24 @@
Julia
=====
[Julia][julia], as a full-fledged programming language with an extensive
standard library that covers numerical computing, can be somewhat challenging to
package. This file aims to provide pointers which could not easily be included
as comments in the expressions themselves.
[julia]: https://julialang.org
For Nixpkgs, the manual is as always your primary reference, and for the Julia
side of things you probably want to familiarise yourself with the [README
][readme], [build instructions][build], and [release process][release_process].
Remember that these can change between Julia releases, especially if the LTS and
release branches have deviated greatly. A lot of the build process is
underdocumented and thus there is no substitute for digging into the code that
controls the build process. You are very likely to need to use the test suite to
locate and address issues and in the end passing it, while only disabling a
minimal set of broken or incompatible tests you think you have a good reason to
disable, is your best bet at arriving at a solid derivation.
[readme]: https://github.com/JuliaLang/julia/blob/master/README.md
[build]: https://github.com/JuliaLang/julia/blob/master/doc/build/build.md
[release_process]: https://julialang.org/blog/2019/08/release-process

View File

@ -1,25 +0,0 @@
From f79775378a9eeec5b99f18cc95735b12d172aba3 Mon Sep 17 00:00:00 2001
From: Tom McLaughlin <pyro777@gmail.com>
Date: Wed, 12 Dec 2018 13:01:32 -0800
Subject: [PATCH] Patch to make work better with nix
---
base/loading.jl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/base/loading.jl b/base/loading.jl
index 51201b98b6..b40c0690f6 100644
--- a/base/loading.jl
+++ b/base/loading.jl
@@ -1384,7 +1384,7 @@ function stale_cachefile(modpath::String, cachefile::String)
# Issue #13606: compensate for Docker images rounding mtimes
# Issue #20837: compensate for GlusterFS truncating mtimes to microseconds
ftime = mtime(f)
- if ftime != ftime_req && ftime != floor(ftime_req) && ftime != trunc(ftime_req, digits=6)
+ if ftime != ftime_req && ftime != floor(ftime_req) && ftime != trunc(ftime_req, digits=6) && ftime != 1.0
@debug "Rejecting stale cache file $cachefile (mtime $ftime_req) because file $f (mtime $ftime) has changed"
return true
end
--
2.17.1

View File

@ -1,27 +0,0 @@
From 9eb180c523b877a53b9e1cf53a4d5e6dad3d7bfe Mon Sep 17 00:00:00 2001
From: Lars Jellema <lars.jellema@gmail.com>
Date: Sat, 19 Sep 2020 13:52:20 +0200
Subject: [PATCH] Use approximate comparisons for diagonal tests
---
stdlib/LinearAlgebra/test/diagonal.jl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/stdlib/LinearAlgebra/test/diagonal.jl b/stdlib/LinearAlgebra/test/diagonal.jl
index e420d5bc6d..7f1b5d0aec 100644
--- a/stdlib/LinearAlgebra/test/diagonal.jl
+++ b/stdlib/LinearAlgebra/test/diagonal.jl
@@ -450,8 +450,8 @@ end
M = randn(T, 5, 5)
MM = [randn(T, 2, 2) for _ in 1:2, _ in 1:2]
for transform in (identity, adjoint, transpose, Adjoint, Transpose)
- @test lmul!(transform(D), copy(M)) == *(transform(Matrix(D)), M)
- @test rmul!(copy(M), transform(D)) == *(M, transform(Matrix(D)))
+ @test lmul!(transform(D), copy(M)) ≈ *(transform(Matrix(D)), M)
+ @test rmul!(copy(M), transform(D)) ≈ *(M, transform(Matrix(D)))
@test lmul!(transform(DD), copy(MM)) == *(transform(fullDD), MM)
@test rmul!(copy(MM), transform(DD)) == *(MM, transform(fullDD))
end
--
2.28.0

View File

@ -1,22 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3 python3Packages.requests
import os
import re
import requests
import subprocess
latest = requests.get("https://api.github.com/repos/JuliaLang/julia/releases/latest").json()["tag_name"]
assert latest[0] == "v"
major, minor, patch = latest[1:].split(".")
assert major == "1"
# When a new minor version comes out we'll have to refactor/copy this update script.
assert minor == "5"
sha256 = subprocess.check_output(["nix-prefetch-url", "--unpack", f"https://github.com/JuliaLang/julia/releases/download/v{major}.{minor}.{patch}/julia-{major}.{minor}.{patch}-full.tar.gz"], text=True).strip()
nix_path = os.path.join(os.path.dirname(__file__), "1.5.nix")
nix0 = open(nix_path, "r").read()
nix1 = re.sub("maintenanceVersion = \".*\";", f"maintenanceVersion = \"{patch}\";", nix0)
nix2 = re.sub("src_sha256 = \".*\";", f"src_sha256 = \"{sha256}\";", nix1)
open(nix_path, "w").write(nix2)

View File

@ -337,8 +337,10 @@ mapAliases ({
kodiPlain = kodi;
kodiPlainWayland = kodi-wayland;
jellyfin_10_5 = throw "Jellyfin 10.5 is no longer supported and contains a security vulnerability. Please upgrade to a newer version."; # added 2021-04-26
julia_07 = throw "julia_07 is deprecated in favor of julia_10 LTS"; # added 2020-09-15
julia_11 = throw "julia_11 is deprecated in favor of latest Julia version"; # added 2020-09-15
julia_07 = throw "julia_07 has been deprecated in favor of the latest LTS version"; # added 2020-09-15
julia_1 = throw "julia_1 has been deprecated in favor of julia_10 as it was ambiguous"; # added 2021-03-13
julia_11 = throw "julia_11 has been deprecated in favor of the latest stable version"; # added 2020-09-15
julia_13 = throw "julia_13 has been deprecated in favor of the latest stable version"; # added 2021-03-13
kdeconnect = plasma5Packages.kdeconnect-kde; # added 2020-10-28
kdiff3-qt5 = kdiff3; # added 2017-02-18
keepass-keefox = keepass-keepassrpc; # backwards compatibility alias, added 2018-02

View File

@ -10986,21 +10986,17 @@ in
julia_10 = callPackage ../development/compilers/julia/1.0.nix {
gmp = gmp6;
inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
inherit (darwin.apple_sdk.frameworks) ApplicationServices CoreServices;
libgit2 = libgit2_0_27;
};
julia_13 = callPackage ../development/compilers/julia/1.3.nix {
gmp = gmp6;
inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
};
julia_15 = callPackage ../development/compilers/julia/1.5.nix {
inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
inherit (darwin.apple_sdk.frameworks) ApplicationServices CoreServices;
};
julia_1 = julia_10;
julia = julia_15;
julia-lts = julia_10;
julia-stable = julia_15;
julia = julia-lts;
jwasm = callPackage ../development/compilers/jwasm { };