Commit 1268974f authored by Weijia Wang's avatar Weijia Wang
Browse files

scalp: unstable-2022-03-15 -> 0-unstable-2024-08-28

parent 03b6ef2a
Loading
Loading
Loading
Loading
+29 −15
Original line number Diff line number Diff line
@@ -9,19 +9,33 @@
  cplex,
  withLpsolve ? true,
  lp_solve,
  unstableGitUpdater,
}:

stdenv.mkDerivation rec {
  pname = "scalp";
  version = "unstable-2022-03-15";
  version = "0-unstable-2024-08-28";

  src = fetchgit {
    url = "https://digidev.digi.e-technik.uni-kassel.de/git/scalp.git";
    # mirrored at https://git.sr.ht/~weijia/scalp
    rev = "185b84e4ff967f42cf2de5db4db4e6fa0cc18fb8";
    hash = "sha256-NyMZdJwdD3FR6uweYCclJjfcf3Y24Bns1ViwsmJ5izg=";
    rev = "4a8e8b850a57328d9377ea7955c27c437394ebd3";
    hash = "sha256-6OEf3yWFBmTKgeTMojRMRf/t9Ec1i851Lx3mQjCeOuw=";
  };

  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}"'
    '';

  nativeBuildInputs = [
    cmake
  ];
@@ -37,30 +51,30 @@ stdenv.mkDerivation rec {
      lp_solve
    ];

  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace CMakeLists.txt \
      --replace "\''$ORIGIN" "\''${CMAKE_INSTALL_PREFIX}/lib"
  '';

  cmakeFlags =
    [
      "-DBUILD_TESTS=${lib.boolToString doCheck}"
      (lib.cmakeBool "BUILD_TESTS" doCheck)
    ]
    ++ lib.optionals withGurobi [
      "-DGUROBI_DIR=${gurobi}"
      (lib.cmakeFeature "GUROBI_ROOT_DIR" "${gurobi}")
    ]
    ++ lib.optionals withCplex [
      "-DCPLEX_DIR=${cplex}"
      (lib.cmakeFeature "CPLEX_ROOT_DIR" "${cplex}")
    ]
    ++ lib.optionals withLpsolve [
      (lib.cmakeFeature "LPSOLVE_ROOT_DIR" "${lp_solve}")
    ];

  doCheck = true;

  meta = with lib; {
  passthru.updateScript = unstableGitUpdater { };

  meta = {
    description = "Scalable Linear Programming Library";
    mainProgram = "scalp";
    homepage = "https://digidev.digi.e-technik.uni-kassel.de/scalp/";
    license = licenses.lgpl3;
    platforms = platforms.unix;
    maintainers = with maintainers; [ wegank ];
    license = lib.licenses.lgpl3Only;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ wegank ];
  };
}