or-tools: 9.7 -> 9.9

This commit is contained in:
Weijia Wang
2025-03-21 09:33:58 +01:00
parent d3b2ce22eb
commit aef59d4ff5
3 changed files with 23 additions and 47 deletions
@@ -7,7 +7,7 @@
eigen,
ensureNewerSourcesForZipFilesHook,
fetchFromGitHub,
replaceVars,
fetchpatch,
glpk,
lib,
pkg-config,
@@ -20,28 +20,27 @@
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 = [
(replaceVars ./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=";
})
];
@@ -49,16 +48,12 @@ stdenv.mkDerivation rec {
# 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"
@@ -95,6 +90,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
@@ -107,20 +104,14 @@ stdenv.mkDerivation rec {
protobuf
(python.pkgs.protobuf4.override { protobuf = protobuf; })
python.pkgs.numpy
python.pkgs.pandas
python.pkgs.immutabledict
];
nativeCheckInputs = [
python.pkgs.matplotlib
python.pkgs.pandas
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;
@@ -149,7 +140,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;
};
@@ -1,16 +0,0 @@
diff --git a/cmake/dependencies/CMakeLists.txt b/cmake/dependencies/CMakeLists.txt
index af3a28c113..ba92c3c55e 100644
--- a/cmake/dependencies/CMakeLists.txt
+++ b/cmake/dependencies/CMakeLists.txt
@@ -177,9 +177,8 @@ if(BUILD_PYTHON AND BUILD_pybind11_protobuf)
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
pybind11_protobuf
- GIT_REPOSITORY "https://github.com/pybind/pybind11_protobuf.git"
- GIT_TAG "main"
- PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11_protobuf.patch"
+ SOURCE_DIR @pybind11_protobuf@
+ PATCH_COMMAND patch -p1 < "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11_protobuf.patch"
)
FetchContent_MakeAvailable(pybind11_protobuf)
list(POP_BACK CMAKE_MESSAGE_INDENT)
+6 -5
View File
@@ -16814,14 +16814,15 @@ with pkgs;
or-tools = callPackage ../development/libraries/science/math/or-tools {
inherit (darwin) DarwinTools;
stdenv = if stdenv.hostPlatform.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.override {
abseil-cpp = abseil-cpp_202401;
};
# 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";
};
};