Unverified Commit 0748a9a5 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

scalp: unstable-2022-03-15 -> 0-unstable-2024-08-28 (#355476)

parents e973c8a0 933b9203
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchurl
, cmake
, unzip
, gmp
, scalp
{
  lib,
  stdenv,
  fetchurl,
  fetchpatch,
  cmake,
  unzip,
  gmp,
  scalp,
}:

stdenv.mkDerivation rec {
@@ -12,10 +14,20 @@ stdenv.mkDerivation rec {
  version = "1.80";

  src = fetchurl {
    url = "https://gitlab.com/kumm/pagsuite/-/raw/master/releases/pagsuite_${lib.replaceStrings ["."] ["_"] version}.zip";
    url = "https://gitlab.com/kumm/pagsuite/-/raw/master/releases/pagsuite_${
      lib.replaceStrings [ "." ] [ "_" ] version
    }.zip";
    hash = "sha256-TYd+dleVPWEWU9Cb3XExd7ixJZyiUAp9QLtorYJSIbQ=";
  };

  patches = [
    # Fix issue with latest ScaLP update
    (fetchpatch {
      url = "https://gitlab.com/kumm/pagsuite/-/commit/cae9f78bec93a7f197461358f2f796f6b5778781.patch";
      hash = "sha256-12IisS6oGYLRicORTemHB7bw9EB9cuQjxG8f6X0WMrU=";
    })
  ];

  sourceRoot = "pagsuite_${lib.replaceStrings [ "." ] [ "_" ] version}";

  nativeBuildInputs = [
+57 −36
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchgit
, cmake
, withGurobi ? false
, gurobi
, withCplex ? false
, cplex
, withLpsolve ? true
, lp_solve
{
  lib,
  stdenv,
  fetchgit,
  cmake,
  withGurobi ? false,
  gurobi,
  withCplex ? false,
  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
  ];

  buildInputs = lib.optionals withGurobi [
  buildInputs =
    lib.optionals withGurobi [
      gurobi
  ] ++ lib.optionals withCplex [
    ]
    ++ lib.optionals withCplex [
      cplex
  ] ++ lib.optionals withLpsolve [
    ]
    ++ lib.optionals withLpsolve [
      lp_solve
    ];

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

  cmakeFlags = [
    "-DBUILD_TESTS=${lib.boolToString doCheck}"
  ] ++ lib.optionals withGurobi [
    "-DGUROBI_DIR=${gurobi}"
  ] ++ lib.optionals withCplex [
    "-DCPLEX_DIR=${cplex}"
  cmakeFlags =
    [
      (lib.cmakeBool "BUILD_TESTS" doCheck)
    ]
    ++ lib.optionals withGurobi [
      (lib.cmakeFeature "GUROBI_ROOT_DIR" "${gurobi}")
    ]
    ++ lib.optionals withCplex [
      (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 ];
  };
}