git: 9c8d5c323a8f - main - devel/pybind11_protobuf: Add pybind11_protobuf 0.0.0.20240809
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Aug 2024 16:04:20 UTC
The branch main has been updated by sunpoet:
URL: https://cgit.FreeBSD.org/ports/commit/?id=9c8d5c323a8f0ec3dc3c882483979dd8f9e98c23
commit 9c8d5c323a8f0ec3dc3c882483979dd8f9e98c23
Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-08-15 16:00:07 +0000
Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-08-15 16:00:07 +0000
devel/pybind11_protobuf: Add pybind11_protobuf 0.0.0.20240809
pybind11_protobuf provides pybind11 bindings for Google's Protocol Buffers.
These adapters make Protocol Buffer message types work with Pybind11 bindings.
---
devel/Makefile | 1 +
devel/pybind11_protobuf/Makefile | 30 ++++
devel/pybind11_protobuf/distinfo | 3 +
devel/pybind11_protobuf/files/patch-CMakeLists.txt | 169 +++++++++++++++++++++
devel/pybind11_protobuf/pkg-descr | 2 +
devel/pybind11_protobuf/pkg-plist | 5 +
6 files changed, 210 insertions(+)
diff --git a/devel/Makefile b/devel/Makefile
index 5e7edde752aa..d35a1a028d2c 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -6095,6 +6095,7 @@
SUBDIR += pybind11
SUBDIR += pybind11-json
SUBDIR += pybind11_abseil
+ SUBDIR += pybind11_protobuf
SUBDIR += pybugz
SUBDIR += pycanberra
SUBDIR += pycdc
diff --git a/devel/pybind11_protobuf/Makefile b/devel/pybind11_protobuf/Makefile
new file mode 100644
index 000000000000..88cd22cc3eb7
--- /dev/null
+++ b/devel/pybind11_protobuf/Makefile
@@ -0,0 +1,30 @@
+PORTNAME= pybind11_protobuf
+PORTVERSION= 0.0.0.20240809
+CATEGORIES= devel
+
+MAINTAINER= sunpoet@FreeBSD.org
+COMMENT= Pybind11 bindings for Google's Protocol Buffers
+WWW= https://github.com/pybind/pybind11_protobuf
+
+LICENSE= BSD3CLAUSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= abseil>=20230125:devel/abseil \
+ pybind11>=2.11.1:devel/pybind11
+LIB_DEPENDS= libabsl_base.so:devel/abseil \
+ libprotobuf.so:devel/protobuf
+
+USES= cmake compiler:c++17-lang python
+
+CFLAGS+= -I${WRKSRC}
+CMAKE_ARGS= -DCMAKE_INSTALL_PYDIR=${PYTHON_SITELIBDIR}
+CMAKE_OFF= BUILD_TESTING
+CMAKE_ON= USE_SYSTEM_ABSEIL \
+ USE_SYSTEM_PROTOBUF \
+ USE_SYSTEM_PYBIND
+
+USE_GITHUB= yes
+GH_ACCOUNT= pybind
+GH_TAGNAME= f1b2459
+
+.include <bsd.port.mk>
diff --git a/devel/pybind11_protobuf/distinfo b/devel/pybind11_protobuf/distinfo
new file mode 100644
index 000000000000..ad0ae136ad66
--- /dev/null
+++ b/devel/pybind11_protobuf/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1723644507
+SHA256 (pybind-pybind11_protobuf-0.0.0.20240809-f1b2459_GH0.tar.gz) = ac216afa9a50c37834906f224fbe8d3e47b2b0299cb12ff12588233a479413ee
+SIZE (pybind-pybind11_protobuf-0.0.0.20240809-f1b2459_GH0.tar.gz) = 56508
diff --git a/devel/pybind11_protobuf/files/patch-CMakeLists.txt b/devel/pybind11_protobuf/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..8bbae9aae903
--- /dev/null
+++ b/devel/pybind11_protobuf/files/patch-CMakeLists.txt
@@ -0,0 +1,169 @@
+--- CMakeLists.txt.orig 2024-08-09 17:15:35 UTC
++++ CMakeLists.txt
+@@ -39,9 +39,9 @@ if(USE_SYSTEM_PROTOBUF)
+ set(_absl_package_args 20230125)
+ endif()
+ if(USE_SYSTEM_PROTOBUF)
+- set(_protobuf_package_args 4.23.3 REQUIRED)
++ set(_protobuf_package_args REQUIRED)
+ else()
+- set(_protobuf_package_args 4.23.3)
++ set(_protobuf_package_args)
+ endif()
+ if(USE_SYSTEM_PYBIND)
+ set(_pybind11_package_args 2.11.1 REQUIRED)
+@@ -52,32 +52,11 @@ set(ABSL_ENABLE_INSTALL ON)
+ set(ABSL_PROPAGATE_CXX_STD ON)
+ set(ABSL_ENABLE_INSTALL ON)
+
+-include(FetchContent)
+-FetchContent_Declare(
+- absl
+- GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git"
+- GIT_TAG 20230125.3
+- FIND_PACKAGE_ARGS ${_absl_package_args} NAMES absl)
+-
+-# cmake-format: off
+-FetchContent_Declare(
+- Protobuf
+- GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
+- GIT_TAG v23.3
+- GIT_SUBMODULES ""
+- FIND_PACKAGE_ARGS ${_protobuf_package_args} NAMES protobuf)
+-set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")
+-# cmake-format: on
+-
+-FetchContent_Declare(
+- pybind11
+- GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
+- GIT_TAG v2.11.1
+- FIND_PACKAGE_ARGS ${_pybind11_package_args} NAMES pybind11)
+-
+ message(CHECK_START "Checking for external dependencies")
++find_package(absl ${_absl_package_args})
++find_package(protobuf ${_protobuf_package_args})
++find_package(pybind11 ${_pybind11_package_args})
+ list(APPEND CMAKE_MESSAGE_INDENT " ")
+-FetchContent_MakeAvailable(absl Protobuf pybind11)
+ list(POP_BACK CMAKE_MESSAGE_INDENT)
+
+ # ============================================================================
+@@ -97,7 +76,7 @@ add_library(
+ # ============================================================================
+ # pybind11_native_proto_caster shared library
+ add_library(
+- pybind11_native_proto_caster STATIC
++ pybind11_native_proto_caster SHARED
+ # bazel: pybind_library: native_proto_caster
+ pybind11_protobuf/native_proto_caster.h
+ # bazel: pybind_library: enum_type_caster
+@@ -106,6 +85,16 @@ add_library(
+ pybind11_protobuf/proto_cast_util.cc
+ pybind11_protobuf/proto_cast_util.h
+ pybind11_protobuf/proto_caster_impl.h)
++add_library(
++ pybind11_native_proto_caster_static STATIC
++ # bazel: pybind_library: native_proto_caster
++ pybind11_protobuf/native_proto_caster.h
++ # bazel: pybind_library: enum_type_caster
++ pybind11_protobuf/enum_type_caster.h
++ # bazel: pybind_library: proto_cast_util
++ pybind11_protobuf/proto_cast_util.cc
++ pybind11_protobuf/proto_cast_util.h
++ pybind11_protobuf/proto_caster_impl.h)
+
+ target_link_libraries(
+ pybind11_native_proto_caster
+@@ -117,22 +106,45 @@ target_link_libraries(
+ protobuf::libprotobuf
+ pybind11::pybind11
+ ${Python_LIBRARIES})
++target_link_libraries(
++ pybind11_native_proto_caster_static
++ absl::flat_hash_map
++ absl::flat_hash_set
++ absl::hash
++ absl::strings
++ absl::optional
++ protobuf::libprotobuf
++ pybind11::pybind11
++ ${Python_LIBRARIES})
+
+ target_include_directories(
+ pybind11_native_proto_caster
+ PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
+ ${pybind11_INCLUDE_DIRS})
++target_include_directories(
++ pybind11_native_proto_caster_static
++ PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
++ ${pybind11_INCLUDE_DIRS})
++set_target_properties(pybind11_native_proto_caster_static PROPERTIES OUTPUT_NAME pybind11_native_proto_caster)
+
+ # ============================================================================
+ # pybind11_wrapped_proto_caster shared library
+ add_library(
+- pybind11_wrapped_proto_caster STATIC
++ pybind11_wrapped_proto_caster SHARED
+ # bazel: pybind_library: wrapped_proto_caster
+ pybind11_protobuf/wrapped_proto_caster.h
+ # bazel: pybind_library: proto_cast_util
+ pybind11_protobuf/proto_cast_util.cc
+ pybind11_protobuf/proto_cast_util.h
+ pybind11_protobuf/proto_caster_impl.h)
++add_library(
++ pybind11_wrapped_proto_caster_static STATIC
++ # bazel: pybind_library: wrapped_proto_caster
++ pybind11_protobuf/wrapped_proto_caster.h
++ # bazel: pybind_library: proto_cast_util
++ pybind11_protobuf/proto_cast_util.cc
++ pybind11_protobuf/proto_cast_util.h
++ pybind11_protobuf/proto_caster_impl.h)
+
+ target_link_libraries(
+ pybind11_wrapped_proto_caster
+@@ -144,11 +156,26 @@ target_link_libraries(
+ protobuf::libprotobuf
+ pybind11::pybind11
+ ${Python_LIBRARIES})
++target_link_libraries(
++ pybind11_wrapped_proto_caster_static
++ absl::flat_hash_map
++ absl::flat_hash_set
++ absl::hash
++ absl::strings
++ absl::optional
++ protobuf::libprotobuf
++ pybind11::pybind11
++ ${Python_LIBRARIES})
+
+ target_include_directories(
+ pybind11_wrapped_proto_caster
+ PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
+ ${pybind11_INCLUDE_DIRS})
++target_include_directories(
++ pybind11_wrapped_proto_caster_static
++ PRIVATE ${PROJECT_SOURCE_DIR} ${protobuf_INCLUDE_DIRS} ${protobuf_SOURCE_DIR}
++ ${pybind11_INCLUDE_DIRS})
++set_target_properties(pybind11_wrapped_proto_caster_static PROPERTIES OUTPUT_NAME pybind11_wrapped_proto_caster)
+
+ if(BUILD_TESTING)
+ add_subdirectory(pybind11_protobuf/tests)
+@@ -171,3 +198,18 @@ endif()
+ #
+ # proto_cast_util
+ #
++
++install(
++ TARGETS pybind11_native_proto_caster pybind11_native_proto_caster_static pybind11_wrapped_proto_caster pybind11_wrapped_proto_caster_static
++ EXPORT pybind11_protobufTargets
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
++)
++install(
++ TARGETS pybind11_proto_utils
++ EXPORT pybind11_protobufTargets
++ LIBRARY DESTINATION ${CMAKE_INSTALL_PYDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_PYDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_PYDIR}
++)
diff --git a/devel/pybind11_protobuf/pkg-descr b/devel/pybind11_protobuf/pkg-descr
new file mode 100644
index 000000000000..f09891059e83
--- /dev/null
+++ b/devel/pybind11_protobuf/pkg-descr
@@ -0,0 +1,2 @@
+pybind11_protobuf provides pybind11 bindings for Google's Protocol Buffers.
+These adapters make Protocol Buffer message types work with Pybind11 bindings.
diff --git a/devel/pybind11_protobuf/pkg-plist b/devel/pybind11_protobuf/pkg-plist
new file mode 100644
index 000000000000..f37f88738eb5
--- /dev/null
+++ b/devel/pybind11_protobuf/pkg-plist
@@ -0,0 +1,5 @@
+lib/libpybind11_native_proto_caster.a
+lib/libpybind11_native_proto_caster.so
+lib/libpybind11_wrapped_proto_caster.a
+lib/libpybind11_wrapped_proto_caster.so
+%%PYTHON_SITELIBDIR%%/pybind11_proto_utils%%PYTHON_EXT_SUFFIX%%.so