From 02fb26136c72dbf942fbd30acb3ed943881ef98c Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Thu, 25 Oct 2018 14:14:42 +0900 Subject: or-tools: new package (v6.9.1) --- .../libraries/science/math/or-tools/default.nix | 63 ++++++++++++++++++++++ .../science/math/or-tools/gflags-include.patch | 12 +++++ 2 files changed, 75 insertions(+) create mode 100644 pkgs/development/libraries/science/math/or-tools/default.nix create mode 100644 pkgs/development/libraries/science/math/or-tools/gflags-include.patch (limited to 'pkgs/development/libraries') 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 < 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 ++#include + + #include "google/protobuf/wrappers.pb.h" + #include "ortools/base/filelineiter.h" -- cgit 1.4.1