git: b555acda955e - main - misc/ollama: Remove one unnecessary architecture-specific place in scripts

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 06 Aug 2024 22:32:58 UTC
The branch main has been updated by yuri:

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

commit b555acda955e9ef31e8132a82a6b15999cf31256
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2024-08-06 22:32:12 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2024-08-06 22:32:55 +0000

    misc/ollama: Remove one unnecessary architecture-specific place in scripts
---
 misc/ollama/files/patch-FreeBSD-compatibility | 84 ++++++++++++---------------
 1 file changed, 37 insertions(+), 47 deletions(-)

diff --git a/misc/ollama/files/patch-FreeBSD-compatibility b/misc/ollama/files/patch-FreeBSD-compatibility
index 02af4cec63c0..03cc31011ab1 100644
--- a/misc/ollama/files/patch-FreeBSD-compatibility
+++ b/misc/ollama/files/patch-FreeBSD-compatibility
@@ -125,9 +125,9 @@ new file mode 100644
  	case "linux", "windows":
  		assert.Greater(t, info.TotalMemory, uint64(0))
  		assert.Greater(t, info.FreeMemory, uint64(0))
---- llm/generate/gen_bsd.sh.orig	2024-08-06 07:41:26 UTC
+--- llm/generate/gen_bsd.sh.orig	2024-08-06 16:29:05 UTC
 +++ llm/generate/gen_bsd.sh
-@@ -0,0 +1,64 @@
+@@ -0,0 +1,54 @@
 +#!/bin/sh
 +# This script is intended to run inside the go generate
 +# working directory must be ./llm/generate/
@@ -143,52 +143,42 @@ new file mode 100644
 +COMMON_BSD_DEFS="-DCMAKE_SYSTEM_NAME=$(uname -s)"
 +CMAKE_TARGETS="--target llama --target ggml"
 +
-+case "${GOARCH}" in
-+  "amd64")
-+    COMMON_CPU_DEFS="${COMMON_BSD_DEFS} -DCMAKE_SYSTEM_PROCESSOR=${ARCH}"
-+
-+    # Static build for linking into the Go binary
-+    init_vars
-+    CMAKE_DEFS="${COMMON_CPU_DEFS} -DBUILD_SHARED_LIBS=off -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
-+    BUILD_DIR="../build/bsd/${ARCH}_static"
-+    echo "Building static library"
-+    build
-+
-+    init_vars
-+    CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
-+    BUILD_DIR="../build/bsd/${ARCH}/cpu"
-+    echo "Building LCD CPU"
-+    build
-+    compress
-+
-+    init_vars
-+    CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
-+    BUILD_DIR="../build/bsd/${ARCH}/cpu_avx"
-+    echo "Building AVX CPU"
-+    build
-+    compress
-+
-+    init_vars
-+    CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=on -DLLAMA_AVX2=on -DLLAMA_AVX512=off -DLLAMA_FMA=on -DLLAMA_F16C=on ${CMAKE_DEFS}"
-+    BUILD_DIR="../build/bsd/${ARCH}/cpu_avx2"
-+    echo "Building AVX2 CPU"
-+    build
-+    compress
-+
-+    init_vars
-+    CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_VULKAN=on ${CMAKE_DEFS}"
-+    BUILD_DIR="../build/bsd/${ARCH}/vulkan"
-+    echo "Building Vulkan GPU"
-+    build
-+    compress
-+    ;;
++COMMON_CPU_DEFS="${COMMON_BSD_DEFS} -DCMAKE_SYSTEM_PROCESSOR=${ARCH}"
 +
-+  *)
-+    echo "GOARCH must be set"
-+    echo "this script is meant to be run from within go generate"
-+    exit 1
-+    ;;
-+esac
++# Static build for linking into the Go binary
++init_vars
++CMAKE_DEFS="${COMMON_CPU_DEFS} -DBUILD_SHARED_LIBS=off -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
++BUILD_DIR="../build/bsd/${ARCH}_static"
++echo "Building static library"
++build
++
++init_vars
++CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
++BUILD_DIR="../build/bsd/${ARCH}/cpu"
++echo "Building LCD CPU"
++build
++compress
++
++init_vars
++CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
++BUILD_DIR="../build/bsd/${ARCH}/cpu_avx"
++echo "Building AVX CPU"
++build
++compress
++
++init_vars
++CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=on -DLLAMA_AVX2=on -DLLAMA_AVX512=off -DLLAMA_FMA=on -DLLAMA_F16C=on ${CMAKE_DEFS}"
++BUILD_DIR="../build/bsd/${ARCH}/cpu_avx2"
++echo "Building AVX2 CPU"
++build
++compress
++
++init_vars
++CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_VULKAN=on ${CMAKE_DEFS}"
++BUILD_DIR="../build/bsd/${ARCH}/vulkan"
++echo "Building Vulkan GPU"
++build
++compress
 +
 +cleanup
 +echo "go generate completed.  LLM runners: $(cd ${BUILD_DIR}/..; echo *)"