git: f6c24e11d35c - main - misc/nanocoder: fix build on powerpc64le

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Wed, 22 Apr 2026 10:13:54 UTC
The branch main has been updated by pkubaj:

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

commit f6c24e11d35c2c430bb4cd49c8e7d36e2eb31366
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-04-21 14:25:22 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-04-22 10:13:35 +0000

    misc/nanocoder: fix build on powerpc64le
    
    On powerpc64le "ppc64" is also used in file names.
    -mpowerpc64 is illegal with clang.
---
 misc/nanocoder/Makefile                                       |  6 +++---
 ...llama-cpp_llama_llama.cpp_ggml_src_ggml-cpu_CMakeLists.txt | 11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/misc/nanocoder/Makefile b/misc/nanocoder/Makefile
index 182d5ddc2c85..92224ad141a8 100644
--- a/misc/nanocoder/Makefile
+++ b/misc/nanocoder/Makefile
@@ -31,6 +31,9 @@ NODE_LLAMA_CPP_DIR=	${WRKSRC}/node_modules/@nanocollective/nanocoder/node_module
 
 FETCH_SCRIPT=	${PORTSDIR}/Tools/scripts/npmjs-fetch-with-dependencies.sh
 
+NODE_ARCH=	${ARCH:S/amd64/x64/:S/aarch64/arm64/:S/i386/ia32/:S/powerpc64le/ppc64/:S/powerpc64/ppc64/:C/armv[67]/arm/} # modeled after electron.mk
+PLIST_SUB=	NODE_ARCH=${NODE_ARCH}
+
 do-fetch:
 	@if ! [ -f ${DISTDIR}/${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX} ]; then \
 		${MKDIR} ${DISTDIR} && \
@@ -58,9 +61,6 @@ do-build:
 	@cd ${WRKSRC} && \
 		npm rebuild --nodedir=${LOCALBASE}
 
-NODE_ARCH=	${ARCH:S/amd64/x64/:S/aarch64/arm64/:S/i386/ia32/:S/powerpc64le/ppc64le/:S/powerpc64/ppc64/:C/armv[67]/arm/} # modeled after electron.mk
-PLIST_SUB=	NODE_ARCH=${NODE_ARCH}
-
 do-install:
 	# install files
 	cd ${WRKSRC} && \
diff --git a/misc/nanocoder/files/patch-node__modules__nanocollective_nanocoder_node__modules_node-llama-cpp_llama_llama.cpp_ggml_src_ggml-cpu_CMakeLists.txt b/misc/nanocoder/files/patch-node__modules__nanocollective_nanocoder_node__modules_node-llama-cpp_llama_llama.cpp_ggml_src_ggml-cpu_CMakeLists.txt
new file mode 100644
index 000000000000..2e5e13acabb5
--- /dev/null
+++ b/misc/nanocoder/files/patch-node__modules__nanocollective_nanocoder_node__modules_node-llama-cpp_llama_llama.cpp_ggml_src_ggml-cpu_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- node_modules/@nanocollective/nanocoder/node_modules/node-llama-cpp/llama/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt.orig	2026-04-22 10:10:30 UTC
++++ node_modules/@nanocollective/nanocoder/node_modules/node-llama-cpp/llama/llama.cpp/ggml/src/ggml-cpu/CMakeLists.txt
+@@ -403,8 +403,6 @@ function(ggml_add_cpu_backend_variant_impl tag_name)
+                 list(APPEND ARCH_FLAGS -mcpu=power9)
+             elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc64le")
+                 list(APPEND ARCH_FLAGS -mcpu=powerpc64le -mtune=native)
+-            else()
+-                list(APPEND ARCH_FLAGS -mcpu=native -mtune=native -mpowerpc64)
+             endif()
+         elseif(GGML_CPU_ALL_VARIANTS)
+             # Begin with the lowest baseline