2019-07-25 10:04:55 +01:00
|
|
|
{ stdenv, fetchFromGitHub, cmake, abseil-cpp, gflags, which
|
2018-12-12 07:54:31 +00:00
|
|
|
, lsb-release, glog, protobuf, cbc, zlib
|
|
|
|
, ensureNewerSourcesForZipFilesHook, python, swig
|
|
|
|
, pythonProtobuf }:
|
2018-10-25 06:14:42 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "or-tools";
|
2019-10-04 03:51:43 +01:00
|
|
|
version = "7.3";
|
2018-10-25 06:14:42 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "or-tools";
|
2019-10-04 03:51:43 +01:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0q06vxmds6nm3dpjw4y5jzr8j98qgfb9i8pbm9pfhmqigv791hwc";
|
2018-10-25 06:14:42 +01:00
|
|
|
};
|
|
|
|
|
2019-10-04 03:51:43 +01:00
|
|
|
patches = [
|
|
|
|
./build.patch # https://github.com/google/or-tools/pull/1619
|
|
|
|
./protobuf.patch # Otherwise it tries to install protobuf from pypi.
|
|
|
|
];
|
|
|
|
|
2018-10-25 06:14:42 +01:00
|
|
|
# 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
|
2019-03-26 22:29:28 +00:00
|
|
|
UNIX_ABSL_DIR=${abseil-cpp}
|
2019-07-25 10:04:55 +01:00
|
|
|
UNIX_GFLAGS_DIR=${gflags}
|
2018-10-25 06:14:42 +01:00
|
|
|
UNIX_GLOG_DIR=${glog}
|
|
|
|
UNIX_PROTOBUF_DIR=${protobuf}
|
|
|
|
UNIX_CBC_DIR=${cbc}
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2018-12-12 07:54:31 +00:00
|
|
|
makeFlags = [
|
|
|
|
"prefix=${placeholder "out"}"
|
|
|
|
"PROTOBUF_PYTHON_DESC=${pythonProtobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
|
|
|
|
];
|
|
|
|
buildFlags = [ "cc" "pypi_archive" ];
|
2018-10-25 06:14:42 +01:00
|
|
|
|
2018-12-01 01:46:17 +00:00
|
|
|
checkTarget = "test_cc";
|
|
|
|
doCheck = true;
|
|
|
|
|
2018-12-01 01:18:32 +00:00
|
|
|
installTargets = [ "install_cc" ];
|
2018-12-12 07:54:31 +00:00
|
|
|
# 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')
|
|
|
|
'';
|
2018-10-25 06:14:42 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2018-12-12 07:54:31 +00:00
|
|
|
cmake lsb-release swig which zlib python
|
|
|
|
ensureNewerSourcesForZipFilesHook
|
|
|
|
python.pkgs.setuptools python.pkgs.wheel
|
2018-10-25 06:14:42 +01:00
|
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
2019-07-25 10:04:55 +01:00
|
|
|
abseil-cpp gflags glog protobuf cbc
|
2018-12-12 07:54:31 +00:00
|
|
|
pythonProtobuf python.pkgs.six
|
2018-10-25 06:14:42 +01:00
|
|
|
];
|
|
|
|
|
2018-12-01 01:20:25 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2018-12-12 07:54:31 +00:00
|
|
|
outputs = [ "out" "python" ];
|
|
|
|
|
2018-10-25 06:14:42 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
}
|