1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pkg-config,
6 blas,
7 lapack,
8 gfortran,
9 enableAMPL ? true,
10 libamplsolver,
11 enableMUMPS ? true,
12 mumps,
13 mpi,
14 enableSPRAL ? true,
15 spral,
16}:
17
18assert (!blas.isILP64) && (!lapack.isILP64);
19
20stdenv.mkDerivation rec {
21 pname = "ipopt";
22 version = "3.14.17";
23
24 src = fetchFromGitHub {
25 owner = "coin-or";
26 repo = "Ipopt";
27 rev = "releases/${version}";
28 sha256 = "sha256-0IRHryADQArhhtfbQjCy+EDvVRi/ywc51IwiQOfWlR4=";
29 };
30
31 CXXDEFS = [
32 "-DHAVE_RAND"
33 "-DHAVE_CSTRING"
34 "-DHAVE_CSTDIO"
35 ];
36
37 configureFlags =
38 lib.optionals enableAMPL [
39 "--with-asl-cflags=-I${libamplsolver}/include"
40 "--with-asl-lflags=-lamplsolver"
41 ]
42 ++ lib.optionals enableMUMPS [
43 "--with-mumps-cflags=-I${mumps}/include"
44 "--with-mumps-lflags=-ldmumps"
45 ]
46 ++ lib.optionals enableSPRAL [
47 "--with-spral-cflags=-I${spral}/include"
48 "--with-spral-lflags=-lspral"
49 ];
50
51 nativeBuildInputs = [
52 pkg-config
53 gfortran
54 ];
55 buildInputs = [
56 blas
57 lapack
58 ]
59 ++ lib.optionals enableAMPL [ libamplsolver ]
60 ++ lib.optionals enableMUMPS [
61 mumps
62 mpi
63 ]
64 ++ lib.optionals enableSPRAL [ spral ];
65
66 enableParallelBuilding = true;
67
68 meta = {
69 description = "Software package for large-scale nonlinear optimization";
70 homepage = "https://projects.coin-or.org/Ipopt";
71 license = lib.licenses.epl10;
72 platforms = lib.platforms.unix;
73 maintainers = with lib.maintainers; [ abbradar ];
74 };
75}