git: 892ce9827770 - main - misc/llama-cpp: Fix run-time on older CPUs

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 11 Apr 2025 01:26:40 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=892ce9827770be54592389891c5fe6d005b19b2e

commit 892ce9827770be54592389891c5fe6d005b19b2e
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2025-04-11 01:09:26 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2025-04-11 01:26:36 +0000

    misc/llama-cpp: Fix run-time on older CPUs
    
    ... by disabling explicit flags that enable them.
---
 misc/llama-cpp/Makefile                                     |  3 ++-
 misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/misc/llama-cpp/Makefile b/misc/llama-cpp/Makefile
index f59d16d148d3..3230207092e5 100644
--- a/misc/llama-cpp/Makefile
+++ b/misc/llama-cpp/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	llama-cpp
 DISTVERSIONPREFIX=	b
 DISTVERSION=	5097
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	misc # machine-learning
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -26,6 +26,7 @@ SHEBANG_GLOB=	*.py
 
 CMAKE_ON=	BUILD_SHARED_LIBS
 CMAKE_OFF=	GGML_NATIVE \
+		FREEBSD_ALLOW_ADVANCED_CPU_FEATURES \
 		LLAMA_BUILD_TESTS
 CMAKE_TESTING_ON=	LLAMA_BUILD_TESTS
 
diff --git a/misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt b/misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt
new file mode 100644
index 000000000000..5e6ff248184a
--- /dev/null
+++ b/misc/llama-cpp/files/patch-ggml_src_ggml-cpu_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- ggml/src/ggml-cpu/CMakeLists.txt.orig	2025-04-10 23:26:06 UTC
++++ ggml/src/ggml-cpu/CMakeLists.txt
+@@ -236,7 +236,7 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
+         else ()
+             if (GGML_NATIVE)
+                 list(APPEND ARCH_FLAGS -march=native)
+-            else ()
++            elseif (FREEBSD_ALLOW_ADVANCED_CPU_FEATURES)
+                 list(APPEND ARCH_FLAGS -msse4.2)
+                 list(APPEND ARCH_DEFINITIONS GGML_SSE42)
+                 if (GGML_F16C)