about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/math/or-tools/default.nix
blob: 415e57e5d3cfc832d8b509336461caf14cad0378 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ stdenv, fetchFromGitHub, cmake, google-gflags, which
, lsb-release, glog, protobuf, cbc, zlib, python3 }:

stdenv.mkDerivation rec {
  name = "or-tools-${version}";
  version = "v6.10";

  src = fetchFromGitHub {
    owner = "google";
    repo = "or-tools";
    rev = version;
    sha256 = "11k3671rpv968dsglc6bgarr9yi8ijaaqm2wq3m0rn4wy8fj7za2";
  };

  # 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
  '';

  makeFlags = [ "prefix=${placeholder "out"}" ];
  buildFlags = [ "cc" ];

  checkTarget = "test_cc";
  doCheck = true;

  installTargets = [ "install_cc" ];

  nativeBuildInputs = [
    cmake lsb-release which zlib python3
  ];
  propagatedBuildInputs = [
    google-gflags glog protobuf cbc
  ];

  enableParallelBuilding = true;

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