about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/levmar/default.nix
blob: f1ba199fc8e0b9d9ad26fb17ddc30c2a253ce8ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ lib, stdenv, fetchurl }:

stdenv.mkDerivation rec {
  pname = "levmar";
  version = "2.6";

  src = fetchurl {
    url = "https://www.ics.forth.gr/~lourakis/levmar/${pname}-${version}.tgz";
    sha256 = "1mxsjip9x782z6qa6k5781wjwpvj5aczrn782m9yspa7lhgfzx1v";
  };

  patchPhase = ''
    substituteInPlace levmar.h --replace "define HAVE_LAPACK" "undef HAVE_LAPACK"
    sed -i 's/LAPACKLIBS=.*/LAPACKLIBS=/' Makefile
    substituteInPlace Makefile --replace "gcc" "${stdenv.cc.targetPrefix}cc"
  '';

  installPhase = ''
    mkdir -p $out/include $out/lib
    cp lm.h $out/include
    cp liblevmar.a $out/lib
  '';

  meta = {
    description = "ANSI C implementations of Levenberg-Marquardt, usable also from C++";
    homepage = "https://www.ics.forth.gr/~lourakis/levmar/";
    license = lib.licenses.gpl2Plus;
    platforms = lib.platforms.all;
  };
}