1{
2 buildOctavePackage,
3 lib,
4 fetchgit,
5 automake,
6 autoconf,
7 autoconf-archive,
8 parallel,
9}:
10
11buildOctavePackage rec {
12 pname = "level-set";
13 version = "2019-04-13";
14
15 src = fetchgit {
16 url = "https://git.code.sf.net/p/octave/${pname}";
17 rev = "dbf46228a7582eef4fe5470fd00bc5b421dd33a5";
18 sha256 = "14qwa4j24m2j7njw8gbagkgmp040h6k0h7kyrrzgb9y0jm087qkl";
19 fetchSubmodules = false;
20 };
21
22 # The monstrosity of a regex below is to ensure that only error() calls are
23 # corrected to have a %s format specifier. However, logic_error() also
24 # exists, (a simple regex also matches that), but logic_error() doesn't
25 # require a format specifier. So, this regex was born to handle that...
26 postPatch = ''
27 substituteInPlace build.sh --replace "level-set-0.3.1" "${pname}-${version}" \
28 --replace "\`pwd\`" '/build'
29 sed -i -E 's#[^[:graph:]]error \(# error \(\"%s\", #g' src/*.cpp
30 '';
31
32 nativeBuildInputs = [
33 automake
34 autoconf
35 autoconf-archive
36 ];
37
38 requiredOctavePackages = [
39 parallel
40 ];
41
42 preBuild = ''
43 mkdir -p $out
44 source ./build.sh
45 cd -
46 '';
47
48 meta = {
49 name = "Level Set";
50 homepage = "https://gnu-octave.github.io/packages/level-set/";
51 license = lib.licenses.gpl3Plus;
52 maintainers = with lib.maintainers; [ KarlJoad ];
53 description = "Routines for calculating the time-evolution of the level-set equation and extracting geometric information from the level-set function";
54 # Got broke with octave 8.x update, and wasn't updated since 2019
55 broken = true;
56 };
57}