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-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
|
2023-10-09 19:29:22 +00:00
|
|
|
# These 3 should use the same lapack and blas as the above, see code prepending
|
|
|
|
, qrupdate, arpack, suitesparse
|
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
|
2023-10-09 19:29:22 +00:00
|
|
|
, ghostscript
|
|
|
|
, hdf5
|
|
|
|
, glpk
|
|
|
|
, gnuplot
|
2020-04-24 23:36:52 +00:00
|
|
|
# - Include support for GNU readline:
|
|
|
|
, enableReadline ? true
|
2023-10-09 19:29:22 +00:00
|
|
|
, readline
|
2020-04-24 23:36:52 +00:00
|
|
|
# - Build Java interface:
|
|
|
|
, enableJava ? true
|
2023-10-09 19:29:22 +00:00
|
|
|
, jdk
|
|
|
|
, python3
|
|
|
|
, sundials
|
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
|
2023-10-09 19:29:22 +00:00
|
|
|
, libsForQt5
|
2020-04-24 23:36:52 +00:00
|
|
|
, libiconv
|
|
|
|
, darwin
|
|
|
|
}:
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
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
|
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';
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
# We keep the option to not enable suitesparse support by putting it null
|
2020-12-25 13:55:36 +00:00
|
|
|
suitesparse' = if suitesparse != null then
|
|
|
|
suitesparse.override {
|
|
|
|
blas = blas';
|
|
|
|
lapack = lapack';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
null
|
|
|
|
;
|
2023-10-09 19:29:22 +00:00
|
|
|
# To avoid confusion later in passthru
|
|
|
|
allPkgs = pkgs;
|
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "9.2.0";
|
2021-03-09 03:18:52 +00:00
|
|
|
pname = "octave";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "mirror://gnu/octave/octave-${finalAttrs.version}.tar.gz";
|
2024-07-27 06:49:29 +00:00
|
|
|
sha256 = "sha256-BjZVSwWZaZfkMcqtRCLAA4bS18aJAEcnAP7PX/63yZE=";
|
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
|
2023-10-09 19:29:22 +00:00
|
|
|
ghostscript
|
|
|
|
hdf5
|
|
|
|
glpk
|
|
|
|
suitesparse'
|
|
|
|
sundials
|
|
|
|
gnuplot
|
|
|
|
python3
|
|
|
|
] ++ lib.optionals enableQt [
|
|
|
|
libsForQt5.qtbase
|
|
|
|
libsForQt5.qtsvg
|
|
|
|
libsForQt5.qscintilla
|
|
|
|
] ++ lib.optionals (enableJava) [
|
|
|
|
jdk
|
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
|
|
|
libGL libGLU libX11
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2021-03-09 03:18:52 +00:00
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Accelerate
|
|
|
|
darwin.apple_sdk.frameworks.Cocoa
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
gfortran
|
|
|
|
texinfo
|
2023-10-09 19:29:22 +00:00
|
|
|
] ++ lib.optionals enableQt [
|
|
|
|
libsForQt5.wrapQtAppsHook
|
|
|
|
libsForQt5.qtscript
|
|
|
|
libsForQt5.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 = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
cp test/fntests.log $out/share/octave/octave-${finalAttrs.version}-fntests.log || true
|
2021-03-09 03:18:52 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
passthru = rec {
|
2023-10-09 19:29:22 +00:00
|
|
|
sitePath = "share/octave/${finalAttrs.version}/site";
|
2021-03-09 03:18:52 +00:00
|
|
|
octPkgsPath = "share/octave/octave_packages";
|
|
|
|
blas = blas';
|
|
|
|
lapack = lapack';
|
|
|
|
qrupdate = qrupdate';
|
|
|
|
arpack = arpack';
|
|
|
|
suitesparse = suitesparse';
|
2023-10-09 19:29:22 +00:00
|
|
|
octavePackages = import ../../../top-level/octave-packages.nix {
|
|
|
|
pkgs = allPkgs;
|
|
|
|
inherit lib stdenv fetchurl newScope;
|
|
|
|
octave = finalAttrs.finalPackage;
|
|
|
|
};
|
|
|
|
wrapOctave = callPackage ./wrap-octave.nix {
|
|
|
|
octave = finalAttrs.finalPackage;
|
|
|
|
inherit (allPkgs) makeSetupHook makeWrapper;
|
|
|
|
};
|
2021-03-09 03:18:52 +00:00
|
|
|
inherit fftw fftwSinglePrec;
|
|
|
|
inherit portaudio;
|
|
|
|
inherit jdk;
|
2023-10-09 19:29:22 +00:00
|
|
|
python = python3;
|
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 {
|
2023-10-09 19:29:22 +00:00
|
|
|
octave = finalAttrs.finalPackage;
|
2021-03-09 03:18:52 +00:00
|
|
|
inherit octavePackages wrapOctave;
|
|
|
|
inherit (octavePackages) computeRequiredOctavePackages;
|
|
|
|
};
|
|
|
|
withPackages = import ./with-packages.nix { inherit buildEnv octavePackages; };
|
|
|
|
pkgs = octavePackages;
|
2023-10-09 19:29:22 +00:00
|
|
|
interpreter = "${finalAttrs.finalPackage}/bin/octave";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
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
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|