diff --git a/sci-ml/ollama-bin/Manifest b/sci-ml/ollama-bin/Manifest index 18dcd63bf3..a0bf507a05 100644 --- a/sci-ml/ollama-bin/Manifest +++ b/sci-ml/ollama-bin/Manifest @@ -1,2 +1,4 @@ DIST ollama-bin-amd64-0.31.1.tar.zst 1408625102 BLAKE2B afb359ccbc5082a4b29af7a8683156edc8115251dcf03c25c501d8335b32bbbb2a6c37302a786808987317b3e398aaf5f3720291ca7accc16ab5183ef4d30a8d SHA512 ad17888dbea1684fa58dddaf549c9d104c1b8afc6b8c0c5bd81bac09d2547c35905f6f4fa8d21be1f9822a37b090ae30be4e64b2c43591954442abf66268a25c +DIST ollama-bin-amd64-0.32.5.tar.zst 1422353729 BLAKE2B 68c656fcf69fe4e9c80b54ddb4e2f184c7b6742fe6a6efc165d0da8529fb730e673761fb84bfda2ae14147a44dd4e91d0765e46e65fde8842b06c95e834b9cb1 SHA512 7cdb81a7d86565f2a40414abfe3f564361beaa73d70c31b823aed3d6db6eda18025152056ecb1d58fd752ee10f315a1ad82d8479613ca307091f64152ca90997 DIST ollama-bin-rocm-amd64-0.31.1.tar.zst 1055132809 BLAKE2B 627a9ef077c201424b4b494f179e8f807f9e8157970bf6cce1abd2fa3a42ae81b912dd7ab691c4943f0fcc8f69ab60a0914d04ac534a837bb1086cb81720edf3 SHA512 7ac5b2d3ec6ebbe664e0b1aef91d774f633e7e48ff02b847eff69fd962dd1028e55b2f4c951fcee2e646e17623f94679a7df4e818ab9116e0c2f14384971824d +DIST ollama-bin-rocm-amd64-0.32.5.tar.zst 1047683394 BLAKE2B ceb42de9c377523fc837072dc183b44df9acc98628251d64d5a53eec1f34559e8dda001d81526c3c85eebe7dde57611ea7ad4e69a03759217a27680767a31fdb SHA512 70dddb5d1e44e1435800a5b587d79cccf6a2b47c8513b0a71ae2ec51d850fd2de3f66504522906e051d971659bd077f07861ac8c9ddbac3b474546f0d1fd6bb9 diff --git a/sci-ml/ollama-bin/files/ollama.confd b/sci-ml/ollama-bin/files/ollama.confd new file mode 100644 index 0000000000..fccb3dbc43 --- /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 0000000000..50e2a8d6a8 --- /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/ollama-bin-0.32.5.ebuild b/sci-ml/ollama-bin/ollama-bin-0.32.5.ebuild new file mode 100644 index 0000000000..7c5b57f8c1 --- /dev/null +++ b/sci-ml/ollama-bin/ollama-bin-0.32.5.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" +}