or-tools: new package (v6.9.1)

This commit is contained in:
Mateusz Kowalczyk 2018-10-25 14:14:42 +09:00
parent 9a2fd03d67
commit 02fb26136c
3 changed files with 77 additions and 0 deletions

View file

@ -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;
};
}

View file

@ -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"

View file

@ -21189,6 +21189,8 @@ with pkgs;
nauty = callPackage ../applications/science/math/nauty {};
or-tools = callPackage ../development/libraries/science/math/or-tools {};
rubiks = callPackage ../development/libraries/science/math/rubiks { };
petsc = callPackage ../development/libraries/science/math/petsc { };