summary refs log tree commit diff
path: root/pkgs/development/libraries/science/math
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-03-01 12:05:54 +0000
committerGitHub <noreply@github.com>2022-03-01 12:05:54 +0000
commit4ae3f9a06c832b7d125debe87a2fd0ec88ad165b (patch)
tree64381c27662b2b2d477094df3cc5803c11ce63bc /pkgs/development/libraries/science/math
parent3135db28cb2d1136bde46aadb4adbbd8a7af0306 (diff)
parente3c78ec446db310c01504dca6cb7ee4cba0f8a7d (diff)
downloadnixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.tar
nixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.tar.gz
nixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.tar.bz2
nixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.tar.lz
nixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.tar.xz
nixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.tar.zst
nixpkgs-4ae3f9a06c832b7d125debe87a2fd0ec88ad165b.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/development/libraries/science/math')
-rw-r--r--pkgs/development/libraries/science/math/ipopt/default.nix29
-rw-r--r--pkgs/development/libraries/science/math/libamplsolver/default.nix37
2 files changed, 56 insertions, 10 deletions
diff --git a/pkgs/development/libraries/science/math/ipopt/default.nix b/pkgs/development/libraries/science/math/ipopt/default.nix
index e0dfef0b7ee..325a6b82a6f 100644
--- a/pkgs/development/libraries/science/math/ipopt/default.nix
+++ b/pkgs/development/libraries/science/math/ipopt/default.nix
@@ -1,26 +1,35 @@
-{ lib, stdenv, fetchurl, unzip, blas, lapack, gfortran }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, pkg-config
+, blas
+, lapack
+, gfortran
+, enableAMPL ? stdenv.isLinux, libamplsolver
+}:
 
 assert (!blas.isILP64) && (!lapack.isILP64);
 
 stdenv.mkDerivation rec {
   pname = "ipopt";
-  version = "3.12.13";
+  version = "3.14.5";
 
-  src = fetchurl {
-    url = "https://www.coin-or.org/download/source/Ipopt/Ipopt-${version}.zip";
-    sha256 = "0kzf05aypx8q5mr3sciclk926ans0yi2d2chjdxxgpi3sza609dx";
+  src = fetchFromGitHub {
+    owner = "coin-or";
+    repo = "Ipopt";
+    rev = "releases/${version}";
+    sha256 = "sha256-eqOacZGuuGAjWMs2H6RntQ+WJmGTi+EqydHUQXEpY54=";
   };
 
   CXXDEFS = [ "-DHAVE_RAND" "-DHAVE_CSTRING" "-DHAVE_CSTDIO" ];
 
   configureFlags = [
-    "--with-blas-lib=-lblas"
-    "--with-lapack-lib=-llapack"
+    "--with-asl-cflags=-I${libamplsolver}/include"
+    "--with-asl-lflags=-lamplsolver"
   ];
 
-  nativeBuildInputs = [ unzip gfortran ];
-
-  buildInputs = [ blas lapack ];
+  nativeBuildInputs = [ pkg-config gfortran ];
+  buildInputs = [ blas lapack ] ++ lib.optionals enableAMPL [ libamplsolver ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/science/math/libamplsolver/default.nix b/pkgs/development/libraries/science/math/libamplsolver/default.nix
new file mode 100644
index 00000000000..bcbde5f6135
--- /dev/null
+++ b/pkgs/development/libraries/science/math/libamplsolver/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  pname = "libamplsolver";
+  version = "20211109";
+
+  src = fetchurl {
+    url = "https://ampl.com/netlib/ampl/solvers.tgz";
+    sha256 = "sha256-LVmScuIvxmZzywPSBl9T9YcUBJP7UFAa3eWs9r4q3JM=";
+  };
+
+  patches = [
+    # Debian provides a patch to build a shared library
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/liba/libamplsolver/0~20190702-2/debian/patches/fix-makefile-shared-lib.patch";
+      sha256 = "sha256-96qwj3fLugzbsfxguKMce13cUo7XGC4VUE7xKcJs42Y=";
+    })
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    pushd sys.`uname -m`.`uname -s`
+    install -D -m 0644 *.h -t $out/include
+    install -D -m 0644 *.so* -t $out/lib
+    install -D -m 0644 *.a -t $out/lib
+    popd
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "A library of routines that help solvers work with AMPL";
+    homepage = "https://ampl.com/netlib/ampl/";
+    license = [ licenses.mit ];
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ aanderse ];
+  };
+}