2024-05-23 11:43:35 +00:00
|
|
|
{ lib, stdenv, substitute, fetchurl }:
|
2022-02-26 14:25:00 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libamplsolver";
|
|
|
|
version = "20211109";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://ampl.com/netlib/ampl/solvers.tgz";
|
|
|
|
sha256 = "sha256-LVmScuIvxmZzywPSBl9T9YcUBJP7UFAa3eWs9r4q3JM=";
|
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2022-08-23 22:18:45 +00:00
|
|
|
(substitute {
|
|
|
|
src = ./libamplsolver-sharedlib.patch;
|
2024-02-09 03:30:09 +00:00
|
|
|
substitutions = [ "--replace" "@sharedlibext@" "${stdenv.hostPlatform.extensions.sharedLibrary}" ];
|
2022-02-26 14:25:00 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-08-23 22:18:45 +00:00
|
|
|
pushd sys.$(uname -m).$(uname -s)
|
2022-02-26 14:25:00 +00:00
|
|
|
install -D -m 0644 *.h -t $out/include
|
2022-08-23 22:18:45 +00:00
|
|
|
install -D -m 0644 *${stdenv.hostPlatform.extensions.sharedLibrary}* -t $out/lib
|
2022-02-26 14:25:00 +00:00
|
|
|
install -D -m 0644 *.a -t $out/lib
|
|
|
|
popd
|
2023-03-11 20:08:50 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
install_name_tool -id $out/lib/libamplsolver.dylib $out/lib/libamplsolver.dylib
|
|
|
|
'' + ''
|
2022-02-26 14:25:00 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Library of routines that help solvers work with AMPL";
|
|
|
|
homepage = "https://ampl.com/netlib/ampl/";
|
|
|
|
license = [ licenses.mit ];
|
2022-08-23 22:18:45 +00:00
|
|
|
platforms = platforms.unix;
|
2022-02-26 14:25:00 +00:00
|
|
|
maintainers = with maintainers; [ aanderse ];
|
2024-11-05 15:48:29 +00:00
|
|
|
# generates header at compile time
|
|
|
|
broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
|
2022-02-26 14:25:00 +00:00
|
|
|
};
|
|
|
|
}
|