From f602e104b08b907d8a913aaff58de0f9bcf7d232 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 10 Dec 2020 18:43:01 +0200 Subject: [PATCH 01/10] octave: Use latest jdk --- pkgs/top-level/all-packages.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dca2d81b9b2..915e8dd883e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10555,19 +10555,16 @@ in octave = callPackage ../development/interpreters/octave { python = python3; mkDerivation = stdenv.mkDerivation; - jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 }; octave-jit = callPackage ../development/interpreters/octave { python = python3; enableJIT = true; mkDerivation = stdenv.mkDerivation; - jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 }; octaveFull = libsForQt5.callPackage ../development/interpreters/octave { python = python3; enableQt = true; overridePlatforms = ["x86_64-linux" "x86_64-darwin"]; - jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 }; ocropus = callPackage ../applications/misc/ocropus { }; From 456d320c7184b0d1f42b788be0e0fc8854cdd327 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 10 Dec 2020 18:46:54 +0200 Subject: [PATCH 02/10] octave: Use only lib.optionals --- .../interpreters/octave/default.nix | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 841f89b97fb..f670dd1ba36 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -89,23 +89,25 @@ mkDerivation rec { libwebp gl2ps ] - ++ (stdenv.lib.optionals enableQt [ + ++ stdenv.lib.optionals enableQt [ qtbase qtsvg qscintilla - ]) - ++ (stdenv.lib.optional (ghostscript != null) ghostscript) - ++ (stdenv.lib.optional (hdf5 != null) hdf5) - ++ (stdenv.lib.optional (glpk != null) glpk) - ++ (stdenv.lib.optional (suitesparse != null) suitesparse) - ++ (stdenv.lib.optional (enableJava) jdk) - ++ (stdenv.lib.optional (sundials_2 != null) sundials_2) - ++ (stdenv.lib.optional (gnuplot != null) gnuplot) - ++ (stdenv.lib.optional (python != null) python) - ++ (stdenv.lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ]) - ++ (stdenv.lib.optionals (stdenv.isDarwin) [ libiconv - darwin.apple_sdk.frameworks.Accelerate - darwin.apple_sdk.frameworks.Cocoa ]) + ] + ++ stdenv.lib.optionals (ghostscript != null) [ ghostscript ] + ++ stdenv.lib.optionals (hdf5 != null) [ hdf5 ] + ++ stdenv.lib.optionals (glpk != null) [ glpk ] + ++ stdenv.lib.optionals (suitesparse != null) [ suitesparse ] + ++ stdenv.lib.optionals (enableJava) [ jdk ] + ++ stdenv.lib.optionals (sundials_2 != null) [ sundials_2 ] + ++ stdenv.lib.optionals (gnuplot != null) [ gnuplot ] + ++ stdenv.lib.optionals (python != null) [ python ] + ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ] + ++ stdenv.lib.optionals stdenv.isDarwin [ + libiconv + darwin.apple_sdk.frameworks.Accelerate + darwin.apple_sdk.frameworks.Cocoa + ] ; nativeBuildInputs = [ pkgconfig @@ -115,12 +117,12 @@ mkDerivation rec { fftwSinglePrec texinfo ] - ++ (stdenv.lib.optional (sundials_2 != null) sundials_2) - ++ (stdenv.lib.optional enableJIT llvm) - ++ (stdenv.lib.optionals enableQt [ + ++ stdenv.lib.optionals (sundials_2 != null) [ sundials_2 ] + ++ stdenv.lib.optionals enableJIT [ llvm ] + ++ stdenv.lib.optionals enableQt [ qtscript qttools - ]) + ] ; doCheck = !stdenv.isDarwin; @@ -135,7 +137,7 @@ mkDerivation rec { "--with-lapack=lapack" (if blas.isILP64 then "--enable-64" else "--disable-64") ] - ++ (if stdenv.isDarwin then [ "--enable-link-all-dependencies" ] else [ ]) + ++ stdenv.lib.optionals stdenv.isDarwin [ "--enable-link-all-dependencies" ] ++ stdenv.lib.optionals enableReadline [ "--enable-readline" ] ++ stdenv.lib.optionals stdenv.isDarwin [ "--with-x=no" ] ++ stdenv.lib.optionals enableQt [ "--with-qt=5" ] From 674c5953b9e5ab1eee675c25d9462767bb2df8f5 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 10 Dec 2020 19:58:49 +0200 Subject: [PATCH 03/10] qrupdate: Fix FFLAGS Apparently, undetected in #98499, trying to use the flags written makes the build fail due to -O3. --- pkgs/development/libraries/qrupdate/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix index 90d4cb45ce2..b941021cb68 100644 --- a/pkgs/development/libraries/qrupdate/default.nix +++ b/pkgs/development/libraries/qrupdate/default.nix @@ -25,10 +25,10 @@ stdenv.mkDerivation rec { "BLAS=-L${blas}/lib -lblas" "PREFIX=${placeholder "out"}" ${stdenv.lib.optionalString blas.isILP64 - # Use their FFLAGS along with `-fdefault-integer-8`. If another - # application intends to use arpack, it should add this to it's FFLAGS as - # well. Otherwise (e.g): https://savannah.gnu.org/bugs/?50339 - "FFLAGS=-fimplicit-none -O3 -funroll-loops -fdefault-integer-8" + # If another application intends to use qrupdate compiled with blas with + # 64 bit support, it should add this to it's FFLAGS as well. See (e.g): + # https://savannah.gnu.org/bugs/?50339 + "FFLAGS=-fdefault-integer-8" } ) ''; From 67888e5bac96c151eb9920ddde1759bf37b328fb Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 10 Dec 2020 20:32:06 +0200 Subject: [PATCH 04/10] octave: Support 64 bit indices arrays Add a build argument `use64BitIdx`, and comment explaining how it affects the build - it modifies the deps to make sure they are all compatible with each other. --- .../interpreters/octave/default.nix | 66 +++++++++++++++---- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index f670dd1ba36..babedef64e7 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -23,15 +23,17 @@ , fftwSinglePrec , zlib , curl -, qrupdate , blas, lapack -, arpack +# These two should use the same lapack and blas as the above +, qrupdate, arpack, suitesparse ? null +# If set to true, the above 5 deps are overriden to use the blas and lapack +# with 64 bit indexes support. If all are not compatible, the build will fail. +, use64BitIdx ? false , libwebp , gl2ps , ghostscript ? null , hdf5 ? null , glpk ? null -, suitesparse ? null , gnuplot ? null # - Include support for GNU readline: , enableReadline ? true @@ -56,9 +58,42 @@ , darwin }: -assert (!blas.isILP64) && (!lapack.isILP64); - -mkDerivation rec { +let + # Not always evaluated + blas' = if use64BitIdx then + blas.override { + isILP64 = true; + } + else + blas + ; + lapack' = if use64BitIdx then + lapack.override { + isILP64 = true; + } + else + lapack + ; + qrupdate' = qrupdate.override { + # If use64BitIdx is false, this override doesn't evaluate to a new + # derivation, as blas and lapack are not overriden. + blas = blas'; + lapack = lapack'; + }; + arpack' = arpack.override { + blas = blas'; + lapack = lapack'; + }; + # Not always suitesparse is required at all + suitesparse' = if suitesparse != null then + suitesparse.override { + blas = blas'; + lapack = lapack'; + } + else + null + ; +in mkDerivation rec { version = "6.1.0"; pname = "octave"; @@ -78,14 +113,14 @@ mkDerivation rec { fltk zlib curl - blas - lapack + blas' + lapack' libsndfile fftw fftwSinglePrec portaudio - qrupdate - arpack + qrupdate' + arpack' libwebp gl2ps ] @@ -97,7 +132,7 @@ mkDerivation rec { ++ stdenv.lib.optionals (ghostscript != null) [ ghostscript ] ++ stdenv.lib.optionals (hdf5 != null) [ hdf5 ] ++ stdenv.lib.optionals (glpk != null) [ glpk ] - ++ stdenv.lib.optionals (suitesparse != null) [ suitesparse ] + ++ stdenv.lib.optionals (suitesparse != null) [ suitesparse' ] ++ stdenv.lib.optionals (enableJava) [ jdk ] ++ stdenv.lib.optionals (sundials_2 != null) [ sundials_2 ] ++ stdenv.lib.optionals (gnuplot != null) [ gnuplot ] @@ -130,12 +165,12 @@ mkDerivation rec { enableParallelBuilding = true; # See https://savannah.gnu.org/bugs/?50339 - F77_INTEGER_8_FLAG = if blas.isILP64 then "-fdefault-integer-8" else ""; + F77_INTEGER_8_FLAG = if use64BitIdx then "-fdefault-integer-8" else ""; configureFlags = [ "--with-blas=blas" "--with-lapack=lapack" - (if blas.isILP64 then "--enable-64" else "--disable-64") + (if use64BitIdx then "--enable-64" else "--disable-64") ] ++ stdenv.lib.optionals stdenv.isDarwin [ "--enable-link-all-dependencies" ] ++ stdenv.lib.optionals enableReadline [ "--enable-readline" ] @@ -153,6 +188,11 @@ mkDerivation rec { passthru = { inherit version; sitePath = "share/octave/${version}/site"; + blas = blas'; + lapack = lapack'; + qrupdate = qrupdate'; + arpack = arpack'; + suitesparse = suitesparse'; }; meta = { From 247cf9f28301cb95e5fa4d38c1da1d8045714715 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 10 Dec 2020 20:47:58 +0200 Subject: [PATCH 05/10] octave: add @doronbehar as maintainer --- pkgs/development/interpreters/octave/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index babedef64e7..e6a1e278f44 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -198,7 +198,7 @@ in mkDerivation rec { meta = { homepage = "https://www.gnu.org/software/octave/"; license = stdenv.lib.licenses.gpl3Plus; - maintainers = with stdenv.lib.maintainers; [raskin]; + maintainers = with stdenv.lib.maintainers; [ raskin doronbehar ]; description = "Scientific Pragramming Language"; # https://savannah.gnu.org/bugs/?func=detailitem&item_id=56425 is the best attempt to fix JIT broken = enableJIT; From 74c94d1a35b306b3e99ae2c6345e744971144819 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 19 Dec 2020 10:27:41 +0200 Subject: [PATCH 06/10] octave: Remove version from passthru It's already defined in the derivation. --- pkgs/development/interpreters/octave/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index e6a1e278f44..6cc70fad247 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -186,7 +186,6 @@ in mkDerivation rec { ''; passthru = { - inherit version; sitePath = "share/octave/${version}/site"; blas = blas'; lapack = lapack'; From 58b27b5ffec84b5da8bcbf67ae4e0d53c34a6ee6 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 19 Dec 2020 10:28:14 +0200 Subject: [PATCH 07/10] octave: inherit python in passthru For in case one day python will be overridden, we'll know which python to use. --- pkgs/development/interpreters/octave/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 6cc70fad247..7fd66dc4275 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -192,6 +192,7 @@ in mkDerivation rec { qrupdate = qrupdate'; arpack = arpack'; suitesparse = suitesparse'; + inherit python; }; meta = { From 421e81780c7e68b119e6a344a7c412b74d4e75d4 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 19 Dec 2020 10:30:20 +0200 Subject: [PATCH 08/10] octave: inherit features enabled in passthru --- pkgs/development/interpreters/octave/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 7fd66dc4275..52649769640 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -193,6 +193,7 @@ in mkDerivation rec { arpack = arpack'; suitesparse = suitesparse'; inherit python; + inherit enableQt enableJIT enableReadline enableJava; }; meta = { From 865f8ae377a550b4059f1ddf7432befef96d7f99 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 19 Dec 2020 10:58:04 +0200 Subject: [PATCH 09/10] octave: Use latest sundials --- pkgs/development/interpreters/octave/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 52649769640..67fca52dad5 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -43,7 +43,7 @@ , jdk ? null , python ? null , overridePlatforms ? null -, sundials_2 ? null +, sundials ? null # - Build Octave Qt GUI: , enableQt ? false , qtbase ? null @@ -134,7 +134,7 @@ in mkDerivation rec { ++ stdenv.lib.optionals (glpk != null) [ glpk ] ++ stdenv.lib.optionals (suitesparse != null) [ suitesparse' ] ++ stdenv.lib.optionals (enableJava) [ jdk ] - ++ stdenv.lib.optionals (sundials_2 != null) [ sundials_2 ] + ++ stdenv.lib.optionals (sundials != null) [ sundials ] ++ stdenv.lib.optionals (gnuplot != null) [ gnuplot ] ++ stdenv.lib.optionals (python != null) [ python ] ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ] @@ -152,7 +152,7 @@ in mkDerivation rec { fftwSinglePrec texinfo ] - ++ stdenv.lib.optionals (sundials_2 != null) [ sundials_2 ] + ++ stdenv.lib.optionals (sundials != null) [ sundials ] ++ stdenv.lib.optionals enableJIT [ llvm ] ++ stdenv.lib.optionals enableQt [ qtscript From 37a16b85e03c44d85a532d94ebb3f426ead744aa Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 19 Dec 2020 10:59:33 +0200 Subject: [PATCH 10/10] sundials_2: remove No package needs it now - octave 5.2.0 was the only one that needed it, but now with octave 6.1.0 latest sundials 5.x.x is used. --- pkgs/development/libraries/sundials/2.x.nix | 59 --------------------- pkgs/top-level/all-packages.nix | 4 -- pkgs/top-level/release-alternatives.nix | 2 +- 3 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 pkgs/development/libraries/sundials/2.x.nix diff --git a/pkgs/development/libraries/sundials/2.x.nix b/pkgs/development/libraries/sundials/2.x.nix deleted file mode 100644 index ae22f0be179..00000000000 --- a/pkgs/development/libraries/sundials/2.x.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ stdenv -, cmake -, fetchurl -, python -# GNU Octave needs KLU for ODE solvers -, suitesparse -, blas, lapack -, gfortran -, lapackSupport ? true }: - -assert (!blas.isILP64) && (!lapack.isILP64); - -stdenv.mkDerivation rec { - pname = "sundials"; - version = "2.7.0"; - - buildInputs = [ python ] ++ stdenv.lib.optionals (lapackSupport) [ - gfortran - suitesparse - ]; - nativeBuildInputs = [ cmake ]; - - src = fetchurl { - url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz"; - sha256 = "01513g0j7nr3rh7hqjld6mw0mcx5j9z9y87bwjc16w2x2z3wm7yk"; - }; - - patches = [ - (fetchurl { - # https://github.com/LLNL/sundials/pull/19 - url = "https://github.com/LLNL/sundials/commit/1350421eab6c5ab479de5eccf6af2dcad1eddf30.patch"; - sha256 = "0g67lixp9m85fqpb9rzz1hl1z8ibdg0ldwq5z6flj5zl8a7cw52l"; - }) - ]; - - cmakeFlags = [ - "-DEXAMPLES_INSTALL_PATH=${placeholder "out"}/share/examples" - ] ++ stdenv.lib.optionals (lapackSupport) [ - "-DSUNDIALS_INDEX_TYPE=int32_t" - # GNU Octave needs KLU for ODE solvers - "-DKLU_ENABLE=ON" - "-DKLU_INCLUDE_DIR=${suitesparse}/include" - "-DKLU_LIBRARY_DIR=${suitesparse}/lib" - "-DLAPACK_ENABLE=ON" - "-DLAPACK_LIBRARIES=${lapack}/lib/lapack${stdenv.hostPlatform.extensions.sharedLibrary};${blas}/lib/blas${stdenv.hostPlatform.extensions.sharedLibrary}" - ]; - - # flaky tests, and patch in https://github.com/LLNL/sundials/pull/21 doesn't apply cleanly for sundials_3 - doCheck = false; - checkPhase = "make test"; - - meta = with stdenv.lib; { - description = "Suite of nonlinear differential/algebraic equation solvers"; - homepage = "https://computation.llnl.gov/projects/sundials"; - platforms = platforms.all; - maintainers = with maintainers; [ idontgetoutmuch ]; - license = licenses.bsd3; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 915e8dd883e..b6c5345dba0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16178,10 +16178,6 @@ in python = python3; }; - sundials_2 = callPackage ../development/libraries/sundials/2.x.nix { - python = python3; - }; - sutils = callPackage ../tools/misc/sutils { }; svrcore = callPackage ../development/libraries/svrcore { }; diff --git a/pkgs/top-level/release-alternatives.nix b/pkgs/top-level/release-alternatives.nix index 7479377bd30..5e309a0129c 100644 --- a/pkgs/top-level/release-alternatives.nix +++ b/pkgs/top-level/release-alternatives.nix @@ -9,7 +9,7 @@ let blasUsers = [ # "julia_07" "julia_10" "julia_11" "julia_13" "octave" "octaveFull" "fflas-ffpack" "linbox" "R" "ipopt" "hpl" "rspamd" "octopus" - "sundials" "sundials_2" "superlu" "suitesparse_5_3" "suitesparse_4_4" + "sundials" "superlu" "suitesparse_5_3" "suitesparse_4_4" "suitesparse_4_2" "scs" "scalapack" "petsc" "cholmod-extra" "arpack" "qrupdate" "libcint" "iml" "globalarrays" "arrayfire" "armadillo" "xfitter" "lammps" "plink-ng" "quantum-espresso" "siesta"