git: 49a46084dc5e - main - devel/libprotobuf-mutator: Add libprotobuf-mutator 1.5

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Wed, 09 Apr 2025 17:49:25 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=49a46084dc5ef76a7eaddbebc4d881f4c7f6544f

commit 49a46084dc5ef76a7eaddbebc4d881f4c7f6544f
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2025-04-09 17:41:32 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2025-04-09 17:41:32 +0000

    devel/libprotobuf-mutator: Add libprotobuf-mutator 1.5
    
    libprotobuf-mutator is a library to randomly mutate protobuffers. It could be
    used together with guided fuzzing engines, such as libFuzzer.
---
 devel/Makefile                                     |  1 +
 devel/libprotobuf-mutator/Makefile                 | 34 ++++++++++++++++++++++
 devel/libprotobuf-mutator/distinfo                 |  3 ++
 .../files/patch-cmake-external-googletest.cmake    | 11 +++++++
 devel/libprotobuf-mutator/pkg-descr                |  2 ++
 devel/libprotobuf-mutator/pkg-plist                | 19 ++++++++++++
 6 files changed, 70 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 2f67b4b170f2..08ba19db3694 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -1409,6 +1409,7 @@
     SUBDIR += libplist
     SUBDIR += libpo6
     SUBDIR += libpololu-avr
+    SUBDIR += libprotobuf-mutator
     SUBDIR += libpru
     SUBDIR += libqb
     SUBDIR += libqcow
diff --git a/devel/libprotobuf-mutator/Makefile b/devel/libprotobuf-mutator/Makefile
new file mode 100644
index 000000000000..b3566df465b6
--- /dev/null
+++ b/devel/libprotobuf-mutator/Makefile
@@ -0,0 +1,34 @@
+PORTNAME=	libprotobuf-mutator
+PORTVERSION=	1.5
+DISTVERSIONPREFIX=	v
+CATEGORIES=	devel
+
+MAINTAINER=	sunpoet@FreeBSD.org
+COMMENT=	Library for structured fuzzing with protobuffers
+WWW=		https://github.com/google/libprotobuf-mutator
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libprotobuf.so:devel/protobuf
+
+USES=		cmake:testing localbase:ldflags
+
+CMAKE_ARGS=	-DLOCALBASE=${LOCALBASE} \
+		-DPKG_CONFIG_PATH=libdata/pkgconfig
+CMAKE_OFF=	LIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF \
+		LIB_PROTO_MUTATOR_EXAMPLES \
+		LIB_PROTO_MUTATOR_EXAMPLES_USE_LATEST \
+		LIB_PROTO_MUTATOR_MSVC_STATIC_RUNTIME \
+		LIB_PROTO_MUTATOR_TESTING \
+		LIB_PROTO_MUTATOR_WITH_ASAN
+CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_TESTING_ON=	LIB_PROTO_MUTATOR_TESTING
+LDFLAGS+=	-labsl_hash \
+		-labsl_log_internal_message \
+		-labsl_log_internal_nullguard
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	google
+
+.include <bsd.port.mk>
diff --git a/devel/libprotobuf-mutator/distinfo b/devel/libprotobuf-mutator/distinfo
new file mode 100644
index 000000000000..703457aea83e
--- /dev/null
+++ b/devel/libprotobuf-mutator/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1744215555
+SHA256 (google-libprotobuf-mutator-v1.5_GH0.tar.gz) = 895958881b4993df70b4f652c2d82c5bd97d22f801ca4f430d6546809df293d5
+SIZE (google-libprotobuf-mutator-v1.5_GH0.tar.gz) = 42820
diff --git a/devel/libprotobuf-mutator/files/patch-cmake-external-googletest.cmake b/devel/libprotobuf-mutator/files/patch-cmake-external-googletest.cmake
new file mode 100644
index 000000000000..1ec876eb3727
--- /dev/null
+++ b/devel/libprotobuf-mutator/files/patch-cmake-external-googletest.cmake
@@ -0,0 +1,11 @@
+--- cmake/external/googletest.cmake.orig	2025-02-26 00:43:54 UTC
++++ cmake/external/googletest.cmake
+@@ -30,7 +30,7 @@ foreach(lib IN LISTS GTEST_BOTH_LIBRARIES)
+       set(LIB_PATH ${GTEST_INSTALL_DIR}/lib/${lib}.lib)
+     endif()
+   else()
+-    set(LIB_PATH ${GTEST_INSTALL_DIR}/lib/lib${lib}.a)
++    set(LIB_PATH ${LOCALBASE}/lib/lib${lib}.so)
+   endif()
+   list(APPEND GTEST_BUILD_BYPRODUCTS ${LIB_PATH})
+ 
diff --git a/devel/libprotobuf-mutator/pkg-descr b/devel/libprotobuf-mutator/pkg-descr
new file mode 100644
index 000000000000..c03dbde2e7ce
--- /dev/null
+++ b/devel/libprotobuf-mutator/pkg-descr
@@ -0,0 +1,2 @@
+libprotobuf-mutator is a library to randomly mutate protobuffers. It could be
+used together with guided fuzzing engines, such as libFuzzer.
diff --git a/devel/libprotobuf-mutator/pkg-plist b/devel/libprotobuf-mutator/pkg-plist
new file mode 100644
index 000000000000..96e84be6800c
--- /dev/null
+++ b/devel/libprotobuf-mutator/pkg-plist
@@ -0,0 +1,19 @@
+include/libprotobuf-mutator/port/gtest.h
+include/libprotobuf-mutator/port/protobuf.h
+include/libprotobuf-mutator/src/binary_format.h
+include/libprotobuf-mutator/src/field_instance.h
+include/libprotobuf-mutator/src/libfuzzer/libfuzzer_macro.h
+include/libprotobuf-mutator/src/libfuzzer/libfuzzer_mutator.h
+include/libprotobuf-mutator/src/mutator.h
+include/libprotobuf-mutator/src/random.h
+include/libprotobuf-mutator/src/text_format.h
+include/libprotobuf-mutator/src/utf8_fix.h
+include/libprotobuf-mutator/src/weighted_reservoir_sampler.h
+lib/cmake/libprotobuf-mutator/libprotobuf-mutatorConfig.cmake
+lib/cmake/libprotobuf-mutator/libprotobuf-mutatorTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/libprotobuf-mutator/libprotobuf-mutatorTargets.cmake
+lib/libprotobuf-mutator-libfuzzer.so
+lib/libprotobuf-mutator-libfuzzer.so.0
+lib/libprotobuf-mutator.so
+lib/libprotobuf-mutator.so.0
+libdata/pkgconfig/libprotobuf-mutator.pc