summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorMateusz Kowalczyk <mateusz.kowalczyk@tweag.io>2018-10-25 14:14:42 +0900
committerMateusz Kowalczyk <mateusz.kowalczyk@tweag.io>2018-10-25 14:15:13 +0900
commit02fb26136c72dbf942fbd30acb3ed943881ef98c (patch)
treec5113ed752a76b6b5b703c8bebabcb09eafc72a4 /pkgs/development/libraries
parent9a2fd03d67b5264de4f93206d2e39d92c4bbb942 (diff)
downloadnixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.tar
nixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.tar.gz
nixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.tar.bz2
nixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.tar.lz
nixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.tar.xz
nixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.tar.zst
nixlib-02fb26136c72dbf942fbd30acb3ed943881ef98c.zip
or-tools: new package (v6.9.1)
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/science/math/or-tools/default.nix63
-rw-r--r--pkgs/development/libraries/science/math/or-tools/gflags-include.patch12
2 files changed, 75 insertions, 0 deletions
diff --git a/pkgs/development/libraries/science/math/or-tools/default.nix b/pkgs/development/libraries/science/math/or-tools/default.nix
new file mode 100644
index 000000000000..5294c779a32b
--- /dev/null
+++ b/pkgs/development/libraries/science/math/or-tools/default.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchFromGitHub, cmake, google-gflags, which
+, lsb-release, glog, protobuf, cbc, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "or-tools-${version}";
+  version = "v6.9.1";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "or-tools";
+    rev = version;
+    sha256 = "099j1mc7vvry0a2fiz9zvk6divivglzphv48wbw0c6nd5w8hb27c";
+  };
+
+  # The original build system uses cmake which does things like pull
+  # in dependencies through git and Makefile creation time. We
+  # obviously don't want to do this so instead we provide the
+  # dependencies straight from nixpkgs and use the make build method.
+  configurePhase = ''
+    cat <<EOF > Makefile.local
+    UNIX_GFLAGS_DIR=${google-gflags}
+    UNIX_GLOG_DIR=${glog}
+    UNIX_PROTOBUF_DIR=${protobuf}
+    UNIX_CBC_DIR=${cbc}
+    EOF
+  '';
+
+  buildPhase = ''
+    make cc
+  '';
+
+  installPhase = ''
+    make install_cc prefix=$out
+  '';
+
+  patches = [
+    # In "expected" way of compilation, the glog package is compiled
+    # with gflags support which then makes gflags header transitively
+    # included through glog. However in nixpkgs we don't compile glog
+    # with gflags so we have to include it ourselves. Upstream should
+    # always include gflags to support both ways I think.
+    #
+    # Upstream ticket: https://github.com/google/or-tools/issues/902
+    ./gflags-include.patch
+  ];
+
+  nativeBuildInputs = [
+    cmake lsb-release which zlib
+  ];
+  propagatedBuildInputs = [
+    google-gflags glog protobuf cbc
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/google/or-tools;
+    license = licenses.asl20;
+    description = ''
+      Google's software suite for combinatorial optimization.
+    '';
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/pkgs/development/libraries/science/math/or-tools/gflags-include.patch b/pkgs/development/libraries/science/math/or-tools/gflags-include.patch
new file mode 100644
index 000000000000..08f76180638b
--- /dev/null
+++ b/pkgs/development/libraries/science/math/or-tools/gflags-include.patch
@@ -0,0 +1,12 @@
+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"