nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix

74 lines
2.1 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, cmake, abseil-cpp, gflags, which
, lsb-release, glog, protobuf3_11, cbc, zlib
, ensureNewerSourcesForZipFilesHook, python, swig }:
2018-10-25 07:14:42 +02:00
let
protobuf = protobuf3_11;
pythonProtobuf = python.pkgs.protobuf.override { inherit protobuf; };
in stdenv.mkDerivation rec {
pname = "or-tools";
2020-05-04 04:32:15 +02:00
version = "7.6";
2018-10-25 07:14:42 +02:00
src = fetchFromGitHub {
owner = "google";
repo = "or-tools";
2019-10-04 04:51:43 +02:00
rev = "v${version}";
2020-05-04 04:32:15 +02:00
sha256 = "0605q3y7vh7x7m9azrbkx44blq12zrab6v28b9wmpcn1lmykbw1b";
2018-10-25 07:14:42 +02: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
UNIX_ABSL_DIR=${abseil-cpp}
UNIX_GFLAGS_DIR=${gflags}
2018-10-25 07:14:42 +02:00
UNIX_GLOG_DIR=${glog}
UNIX_PROTOBUF_DIR=${protobuf}
UNIX_CBC_DIR=${cbc}
EOF
'';
makeFlags = [
"prefix=${placeholder "out"}"
"PROTOBUF_PYTHON_DESC=${pythonProtobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
];
buildFlags = [ "cc" "pypi_archive" ];
2018-10-25 07:14:42 +02:00
checkTarget = "test_cc";
doCheck = true;
2018-12-01 02:18:32 +01:00
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')
'';
2018-10-25 07:14:42 +02:00
nativeBuildInputs = [
cmake lsb-release swig which zlib python
ensureNewerSourcesForZipFilesHook
python.pkgs.setuptools python.pkgs.wheel
2018-10-25 07:14:42 +02:00
];
propagatedBuildInputs = [
abseil-cpp gflags glog protobuf cbc
pythonProtobuf python.pkgs.six
2018-10-25 07:14:42 +02:00
];
2018-12-01 02:20:25 +01:00
enableParallelBuilding = true;
outputs = [ "out" "python" ];
2018-10-25 07:14:42 +02:00
meta = with stdenv.lib; {
homepage = "https://github.com/google/or-tools";
2018-10-25 07:14:42 +02:00
license = licenses.asl20;
description = ''
Google's software suite for combinatorial optimization.
'';
maintainers = with maintainers; [ andersk ];
2018-10-25 07:14:42 +02:00
platforms = with platforms; linux;
};
}