Files
nixpkgs/pkgs/by-name/le/levmar/package.nix
Guilhem Saurel cdcdbe2731 levmar: install new header
lm.h only contains a deprecation warning now
2025-10-28 19:54:35 +01:00

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;
};
})