Skip to content

Commit 241506a

Browse files
committedMar 20, 2025
or-tools: 9.7 -> 9.9
1 parent d3b2ce2 commit 241506a

File tree

3 files changed

+21
-46
lines changed

3 files changed

+21
-46
lines changed
 

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

+17-26
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
eigen,
88
ensureNewerSourcesForZipFilesHook,
99
fetchFromGitHub,
10-
replaceVars,
10+
fetchpatch,
1111
glpk,
1212
lib,
1313
pkg-config,
@@ -20,45 +20,40 @@
2020
zlib,
2121
}:
2222

23-
let
24-
pybind11_protobuf = fetchFromGitHub {
25-
owner = "pybind";
26-
repo = "pybind11_protobuf";
27-
rev = "b713501f1da56d9b76c42f89efd00b97c26c9eac";
28-
hash = "sha256-f6pzRWextH+7lm1xzyhx98wCIWH3lbhn59gSCcjsBVw=";
29-
};
30-
in
3123
stdenv.mkDerivation rec {
3224
pname = "or-tools";
33-
version = "9.7";
25+
version = "9.9";
3426

3527
src = fetchFromGitHub {
3628
owner = "google";
3729
repo = "or-tools";
3830
rev = "v${version}";
39-
hash = "sha256-eHukf6TbY2dx7iEf8WfwfWsjDEubPtRO02ju0kHtASo=";
31+
hash = "sha256-Ip2mKl+MuzOPaF1a2FTubqT0tA4gzDnD8dR7dLaHHo8=";
4032
};
4133

4234
patches = [
43-
(replaceVars ./offline.patch {
44-
pybind11_protobuf = "../../pybind11_protobuf";
35+
(fetchpatch {
36+
name = "0001-Allow-to-use-pybind11-system-packages.patch";
37+
url = "https://build.opensuse.org/public/source/science/google-or-tools/0001-Allow-to-use-pybind11-system-packages.patch?rev=18";
38+
hash = "sha256-+hFgZt9G0EMpMMXA/qnHjOdk6+eIlgV6T0qu36s4Z/Y=";
39+
})
40+
(fetchpatch {
41+
name = "0001-Do-not-try-to-copy-pybind11_abseil-status-extension-.patch";
42+
url = "https://build.opensuse.org/public/source/science/google-or-tools/0001-Do-not-try-to-copy-pybind11_abseil-status-extension-.patch?rev=18";
43+
hash = "sha256-vAjxUW1SjHRG2mpyjHjrAkyoix1BnGCxzvFDMzRp3Bk=";
4544
})
4645
];
4746

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

5753
cmakeFlags = [
5854
"-DBUILD_DEPS=OFF"
5955
"-DBUILD_PYTHON=ON"
6056
"-DBUILD_pybind11=OFF"
61-
"-DBUILD_pybind11_protobuf=ON"
6257
"-DCMAKE_INSTALL_BINDIR=bin"
6358
"-DCMAKE_INSTALL_INCLUDEDIR=include"
6459
"-DCMAKE_INSTALL_LIBDIR=lib"
@@ -95,6 +90,8 @@ stdenv.mkDerivation rec {
9590
glpk
9691
python.pkgs.absl-py
9792
python.pkgs.pybind11
93+
python.pkgs.pybind11-abseil
94+
python.pkgs.pybind11-protobuf
9895
python.pkgs.pytest
9996
python.pkgs.scipy
10097
python.pkgs.setuptools
@@ -107,20 +104,14 @@ stdenv.mkDerivation rec {
107104
protobuf
108105
(python.pkgs.protobuf4.override { protobuf = protobuf; })
109106
python.pkgs.numpy
107+
python.pkgs.pandas
108+
python.pkgs.immutabledict
110109
];
111110
nativeCheckInputs = [
112111
python.pkgs.matplotlib
113-
python.pkgs.pandas
114112
python.pkgs.virtualenv
115113
];
116114

117-
env.NIX_CFLAGS_COMPILE = toString [
118-
# fatal error: 'python/google/protobuf/proto_api.h' file not found
119-
"-I${protobuf.src}"
120-
# fatal error: 'pybind11_protobuf/native_proto_caster.h' file not found
121-
"-I${pybind11_protobuf}"
122-
];
123-
124115
# some tests fail on linux and hang on darwin
125116
doCheck = false;
126117

@@ -149,7 +140,7 @@ stdenv.mkDerivation rec {
149140
description = ''
150141
Google's software suite for combinatorial optimization.
151142
'';
152-
mainProgram = "fzn-ortools";
143+
mainProgram = "fzn-cp-sat";
153144
maintainers = with maintainers; [ andersk ];
154145
platforms = with platforms; linux ++ darwin;
155146
};

‎pkgs/development/libraries/science/math/or-tools/offline.patch

-16
This file was deleted.

‎pkgs/top-level/all-packages.nix

+4-4
Original file line numberDiff line numberDiff line change
@@ -16816,12 +16816,12 @@ with pkgs;
1681616816
inherit (darwin) DarwinTools;
1681716817
stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
1681816818
python = python3;
16819-
protobuf = protobuf_23;
16820-
# or-tools builds with -std=c++20, so abseil-cpp must
16819+
protobuf = protobuf_25;
16820+
# or-tools builds with -std=c++17, so abseil-cpp must
1682116821
# also be built that way
16822-
abseil-cpp = abseil-cpp_202301.override {
16822+
abseil-cpp = abseil-cpp_202401.override {
1682316823
static = true;
16824-
cxxStandard = "20";
16824+
cxxStandard = "17";
1682516825
};
1682616826
};
1682716827

0 commit comments

Comments
 (0)
Failed to load comments.