2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
2021-03-09 03:18:52 +00:00
|
|
|
, pkgs
|
2021-02-05 17:12:51 +00:00
|
|
|
, lib
|
2020-10-07 09:15:18 +00:00
|
|
|
# Note: either stdenv.mkDerivation or, for octaveFull, the qt-5 mkDerivation
|
|
|
|
# with wrapQtAppsHook (comes from libsForQt5.callPackage)
|
|
|
|
, mkDerivation
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, gfortran
|
|
|
|
, ncurses
|
|
|
|
, perl
|
|
|
|
, flex
|
|
|
|
, texinfo
|
|
|
|
, qhull
|
|
|
|
, libsndfile
|
|
|
|
, portaudio
|
|
|
|
, libX11
|
|
|
|
, graphicsmagick
|
2023-03-30 22:05:00 +00:00
|
|
|
, pcre2
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, libGL
|
|
|
|
, libGLU
|
|
|
|
, fltk
|
|
|
|
# Both are needed for discrete Fourier transform
|
|
|
|
, fftw
|
|
|
|
, fftwSinglePrec
|
|
|
|
, zlib
|
|
|
|
, curl
|
2022-11-21 17:40:18 +00:00
|
|
|
, rapidjson
|
2020-04-24 23:36:52 +00:00
|
|
|
, blas, lapack
|
2020-12-25 13:55:36 +00:00
|
|
|
# These two should use the same lapack and blas as the above
|
|
|
|
, qrupdate, arpack, suitesparse ? null
|
2022-12-28 21:21:41 +00:00
|
|
|
# If set to true, the above 5 deps are overridden to use the blas and lapack
|
2020-12-25 13:55:36 +00:00
|
|
|
# with 64 bit indexes support. If all are not compatible, the build will fail.
|
|
|
|
, use64BitIdx ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
, libwebp
|
|
|
|
, gl2ps
|
|
|
|
, ghostscript ? null
|
|
|
|
, hdf5 ? null
|
|
|
|
, glpk ? null
|
|
|
|
, gnuplot ? null
|
|
|
|
# - Include support for GNU readline:
|
|
|
|
, enableReadline ? true
|
|
|
|
, readline ? null
|
|
|
|
# - Build Java interface:
|
|
|
|
, enableJava ? true
|
|
|
|
, jdk ? null
|
|
|
|
, python ? null
|
|
|
|
, overridePlatforms ? null
|
2020-12-25 13:55:36 +00:00
|
|
|
, sundials ? null
|
2021-03-09 03:18:52 +00:00
|
|
|
# - Packages required for building extra packages.
|
|
|
|
, newScope
|
|
|
|
, callPackage
|
|
|
|
, makeSetupHook
|
|
|
|
, makeWrapper
|
2020-04-24 23:36:52 +00:00
|
|
|
# - Build Octave Qt GUI:
|
|
|
|
, enableQt ? false
|
|
|
|
, qtbase ? null
|
|
|
|
, qtsvg ? null
|
|
|
|
, qtscript ? null
|
|
|
|
, qscintilla ? null
|
|
|
|
, qttools ? null
|
|
|
|
, libiconv
|
|
|
|
, darwin
|
|
|
|
}:
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
let
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
# 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
|
2022-12-28 21:21:41 +00:00
|
|
|
# derivation, as blas and lapack are not overridden.
|
2020-12-25 13:55:36 +00:00
|
|
|
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
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
octavePackages = import ../../../top-level/octave-packages.nix {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit lib stdenv fetchurl newScope;
|
|
|
|
octave = self;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
wrapOctave = callPackage ./wrap-octave.nix {
|
|
|
|
octave = self;
|
|
|
|
inherit (pkgs) makeSetupHook makeWrapper;
|
|
|
|
};
|
|
|
|
|
|
|
|
self = mkDerivation rec {
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "8.2.0";
|
2021-03-09 03:18:52 +00:00
|
|
|
pname = "octave";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/octave/${pname}-${version}.tar.gz";
|
2023-04-29 16:46:19 +00:00
|
|
|
sha256 = "sha256-V9F/kYqUDTjKM0ghHhELNNc1oyKofbccF3xGkqSanIQ=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
readline
|
|
|
|
ncurses
|
|
|
|
perl
|
|
|
|
flex
|
|
|
|
qhull
|
|
|
|
graphicsmagick
|
2023-03-30 22:05:00 +00:00
|
|
|
pcre2
|
2021-03-09 03:18:52 +00:00
|
|
|
fltk
|
|
|
|
zlib
|
|
|
|
curl
|
2022-11-21 17:40:18 +00:00
|
|
|
rapidjson
|
2021-03-09 03:18:52 +00:00
|
|
|
blas'
|
|
|
|
lapack'
|
|
|
|
libsndfile
|
|
|
|
fftw
|
|
|
|
fftwSinglePrec
|
|
|
|
portaudio
|
|
|
|
qrupdate'
|
|
|
|
arpack'
|
|
|
|
libwebp
|
|
|
|
gl2ps
|
|
|
|
]
|
|
|
|
++ lib.optionals enableQt [
|
|
|
|
qtbase
|
|
|
|
qtsvg
|
|
|
|
qscintilla
|
|
|
|
]
|
|
|
|
++ lib.optionals (ghostscript != null) [ ghostscript ]
|
|
|
|
++ lib.optionals (hdf5 != null) [ hdf5 ]
|
|
|
|
++ lib.optionals (glpk != null) [ glpk ]
|
|
|
|
++ lib.optionals (suitesparse != null) [ suitesparse' ]
|
|
|
|
++ lib.optionals (enableJava) [ jdk ]
|
|
|
|
++ lib.optionals (sundials != null) [ sundials ]
|
|
|
|
++ lib.optionals (gnuplot != null) [ gnuplot ]
|
|
|
|
++ lib.optionals (python != null) [ python ]
|
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ libGL libGLU libX11 ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Accelerate
|
|
|
|
darwin.apple_sdk.frameworks.Cocoa
|
|
|
|
]
|
|
|
|
;
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
gfortran
|
|
|
|
# Listed here as well because it's outputs are split
|
|
|
|
fftw
|
|
|
|
fftwSinglePrec
|
|
|
|
texinfo
|
|
|
|
]
|
|
|
|
++ lib.optionals (sundials != null) [ sundials ]
|
|
|
|
++ lib.optionals enableQt [
|
|
|
|
qtscript
|
|
|
|
qttools
|
|
|
|
]
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
enableParallelBuilding = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
# Fix linker error on Darwin (see https://trac.macports.org/ticket/61865)
|
|
|
|
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lobjc";
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
# See https://savannah.gnu.org/bugs/?50339
|
2023-02-16 17:41:37 +00:00
|
|
|
F77_INTEGER_8_FLAG = lib.optionalString use64BitIdx "-fdefault-integer-8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--with-blas=blas"
|
|
|
|
"--with-lapack=lapack"
|
|
|
|
(if use64BitIdx then "--enable-64" else "--disable-64")
|
|
|
|
]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ "--enable-link-all-dependencies" ]
|
|
|
|
++ lib.optionals enableReadline [ "--enable-readline" ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ "--with-x=no" ]
|
|
|
|
++ lib.optionals enableQt [ "--with-qt=5" ]
|
2021-03-09 03:18:52 +00:00
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
# Keep a copy of the octave tests detailed results in the output
|
|
|
|
# derivation, because someone may care
|
|
|
|
postInstall = ''
|
|
|
|
cp test/fntests.log $out/share/octave/${pname}-${version}-fntests.log || true
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
passthru = rec {
|
|
|
|
sitePath = "share/octave/${version}/site";
|
|
|
|
octPkgsPath = "share/octave/octave_packages";
|
|
|
|
blas = blas';
|
|
|
|
lapack = lapack';
|
|
|
|
qrupdate = qrupdate';
|
|
|
|
arpack = arpack';
|
|
|
|
suitesparse = suitesparse';
|
|
|
|
inherit fftw fftwSinglePrec;
|
|
|
|
inherit portaudio;
|
|
|
|
inherit jdk;
|
|
|
|
inherit python;
|
2022-04-15 01:41:22 +00:00
|
|
|
inherit enableQt enableReadline enableJava;
|
2021-03-09 03:18:52 +00:00
|
|
|
buildEnv = callPackage ./build-env.nix {
|
|
|
|
octave = self;
|
|
|
|
inherit octavePackages wrapOctave;
|
|
|
|
inherit (octavePackages) computeRequiredOctavePackages;
|
|
|
|
};
|
|
|
|
withPackages = import ./with-packages.nix { inherit buildEnv octavePackages; };
|
|
|
|
pkgs = octavePackages;
|
|
|
|
interpreter = "${self}/bin/octave";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://www.gnu.org/software/octave/";
|
|
|
|
license = lib.licenses.gpl3Plus;
|
|
|
|
maintainers = with lib.maintainers; [ raskin doronbehar ];
|
2021-12-06 16:07:01 +00:00
|
|
|
description = "Scientific Programming Language";
|
2021-03-09 03:18:52 +00:00
|
|
|
platforms = if overridePlatforms == null then
|
|
|
|
(lib.platforms.linux ++ lib.platforms.darwin)
|
|
|
|
else overridePlatforms;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
in self
|