1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 14:41:17 +00:00

octave.pkgs.level-set: init at 2019-04-13

1) Version 0.3.0 has numerous bugs due to not being updated for nearly 5
years. So, I had to use fetchgit instead, grabbing HEAD of master.

2) level-set uses a non-standard layout for its files (no MAKEFILE in
the root of the package for octave to use), but instead has a build.sh
script to run. This script *JUST* generates a tarball that can THEN be
used for `pkg build`.
`patchPhase` performs some substitutions on this to make it generate
the tarball in a way we expect it to. This tarball ends up in the
/build directory we have available to us.

2.5) This script NEEDS automake, autoconf, and autoconf-archive to be
available. This is unnecessary for other packages because Octave has a
well-defined Makefile scheme that developers are supposed to follow
that allows Octave to handle the building of packages.
But this package breaks the mold.

3) With the tarball we use to build being available, we need to then
`cd` back to the previous location (as the script takes us from
`/build` to `/tmp`. So we go back using `cd -`.

4) Lastly, we can now use the standard `buildPhase` defined for
`buildOctavePackage` and complete the building of level-set.

Hopefully, this will be fixed in a later release, so it is easier to
maintain.

10/260 tests FAIL, where most of those 10 are due to improper usage of
the parallel package. Overall, I believe this is a reasonable amount
of passing tests to allow this to be marked as working.
This commit is contained in:
Karl Hallsby 2021-01-06 01:00:36 -06:00 committed by Doron Behar
parent 8ec29ea849
commit 31c13c07d2

View file

@ -0,0 +1,54 @@
{ buildOctavePackage
, lib
, fetchgit
, automake
, autoconf
, autoconf-archive
, parallel
}:
buildOctavePackage rec {
pname = "level-set";
version = "2019-04-13";
src = fetchgit {
url = "https://git.code.sf.net/p/octave/${pname}";
rev = "dbf46228a7582eef4fe5470fd00bc5b421dd33a5";
sha256 = "14qwa4j24m2j7njw8gbagkgmp040h6k0h7kyrrzgb9y0jm087qkl";
fetchSubmodules = false;
};
# The monstrosity of a regex below is to ensure that only error() calls are
# corrected to have a %s format specifier. However, logic_error() also
# exists, (a simple regex also matches that), but logic_error() doesn't
# require a format specifier. So, this regex was born to handle that...
patchPhase = ''
substituteInPlace build.sh --replace "level-set-0.3.1" "${pname}-${version}" \
--replace "\`pwd\`" '/build'
sed -i -E 's#[^[:graph:]]error \(# error \(\"%s\", #g' src/*.cpp
'';
nativeBuildInputs = [
automake
autoconf
autoconf-archive
];
requiredOctavePackages = [
parallel
];
preBuild = ''
mkdir -p $out
source ./build.sh
cd -
'';
meta = with lib; {
name = "Level Set";
homepage = "https://octave.sourceforge.io/level-set/index.html";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ KarlJoad ];
description = "Routines for calculating the time-evolution of the level-set equation and extracting geometric information from the level-set function";
};
}