nixpkgs/pkgs/by-name/li/libamplsolver/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

42 lines
1.2 KiB
Nix

{ lib, stdenv, substitute, fetchurl }:
stdenv.mkDerivation rec {
pname = "libamplsolver";
version = "20211109";
src = fetchurl {
url = "https://ampl.com/netlib/ampl/solvers.tgz";
sha256 = "sha256-LVmScuIvxmZzywPSBl9T9YcUBJP7UFAa3eWs9r4q3JM=";
};
patches = [
(substitute {
src = ./libamplsolver-sharedlib.patch;
substitutions = [ "--replace" "@sharedlibext@" "${stdenv.hostPlatform.extensions.sharedLibrary}" ];
})
];
installPhase = ''
runHook preInstall
pushd sys.$(uname -m).$(uname -s)
install -D -m 0644 *.h -t $out/include
install -D -m 0644 *${stdenv.hostPlatform.extensions.sharedLibrary}* -t $out/lib
install -D -m 0644 *.a -t $out/lib
popd
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -id $out/lib/libamplsolver.dylib $out/lib/libamplsolver.dylib
'' + ''
runHook postInstall
'';
meta = with lib; {
description = "Library of routines that help solvers work with AMPL";
homepage = "https://ampl.com/netlib/ampl/";
license = [ licenses.mit ];
platforms = platforms.unix;
maintainers = with maintainers; [ aanderse ];
# generates header at compile time
broken = !stdenv.buildPlatform.canExecute stdenv.hostPlatform;
};
}