about summary refs log tree commit diff
path: root/pkgs/development/libraries/science
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2019-04-20 17:39:23 +0900
committerGitHub <noreply@github.com>2019-04-20 17:39:23 +0900
commit575d6a48267670cbb298770a910fb1c6311f55fd (patch)
treefba197600203d079097609809a95517f2b1ae9e3 /pkgs/development/libraries/science
parent7250104c7b1567dc5b9a78daa8f0018fa383f939 (diff)
parentae6b9dcb0e9ece499db00ba1ab5062ee4bf13ce8 (diff)
downloadnixlib-575d6a48267670cbb298770a910fb1c6311f55fd.tar
nixlib-575d6a48267670cbb298770a910fb1c6311f55fd.tar.gz
nixlib-575d6a48267670cbb298770a910fb1c6311f55fd.tar.bz2
nixlib-575d6a48267670cbb298770a910fb1c6311f55fd.tar.lz
nixlib-575d6a48267670cbb298770a910fb1c6311f55fd.tar.xz
nixlib-575d6a48267670cbb298770a910fb1c6311f55fd.tar.zst
nixlib-575d6a48267670cbb298770a910fb1c6311f55fd.zip
Merge pull request #58417 from andersk/ortools-7.0
or-tools: 6.10 -> 7.0, add Python bindings
Diffstat (limited to 'pkgs/development/libraries/science')
-rw-r--r--pkgs/development/libraries/science/math/or-tools/default.nix32
-rw-r--r--pkgs/development/libraries/science/math/or-tools/gflags-include.patch12
2 files changed, 24 insertions, 20 deletions
diff --git a/pkgs/development/libraries/science/math/or-tools/default.nix b/pkgs/development/libraries/science/math/or-tools/default.nix
index 415e57e5d3cf..ba6827bf6947 100644
--- a/pkgs/development/libraries/science/math/or-tools/default.nix
+++ b/pkgs/development/libraries/science/math/or-tools/default.nix
@@ -1,15 +1,17 @@
-{ stdenv, fetchFromGitHub, cmake, google-gflags, which
-, lsb-release, glog, protobuf, cbc, zlib, python3 }:
+{ stdenv, fetchFromGitHub, cmake, abseil-cpp, google-gflags, which
+, lsb-release, glog, protobuf, cbc, zlib
+, ensureNewerSourcesForZipFilesHook, python, swig
+, pythonProtobuf }:
 
 stdenv.mkDerivation rec {
   name = "or-tools-${version}";
-  version = "v6.10";
+  version = "v7.0";
 
   src = fetchFromGitHub {
     owner = "google";
     repo = "or-tools";
     rev = version;
-    sha256 = "11k3671rpv968dsglc6bgarr9yi8ijaaqm2wq3m0rn4wy8fj7za2";
+    sha256 = "09rs2j3w4ljw9qhhnsjlvfii297njjszwvkbgj1i6kns3wnlr7cp";
   };
 
   # The original build system uses cmake which does things like pull
@@ -18,6 +20,7 @@ stdenv.mkDerivation rec {
   # dependencies straight from nixpkgs and use the make build method.
   configurePhase = ''
     cat <<EOF > Makefile.local
+    UNIX_ABSL_DIR=${abseil-cpp}
     UNIX_GFLAGS_DIR=${google-gflags}
     UNIX_GLOG_DIR=${glog}
     UNIX_PROTOBUF_DIR=${protobuf}
@@ -25,23 +28,36 @@ stdenv.mkDerivation rec {
     EOF
   '';
 
-  makeFlags = [ "prefix=${placeholder "out"}" ];
-  buildFlags = [ "cc" ];
+  makeFlags = [
+    "prefix=${placeholder "out"}"
+    "PROTOBUF_PYTHON_DESC=${pythonProtobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
+  ];
+  buildFlags = [ "cc" "pypi_archive" ];
 
   checkTarget = "test_cc";
   doCheck = true;
 
   installTargets = [ "install_cc" ];
+  # The upstream install_python target installs to $HOME.
+  postInstall = ''
+    mkdir -p "$python/${python.sitePackages}"
+    (cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python')
+  '';
 
   nativeBuildInputs = [
-    cmake lsb-release which zlib python3
+    cmake lsb-release swig which zlib python
+    ensureNewerSourcesForZipFilesHook
+    python.pkgs.setuptools python.pkgs.wheel
   ];
   propagatedBuildInputs = [
-    google-gflags glog protobuf cbc
+    abseil-cpp google-gflags glog protobuf cbc
+    pythonProtobuf python.pkgs.six
   ];
 
   enableParallelBuilding = true;
 
+  outputs = [ "out" "python" ];
+
   meta = with stdenv.lib; {
     homepage = https://github.com/google/or-tools;
     license = licenses.asl20;
diff --git a/pkgs/development/libraries/science/math/or-tools/gflags-include.patch b/pkgs/development/libraries/science/math/or-tools/gflags-include.patch
deleted file mode 100644
index 08f76180638b..000000000000
--- a/pkgs/development/libraries/science/math/or-tools/gflags-include.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/ortools/data/jobshop_scheduling_parser.cc b/ortools/data/jobshop_scheduling_parser.cc
-index cb0a360b..c2f055eb 100644
---- a/ortools/data/jobshop_scheduling_parser.cc
-+++ b/ortools/data/jobshop_scheduling_parser.cc
-@@ -14,6 +14,7 @@
- #include "ortools/data/jobshop_scheduling_parser.h"
- 
- #include <cmath>
-+#include <gflags/gflags.h>
- 
- #include "google/protobuf/wrappers.pb.h"
- #include "ortools/base/filelineiter.h"