mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-27 02:34:53 +00:00
41 lines
1.1 KiB
Nix
41 lines
1.1 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "levmar";
|
|
version = "2.6";
|
|
|
|
src = fetchurl {
|
|
url = "https://www.ics.forth.gr/~lourakis/levmar/levmar-${finalAttrs.version}.tgz";
|
|
hash = "sha256-O/TvHqRHXe1TFejY/Jkqcl8ueUCnTKOw+QKdnm6Uutc=";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace levmar.h --replace-fail "define HAVE_LAPACK" "undef HAVE_LAPACK"
|
|
sed -i 's/LAPACKLIBS=.*/LAPACKLIBS=/' Makefile
|
|
substituteInPlace Makefile --replace-fail "gcc" "${stdenv.cc.targetPrefix}cc"
|
|
''
|
|
+ lib.optionalString stdenv.cc.isClang ''
|
|
substituteInPlace compiler.h \
|
|
--replace-fail "#define LM_FINITE finite // ICC, GCC" \
|
|
"#define LM_FINITE isfinite // ICC, GCC"
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/include $out/lib
|
|
cp levmar.h 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;
|
|
maintainers = [ lib.maintainers.nim65s ];
|
|
platforms = lib.platforms.all;
|
|
};
|
|
})
|