1{ lib
2, stdenv
3, cmake
4, darwin
5, fetchFromGitHub
6, fetchurl
7, withBlas ? true, blas
8}:
9
10stdenv.mkDerivation rec {
11 pname = "cminpack";
12 version = "1.3.8";
13
14 src = fetchFromGitHub {
15 owner = "devernay";
16 repo = "cminpack";
17 rev = "v${version}";
18 hash = "sha256-eFJ43cHbSbWld+gPpMaNiBy1X5TIcN9aVxjh8PxvVDU=";
19 };
20
21 strictDeps = true;
22
23 nativeBuildInputs = [
24 cmake
25 ];
26
27 buildInputs = lib.optionals withBlas [
28 blas
29 ] ++ lib.optionals (withBlas && stdenv.isDarwin) [
30 darwin.apple_sdk.frameworks.Accelerate
31 darwin.apple_sdk.frameworks.CoreGraphics
32 darwin.apple_sdk.frameworks.CoreVideo
33 ];
34
35 cmakeFlags = [
36 "-DUSE_BLAS=${if withBlas then "ON" else "OFF"}"
37 "-DBUILD_SHARED_LIBS=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
38 ];
39
40 meta = {
41 description = "Software for solving nonlinear equations and nonlinear least squares problems";
42 homepage = "http://devernay.free.fr/hacks/cminpack/";
43 changelog = "https://github.com/devernay/cminpack/blob/v${version}/README.md#history";
44 license = lib.licenses.bsd3;
45 platforms = lib.platforms.all;
46 maintainers = [ ];
47 };
48}