diff --git a/sci-ml/ollama-bin/Manifest b/sci-ml/ollama-bin/Manifest new file mode 100644 index 0000000..c0704fe --- /dev/null +++ b/sci-ml/ollama-bin/Manifest @@ -0,0 +1,6 @@ +AUX ollama.confd 395 BLAKE2B acb2e9d4fb786154461142b77ee75b10a9b262ab4908ed5d2206417f9a4a522c78dd188333100372adf16a261ca90ef6785cf08b15f9f6ef1c0eb255654a5f8c SHA512 6fa03fc3932371352e60d5ce3d295103e459eacb6e241e0c2517575a827cef54862973e5a4a5124e154cf43b2d4ff1f0bdfe64a172843eb039c4758b32538046 +AUX ollama.init 258 BLAKE2B 33cd9d711d0865056f604630ec910ef7a0d72ca06cc98613fa63962bbfd6f8a9ac4299e7c864c196c8eaaf9222e2b6be913da06d99f557be151e224348cd8fc0 SHA512 9a16bd84cc8f44b0c1d46050560ffefa6cd71bf98b28c2904bdefcda9728ed3f6902e3f7fecc768e7539e6a6197802b4b54d0dd745129d44932da265eb91d430 +AUX ollama.service 310 BLAKE2B ec8667df53c31527111c551b1fea61e6d1f3479a5e757ec150326ed80501051194c5d7a375ee61fd1d5036ea47f5c83ef0eeb0a20a53f7020f934a35be4bdc9a SHA512 5eee1d4f001aecd2bb04f7987cc3abf685972873bbb69687a3b7dd5d864c90d9acda6ce5528232f2f2ced006578891c427237fefe6e4282ccf1f7639861d8558 +DIST ollama-bin-amd64-0.34.0.tar.zst 1433537033 BLAKE2B e7ec31b253ed5d16566a887b5b1d8a7d3f45839610d79bec93b8abc9a85f974110ea0416e69777b620ab5ef33e221ce0e118e8841d0c4a8c8eb9eac465a2e993 SHA512 bda3340d4d76736400c91d4fb257bf230742762ff6ea71e806d795ae4321ad97f985e8049ded3b88c1cb5e68597d65764f355678f914b3c25ab33997122c6376 +DIST ollama-bin-rocm-amd64-0.34.0.tar.zst 1049334693 BLAKE2B a392636946e62949d2841607ddb56b7f9d425562f692c33983a4b9dc3a5aebc8c86df7fb0aee8d7f1fe8d58fd6e8177ca7f0e37fe6a99a872bd169b413d59371 SHA512 c8598374f24cac4d16555788e85c7ef71db32bfa479ef37793b02bc815740f3e192376fa9b954e34d4439eb09a3f7984ec682edd66ed19f7acc47834b30b0228 +EBUILD ollama-bin-0.34.0.ebuild 1909 BLAKE2B 4f05b8c0f257e3549c1fdaab1d217584a5c57febd72bfa8b13cbdb03cc37a34d9641f1beef8bb7be352494f381eab45fb9a883051ebbd6f0ee188254b6451b29 SHA512 a9bf8e4465444bc7b639bcb7b03f7763a8a9db838b9a06d8a412f97455cb7b441c54b6da87beb2c173565fb49a476f391aa8c27c7f42475ad756241e5f242e2e diff --git a/sci-ml/ollama-bin/files/ollama.confd b/sci-ml/ollama-bin/files/ollama.confd new file mode 100644 index 0000000..fccb3db --- /dev/null +++ b/sci-ml/ollama-bin/files/ollama.confd @@ -0,0 +1,11 @@ +# Ollama allows cross-origin requests from 127.0.0.1 and 0.0.0.0 by default. +# Additional origins can be configured with OLLAMA_ORIGINS. +# export OLLAMA_ORIGINS="" + +# log to syslog +# output_logger="logger -t \"$RC_SVCNAME\" -p daemon.info" +# error_logger="logger -t \"$RC_SVCNAME\" -p daemon.err" + +# log to file +output_log="/var/log/ollama/ollama.log" +error_log="/var/log/ollama/ollama.log" diff --git a/sci-ml/ollama-bin/files/ollama.init b/sci-ml/ollama-bin/files/ollama.init new file mode 100644 index 0000000..50e2a8d --- /dev/null +++ b/sci-ml/ollama-bin/files/ollama.init @@ -0,0 +1,9 @@ +#!/sbin/openrc-run +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License, v2 + +supervisor=supervise-daemon +description="Ollama Service" +command="/usr/bin/ollama" +command_args="serve" +command_user="ollama:ollama" diff --git a/sci-ml/ollama-bin/files/ollama.service b/sci-ml/ollama-bin/files/ollama.service new file mode 100644 index 0000000..0187e6e --- /dev/null +++ b/sci-ml/ollama-bin/files/ollama.service @@ -0,0 +1,15 @@ +[Unit] +Description=Ollama Service +After=network-online.target + +[Service] +ExecStart=/usr/bin/ollama serve +User=ollama +Group=ollama +# GPU access: render -> /dev/dri/renderD* + /dev/kfd (ROCm), video -> legacy/NVIDIA +SupplementaryGroups=render video +Restart=always +RestartSec=3 + +[Install] +WantedBy=default.target diff --git a/sci-ml/ollama-bin/ollama-bin-0.34.0.ebuild b/sci-ml/ollama-bin/ollama-bin-0.34.0.ebuild new file mode 100644 index 0000000..7c5b57f --- /dev/null +++ b/sci-ml/ollama-bin/ollama-bin-0.34.0.ebuild @@ -0,0 +1,78 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit unpacker systemd + +DESCRIPTION="Get up and running with local large language models" +HOMEPAGE="https://ollama.com" +SRC_URI=" + amd64? ( + https://github.com/ollama/ollama/releases/download/v${PV}/ollama-linux-amd64.tar.zst + -> ${PN}-amd64-${PV}.tar.zst + ) + rocm? ( + https://github.com/ollama/ollama/releases/download/v${PV}/ollama-linux-amd64-rocm.tar.zst + -> ${PN}-rocm-amd64-${PV}.tar.zst + ) +" +S="${WORKDIR}" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="-* ~amd64" +IUSE="rocm cuda" + +RESTRICT="strip" + +BDEPEND=" + dev-util/patchelf +" + +RDEPEND=" + acct-group/ollama + acct-group/render + acct-group/video + app-arch/bzip2 + app-arch/xz-utils + app-arch/zstd + media-libs/vulkan-loader + sys-libs/zlib-ng + >=acct-user/ollama-3[cuda?] + cuda? ( + dev-util/nvidia-cuda-toolkit + ) + !!sci-ml/ollama +" + +QA_PREBUILT="*" + +src_prepare() { + default + if ! use cuda; then + rm -rf "${S}"/lib/ollama/{cuda_v12,cuda_v13} || die + fi + # no need to strip for rocm, because the folder containing it wouldn't even be fetched and unpacked + + # Shipped upstream libraries come with '$ORIGIN:/build/llama-server-cpu/bin:' set in their RUNPATH + # scanelf complains about it during install, and we only need $ORIGIN + # (all libs are in the same folder), so we set it to that + for so in "${S}"/lib/ollama/*.so; do + patchelf --set-rpath '$ORIGIN' "${so}" || die + done +} + +src_install(){ + dodir /opt/ollama + cp -a bin lib "${ED}/opt/ollama/" || die "installing ollama blob failed" + + dosym ../../opt/ollama/bin/ollama /usr/bin/ollama + dosym ../../opt/ollama/lib/ollama/llama-server /usr/bin/llama-server + dosym ../../opt/ollama/lib/ollama/llama-quantize /usr/bin/llama-quantize + + newinitd "${FILESDIR}/ollama.init" "${PN}" + newconfd "${FILESDIR}/ollama.confd" "${PN}" + + systemd_dounit "${FILESDIR}/ollama.service" +}