git: 986f1636894e - 2025Q2 - textproc/sentencepiece: Add GPERFTOOLS option

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Thu, 10 Apr 2025 16:46:55 UTC
The branch 2025Q2 has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=986f1636894ea43376839a09db3df566b0bd5b67

commit 986f1636894ea43376839a09db3df566b0bd5b67
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2025-04-10 15:27:47 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-04-10 16:46:50 +0000

    textproc/sentencepiece: Add GPERFTOOLS option
    
    (cherry picked from commit f3aaf3992bf28a8af00347e3bb2037256bf030b8)
---
 textproc/sentencepiece/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/textproc/sentencepiece/Makefile b/textproc/sentencepiece/Makefile
index 96702c90186e..b172a3a20923 100644
--- a/textproc/sentencepiece/Makefile
+++ b/textproc/sentencepiece/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	sentencepiece
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.2.0
+PORTREVISION=	1
 CATEGORIES=	textproc # machine-learning
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -10,8 +11,6 @@ WWW=		https://github.com/google/sentencepiece
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-LIB_DEPENDS=	libtcmalloc_minimal.so:devel/google-perftools
-
 USES=		cmake:testing compiler:c++17-lang
 USE_LDCONFIG=	yes
 
@@ -20,4 +19,9 @@ GH_ACCOUNT=	google
 
 CMAKE_TESTING_ON=	SPM_BUILD_TEST
 
+OPTIONS_DEFINE=		GPERFTOOLS # this seems to cause this error in llama-cpp's convert_hf_to_gguf.py: Attempt to free invalid pointer 0x1ef160aa2f80, see https://github.com/google/sentencepiece/issues/1105
+
+GPERFTOOLS_CMAKE_BOOL=	SPM_ENABLE_TCMALLOC
+GPERFTOOLS_LIB_DEPENDS=	libtcmalloc.so:devel/google-perftools
+
 .include <bsd.port.mk>