Date: Sun, 22 Mar 2026 19:28:40 +0000 From: Yuri Victorovich <yuri@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 97e1c1d89634 - main - misc/ollama: Fix options handlingl; Fix MLX option; Make it default Message-ID: <69c042e8.42811.42aa7bd4@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=97e1c1d8963461f45e7fe8cfc125a0364a4c2a8d commit 97e1c1d8963461f45e7fe8cfc125a0364a4c2a8d Author: Yuri Victorovich <yuri@FreeBSD.org> AuthorDate: 2026-03-22 19:26:26 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2026-03-22 19:28:35 +0000 misc/ollama: Fix options handlingl; Fix MLX option; Make it default --- misc/ollama/Makefile | 60 +++++++++++++++++++++++++++++++++---------------- misc/ollama/distinfo | 6 +++++ misc/ollama/pkg-message | 2 +- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/misc/ollama/Makefile b/misc/ollama/Makefile index 2f0c7ddf8920..1a3552c87d85 100644 --- a/misc/ollama/Makefile +++ b/misc/ollama/Makefile @@ -1,6 +1,7 @@ PORTNAME= ollama DISTVERSIONPREFIX= v DISTVERSION= 0.18.2 +PORTREVISION= 1 CATEGORIES= misc # machine-learning MAINTAINER= yuri@FreeBSD.org @@ -8,11 +9,11 @@ COMMENT= Run Llama 2, Mistral, and other large language models WWW= https://ollama.com \ https://github.com/ollama/ollama -BROKEN_i386= fails to compile: x/mlxrunner/mlx/memory.go:40:11: 1 << (4 * 10) (untyped int constant 1099511627776) overflows int - LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE +BROKEN_i386= fails to compile: x/mlxrunner/mlx/memory.go:40:11: 1 << (4 * 10) (untyped int constant 1099511627776) overflows int + BUILD_DEPENDS= bash:shells/bash \ ${LOCALBASE}/include/miniaudio/miniaudio.h:audio/miniaudio \ ${LOCALBASE}/include/nlohmann/json_fwd.hpp:devel/nlohmann-json \ @@ -24,20 +25,18 @@ GO_MODULE= github.com/yurivict/${PORTNAME} # fork with FreeBSD patches GO_TARGET= . GO_ENV+= CGO_CXXFLAGS="${CXXFLAGS}" -.include <bsd.port.options.mk> - -.if ${PORT_OPTIONS:MMLX} -GO_BUILDFLAGS+= -tags mlx -.endif +MLX_CORE_VERSION= 0.30.6 +MLX_C_VERSION= 0.5.0 +JSON_VERSION= 3.11.3 PLIST_FILES= bin/${PORTNAME} \ bin/ollama-limit-gpu-layers OPTIONS_GROUP= BACKENDS OPTIONS_GROUP_BACKENDS= CPU VULKAN MLX -OPTIONS_DEFAULT= CPU VULKAN +OPTIONS_DEFAULT= CPU VULKAN MLX -CPU_DESC= Build CPU backend shared libraries +CPU_DESC= Build CPU backend shared libraries for various SIMD instruction sets CPU_PLIST_FILES= lib/ollama/libggml-base.so \ lib/ollama/libggml-cpu-alderlake.so \ lib/ollama/libggml-cpu-haswell.so \ @@ -54,16 +53,30 @@ VULKAN_LIB_DEPENDS= libvulkan.so:graphics/vulkan-loader VULKAN_PLIST_FILES= lib/ollama/libggml-vulkan.so MLX_DESC= Build MLX backend for image generation (CPU) +MLX_BUILD_DEPENDS= ${LOCALBASE}/lib/cmake/fmt/fmt-config.cmake:devel/libfmt +MLX_LIB_DEPENDS= libopenblas.so:math/openblas MLX_PLIST_FILES= lib/ollama/libmlx.so \ lib/ollama/libmlxc.so -MLX_CMAKE_ON= -DMLX_ENGINE:BOOL=ON _CMAKE_FLAGS= -DCMAKE_BUILD_TYPE=Release -DGGML_BACKEND_DL=ON -DGGML_BACKEND_DIR=${PREFIX}/lib/ollama +.include <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MMLX} +GO_BUILDFLAGS+= -tags mlx +DISTFILES+= v${MLX_CORE_VERSION}.tar.gz:mlxsrc \ + v${MLX_C_VERSION}.tar.gz:mlxcsrc \ + json.tar.xz:jsonsrc +MASTER_SITES+= https://github.com/ml-explore/mlx/archive/refs/tags/:mlxsrc \ + https://github.com/ml-explore/mlx-c/archive/refs/tags/:mlxcsrc \ + https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}/:jsonsrc +.endif + post-patch: # change import path to the fork @cd ${WRKSRC} && \ (${GREP} -rl ollama/ollama | ${XARGS} ${REINPLACE_CMD} -i '' -e 's|ollama/ollama|yurivict/ollama|g') + # update version in go.mod and version.go @${REINPLACE_CMD} -e 's|var Version string = "0.0.0"|var Version string = "${PORTVERSION}"|g' \ ${WRKSRC}/go.mod ${WRKSRC}/version/version.go @@ -83,18 +96,27 @@ pre-build-VULKAN-on: @cd ${WRKSRC}/build && \ ${MAKE_CMD} ggml-vulkan +post-patch-MLX-on: + # FreeBSD compatibility fix: add missing netinet/in.h include + @${AWK} '/^#include <fcntl.h>/{print;print "#include <netinet/in.h>";next}1' \ + ${WRKDIR}/mlx-${MLX_CORE_VERSION}/mlx/distributed/ring/ring.cpp > \ + ${WRKDIR}/mlx-${MLX_CORE_VERSION}/mlx/distributed/ring/ring.cpp.new && \ + ${MV} ${WRKDIR}/mlx-${MLX_CORE_VERSION}/mlx/distributed/ring/ring.cpp.new \ + ${WRKDIR}/mlx-${MLX_CORE_VERSION}/mlx/distributed/ring/ring.cpp + pre-build-MLX-on: -.if !${PORT_OPTIONS:MCPU} && !${PORT_OPTIONS:MVULKAN} @${MKDIR} ${WRKSRC}/build && \ cd ${WRKSRC}/build && \ - ${CMAKE_BIN} ${_CMAKE_FLAGS} -DMLX_ENGINE:BOOL=ON .. -.endif - # Patch MLX after it's fetched by CMake (FreeBSD compatibility fix) - @if [ -f ${WRKSRC}/build/_deps/mlx-src/mlx/distributed/ring/ring.cpp ]; then \ - ${REINPLACE_CMD} -i '' -e '/^#include <fcntl.h>/a\\ -#include <netinet/in.h>' \ - ${WRKSRC}/build/_deps/mlx-src/mlx/distributed/ring/ring.cpp; \ - fi + OLLAMA_MLX_SOURCE=${WRKDIR}/mlx-${MLX_CORE_VERSION} \ + OLLAMA_MLX_C_SOURCE=${WRKDIR}/mlx-c-${MLX_C_VERSION} \ + ${CMAKE_BIN} ${_CMAKE_FLAGS} \ + -DMLX_ENGINE:BOOL=ON \ + -DFETCHCONTENT_FULLY_DISCONNECTED:BOOL=ON \ + -DFETCHCONTENT_SOURCE_DIR_JSON:PATH=${WRKDIR}/json \ + -DUSE_SYSTEM_FMT:BOOL=ON \ + -DMLX_BUILD_TESTS:BOOL=OFF \ + -DMLX_BUILD_EXAMPLES:BOOL=OFF \ + .. @cd ${WRKSRC}/build && \ ${MAKE_CMD} mlx mlxc diff --git a/misc/ollama/distinfo b/misc/ollama/distinfo index fbdc86e10cc6..e709a9fc964b 100644 --- a/misc/ollama/distinfo +++ b/misc/ollama/distinfo @@ -3,3 +3,9 @@ SHA256 (go/misc_ollama/ollama-v0.18.2/v0.18.2.mod) = e660ffa37ad33611a4c12489672 SIZE (go/misc_ollama/ollama-v0.18.2/v0.18.2.mod) = 4757 SHA256 (go/misc_ollama/ollama-v0.18.2/v0.18.2.zip) = 2ad77971884d45d35ba80db3d610cdfb93e7a2f390ea68fe1745085ebf73da4a SIZE (go/misc_ollama/ollama-v0.18.2/v0.18.2.zip) = 23468279 +SHA256 (go/misc_ollama/ollama-v0.18.2/v0.30.6.tar.gz) = 04d8e3c5d3c3ae748145ffe51d3ad8b72493e1e8597fc0f9dc631ed620b12618 +SIZE (go/misc_ollama/ollama-v0.18.2/v0.30.6.tar.gz) = 4138686 +SHA256 (go/misc_ollama/ollama-v0.18.2/v0.5.0.tar.gz) = dcfc404d7004e6da70170c669dbc920913cb25a59c9f7dac781caf92e524cc86 +SIZE (go/misc_ollama/ollama-v0.18.2/v0.5.0.tar.gz) = 169957 +SHA256 (go/misc_ollama/ollama-v0.18.2/json.tar.xz) = d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d +SIZE (go/misc_ollama/ollama-v0.18.2/json.tar.xz) = 110988 diff --git a/misc/ollama/pkg-message b/misc/ollama/pkg-message index 4d6db4b1a43a..b286f8cf71d1 100644 --- a/misc/ollama/pkg-message +++ b/misc/ollama/pkg-message @@ -5,7 +5,7 @@ You installed ollama: the AI model runner. To run ollama, plese open 2 terminals. 1. In the first terminal, please run: - $ OLLAMA_NUM_PARALLEL=1 OLLAMA_DEBUG=1 LLAMA_DEBUG=1 ollama start + $ ollama serve 2. In the second terminal, please run: $ ollama run gemma3 orhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c042e8.42811.42aa7bd4>
