Skip to content

Commit cca99e1

Browse files
committedDec 10, 2024
or-tools: 9.7 -> 9.9
1 parent 16430e2 commit cca99e1

File tree

3 files changed

+21
-47
lines changed

3 files changed

+21
-47
lines changed
 

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

+17-27
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
eigen,
88
ensureNewerSourcesForZipFilesHook,
99
fetchFromGitHub,
10-
substituteAll,
10+
fetchpatch,
1111
glpk,
1212
lib,
1313
pkg-config,
@@ -20,46 +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-
(substituteAll {
44-
src = ./offline.patch;
45-
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=";
4644
})
4745
];
4846

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

5853
cmakeFlags = [
5954
"-DBUILD_DEPS=OFF"
6055
"-DBUILD_PYTHON=ON"
6156
"-DBUILD_pybind11=OFF"
62-
"-DBUILD_pybind11_protobuf=ON"
6357
"-DCMAKE_INSTALL_BINDIR=bin"
6458
"-DCMAKE_INSTALL_INCLUDEDIR=include"
6559
"-DCMAKE_INSTALL_LIBDIR=lib"
@@ -96,6 +90,8 @@ stdenv.mkDerivation rec {
9690
glpk
9791
python.pkgs.absl-py
9892
python.pkgs.pybind11
93+
python.pkgs.pybind11-abseil
94+
python.pkgs.pybind11-protobuf
9995
python.pkgs.pytest
10096
python.pkgs.scipy
10197
python.pkgs.setuptools
@@ -108,20 +104,14 @@ stdenv.mkDerivation rec {
108104
protobuf
109105
(python.pkgs.protobuf4.override { protobuf = protobuf; })
110106
python.pkgs.numpy
107+
python.pkgs.pandas
108+
python.pkgs.immutabledict
111109
];
112110
nativeCheckInputs = [
113111
python.pkgs.matplotlib
114-
python.pkgs.pandas
115112
python.pkgs.virtualenv
116113
];
117114

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

@@ -150,7 +140,7 @@ stdenv.mkDerivation rec {
150140
description = ''
151141
Google's software suite for combinatorial optimization.
152142
'';
153-
mainProgram = "fzn-ortools";
143+
mainProgram = "fzn-cp-sat";
154144
maintainers = with maintainers; [ andersk ];
155145
platforms = with platforms; linux ++ darwin;
156146
};

‎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
@@ -17477,12 +17477,12 @@ with pkgs;
1747717477
inherit (darwin) DarwinTools;
1747817478
stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv;
1747917479
python = python3;
17480-
protobuf = protobuf_23;
17481-
# or-tools builds with -std=c++20, so abseil-cpp must
17480+
protobuf = protobuf_25;
17481+
# or-tools builds with -std=c++17, so abseil-cpp must
1748217482
# also be built that way
17483-
abseil-cpp = abseil-cpp_202301.override {
17483+
abseil-cpp = abseil-cpp_202401.override {
1748417484
static = true;
17485-
cxxStandard = "20";
17485+
cxxStandard = "17";
1748617486
};
1748717487
};
1748817488

0 commit comments

Comments
 (0)
Failed to load comments.