summary refs log tree commit diff
path: root/pkgs/development/octave-modules
diff options
context:
space:
mode:
authorKarl Hallsby <karl@hallsby.com>2021-01-06 01:00:36 -0600
committerDoron Behar <doron.behar@gmail.com>2021-02-24 21:00:50 +0200
commit31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c (patch)
treea9f26e3ab565a9a3a5857df519e07d8d3743df7d /pkgs/development/octave-modules
parent8ec29ea849c9b416ce3fd0f84f47d9bc9fc6a004 (diff)
downloadnixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.tar
nixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.tar.gz
nixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.tar.bz2
nixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.tar.lz
nixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.tar.xz
nixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.tar.zst
nixpkgs-31c13c07d2f67fe18f7a6ffa9753dd90bb92be8c.zip
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.
Diffstat (limited to 'pkgs/development/octave-modules')
-rw-r--r--pkgs/development/octave-modules/level-set/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/development/octave-modules/level-set/default.nix b/pkgs/development/octave-modules/level-set/default.nix
new file mode 100644
index 00000000000..d1f882904d5
--- /dev/null
+++ b/pkgs/development/octave-modules/level-set/default.nix
@@ -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";
+  };
+}