8 ensureNewerSourcesForZipFilesHook,
24 pybind11_protobuf = fetchFromGitHub {
26 repo = "pybind11_protobuf";
27 rev = "b713501f1da56d9b76c42f89efd00b97c26c9eac";
28 hash = "sha256-f6pzRWextH+7lm1xzyhx98wCIWH3lbhn59gSCcjsBVw=";
31 stdenv.mkDerivation rec {
35 src = fetchFromGitHub {
39 hash = "sha256-eHukf6TbY2dx7iEf8WfwfWsjDEubPtRO02ju0kHtASo=";
44 src = ./offline.patch;
45 pybind11_protobuf = "../../pybind11_protobuf";
49 # or-tools normally attempts to build Protobuf for the build platform when
50 # cross-compiling. Instead, just tell it where to find protoc.
52 echo "set(PROTOC_PRG $(type -p protoc))" > cmake/host.cmake
54 cp -R ${pybind11_protobuf} pybind11_protobuf
55 chmod -R u+w pybind11_protobuf
61 "-DBUILD_pybind11=OFF"
62 "-DBUILD_pybind11_protobuf=ON"
63 "-DCMAKE_INSTALL_BINDIR=bin"
64 "-DCMAKE_INSTALL_INCLUDEDIR=include"
65 "-DCMAKE_INSTALL_LIBDIR=lib"
66 "-DFETCH_PYTHON_DEPS=OFF"
69 "-DPython3_EXECUTABLE=${python.pythonOnBuildForHost.interpreter}"
70 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DCMAKE_MACOSX_RPATH=OFF" ];
77 ensureNewerSourcesForZipFilesHook
79 python.pythonOnBuildForHost
83 ++ lib.optionals stdenv.hostPlatform.isDarwin [
86 ++ (with python.pythonOnBuildForHost.pkgs; [
101 python.pkgs.setuptools
106 propagatedBuildInputs = [
109 (python.pkgs.protobuf4.override { protobuf = protobuf; })
112 nativeCheckInputs = [
113 python.pkgs.matplotlib
115 python.pkgs.virtualenv
118 env.NIX_CFLAGS_COMPILE = toString [
119 # fatal error: 'python/google/protobuf/proto_api.h' file not found
121 # fatal error: 'pybind11_protobuf/native_proto_caster.h' file not found
122 "-I${pybind11_protobuf}"
125 # some tests fail on linux and hang on darwin
129 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
132 # This extra configure step prevents the installer from littering
133 # $out/bin with sample programs that only really function as tests,
134 # and disables the upstream installation of a zipped Python egg that
135 # can’t be imported with our Python setup.
137 cmake . -DBUILD_EXAMPLES=OFF -DBUILD_PYTHON=OFF -DBUILD_SAMPLES=OFF
139 pip install --prefix="$python" python/
148 homepage = "https://github.com/google/or-tools";
149 license = licenses.asl20;
151 Google's software suite for combinatorial optimization.
153 mainProgram = "fzn-ortools";
154 maintainers = with maintainers; [ andersk ];
155 platforms = with platforms; linux ++ darwin;