From 03b6ef2ae0ef082279294555b63097051cff4902 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 12 Nov 2024 17:53:11 +0100 Subject: [PATCH 1/4] scalp: reformat --- pkgs/by-name/sc/scalp/package.nix | 55 +++++++++++++++++-------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/pkgs/by-name/sc/scalp/package.nix b/pkgs/by-name/sc/scalp/package.nix index a4d3dc52e0a9..f41100fc1228 100644 --- a/pkgs/by-name/sc/scalp/package.nix +++ b/pkgs/by-name/sc/scalp/package.nix @@ -1,13 +1,14 @@ -{ 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, }: stdenv.mkDerivation rec { @@ -25,26 +26,32 @@ stdenv.mkDerivation rec { cmake ]; - buildInputs = lib.optionals withGurobi [ - gurobi - ] ++ lib.optionals withCplex [ - cplex - ] ++ lib.optionals withLpsolve [ - lp_solve - ]; + buildInputs = + lib.optionals withGurobi [ + gurobi + ] + ++ lib.optionals withCplex [ + cplex + ] + ++ 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 = + [ + "-DBUILD_TESTS=${lib.boolToString doCheck}" + ] + ++ lib.optionals withGurobi [ + "-DGUROBI_DIR=${gurobi}" + ] + ++ lib.optionals withCplex [ + "-DCPLEX_DIR=${cplex}" + ]; doCheck = true; From 1268974f036a9c0f9635c9b94785a0da7312cd78 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:28:50 +0100 Subject: [PATCH 2/4] scalp: unstable-2022-03-15 -> 0-unstable-2024-08-28 --- pkgs/by-name/sc/scalp/package.nix | 44 ++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/sc/scalp/package.nix b/pkgs/by-name/sc/scalp/package.nix index f41100fc1228..fcd0ce58c24f 100644 --- a/pkgs/by-name/sc/scalp/package.nix +++ b/pkgs/by-name/sc/scalp/package.nix @@ -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 ]; }; } From e8e8784f34ea27a2157e93bdecd9b72479443213 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:29:29 +0100 Subject: [PATCH 3/4] pagsuite: reformat --- pkgs/by-name/pa/pagsuite/package.nix | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/pa/pagsuite/package.nix b/pkgs/by-name/pa/pagsuite/package.nix index 6994712e18fd..4f4c7b4a445b 100644 --- a/pkgs/by-name/pa/pagsuite/package.nix +++ b/pkgs/by-name/pa/pagsuite/package.nix @@ -1,10 +1,11 @@ -{ lib -, stdenv -, fetchurl -, cmake -, unzip -, gmp -, scalp +{ + lib, + stdenv, + fetchurl, + cmake, + unzip, + gmp, + scalp, }: stdenv.mkDerivation rec { @@ -12,11 +13,13 @@ 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="; }; - sourceRoot = "pagsuite_${lib.replaceStrings ["."] ["_"] version}"; + sourceRoot = "pagsuite_${lib.replaceStrings [ "." ] [ "_" ] version}"; nativeBuildInputs = [ cmake From 933b920360feb7203866f66fcd515f8329d16010 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sat, 16 Nov 2024 00:31:49 +0100 Subject: [PATCH 4/4] pagsuite: fix build --- pkgs/by-name/pa/pagsuite/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/pa/pagsuite/package.nix b/pkgs/by-name/pa/pagsuite/package.nix index 4f4c7b4a445b..850732275cb3 100644 --- a/pkgs/by-name/pa/pagsuite/package.nix +++ b/pkgs/by-name/pa/pagsuite/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchurl, + fetchpatch, cmake, unzip, gmp, @@ -19,6 +20,14 @@ stdenv.mkDerivation rec { 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 = [