nixpkgs/pkgs/by-name/sc/scalp/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
1.9 KiB
Nix
Raw Normal View History

2024-11-12 16:53:11 +00:00
{
lib,
stdenv,
fetchgit,
cmake,
withGurobi ? false,
gurobi,
withCplex ? false,
cplex,
withLpsolve ? true,
lp_solve,
unstableGitUpdater,
2022-07-31 11:28:19 +00:00
}:
stdenv.mkDerivation rec {
pname = "scalp";
version = "0-unstable-2024-08-28";
2022-07-31 11:28:19 +00:00
src = fetchgit {
url = "https://digidev.digi.e-technik.uni-kassel.de/git/scalp.git";
2023-04-03 11:16:03 +00:00
# mirrored at https://git.sr.ht/~weijia/scalp
rev = "4a8e8b850a57328d9377ea7955c27c437394ebd3";
hash = "sha256-6OEf3yWFBmTKgeTMojRMRf/t9Ec1i851Lx3mQjCeOuw=";
2022-07-31 11:28:19 +00:00
};
postPatch =
''
substituteInPlace CMakeLists.txt \
--replace-fail "\''$ORIGIN" "\''${CMAKE_INSTALL_PREFIX}/lib" \
--replace-fail "-m64" ""
substituteInPlace src/tests/CMakeLists.txt \
--replace-fail "src/tests/" ""
''
+ lib.optionalString withGurobi ''
substituteInPlace CMakeExtensions/FindGurobi.cmake \
--replace-fail "\''${GUROBI_VERSION}" '"${lib.versions.major gurobi.version}${lib.versions.minor gurobi.version}"'
'';
2022-07-31 11:28:19 +00:00
nativeBuildInputs = [
cmake
];
2024-11-12 16:53:11 +00:00
buildInputs =
lib.optionals withGurobi [
gurobi
]
++ lib.optionals withCplex [
cplex
]
++ lib.optionals withLpsolve [
lp_solve
];
2022-07-31 11:28:19 +00:00
2024-11-12 16:53:11 +00:00
cmakeFlags =
[
(lib.cmakeBool "BUILD_TESTS" doCheck)
2024-11-12 16:53:11 +00:00
]
++ lib.optionals withGurobi [
(lib.cmakeFeature "GUROBI_ROOT_DIR" "${gurobi}")
2024-11-12 16:53:11 +00:00
]
++ lib.optionals withCplex [
(lib.cmakeFeature "CPLEX_ROOT_DIR" "${cplex}")
]
++ lib.optionals withLpsolve [
(lib.cmakeFeature "LPSOLVE_ROOT_DIR" "${lp_solve}")
2024-11-12 16:53:11 +00:00
];
2022-07-31 11:28:19 +00:00
doCheck = true;
passthru.updateScript = unstableGitUpdater { };
meta = {
2022-07-31 11:28:19 +00:00
description = "Scalable Linear Programming Library";
mainProgram = "scalp";
2022-07-31 11:28:19 +00:00
homepage = "https://digidev.digi.e-technik.uni-kassel.de/scalp/";
license = lib.licenses.lgpl3Only;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ wegank ];
2022-07-31 11:28:19 +00:00
};
}