From: "Paul Zander" <negril.nx+gentoo@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
Date: Tue, 24 Jun 2025 12:06:27 +0000 (UTC) [thread overview]
Message-ID: <1750764763.0f8375f5909a39b095ace204f3b593e14aa9bfbb.negril.nx+gentoo@gentoo> (raw)
commit: 0f8375f5909a39b095ace204f3b593e14aa9bfbb
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Tue Jun 24 11:32:43 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Tue Jun 24 11:32:43 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0f8375f5
sci-ml/ollama: add 0.9.2
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.9.2.ebuild | 308 ++++++++++++++++++++++++++++++++++++++
2 files changed, 310 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index db7ff5e1a5..4eb171a912 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -6,3 +6,5 @@ DIST ollama-0.9.0-vendor.tar.xz 4412428 BLAKE2B 8d84c7020d350cf6aaf67216ef37be69
DIST ollama-0.9.0.gh.tar.gz 8353746 BLAKE2B 14b685fdc017c0a0485917d3690430e5205366de94291623f07cb3b9c9862ba96894b62ba4798876f841cb3a3ee7497dbae71b253bfb513556bdfc9153deb45c SHA512 32ef42663ea831556fa033bc03a481d103f09e8f5c16f611b3f2308ae80c81daec924192800a2f7c22f70ac86c5440377f892a88cce522223cbbdff793114091
DIST ollama-0.9.1-vendor.tar.xz 4414480 BLAKE2B 60854edfd5f4a0abb674bb4a430694f4a51fae75cfdda268fd0589cc73f467bc6f2fb1fc451c009627818909fa79539f101654069f86583a5457a9e243413f51 SHA512 1b4bc511a74289ccff9940c6a11fab48205d46f2bbbaae028a64476353ff204038703143c5e3207e5dbfc4a27160806e47564728282d8b47030d7303654263b1
DIST ollama-0.9.1.gh.tar.gz 8358070 BLAKE2B 601b93e38247046ad958b332caac074a78554c97cbac93cf3b2eff87f4353d901cc3c807e597a4b217e20aaa2982ec0be6c80e2825ffa87061ad926bcf393f55 SHA512 dffc3da4f2b0c5b50c195a98c1ab8ace049f61536297658cb1ac8dc90a35cd0402e92f61aa11b5283791a5c2e7ac6756b9232a9713d30aee4d7cc24fa2a577e3
+DIST ollama-0.9.2-vendor.tar.xz 4408288 BLAKE2B 704b11317733e10d95f4782a86d7762bb259b20cd1cf879385f236824cfe2378b617bf96ca455d018d4a4dea84db2165459e8015aa6c320bdaf1aea1de0fb9f9 SHA512 4dd32d6c67bafa05db47a0bcc4a7852b5fbd8776acde470bdd524a4772d312a3724778025011ea85135184229b0eac89ccfe4c2323bc02d218686a3497949400
+DIST ollama-0.9.2.gh.tar.gz 8351627 BLAKE2B 84aba6436304260a5743d43eb3c74d48dc3b3168679db26ecb76c25ec78c517bb4d9318eba166e2e2053e6d444d06d3798849f5fe1de53851b01607d18aaeb59 SHA512 a68c581af7a7ea7a2193165773a9e5f1d832ab53e6e5f9f1786d530deab4c7a1e01b39cb1b2775f8415b3e9556991b6cf3e1e2a1066d1070d3ae500433217a33
diff --git a/sci-ml/ollama/ollama-0.9.2.ebuild b/sci-ml/ollama/ollama-0.9.2.ebuild
new file mode 100644
index 0000000000..81e1307e83
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.9.2.ebuild
@@ -0,0 +1,308 @@
+# Copyright 2024-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# supports ROCM/HIP >=5.5, but we define 6.1 due to the eclass
+ROCM_VERSION=6.1
+inherit cuda rocm
+inherit cmake
+inherit go-module systemd toolchain-funcs
+
+DESCRIPTION="Get up and running with Llama 3, Mistral, Gemma, and other language models."
+HOMEPAGE="https://ollama.com"
+
+if [[ ${PV} == *9999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/ollama/ollama.git"
+else
+ SRC_URI="
+ https://github.com/ollama/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz
+ https://github.com/negril/gentoo-overlay-vendored/raw/refs/heads/blobs/${P}-vendor.tar.xz
+ "
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+
+X86_CPU_FLAGS=(
+ sse4_2
+ avx
+ f16c
+ avx2
+ bmi2
+ fma3
+ avx512f
+ avx512vbmi
+ avx512_vnni
+ avx_vnni
+)
+CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
+IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
+# IUSE+=" opencl vulkan"
+
+RESTRICT="test"
+
+COMMON_DEPEND="
+ cuda? (
+ dev-util/nvidia-cuda-toolkit:=
+ )
+ blas? (
+ !mkl? (
+ virtual/blas
+ )
+ mkl? (
+ sci-libs/mkl
+ )
+ )
+ rocm? (
+ >=sci-libs/hipBLAS-5.5:=[${ROCM_USEDEP}]
+ )
+"
+
+DEPEND="
+ ${COMMON_DEPEND}
+ >=dev-lang/go-1.23.4
+"
+
+RDEPEND="
+ ${COMMON_DEPEND}
+ acct-group/${PN}
+ >=acct-user/${PN}-3[cuda?]
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
+)
+
+pkg_pretend() {
+ if use amd64; then
+ if use cpu_flags_x86_f16c && use cpu_flags_x86_avx2 && use cpu_flags_x86_fma3 && ! use cpu_flags_x86_bmi2; then
+ ewarn
+ ewarn "CPU_FLAGS_X86: bmi2 not enabled."
+ ewarn " Not building haswell runner."
+ ewarn " Not building skylakex runner."
+ ewarn " Not building icelake runner."
+ ewarn " Not building alderlake runner."
+ ewarn
+ if grep bmi2 /proc/cpuinfo > /dev/null; then
+ ewarn "bmi2 found in /proc/cpuinfo"
+ ewarn
+ fi
+ fi
+ fi
+}
+
+src_unpack() {
+ if [[ "${PV}" == *9999* ]]; then
+ git-r3_src_unpack
+ go-module_live_vendor
+ else
+ go-module_src_unpack
+ fi
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed \
+ -e "/set(GGML_CCACHE/s/ON/OFF/g" \
+ -e "/PRE_INCLUDE_REGEXES.*cu/d" \
+ -e "/PRE_INCLUDE_REGEXES.*hip/d" \
+ -i CMakeLists.txt || die sed
+
+ sed \
+ -e "s/ -O3//g" \
+ -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
+ # fix library location
+ sed \
+ -e "s#lib/ollama#$(get_libdir)/ollama#g" \
+ -i CMakeLists.txt || die sed
+
+ sed \
+ -e "s/\"..\", \"lib\"/\"..\", \"$(get_libdir)\"/" \
+ -e "s#\"lib/ollama\"#\"$(get_libdir)/ollama\"#" \
+ -i \
+ ml/backend/ggml/ggml/src/ggml.go \
+ discover/path.go \
+ || die
+
+ if use amd64; then
+ if
+ ! use cpu_flags_x86_sse4_2; then
+ sed -e "/ggml_add_cpu_backend_variant(sse42/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ # SSE42)
+ fi
+ if
+ ! use cpu_flags_x86_sse4_2 ||
+ ! use cpu_flags_x86_avx; then
+ sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ # SSE42 AVX)
+ fi
+ if
+ ! use cpu_flags_x86_sse4_2 ||
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! use cpu_flags_x86_bmi2 ||
+ ! use cpu_flags_x86_fma3; then
+ sed -e "/ggml_add_cpu_backend_variant(haswell/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ # SSE42 AVX F16C AVX2 BMI2 FMA)
+ fi
+ if
+ ! use cpu_flags_x86_sse4_2 ||
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! use cpu_flags_x86_bmi2 ||
+ ! use cpu_flags_x86_fma3 ||
+ ! use cpu_flags_x86_avx512f; then
+ sed -e "/ggml_add_cpu_backend_variant(skylakex/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ # SSE42 AVX F16C AVX2 BMI2 FMA AVX512)
+ fi
+ if
+ ! use cpu_flags_x86_sse4_2 ||
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! use cpu_flags_x86_bmi2 ||
+ ! use cpu_flags_x86_fma3 ||
+ ! use cpu_flags_x86_avx512f ||
+ ! use cpu_flags_x86_avx512vbmi ||
+ ! use cpu_flags_x86_avx512_vnni; then
+ sed -e "/ggml_add_cpu_backend_variant(icelake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ # SSE42 AVX F16C AVX2 BMI2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
+ fi
+ if
+ ! use cpu_flags_x86_sse4_2 ||
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! use cpu_flags_x86_bmi2 ||
+ ! use cpu_flags_x86_fma3 ||
+ ! use cpu_flags_x86_avx_vnni; then
+ sed -e "/ggml_add_cpu_backend_variant(alderlake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ # SSE42 AVX F16C AVX2 BMI2 FMA AVX_VNNI)
+ fi
+
+ # ml/backend/ggml/ggml/src/CMakeLists.txt
+ fi
+
+ # default
+ # return
+ if use cuda; then
+ cuda_src_prepare
+ fi
+
+ if use rocm; then
+ # --hip-version gets appended to the compile flags which isn't a known flag.
+ # This causes rocm builds to fail because -Wunused-command-line-argument is turned on.
+ # Use nuclear option to fix this.
+ # Disable -Werror's from go modules.
+ find "${S}" -name ".go" -exec sed -i "s/ -Werror / /g" {} + || die
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DGGML_CCACHE="no"
+
+ # -DGGML_CPU="yes"
+ -DGGML_BLAS="$(usex blas)"
+ # -DGGML_CUDA="$(usex cuda)"
+ # -DGGML_HIP="$(usex rocm)"
+
+ # -DGGML_METAL="yes" # apple
+ # missing from ml/backend/ggml/ggml/src/
+ # -DGGML_CANN="yes"
+ # -DGGML_MUSA="yes"
+ # -DGGML_RPC="yes"
+ # -DGGML_SYCL="yes"
+ # -DGGML_KOMPUTE="$(usex kompute)"
+ # -DGGML_OPENCL="$(usex opencl)"
+ # -DGGML_VULKAN="$(usex vulkan)"
+ )
+
+ if use blas; then
+ if use mkl; then
+ mycmakeargs+=(
+ -DGGML_BLAS_VENDOR="Intel"
+ )
+ else
+ mycmakeargs+=(
+ -DGGML_BLAS_VENDOR="Generic"
+ )
+ fi
+ fi
+ if use cuda; then
+ local -x CUDAHOSTCXX CUDAHOSTLD
+ CUDAHOSTCXX="$(cuda_gccdir)"
+ CUDAHOSTLD="$(tc-getCXX)"
+
+ cuda_add_sandbox -w
+ addpredict "/dev/char/"
+ else
+ mycmakeargs+=(
+ -DCMAKE_CUDA_COMPILER="NOTFOUND"
+ )
+ fi
+
+ if use rocm; then
+ mycmakeargs+=(
+ -DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
+ -DCMAKE_HIP_PLATFORM="amd"
+ # ollama doesn't honor the default cmake options
+ -DAMDGPU_TARGETS="$(get_amdgpu_flags)"
+ )
+
+ local -x HIP_PATH="${ESYSROOT}/usr"
+
+ check_amdgpu
+ else
+ mycmakeargs+=(
+ -DCMAKE_HIP_COMPILER="NOTFOUND"
+ )
+ fi
+
+ cmake_src_configure
+}
+
+src_compile() {
+ ego build
+
+ cmake_src_compile
+}
+
+src_install() {
+ dobin ollama
+
+ cmake_src_install
+
+ newinitd "${FILESDIR}/ollama.init" "${PN}"
+ newconfd "${FILESDIR}/ollama.confd" "${PN}"
+
+ systemd_dounit "${FILESDIR}/ollama.service"
+}
+
+pkg_preinst() {
+ keepdir /var/log/ollama
+ fperms 750 /var/log/ollama
+ fowners "${PN}:${PN}" /var/log/ollama
+}
+
+pkg_postinst() {
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then
+ einfo "Quick guide:"
+ einfo "\tollama serve"
+ einfo "\tollama run llama3:70b"
+ einfo
+ einfo "See available models at https://ollama.com/library"
+ fi
+
+ if use cuda ; then
+ einfo "When using cuda the user running ${PN} has to be in the video group or it won't detect devices."
+ einfo "The ebuild ensures this for user ${PN} via acct-user/${PN}[cuda]"
+ fi
+}
next reply other threads:[~2025-06-24 12:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 12:06 Paul Zander [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-11-06 18:32 [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/ Paul Zander
2025-11-06 18:32 Paul Zander
2025-10-19 21:04 Paul Zander
2025-10-19 21:04 Paul Zander
2025-10-19 20:03 Sv. Lockal
2025-10-05 20:46 Paul Zander
2025-10-04 21:12 Paul Zander
2025-09-07 7:32 Paul Zander
2025-09-07 7:32 Paul Zander
2025-09-07 7:32 Paul Zander
2025-08-09 14:20 Paul Zander
2025-07-31 8:30 Paul Zander
2025-07-31 8:30 Paul Zander
2025-07-31 8:30 Paul Zander
2025-07-15 12:10 David Roman
2025-07-15 7:47 Dawn Xu
2025-07-11 13:31 Paul Zander
2025-07-08 17:04 Paul Zander
2025-06-30 9:15 Paul Zander
2025-06-29 19:32 Paul Zander
2025-06-24 12:06 Paul Zander
2025-06-16 14:21 Paul Zander
2025-06-11 11:50 Paul Zander
2025-06-11 11:50 Paul Zander
2025-05-24 19:26 Paul Zander
2025-05-23 19:37 Paul Zander
2025-04-28 18:52 Paul Zander
2025-04-16 12:24 Paul Zander
2025-04-16 12:24 Paul Zander
2025-04-16 12:24 Paul Zander
2025-04-10 21:48 Paul Zander
2025-04-07 18:22 Paul Zander
2025-04-07 18:22 Paul Zander
2025-04-07 18:22 Paul Zander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1750764763.0f8375f5909a39b095ace204f3b593e14aa9bfbb.negril.nx+gentoo@gentoo \
--to=negril.nx+gentoo@gmail.com \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox