Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Mar 2026 19:03:47 +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: 84cdc87773aa - main - misc/ollama: Add ollama service; Add BUILD_CONFLICTS
Message-ID:  <69c97793.19b78.71adbc8a@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=84cdc87773aa21a1e26dc2f1e5249bee87776a32

commit 84cdc87773aa21a1e26dc2f1e5249bee87776a32
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-03-29 19:02:59 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-03-29 19:03:39 +0000

    misc/ollama: Add ollama service; Add BUILD_CONFLICTS
---
 misc/ollama/Makefile        |  5 ++++-
 misc/ollama/files/ollama.in | 51 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/misc/ollama/Makefile b/misc/ollama/Makefile
index e78c28f88d48..0bc5709974d3 100644
--- a/misc/ollama/Makefile
+++ b/misc/ollama/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	ollama
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.18.3
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	misc # machine-learning
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -21,6 +21,7 @@ BUILD_DEPENDS=	bash:shells/bash \
 		patchelf:sysutils/patchelf
 
 USES=		cmake:indirect go:1.24+,modules localbase pkgconfig
+USE_RC_SUBR=	ollama
 
 GO_MODULE=	github.com/yurivict/${PORTNAME} # fork with FreeBSD patches
 GO_TARGET=	.
@@ -72,6 +73,8 @@ MASTER_SITES+=	https://github.com/ml-explore/mlx/archive/refs/tags/:mlxsrc \
 		https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}/:jsonsrc
 .endif
 
+CONFLICTS_BUILD=	ggml
+
 post-patch:
 	# change import path to the fork
 	@cd ${WRKSRC} && \
diff --git a/misc/ollama/files/ollama.in b/misc/ollama/files/ollama.in
new file mode 100644
index 000000000000..c6ea19ebd8ad
--- /dev/null
+++ b/misc/ollama/files/ollama.in
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# PROVIDE: ollama
+# REQUIRE: LOGIN
+# KEYWORDS: shutdown
+
+# Add the following lines to /etc/rc.conf to enable ollama
+# ollama_enable="YES"
+#
+# ollama_enable (bool):  Set to YES to enable ollama
+#                        Default: NO
+# ollama_user (str):     Ollama daemon user
+#                        Default: %%USER%%
+# ollama_args (str):     Additional arguments for ollama
+#                        Default: ""
+# ollama_log (str):      Log file for ollama
+#                        Default: "/var/log/ollama.log"
+# ollama_pidfile (str):  PID file for ollama
+#                        Default: "/var/run/ollama.pid"
+
+. /etc/rc.subr
+
+name="ollama"
+rcvar=ollama_enable
+
+load_rc_config $name
+
+: ${ollama_enable:="NO"}
+: ${ollama_user:="root"} # the user nobody doesn't have a home diectory and ollama needs one to store the models
+: ${ollama_args:="serve"}
+: ${ollama_log:="/var/log/ollama-${ollama_user}.log"}
+: ${ollama_pidfile:="/var/run/${name}-${ollama_user}.pid"}
+
+run_command="%%PREFIX%%/bin/ollama"
+procname="${run_command}"
+pidfile=${ollama_pidfile}
+command=/usr/sbin/daemon
+command_args="-f -t ${name} -p ${pidfile} -o ${ollama_log} ${run_command} ${ollama_args}"
+
+start_precmd="ollama_precmd"
+ollama_chdir=/tmp
+
+ollama_precmd()
+{
+    # ensure log file exists
+    touch ${ollama_log} ${pidfile}
+    chown ${ollama_user} ${ollama_log} ${pidfile}
+    chmod 640 ${ollama_log}
+}
+
+run_rc_command "$1"


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c97793.19b78.71adbc8a>