git: 1356ba4c29c9 - main - misc/ggml: New port: Tensor library for machine learning

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Thu, 04 Sep 2025 07:33:05 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1356ba4c29c9cda627af75342458b797bcbb58fc

commit 1356ba4c29c9cda627af75342458b797bcbb58fc
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2025-09-04 05:43:37 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-09-04 07:32:57 +0000

    misc/ggml: New port: Tensor library for machine learning
---
 misc/Makefile                              |  1 +
 misc/ggml/Makefile                         | 36 ++++++++++++++++++++++++++++++
 misc/ggml/distinfo                         |  3 +++
 misc/ggml/files/patch-tests_CMakeLists.txt | 11 +++++++++
 misc/ggml/pkg-descr                        | 13 +++++++++++
 misc/ggml/pkg-plist                        | 22 ++++++++++++++++++
 6 files changed, 86 insertions(+)

diff --git a/misc/Makefile b/misc/Makefile
index 9d8fb792d908..367933aea44b 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -157,6 +157,7 @@
     SUBDIR += gedkeeper
     SUBDIR += geekcode
     SUBDIR += getopt
+    SUBDIR += ggml
     SUBDIR += gimp-help-en
     SUBDIR += gkrellm-gamma
     SUBDIR += gkrellm-xkb
diff --git a/misc/ggml/Makefile b/misc/ggml/Makefile
new file mode 100644
index 000000000000..b332c2d881c5
--- /dev/null
+++ b/misc/ggml/Makefile
@@ -0,0 +1,36 @@
+PORTNAME=	ggml
+DISTVERSION=	g20250828
+CATEGORIES=	misc # machine-learning
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Tensor library for machine learning
+WWW=		https://github.com/ggerganov/ggml
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		cmake:testing compiler:c++17-lang python:run shebangfix
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	ggerganov
+GH_TAGNAME=	83835ff
+
+CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_OFF=	GGML_BUILD_TESTS GGML_BUILD_EXAMPLES
+CMAKE_TESTING_ON=	GGML_BUILD_TESTS
+
+BINARY_ALIAS=	git=false
+
+OPTIONS_DEFINE=		VULKAN
+OPTIONS_DEFAULT=	VULKAN
+OPTIONS_SUB=		yes
+
+VULKAN_CMAKE_BOOL=	GGML_VULKAN
+VULKAN_BUILD_DEPENDS=	glslc:graphics/shaderc \
+			vulkan-headers>0:graphics/vulkan-headers
+VULKAN_LIB_DEPENDS=	libvulkan.so:graphics/vulkan-loader
+
+# tests as of g20250828: 100% tests passed, 0 tests failed out of 21
+
+.include <bsd.port.mk>
diff --git a/misc/ggml/distinfo b/misc/ggml/distinfo
new file mode 100644
index 000000000000..a17e9ebaeb14
--- /dev/null
+++ b/misc/ggml/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1756957568
+SHA256 (ggerganov-ggml-g20250828-83835ff_GH0.tar.gz) = 42e76df96d99c86e9fe15a87dfe5eab6c0a117497d5bb6c4ef154dbf7b5e805c
+SIZE (ggerganov-ggml-g20250828-83835ff_GH0.tar.gz) = 2072055
diff --git a/misc/ggml/files/patch-tests_CMakeLists.txt b/misc/ggml/files/patch-tests_CMakeLists.txt
new file mode 100644
index 000000000000..d6d713231e9a
--- /dev/null
+++ b/misc/ggml/files/patch-tests_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- tests/CMakeLists.txt.orig	2025-09-04 04:13:15 UTC
++++ tests/CMakeLists.txt
+@@ -114,7 +114,7 @@ else()
+             set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX")
+         endif()
+     else()
+-        set(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -mfma -mf16c -mavx -mavx2")
++        #set(CMAKE_C_FLAGS  "${CMAKE_C_FLAGS} -mfma -mf16c -mavx -mavx2")
+     endif()
+ endif()
+ 
diff --git a/misc/ggml/pkg-descr b/misc/ggml/pkg-descr
new file mode 100644
index 000000000000..611fa3ef39ae
--- /dev/null
+++ b/misc/ggml/pkg-descr
@@ -0,0 +1,13 @@
+ggml is a tensor library for machine learning.
+
+Features:
+* Written in C
+* 16-bit float support
+* Integer quantization support (4-bit, 5-bit, 8-bit, etc.)
+* Automatic differentiation
+* ADAM and L-BFGS optimizers
+* Optimized for Apple Silicon
+* On x86 architectures utilizes AVX / AVX2 intrinsics
+* On ppc64 architectures utilizes VSX intrinsics
+* No third-party dependencies
+* Zero memory allocations during runtime
diff --git a/misc/ggml/pkg-plist b/misc/ggml/pkg-plist
new file mode 100644
index 000000000000..9c74452171bf
--- /dev/null
+++ b/misc/ggml/pkg-plist
@@ -0,0 +1,22 @@
+include/ggml-alloc.h
+include/ggml-backend.h
+include/ggml-blas.h
+include/ggml-cann.h
+include/ggml-cpp.h
+include/ggml-cpu.h
+include/ggml-cuda.h
+include/ggml-metal.h
+include/ggml-opt.h
+include/ggml-rpc.h
+include/ggml-sycl.h
+include/ggml-vulkan.h
+include/ggml-webgpu.h
+include/ggml.h
+include/gguf.h
+lib/cmake/ggml/ggml-config.cmake
+lib/cmake/ggml/ggml-version.cmake
+lib/libggml-base.so
+lib/libggml-cpu.so
+%%VULKAN%%lib/libggml-vulkan.so
+lib/libggml.so
+share/pkgconfig/ggml.pc