1 # Generic builder for GNU Octave libraries.
2 # This is a file that contains nested functions. The first, outer, function
3 # is the library- and package-wide details, such as the nixpkgs library, any
4 # additional configuration provided, and the namePrefix to use (based on the
5 # pname and version of Octave), the octave package, etc.
12 , computeRequiredOctavePackages
13 , writeRequiredOctavePackagesHook
16 # The inner function contains information required to build the individual
18 { fullLibName ? "${attrs.pname}-${attrs.version}"
26 , enableParallelBuilding ? true
27 # Build-time dependencies for the package, which were compiled for the system compiling this.
28 , nativeBuildInputs ? []
30 # Build-time dependencies for the package, which may not have been compiled for the system compiling this.
33 # Propagate build dependencies so in case we have A -> B -> C,
34 # C can import package A propagated by B
35 # Run-time dependencies for the package.
36 , propagatedBuildInputs ? []
38 # Octave packages that are required at runtime for this one.
39 # These behave similarly to propagatedBuildInputs, where if
40 # package A is needed by B, and C needs B, then C also requires A.
41 # The main difference between these and propagatedBuildInputs is
42 # during the package's installation into octave, where all
43 # requiredOctavePackages are ALSO installed into octave.
44 , requiredOctavePackages ? []
55 requiredOctavePackages' = computeRequiredOctavePackages requiredOctavePackages;
57 in stdenv.mkDerivation {
58 packageName = "${fullLibName}";
59 # The name of the octave package ends up being
60 # "octave-version-package-version"
61 name = "${octave.pname}-${octave.version}-${fullLibName}";
63 # This states that any package built with the function that this returns
64 # will be an octave package. This is used for ensuring other octave
65 # packages are installed into octave during the environment building phase.
66 isOctavePackage = true;
68 OCTAVE_HISTFILE = "/dev/null";
72 inherit dontPatch patches patchPhase;
76 enableParallelBuilding = enableParallelBuilding;
78 requiredOctavePackages = requiredOctavePackages';
82 writeRequiredOctavePackagesHook
86 buildInputs = buildInputs ++ requiredOctavePackages';
88 propagatedBuildInputs = propagatedBuildInputs ++ [ texinfo ];
90 preBuild = if preBuild == "" then
92 # This trickery is needed because Octave expects a single directory inside
93 # at the top-most level of the tarball.
94 tar --transform 's,^,${fullLibName}/,' -cz * -f ${fullLibName}.tar.gz
103 octave-cli --eval "pkg build $out ${fullLibName}.tar.gz"
108 # We don't install here, because that's handled when we build the environment
109 # together with Octave.