base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / li / libamplsolver / package.nix
blobbfaad6cbc7674beb4fb9291628b24398be2ae741
1 { lib, stdenv, substitute, fetchurl }:
3 stdenv.mkDerivation rec {
4   pname = "libamplsolver";
5   version = "20211109";
7   src = fetchurl {
8     url = "https://ampl.com/netlib/ampl/solvers.tgz";
9     sha256 = "sha256-LVmScuIvxmZzywPSBl9T9YcUBJP7UFAa3eWs9r4q3JM=";
10   };
12   patches = [
13     (substitute {
14       src = ./libamplsolver-sharedlib.patch;
15       substitutions = [ "--replace" "@sharedlibext@" "${stdenv.hostPlatform.extensions.sharedLibrary}" ];
16     })
17   ];
19   installPhase = ''
20     runHook preInstall
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
25     popd
26   '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
27     install_name_tool -id $out/lib/libamplsolver.dylib $out/lib/libamplsolver.dylib
28   '' + ''
29     runHook postInstall
30   '';
32   meta = with lib; {
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;
40   };