about summary refs log tree commit diff
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorAleksana <me@aleksana.moe>2024-06-17 01:13:54 +0800
committerGitHub <noreply@github.com>2024-06-17 01:13:54 +0800
commitd0c7b3f6530f48dfde4d16669b61fe2cfff4f752 (patch)
tree93d1dbcae7e606ef75414caba4338219701dd5f1 /pkgs/by-name
parent2815c3a421f4cb2e20ac629e2642125207b71a33 (diff)
parent895f3506f3196aca9c898fc86478acfa55413fc7 (diff)
Merge pull request #320260 from quantenzitrone/coinmp
CoinMP: rename to coinmp
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/co/coinmp/0001-change-more-reinterpret_cast-from-NULL-to-C-cast-see.patch95
-rw-r--r--pkgs/by-name/co/coinmp/0001-use-static_cast-for-static-cast-fixes-319.patch25
-rw-r--r--pkgs/by-name/co/coinmp/0002-change-reinterpret_cast-of-NULL-to-C-style-case-fixe.patch26
-rw-r--r--pkgs/by-name/co/coinmp/package.nix42
-rw-r--r--pkgs/by-name/sy/symphony/package.nix4
5 files changed, 190 insertions, 2 deletions
diff --git a/pkgs/by-name/co/coinmp/0001-change-more-reinterpret_cast-from-NULL-to-C-cast-see.patch b/pkgs/by-name/co/coinmp/0001-change-more-reinterpret_cast-from-NULL-to-C-cast-see.patch
new file mode 100644
index 0000000000000..fccba169df490
--- /dev/null
+++ b/pkgs/by-name/co/coinmp/0001-change-more-reinterpret_cast-from-NULL-to-C-cast-see.patch
@@ -0,0 +1,95 @@
+From 0259f2b936ee0d9288ff39c509c69a66f5b13b80 Mon Sep 17 00:00:00 2001
+From: Stefan Vigerske <svigerske@gams.com>
+Date: Mon, 11 Mar 2019 16:34:25 +0000
+Subject: [PATCH 1/2] change more reinterpret_cast from NULL to C-cast, see
+ also #93
+
+---
+ Clp/src/AbcSimplex.cpp | 48 +++++++++++++++++++++---------------------
+ Clp/src/ClpModel.cpp   |  2 +-
+ 2 files changed, 25 insertions(+), 25 deletions(-)
+
+diff --git a/Clp/src/AbcSimplex.cpp b/Clp/src/AbcSimplex.cpp
+index 0eacd91e..1715e6d8 100644
+--- a/Clp/src/AbcSimplex.cpp
++++ b/Clp/src/AbcSimplex.cpp
+@@ -368,19 +368,19 @@ AbcSimplex::gutsOfInitialize(int numberRows,int numberColumns,bool doMore)
+     // say Steepest pricing
+     abcDualRowPivot_ = new AbcDualRowSteepest();
+     abcPrimalColumnPivot_ = new AbcPrimalColumnSteepest();
+-    internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),
++    internalStatus_ = newArray((unsigned char *)NULL,
+ 			       sizeArray+maximumNumberTotal_);
+-    abcLower_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-    abcUpper_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-    abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+maximumNumberTotal_);
+-    abcDj_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-    abcSolution_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+maximumNumberTotal_);
+-    //fromExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
+-    //toExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
+-    scaleFromExternal_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-    offset_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-    abcPerturbation_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-    abcPivotVariable_ = newArray(reinterpret_cast<int *>(NULL),maximumAbcNumberRows_);
++    abcLower_ = newArray((double *)NULL,sizeArray);
++    abcUpper_ = newArray((double *)NULL,sizeArray);
++    abcCost_ = newArray((double *)NULL,sizeArray+maximumNumberTotal_);
++    abcDj_ = newArray((double *)NULL,sizeArray);
++    abcSolution_ = newArray((double *)NULL,sizeArray+maximumNumberTotal_);
++    //fromExternal_ = newArray((int *)NULL,sizeArray);
++    //toExternal_ = newArray((int *)NULL,sizeArray);
++    scaleFromExternal_ = newArray((double *)NULL,sizeArray);
++    offset_ = newArray((double *)NULL,sizeArray);
++    abcPerturbation_ = newArray((double *)NULL,sizeArray);
++    abcPivotVariable_ = newArray((int *)NULL,maximumAbcNumberRows_);
+     // Fill perturbation array
+     setupPointers(maximumAbcNumberRows_,maximumAbcNumberColumns_);
+     fillPerturbation(0,maximumNumberTotal_);
+@@ -554,19 +554,19 @@ AbcSimplex::createSubProblem(int numberColumns,const int * whichColumn)
+   subProblem->maximumNumberTotal_= maximumAbcNumberRows_+numberColumns;
+   subProblem->numberTotalWithoutFixed_= subProblem->numberTotal_;
+   int sizeArray=2*subProblem->maximumNumberTotal_+maximumAbcNumberRows_;
+-  subProblem->internalStatus_ = newArray(reinterpret_cast<unsigned char *>(NULL),
++  subProblem->internalStatus_ = newArray((unsigned char *)NULL,
+ 					 sizeArray+subProblem->maximumNumberTotal_);
+-  subProblem->abcLower_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-  subProblem->abcUpper_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-  subProblem->abcCost_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+subProblem->maximumNumberTotal_);
+-  subProblem->abcDj_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-  subProblem->abcSolution_ = newArray(reinterpret_cast<double *>(NULL),sizeArray+subProblem->maximumNumberTotal_);
+-  //fromExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
+-  //toExternal_ = newArray(reinterpret_cast<int *>(NULL),sizeArray);
+-  subProblem->scaleFromExternal_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-  subProblem->offset_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-  subProblem->abcPerturbation_ = newArray(reinterpret_cast<double *>(NULL),sizeArray);
+-  subProblem->abcPivotVariable_ = newArray(reinterpret_cast<int *>(NULL),maximumAbcNumberRows_);
++  subProblem->abcLower_ = newArray((double *)NULL,sizeArray);
++  subProblem->abcUpper_ = newArray((double *)NULL,sizeArray);
++  subProblem->abcCost_ = newArray((double *)NULL,sizeArray+subProblem->maximumNumberTotal_);
++  subProblem->abcDj_ = newArray((double *)NULL,sizeArray);
++  subProblem->abcSolution_ = newArray((double *)NULL,sizeArray+subProblem->maximumNumberTotal_);
++  //fromExternal_ = newArray((int *)NULL,sizeArray);
++  //toExternal_ = newArray((int *)NULL,sizeArray);
++  subProblem->scaleFromExternal_ = newArray((double *)NULL,sizeArray);
++  subProblem->offset_ = newArray((double *)NULL,sizeArray);
++  subProblem->abcPerturbation_ = newArray((double *)NULL,sizeArray);
++  subProblem->abcPivotVariable_ = newArray((int *)NULL,maximumAbcNumberRows_);
+   subProblem->setupPointers(maximumAbcNumberRows_,numberColumns);
+   // could use arrays - but for now be safe
+   int * backward = new int [numberFullColumns+numberRows_];
+diff --git a/Clp/src/ClpModel.cpp b/Clp/src/ClpModel.cpp
+index 1fc905c4..83aa3b63 100644
+--- a/Clp/src/ClpModel.cpp
++++ b/Clp/src/ClpModel.cpp
+@@ -3845,7 +3845,7 @@ ClpModel::writeMps(const char *filename,
+      writer.setMpsData(*(matrix_->getPackedMatrix()), COIN_DBL_MAX,
+                        getColLower(), getColUpper(),
+                        objective,
+-                       reinterpret_cast<const char*> (NULL) /*integrality*/,
++                       (const char*)NULL /*integrality*/,
+                        getRowLower(), getRowUpper(),
+                        columnNames, rowNames);
+      // Pass in array saying if each variable integer
+-- 
+2.37.3
+
diff --git a/pkgs/by-name/co/coinmp/0001-use-static_cast-for-static-cast-fixes-319.patch b/pkgs/by-name/co/coinmp/0001-use-static_cast-for-static-cast-fixes-319.patch
new file mode 100644
index 0000000000000..3f1790bd50c39
--- /dev/null
+++ b/pkgs/by-name/co/coinmp/0001-use-static_cast-for-static-cast-fixes-319.patch
@@ -0,0 +1,25 @@
+From b36a5bd502fbf6b8ad31b6bc35c7bab4aff24313 Mon Sep 17 00:00:00 2001
+From: Stefan Vigerske <svigerske@gams.com>
+Date: Mon, 20 Jul 2020 18:39:20 +0200
+Subject: [PATCH] use static_cast for static cast, fixes #319
+
+---
+ Cbc/src/CbcModel.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Cbc/src/CbcModel.cpp b/Cbc/src/CbcModel.cpp
+index 8603942b..239bf0b4 100644
+--- a/Cbc/src/CbcModel.cpp
++++ b/Cbc/src/CbcModel.cpp
+@@ -5357,7 +5357,7 @@ void CbcModel::branchAndBound(int doStatistics)
+         OsiClpSolverInterface * clpSolver
+         = dynamic_cast<OsiClpSolverInterface *> (solver_);
+         if (clpSolver)
+-            clpSolver->setFakeObjective(reinterpret_cast<double *> (NULL));
++            clpSolver->setFakeObjective(static_cast<double *> (NULL));
+     }
+ #endif
+     moreSpecialOptions_ = saveMoreSpecialOptions;
+-- 
+2.37.3
+
diff --git a/pkgs/by-name/co/coinmp/0002-change-reinterpret_cast-of-NULL-to-C-style-case-fixe.patch b/pkgs/by-name/co/coinmp/0002-change-reinterpret_cast-of-NULL-to-C-style-case-fixe.patch
new file mode 100644
index 0000000000000..b1ca1806b5a9c
--- /dev/null
+++ b/pkgs/by-name/co/coinmp/0002-change-reinterpret_cast-of-NULL-to-C-style-case-fixe.patch
@@ -0,0 +1,26 @@
+From 4571de031e528bc145590d6a1be5ceb87bd8cdb5 Mon Sep 17 00:00:00 2001
+From: Stefan Vigerske <svigerske@gams.com>
+Date: Mon, 11 Mar 2019 16:29:20 +0000
+Subject: [PATCH 2/2] change reinterpret_cast of NULL to C-style case, fixes
+ #93
+
+---
+ Clp/src/OsiClp/OsiClpSolverInterface.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Clp/src/OsiClp/OsiClpSolverInterface.cpp b/Clp/src/OsiClp/OsiClpSolverInterface.cpp
+index 55dd4dcd..a0217d42 100644
+--- a/Clp/src/OsiClp/OsiClpSolverInterface.cpp
++++ b/Clp/src/OsiClp/OsiClpSolverInterface.cpp
+@@ -1448,7 +1448,7 @@ OsiClpSolverInterface::setupForRepeatedUse(int senseOfAdventure, int printOut)
+   if (stopPrinting) {
+     CoinMessages * messagesPointer = modelPtr_->messagesPointer();
+     // won't even build messages 
+-    messagesPointer->setDetailMessages(100,10000,reinterpret_cast<int *> (NULL));
++    messagesPointer->setDetailMessages(100,10000,(int*)NULL);
+   }
+ #endif
+ }
+-- 
+2.37.3
+
diff --git a/pkgs/by-name/co/coinmp/package.nix b/pkgs/by-name/co/coinmp/package.nix
new file mode 100644
index 0000000000000..8c15c5ca62c34
--- /dev/null
+++ b/pkgs/by-name/co/coinmp/package.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchurl, fetchpatch }:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "coinmp";
+  version = "1.8.4";
+
+  src = fetchurl {
+    url = "https://www.coin-or.org/download/source/CoinMP/CoinMP-${finalAttrs.version}.tgz";
+    sha256 = "13d3j1sdcjzpijp4qks3n0zibk649ac3hhv88hkk8ffxrc6gnn9l";
+  };
+
+  patches = [
+    # backport build fixes for pkgsMusl.CoinMP
+    (fetchpatch {
+      url = "https://github.com/coin-or/Cgl/commit/57d8c71cd50dc27a89eaeb4672499bca55f1fd72.patch";
+      extraPrefix = "Cgl/";
+      stripLen = 1;
+      hash = "sha256-NdwXpIL1w6kHVfhBFscTlpriQOfUXx860/4x7pK+698=";
+    })
+    # https://github.com/coin-or/Clp/commit/b637e1d633425ae21ec041bf7f9e06f56b741de0
+    ./0001-change-more-reinterpret_cast-from-NULL-to-C-cast-see.patch
+    # https://github.com/coin-or/Clp/commit/e749fe6b11a90006d744af2ca2691220862e3a59
+    ./0002-change-reinterpret_cast-of-NULL-to-C-style-case-fixe.patch
+    # https://github.com/coin-or/Cbc/commit/584fd12fba6a562d49864f44bedd13ee32d06999
+    ./0001-use-static_cast-for-static-cast-fixes-319.patch
+  ];
+
+  enableParallelBuilding = true;
+
+  env = lib.optionalAttrs stdenv.cc.isClang {
+    CXXFLAGS = "-std=c++14";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  meta = with lib; {
+    homepage = "https://projects.coin-or.org/CoinMP/";
+    description = "COIN-OR lightweight API for COIN-OR libraries CLP, CBC, and CGL";
+    platforms = platforms.unix;
+    license = licenses.epl10;
+  };
+})
diff --git a/pkgs/by-name/sy/symphony/package.nix b/pkgs/by-name/sy/symphony/package.nix
index 51d3316c7d17b..cb75fae961b1c 100644
--- a/pkgs/by-name/sy/symphony/package.nix
+++ b/pkgs/by-name/sy/symphony/package.nix
@@ -3,7 +3,7 @@
 , fetchFromGitHub
 , cmake
 , coin-utils
-, CoinMP
+, coinmp
 , gfortran
 , libtool
 , glpk
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-OdTUMG3iVhjhw5uKtUnsLCZ4DfMjYHm8+/ozfmw7J6c=";
   };
 
-  nativeBuildInputs = [ libtool pkg-config glpk gfortran CoinMP osi coin-utils ];
+  nativeBuildInputs = [ libtool pkg-config glpk gfortran coinmp osi coin-utils ];
 
   meta = {
     description = "SYMPHONY is an open-source solver, callable library, and development framework for mixed-integer linear programs (MILPs) written in C with a number of unique features";