-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0765327
commit c6e385a
Showing
2 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 | ||
|
||
PortSystem 1.0 | ||
PortGroup golang 1.0 | ||
|
||
go.setup github.com/ollama/ollama 0.5.4 v | ||
go.offline_build no | ||
github.tarball_from archive | ||
revision 0 | ||
|
||
categories llm | ||
installs_libs no | ||
maintainers {@rdallman reed.pizza:github} \ | ||
openmaintainer | ||
license MIT | ||
|
||
description Ollama runs and manages LLMs | ||
long_description {*}${description} | ||
homepage https://ollama.com | ||
|
||
checksums rmd160 acc548a9cb39b7f240ec77848d2a10c9734ad977 \ | ||
sha256 fb4456a4c9f65d345f4831a50d27ed76a849085ac5d53b3c9017933cbfb0ecde \ | ||
size 2923059 | ||
|
||
depends_build-append \ | ||
port:cmake | ||
|
||
build.cmd make | ||
build.pre_args-append \ | ||
VERSION=${version} | ||
build.args exe | ||
|
||
set ollama_user ${name} | ||
set ol_data_path ${prefix}/var/${name} | ||
set ol_models_path ${ol_data_path}/models | ||
set ol_log_file ${prefix}/var/log/${name}.log | ||
|
||
add_users ${ollama_user} \ | ||
group=${ollama_user} \ | ||
realname=Ollama | ||
|
||
post-extract { | ||
copy ${filespath}/org.macports.ollama.plist ${workpath}/ | ||
} | ||
|
||
patch { | ||
# Configure plist file for current environment and prefix | ||
foreach pattern [list \ | ||
"s|@NAME@|${name}|g" \ | ||
"s|@USER@|${ollama_user}|g" \ | ||
"s|@GROUP@|${ollama_user}|g" \ | ||
"s|@PREFIX@|${prefix}|g" \ | ||
"s|@BIN@|${name}|g" \ | ||
"s|@HOME@|${ol_data_path}|g" \ | ||
"s|@MODELS_PATH@|${ol_models_path}|g" \ | ||
"s|@LOGFILE@|${ol_log_file}|g" \ | ||
] { | ||
reinplace -E ${pattern} ${workpath}/org.macports.ollama.plist | ||
} | ||
} | ||
|
||
destroot.keepdirs-append \ | ||
${destroot}${ol_models_path} | ||
|
||
destroot { | ||
# Install binary | ||
xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name} | ||
|
||
# Create data & models directory | ||
xinstall -d -m 0755 ${destroot}${ol_models_path} | ||
|
||
file attributes ${destroot}${ol_models_path} -owner ${ollama_user} \ | ||
-group ${ollama_user} | ||
|
||
file attributes ${destroot}${ol_data_path} -owner ${ollama_user} \ | ||
-group ${ollama_user} | ||
|
||
# Create log file | ||
touch ${destroot}${ol_log_file} | ||
|
||
file attributes ${destroot}${ol_log_file} -owner ${ollama_user} \ | ||
-group ${ollama_user} | ||
|
||
# Install plist file | ||
xinstall -d -m 0755 \ | ||
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name} | ||
|
||
xinstall -m 0644 -o root -W ${workpath} org.macports.${name}.plist \ | ||
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name} | ||
|
||
xinstall -d -m 0755 ${destroot}/Library/LaunchDaemons | ||
|
||
ln -s ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist \ | ||
${destroot}/Library/LaunchDaemons/org.macports.${name}.plist | ||
} | ||
|
||
notes-append " | ||
Ollama provides a background service that runs at startup. To enable, do: | ||
$ sudo port load ollama | ||
To disable, issue: | ||
$ sudo port unload ollama | ||
Ollama models will be installed into: | ||
${ol_models_path} | ||
" | ||
|
||
github.livecheck.regex \ | ||
{([0-9.]+)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.macports.@NAME@</string> | ||
<key>ProcessType</key> | ||
<string>Interactive</string> | ||
<key>Disabled</key> | ||
<false/> | ||
<key>RunAtLoad</key> | ||
<true/> | ||
<key>KeepAlive</key> | ||
<true/> | ||
<key>SessionCreate</key> | ||
<true/> | ||
<key>LaunchOnlyOnce</key> | ||
<false/> | ||
<key>UserName</key> | ||
<string>@USER@</string> | ||
<key>GroupName</key> | ||
<string>@GROUP@</string> | ||
<key>ExitTimeOut</key> | ||
<integer>600</integer> | ||
<key>ProgramArguments</key> | ||
<array> | ||
<string>@PREFIX@/bin/@BIN@</string> | ||
<string>serve</string> | ||
</array> | ||
<key>StandardErrorPath</key> | ||
<string>@LOGFILE@</string> | ||
<key>StandardOutPath</key> | ||
<string>@LOGFILE@</string> | ||
<key>EnvironmentVariables</key> | ||
<dict> | ||
<key>HOME</key> | ||
<string>@HOME@</string> | ||
<key>OLLAMA_MODELS</key> | ||
<string>@MODELS_PATH@</string> | ||
</dict> | ||
</dict> | ||
</plist> |