1 { lib, stdenv, substitute, fetchurl }:
3 stdenv.mkDerivation rec {
4 pname = "libamplsolver";
8 url = "https://ampl.com/netlib/ampl/solvers.tgz";
9 sha256 = "sha256-LVmScuIvxmZzywPSBl9T9YcUBJP7UFAa3eWs9r4q3JM=";
14 src = ./libamplsolver-sharedlib.patch;
15 substitutions = [ "--replace" "@sharedlibext@" "${stdenv.hostPlatform.extensions.sharedLibrary}" ];
21 pushd sys.$(uname -m).$(uname -s)
22 install -D -m 0644 *.h -t $out/include
23 install -D -m 0644 *${stdenv.hostPlatform.extensions.sharedLibrary}* -t $out/lib
24 install -D -m 0644 *.a -t $out/lib
26 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
27 install_name_tool -id $out/lib/libamplsolver.dylib $out/lib/libamplsolver.dylib
33 description = "Library of routines that help solvers work with AMPL";
34 homepage = "https://ampl.com/netlib/ampl/";
35 license = [ licenses.mit ];
36 platforms = platforms.unix;
37 maintainers = with maintainers; [ aanderse ];
38 # generates header at compile time
39 broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;