Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
84 lines
1.9 KiB
Nix
84 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
cctools,
|
|
fixDarwinDylibNames,
|
|
autoSignDarwinBinariesHook,
|
|
replaceVars,
|
|
buildPackages,
|
|
binutils,
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "lp_solve";
|
|
version = "5.5.2.11";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/project/lpsolve/lpsolve/${version}/lp_solve_${version}_source.tar.gz";
|
|
sha256 = "sha256-bUq/9cxqqpM66ObBeiJt8PwLZxxDj2lxXUHQn+gfkC8=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
binutils
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
cctools
|
|
fixDarwinDylibNames
|
|
]
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
|
|
autoSignDarwinBinariesHook
|
|
];
|
|
|
|
env = {
|
|
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-int";
|
|
}
|
|
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) {
|
|
NIX_LDFLAGS = "-headerpad_max_install_names";
|
|
};
|
|
|
|
dontConfigure = true;
|
|
|
|
patches = [
|
|
(replaceVars ./0001-fix-cross-compilation.patch {
|
|
emulator = "${stdenv.hostPlatform.emulator buildPackages}";
|
|
})
|
|
];
|
|
|
|
buildPhase =
|
|
let
|
|
ccc = if stdenv.hostPlatform.isDarwin then "ccc.osx" else "ccc";
|
|
in
|
|
''
|
|
runHook preBuild
|
|
|
|
(cd lpsolve55 && bash -x -e ${ccc})
|
|
(cd lp_solve && bash -x -e ${ccc})
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -d -m755 $out/bin $out/lib $out/include/lpsolve
|
|
install -m755 lp_solve/bin/*/lp_solve -t $out/bin
|
|
install -m644 lpsolve55/bin/*/liblpsolve* -t $out/lib
|
|
install -m644 lp_*.h -t $out/include/lpsolve
|
|
|
|
rm $out/lib/liblpsolve*.a
|
|
rm $out/include/lpsolve/lp_solveDLL.h # A Windows header
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Mixed Integer Linear Programming (MILP) solver";
|
|
mainProgram = "lp_solve";
|
|
homepage = "https://lpsolve.sourceforge.net";
|
|
license = licenses.gpl2Plus;
|
|
maintainers = with maintainers; [ smironov ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|