nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchFromGitHub, cmake, abseil-cpp, gflags, which
2, lsb-release, glog, protobuf, cbc, zlib
3, ensureNewerSourcesForZipFilesHook, python, swig }:
4
5stdenv.mkDerivation rec {
6 pname = "or-tools";
7 version = "7.7";
8
9 src = fetchFromGitHub {
10 owner = "google";
11 repo = "or-tools";
12 rev = "v${version}";
13 sha256 = "06ig9a1afmzgzcg817y0rdq49ahll0q9y7bhhg9d89x6zy959ypv";
14 };
15
16 # The original build system uses cmake which does things like pull
17 # in dependencies through git and Makefile creation time. We
18 # obviously don't want to do this so instead we provide the
19 # dependencies straight from nixpkgs and use the make build method.
20 configurePhase = ''
21 cat <<EOF > Makefile.local
22 UNIX_ABSL_DIR=${abseil-cpp}
23 UNIX_GFLAGS_DIR=${gflags}
24 UNIX_GLOG_DIR=${glog}
25 UNIX_PROTOBUF_DIR=${protobuf}
26 UNIX_CBC_DIR=${cbc}
27 EOF
28 '';
29
30 makeFlags = [
31 "prefix=${placeholder "out"}"
32 "PROTOBUF_PYTHON_DESC=${python.pkgs.protobuf}/${python.sitePackages}/google/protobuf/descriptor_pb2.py"
33 ];
34 buildFlags = [ "cc" "pypi_archive" ];
35
36 checkTarget = "test_cc";
37 doCheck = true;
38
39 installTargets = [ "install_cc" ];
40 # The upstream install_python target installs to $HOME.
41 postInstall = ''
42 mkdir -p "$python/${python.sitePackages}"
43 (cd temp_python/ortools; PYTHONPATH="$python/${python.sitePackages}:$PYTHONPATH" python setup.py install '--prefix=$python')
44 '';
45
46 nativeBuildInputs = [
47 cmake lsb-release swig which zlib python
48 ensureNewerSourcesForZipFilesHook
49 python.pkgs.setuptools python.pkgs.wheel
50 ];
51 propagatedBuildInputs = [
52 abseil-cpp gflags glog protobuf cbc
53 python.pkgs.protobuf python.pkgs.six
54 ];
55
56 enableParallelBuilding = true;
57
58 outputs = [ "out" "python" ];
59
60 meta = with stdenv.lib; {
61 homepage = "https://github.com/google/or-tools";
62 license = licenses.asl20;
63 description = ''
64 Google's software suite for combinatorial optimization.
65 '';
66 maintainers = with maintainers; [ andersk ];
67 platforms = with platforms; linux;
68 };
69}