Merge pull request #79864 from doronbehar/improve-octave

octave: Use qt5 and other improvements
This commit is contained in:
Michael Raskin 2020-02-27 06:32:54 +00:00 committed by GitHub
commit b41a7eeb18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 193 additions and 51 deletions

View File

@ -1,8 +1,54 @@
{ stdenv, fetchurl, gfortran, readline, ncurses, perl, flex, texinfo, qhull
, libsndfile, portaudio, libX11, graphicsmagick, pcre, pkgconfig, libGL, libGLU, fltk
, fftw, fftwSinglePrec, zlib, curl, qrupdate, openblas, arpack, libwebp, gl2ps
, qt ? null, qscintilla ? null, ghostscript ? null, llvm ? null, hdf5 ? null,glpk ? null
, suitesparse ? null, gnuplot ? null, jdk ? null, python ? null, overridePlatforms ? null
{ stdenv
, fetchurl
, gfortran
, ncurses
, perl
, flex
, texinfo
, qhull
, libsndfile
, portaudio
, libX11
, graphicsmagick
, pcre
, pkgconfig
, libGL
, libGLU
, fltk
# Both are needed for discrete Fourier transform
, fftw
, fftwSinglePrec
, zlib
, curl
, qrupdate
, openblas
, arpack
, libwebp
, gl2ps
, ghostscript ? null
, hdf5 ? null
, glpk ? null
, suitesparse ? null
, gnuplot ? null
# - Include support for GNU readline:
, enableReadline ? true
, readline ? null
# - Build Java interface:
, enableJava ? true
, jdk ? null
, python ? null
, overridePlatforms ? null
, sundials_2 ? null
# - Build Octave Qt GUI:
, enableQt ? false
, qtbase ? null
, qtsvg ? null
, qtscript ? null
, qscintilla ? null
, qttools ? null
# - JIT compiler for loops:
, enableJIT ? false
, llvm ? null
}:
let
@ -20,33 +66,63 @@ in
stdenv.mkDerivation rec {
version = "5.2.0";
pname = "octave";
src = fetchurl {
url = "mirror://gnu/octave/${pname}-${version}.tar.gz";
sha256 = "1qcmcpsq1lfka19fxzvxjwjhg113c39a9a0x8plkhvwdqyrn5sig";
};
buildInputs = [ gfortran readline ncurses perl flex texinfo qhull
graphicsmagick pcre pkgconfig fltk zlib curl openblas libsndfile fftw
fftwSinglePrec portaudio qrupdate arpack libwebp gl2ps ]
++ (stdenv.lib.optional (qt != null) qt)
++ (stdenv.lib.optional (qscintilla != null) qscintilla)
++ (stdenv.lib.optional (ghostscript != null) ghostscript)
++ (stdenv.lib.optional (llvm != null) llvm)
++ (stdenv.lib.optional (hdf5 != null) hdf5)
++ (stdenv.lib.optional (glpk != null) glpk)
++ (stdenv.lib.optional (suitesparse != null) suitesparse)
++ (stdenv.lib.optional (jdk != null) jdk)
++ (stdenv.lib.optional (gnuplot != null) gnuplot)
++ (stdenv.lib.optional (python != null) python)
++ (stdenv.lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ])
;
# makeinfo is required by Octave at runtime to display help
prePatch = ''
substituteInPlace libinterp/corefcn/help.cc \
--replace 'Vmakeinfo_program = "makeinfo"' \
'Vmakeinfo_program = "${texinfo}/bin/makeinfo"'
'';
buildInputs = [
readline
ncurses
perl
flex
qhull
graphicsmagick
pcre
fltk
zlib
curl
openblas
libsndfile
fftw
fftwSinglePrec
portaudio
qrupdate
arpack
libwebp
gl2ps
]
++ (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 ])
;
nativeBuildInputs = [
pkgconfig
gfortran
# Listed here as well because it's outputs are split
fftw
fftwSinglePrec
texinfo
]
++ (stdenv.lib.optional (sundials_2 != null) sundials_2)
++ (stdenv.lib.optional enableJIT llvm)
++ (stdenv.lib.optionals enableQt [
qtscript
qttools
])
;
doCheck = !stdenv.isDarwin;
@ -55,15 +131,16 @@ stdenv.mkDerivation rec {
# See https://savannah.gnu.org/bugs/?50339
F77_INTEGER_8_FLAG = if openblas.blas64 then "-fdefault-integer-8" else "";
configureFlags =
[ "--enable-readline"
"--enable-dl"
"--with-blas=openblas"
"--with-lapack=openblas"
]
++ stdenv.lib.optional openblas.blas64 "--enable-64"
++ stdenv.lib.optionals stdenv.isDarwin ["--with-x=no"]
;
configureFlags = [
"--with-blas=openblas"
"--with-lapack=openblas"
]
++ stdenv.lib.optionals enableReadline [ "--enable-readline" ]
++ stdenv.lib.optionals openblas.blas64 [ "--enable-64" ]
++ stdenv.lib.optionals stdenv.isDarwin [ "--with-x=no" ]
++ stdenv.lib.optionals enableQt [ "--with-qt=5" ]
++ stdenv.lib.optionals enableJIT [ "--enable-jit" ]
;
# Keep a copy of the octave tests detailed results in the output
# derivation, because someone may care
@ -81,6 +158,8 @@ stdenv.mkDerivation rec {
license = stdenv.lib.licenses.gpl3Plus;
maintainers = with stdenv.lib.maintainers; [raskin];
description = "Scientific Pragramming Language";
# https://savannah.gnu.org/bugs/?func=detailitem&item_id=56425 is the best attempt to fix JIT
broken = enableJIT;
platforms = if overridePlatforms == null then
(with stdenv.lib.platforms; linux ++ darwin)
else overridePlatforms;

View File

@ -0,0 +1,61 @@
{ stdenv
, cmake
, fetchurl
, python
# GNU Octave needs KLU for ODE solvers
, suitesparse
, liblapack
, gfortran
, lapackSupport ? true }:
let liblapackShared = liblapack.override {
shared = true;
};
in 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=${liblapackShared}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary};${liblapackShared}/lib/libblas${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; [ flokli idontgetoutmuch ];
license = licenses.bsd3;
};
}

View File

@ -9247,23 +9247,19 @@ in
};
octave = callPackage ../development/interpreters/octave {
qt = null;
qscintilla = null;
ghostscript = null;
graphicsmagick = null;
llvm = null;
hdf5 = null;
glpk = null;
suitesparse = null;
jdk = null;
python = python3;
openblas = if stdenv.isDarwin then openblasCompat else openblas;
};
octaveFull = (lowPrio (octave.override {
qt = qt4;
inherit qscintilla;
overridePlatforms = ["x86_64-linux" "x86_64-darwin"];
octave-jit = callPackage ../development/interpreters/octave {
python = python3;
openblas = if stdenv.isDarwin then openblasCompat else openblas;
enableJIT = true;
};
octaveFull = (lowPrio (libsForQt512.callPackage ../development/interpreters/octave {
python = python3;
openblas = if stdenv.isDarwin then openblasCompat else openblas;
enableQt = true;
overridePlatforms = ["x86_64-linux" "x86_64-darwin"];
}));
ocropus = callPackage ../applications/misc/ocropus { };
@ -14432,7 +14428,13 @@ in
withQt5 = false;
};
sundials = callPackage ../development/libraries/sundials { };
sundials = callPackage ../development/libraries/sundials {
python = python3;
};
sundials_2 = callPackage ../development/libraries/sundials/2.x.nix {
python = python3;
};
sutils = callPackage ../tools/misc/sutils { };