1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 cmake,
7 abseil-cpp_202407, # downgrade, same reason as toplevel protobuf_29
8 protobuf_29,
9 pybind11,
10 zlib,
11}:
12
13buildPythonPackage {
14 pname = "pybind11-protobuf";
15 version = "0-unstable-2025-02-10";
16 pyproject = false;
17
18 src = fetchFromGitHub {
19 owner = "pybind";
20 repo = "pybind11_protobuf";
21 rev = "f02a2b7653bc50eb5119d125842a3870db95d251";
22 hash = "sha256-jlZcxQKYYYvTOGhk+0Sgtek4oKy6R1wDGiBOf2t+KiU=";
23 };
24
25 patches = [
26 # Rebase of the OpenSUSE patch: https://build.opensuse.org/projects/openSUSE:Factory/packages/pybind11_protobuf/files/0006-Add-install-target-for-CMake-builds.patch?expand=1
27 # on top of: https://github.com/pybind/pybind11_protobuf/pull/188/commits/5f0ac3d8c10cbb8b3b81063467c71085cd39624f
28 ./add-install-target-for-cmake-builds.patch
29 ];
30
31 nativeBuildInputs = [ cmake ];
32
33 buildInputs = [
34 abseil-cpp_202407
35 protobuf_29
36 pybind11
37 zlib
38 ];
39
40 cmakeFlags = [
41 (lib.cmakeBool "USE_SYSTEM_ABSEIL" true)
42 (lib.cmakeBool "USE_SYSTEM_PROTOBUF" true)
43 (lib.cmakeBool "USE_SYSTEM_PYBIND" true)
44
45 # The find_package calls are local to the dependencies subdirectory
46 (lib.cmakeBool "CMAKE_FIND_PACKAGE_TARGETS_GLOBAL" true)
47 ]
48 ++ lib.optionals stdenv.hostPlatform.isDarwin [
49 # Without it, Cmake prefers using Find-module which is mysteriously broken
50 # But the generated Config works
51 (lib.cmakeBool "CMAKE_FIND_PACKAGE_PREFER_CONFIG" true)
52 ];
53
54 meta = {
55 description = "Pybind11 bindings for Google's Protocol Buffers";
56 homepage = "https://github.com/pybind/pybind11_protobuf";
57 license = lib.licenses.bsd3;
58 maintainers = with lib.maintainers; [ wegank ];
59 };
60}