julia_1{9,10}: deduplicate common code

This commit is contained in:
Nick Cao 2024-01-11 11:28:44 -05:00
parent fd37c3101b
commit e2ada3ce79
No known key found for this signature in database
3 changed files with 35 additions and 100 deletions

View file

@ -1,85 +0,0 @@
{ lib
, stdenv
, fetchurl
, which
, python3
, gfortran
, cmake
, perl
, gnum4
, openssl
, libxml2
}:
stdenv.mkDerivation rec {
pname = "julia";
version = "1.9.4";
src = fetchurl {
url = "https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
hash = "sha256-YYQ7lkf9BtOymU8yd6ZN4ctaWlKX2TC4yOO8DpN0ACQ=";
};
patches = [
./patches/1.9/0002-skip-failing-and-flaky-tests.patch
];
strictDeps = true;
nativeBuildInputs = [
which
python3
gfortran
cmake
perl
gnum4
openssl
];
buildInputs = [
libxml2
];
dontUseCmakeConfigure = true;
postPatch = ''
patchShebangs .
'';
makeFlags = [
"prefix=$(out)"
"USE_BINARYBUILDER=0"
] ++ lib.optionals stdenv.isx86_64 [
# https://github.com/JuliaCI/julia-buildbot/blob/master/master/inventory.py
"JULIA_CPU_TARGET=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)"
] ++ lib.optionals stdenv.isAarch64 [
"JULIA_CPU_TARGET=generic;cortex-a57;thunderx2t99;armv8.2-a,crypto,fullfp16,lse,rdm"
];
# remove forbidden reference to $TMPDIR
preFixup = ''
for file in libcurl.so libgmpxx.so libmpfr.so; do
patchelf --shrink-rpath --allowed-rpath-prefixes ${builtins.storeDir} "$out/lib/julia/$file"
done
'';
doInstallCheck = !stdenv.hostPlatform.isAarch64; # tests are flaky for aarch64-linux on hydra
installCheckTarget = "testall";
preInstallCheck = ''
export HOME="$TMPDIR"
export JULIA_TEST_USE_MULTIPLE_WORKERS="true"
'';
dontStrip = true;
enableParallelBuilding = true;
meta = with lib; {
description = "High-level performance-oriented dynamical language for technical computing";
homepage = "https://julialang.org/";
license = licenses.mit;
maintainers = with maintainers; [ nickcao joshniemela thomasjm ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
}

View file

@ -1,10 +1,10 @@
{ callPackage }:
let
juliaWithPackages = callPackage ../../julia-modules {};
juliaWithPackages = callPackage ../../julia-modules { };
wrapJulia = julia: julia.overrideAttrs (oldAttrs: {
passthru = (oldAttrs.passthru or {}) // {
passthru = (oldAttrs.passthru or { }) // {
withPackages = juliaWithPackages.override { inherit julia; };
};
});
@ -12,9 +12,26 @@ let
in
{
julia_16-bin = wrapJulia (callPackage ./1.6-bin.nix {});
julia_19-bin = wrapJulia (callPackage ./1.9-bin.nix {});
julia_110-bin = wrapJulia (callPackage ./1.10-bin.nix {});
julia_19 = wrapJulia (callPackage ./1.9.nix {});
julia_110 = wrapJulia (callPackage ./1.10.nix {});
julia_16-bin = wrapJulia (callPackage ./1.6-bin.nix { });
julia_19-bin = wrapJulia (callPackage ./1.9-bin.nix { });
julia_110-bin = wrapJulia (callPackage ./1.10-bin.nix { });
julia_19 = wrapJulia (callPackage
(import ./generic.nix {
version = "1.9.4";
hash = "sha256-YYQ7lkf9BtOymU8yd6ZN4ctaWlKX2TC4yOO8DpN0ACQ=";
patches = [
./patches/1.9/0002-skip-failing-and-flaky-tests.patch
];
})
{ });
julia_110 = wrapJulia (callPackage
(import ./generic.nix {
version = "1.10.0";
hash = "sha256-pfjAzgjPEyvdkZygtbOytmyJ4OX35/sqgf+n8iXj20w=";
patches = [
./patches/1.10/0001-skip-building-docs-as-it-requires-network-access.patch
./patches/1.10/0002-skip-failing-and-flaky-tests.patch
];
})
{ });
}

View file

@ -1,3 +1,8 @@
{ version
, hash
, patches
}:
{ lib
, stdenv
, fetchurl
@ -13,18 +18,14 @@
stdenv.mkDerivation rec {
pname = "julia";
version = "1.10.0";
inherit version patches;
src = fetchurl {
url = "https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
hash = "sha256-pfjAzgjPEyvdkZygtbOytmyJ4OX35/sqgf+n8iXj20w=";
inherit hash;
};
patches = [
./patches/1.10/0001-skip-building-docs-as-it-requires-network-access.patch
./patches/1.10/0002-skip-failing-and-flaky-tests.patch
];
strictDeps = true;
nativeBuildInputs = [
@ -64,7 +65,9 @@ stdenv.mkDerivation rec {
done
'';
doInstallCheck = true;
# tests are flaky for aarch64-linux on hydra
doInstallCheck = if (lib.versionOlder version "1.10") then !stdenv.hostPlatform.isAarch64 else true;
installCheckTarget = "testall";
preInstallCheck = ''