Skip to content

Commit

Permalink
or-tools: 9.7 -> 9.9
Browse files Browse the repository at this point in the history
  • Loading branch information
wegank committed Jul 16, 2024
1 parent d1f41ec commit 272966f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 46 deletions.
41 changes: 15 additions & 26 deletions pkgs/development/libraries/science/math/or-tools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
, eigen
, ensureNewerSourcesForZipFilesHook
, fetchFromGitHub
, substituteAll
, fetchpatch
, glpk
, lib
, pkg-config
Expand All @@ -19,46 +19,40 @@
, zlib
}:

let
pybind11_protobuf = fetchFromGitHub {
owner = "pybind";
repo = "pybind11_protobuf";
rev = "b713501f1da56d9b76c42f89efd00b97c26c9eac";
hash = "sha256-f6pzRWextH+7lm1xzyhx98wCIWH3lbhn59gSCcjsBVw=";
};
in
stdenv.mkDerivation rec {
pname = "or-tools";
version = "9.7";
version = "9.9";

src = fetchFromGitHub {
owner = "google";
repo = "or-tools";
rev = "v${version}";
hash = "sha256-eHukf6TbY2dx7iEf8WfwfWsjDEubPtRO02ju0kHtASo=";
hash = "sha256-Ip2mKl+MuzOPaF1a2FTubqT0tA4gzDnD8dR7dLaHHo8=";
};

patches = [
(substituteAll {
src = ./offline.patch;
pybind11_protobuf = "../../pybind11_protobuf";
(fetchpatch {
name = "0001-Allow-to-use-pybind11-system-packages.patch";
url = "https://build.opensuse.org/public/source/science/google-or-tools/0001-Allow-to-use-pybind11-system-packages.patch?rev=18";
hash = "sha256-+hFgZt9G0EMpMMXA/qnHjOdk6+eIlgV6T0qu36s4Z/Y=";
})
(fetchpatch {
name = "0001-Do-not-try-to-copy-pybind11_abseil-status-extension-.patch";
url = "https://build.opensuse.org/public/source/science/google-or-tools/0001-Do-not-try-to-copy-pybind11_abseil-status-extension-.patch?rev=18";
hash = "sha256-vAjxUW1SjHRG2mpyjHjrAkyoix1BnGCxzvFDMzRp3Bk=";
})
];

# or-tools normally attempts to build Protobuf for the build platform when
# cross-compiling. Instead, just tell it where to find protoc.
postPatch = ''
echo "set(PROTOC_PRG $(type -p protoc))" > cmake/host.cmake
cp -R ${pybind11_protobuf} pybind11_protobuf
chmod -R u+w pybind11_protobuf
'';

cmakeFlags = [
"-DBUILD_DEPS=OFF"
"-DBUILD_PYTHON=ON"
"-DBUILD_pybind11=OFF"
"-DBUILD_pybind11_protobuf=ON"
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
Expand Down Expand Up @@ -92,6 +86,8 @@ stdenv.mkDerivation rec {
glpk
python.pkgs.absl-py
python.pkgs.pybind11
python.pkgs.pybind11-abseil
python.pkgs.pybind11-protobuf
python.pkgs.pytest
python.pkgs.scipy
python.pkgs.setuptools
Expand All @@ -111,13 +107,6 @@ stdenv.mkDerivation rec {
python.pkgs.virtualenv
];

env.NIX_CFLAGS_COMPILE = toString [
# fatal error: 'python/google/protobuf/proto_api.h' file not found
"-I${protobuf.src}"
# fatal error: 'pybind11_protobuf/native_proto_caster.h' file not found
"-I${pybind11_protobuf}"
];

# some tests fail on linux and hang on darwin
doCheck = false;

Expand All @@ -143,7 +132,7 @@ stdenv.mkDerivation rec {
description = ''
Google's software suite for combinatorial optimization.
'';
mainProgram = "fzn-ortools";
mainProgram = "fzn-cp-sat";
maintainers = with maintainers; [ andersk ];
platforms = with platforms; linux ++ darwin;
};
Expand Down
16 changes: 0 additions & 16 deletions pkgs/development/libraries/science/math/or-tools/offline.patch

This file was deleted.

8 changes: 4 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37725,12 +37725,12 @@ with pkgs;
inherit (darwin) DarwinTools;
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
python = python3;
protobuf = protobuf_23;
# or-tools builds with -std=c++20, so abseil-cpp must
protobuf = protobuf_25;
# or-tools builds with -std=c++17, so abseil-cpp must
# also be built that way
abseil-cpp = abseil-cpp_202301.override {
abseil-cpp = abseil-cpp_202401.override {
static = true;
cxxStandard = "20";
cxxStandard = "17";
};
};

Expand Down

0 comments on commit 272966f

Please sign in to comment.