commit: b4149d3fdc886c847c50a5c2e5b950716bc7d9d7
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Aug 4 10:22:49 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sat Oct 4 16:48:34 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=b4149d3f
sci-ml/ollama: add 0.12.3
Use gentoo-golang-dist crates
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
.../{ollama-9999.ebuild => ollama-0.12.3.ebuild} | 47 +++++++++++++++++-----
sci-ml/ollama/ollama-9999.ebuild | 47 +++++++++++++++++-----
3 files changed, 74 insertions(+), 22 deletions(-)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index e844b2c4d2..d65a8f47f9 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -10,5 +10,7 @@ DIST ollama-0.11.5-vendor.tar.xz 4495744 BLAKE2B
ef1d55de3ba6e7116d56a1a0178eea4
DIST ollama-0.11.5.gh.tar.gz 10981612 BLAKE2B
0ade2ca5722289c6f1e32eb3af6c310cc1d6a0cd33a4bab98c385e4a62b73dc7e727149cc1dd34d26fc7eb36c081f9482ad396a007e9ba81fade143fb028ca65
SHA512
f05d0ce0105f185050e797c824b536b3d93012df6483c8b637571190832e2b1d96826e824829c3d62a691061da9b2bdda756229e2ffaa713af7335903b6b272d
DIST ollama-0.11.6-vendor.tar.xz 4496536 BLAKE2B
31cae5f914d1fe9b125d9be13588cca2bd7b1665214eb4b33ce41c9ffecea0c2cf50378f62511d8e5fb02c7a4c6a0f89f713166dd6f68580aa68b561a328b804
SHA512
ca4ec77aa86362f2c974b19e3635028c1ea743cfa8d5b5c6a9f7a7b9942596398080421cd60358178a4953244247941d97aef4e190abca4921b903dbc7d1dfa2
DIST ollama-0.11.6.gh.tar.gz 10981671 BLAKE2B
29a6e7ab6a6732b79492695f5b8d064539c56b8455607e88776f6c84d46f61b95e22650ec637d7f0a37fd506b0f343d34eb2666a0f4aadbce26d518c1fa1a77e
SHA512
7118feea14ee50c463dca3a23804298597165a8db6f831994049b384786b0391ee8f441d626347109c6b1e9e014c5d6d9890bd5a57598d55845c8d3ffdd30223
+DIST ollama-0.12.3-deps.tar.xz 48057580 BLAKE2B
f27521bd7755fe5d7deb57962f305ec17ddbe34b024744152531143eda1128f25a501b5923cee58dc54c832eeaaa50b7135c4a594a1f25f9eec211ac2e55e148
SHA512
cb226f4bbb46c9b76f890f12d7a9671331690a866f74440c10444c6638b2895f3df4036930a98f06401e3a3cfec562e214a4030aca1787600175760f7eaedef8
+DIST ollama-0.12.3.gh.tar.gz 11024073 BLAKE2B
4de9eb2b6c1860ef93b3c396139c6fc99f71c208b717207cc22780725b8826b0f28d74c223c26ca05ab5d07a2548c60ac6bcd34cb15222b9e6b1d79a40cbe25b
SHA512
22c182bc233db3f403e32bd45bbc7ef59644211434a48c95d97d624468880388a7a806af75a6d9be0497a611674d83970679f90df0b4afb536cec5ce2682db65
DIST ollama-0.9.6-vendor.tar.xz 4499268 BLAKE2B
8fd2834e258d92b49a75f543709ec609ec9c4ad480755ed570165f24c1259128985b9e09ce3d1ad7a94375aaf42d85ec75e4cd8de5828e225e95f1ed9dc45362
SHA512
5eca6971a8119d500562cf76039f97207bc66cad4fac78f56066fe54d64257958b3e6f74393c6797a6752776e3161b9d7fbd6fae5e0a59cdd8ed25d9b1df101d
DIST ollama-0.9.6.gh.tar.gz 10421166 BLAKE2B
98c9d61d96da502e6aa21cfe2df54f2532645808777ced00dc56bce562824952aa15fff82d769af989a8815f5f26e97853db14d549a3a02610ac755f30918955
SHA512
a3dfac78b6405128837a16588d9de898b3cd4bc9c20dae46f73e1de8d71ccf3c44068ff900f6f6770e5ea6c82a5a91db266bb275d3e159cf701e8e037be9e3c4
diff --git a/sci-ml/ollama/ollama-9999.ebuild
b/sci-ml/ollama/ollama-0.12.3.ebuild
similarity index 88%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.12.3.ebuild
index c8e23efd95..e180d3d88b 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.12.3.ebuild
@@ -4,7 +4,7 @@
EAPI=8
# supports ROCM/HIP >=5.5, but we define 6.1 due to the eclass
-ROCM_VERSION=6.1
+ROCM_VERSION="6.1"
inherit cuda rocm
inherit cmake
inherit go-module systemd toolchain-funcs
@@ -18,7 +18,7 @@ if [[ ${PV} == *9999* ]]; then
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
+
https://github.com/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-deps.tar.xz
"
KEYWORDS="~amd64"
fi
@@ -39,15 +39,12 @@ X86_CPU_FLAGS=(
avx_vnni
)
CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
+IUSE="blas ${CPU_FLAGS[*]} cuda mkl rocm"
# IUSE+=" opencl vulkan"
RESTRICT="test"
COMMON_DEPEND="
- cuda? (
- dev-util/nvidia-cuda-toolkit:=
- )
blas? (
!mkl? (
virtual/blas
@@ -56,6 +53,9 @@ COMMON_DEPEND="
sci-libs/mkl
)
)
+ cuda? (
+ dev-util/nvidia-cuda-toolkit:=
+ )
rocm? (
>=sci-libs/hipBLAS-5.5:=[${ROCM_USEDEP}]
)
@@ -94,7 +94,26 @@ pkg_pretend() {
fi
}
+pkg_setup() {
+ if use hip; then
+ linux-info_pkg_setup
+ if linux-info_get_any_version && linux_config_exists; then
+ if ! linux_chkconfig_present HSA_AMD_SVM; then
+ ewarn "To use ROCm/HIP, you need to have
HSA_AMD_SVM option enabled in your kernel."
+ fi
+ fi
+ fi
+}
+
src_unpack() {
+ # Already filter lto flags for ROCM
+ # 963401
+ if use rocm && tc-is-lto; then
+ # copied from _rocm_strip_unsupported_flags
+ strip-unsupported-flags
+ export CXXFLAGS="$(test-flags-HIPCXX "${CXXFLAGS}")"
+ fi
+
if [[ "${PV}" == *9999* ]]; then
git-r3_src_unpack
go-module_live_vendor
@@ -112,6 +131,7 @@ src_prepare() {
-e "/PRE_INCLUDE_REGEXES.*hip/d" \
-i CMakeLists.txt || die sed
+ # TODO see src_unpack?
sed \
-e "s/ -O3//g" \
-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
@@ -190,8 +210,6 @@ src_prepare() {
# ml/backend/ggml/ggml/src/CMakeLists.txt
fi
- # default
- # return
if use cuda; then
cuda_src_prepare
fi
@@ -236,6 +254,7 @@ src_configure() {
)
fi
fi
+
if use cuda; then
local -x CUDAHOSTCXX CUDAHOSTLD
CUDAHOSTCXX="$(cuda_gccdir)"
@@ -278,14 +297,20 @@ src_compile() {
# https://forums.gentoo.org/viewtopic-p-8831646.html
local VERSION
if [[ "${PV}" == *9999* ]]; then
- VERSION=$(
+ VERSION="$(
git describe --tags --first-parent --abbrev=7 --long
--dirty --always \
| sed -e "s/^v//g"
- )
+ )"
else
VERSION="${PVR}"
fi
- GOFLAGS+=" '-ldflags=-w -s
\"-X=github.com/ollama/ollama/version.Version=$VERSION\"
\"-X=github.com/ollama/ollama/server.mode=release\"'"
+ local EXTRA_GOFLAGS_LD=(
+ "-w"
+ "-s"
+ "\"-X=github.com/ollama/ollama/version.Version=${VERSION}\""
+ "\"-X=github.com/ollama/ollama/server.mode=release\""
+ )
+ GOFLAGS+=" '-ldflags=${EXTRA_GOFLAGS_LD[*]}'"
ego build
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index c8e23efd95..e180d3d88b 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -4,7 +4,7 @@
EAPI=8
# supports ROCM/HIP >=5.5, but we define 6.1 due to the eclass
-ROCM_VERSION=6.1
+ROCM_VERSION="6.1"
inherit cuda rocm
inherit cmake
inherit go-module systemd toolchain-funcs
@@ -18,7 +18,7 @@ if [[ ${PV} == *9999* ]]; then
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
+
https://github.com/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-deps.tar.xz
"
KEYWORDS="~amd64"
fi
@@ -39,15 +39,12 @@ X86_CPU_FLAGS=(
avx_vnni
)
CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
+IUSE="blas ${CPU_FLAGS[*]} cuda mkl rocm"
# IUSE+=" opencl vulkan"
RESTRICT="test"
COMMON_DEPEND="
- cuda? (
- dev-util/nvidia-cuda-toolkit:=
- )
blas? (
!mkl? (
virtual/blas
@@ -56,6 +53,9 @@ COMMON_DEPEND="
sci-libs/mkl
)
)
+ cuda? (
+ dev-util/nvidia-cuda-toolkit:=
+ )
rocm? (
>=sci-libs/hipBLAS-5.5:=[${ROCM_USEDEP}]
)
@@ -94,7 +94,26 @@ pkg_pretend() {
fi
}
+pkg_setup() {
+ if use hip; then
+ linux-info_pkg_setup
+ if linux-info_get_any_version && linux_config_exists; then
+ if ! linux_chkconfig_present HSA_AMD_SVM; then
+ ewarn "To use ROCm/HIP, you need to have
HSA_AMD_SVM option enabled in your kernel."
+ fi
+ fi
+ fi
+}
+
src_unpack() {
+ # Already filter lto flags for ROCM
+ # 963401
+ if use rocm && tc-is-lto; then
+ # copied from _rocm_strip_unsupported_flags
+ strip-unsupported-flags
+ export CXXFLAGS="$(test-flags-HIPCXX "${CXXFLAGS}")"
+ fi
+
if [[ "${PV}" == *9999* ]]; then
git-r3_src_unpack
go-module_live_vendor
@@ -112,6 +131,7 @@ src_prepare() {
-e "/PRE_INCLUDE_REGEXES.*hip/d" \
-i CMakeLists.txt || die sed
+ # TODO see src_unpack?
sed \
-e "s/ -O3//g" \
-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
@@ -190,8 +210,6 @@ src_prepare() {
# ml/backend/ggml/ggml/src/CMakeLists.txt
fi
- # default
- # return
if use cuda; then
cuda_src_prepare
fi
@@ -236,6 +254,7 @@ src_configure() {
)
fi
fi
+
if use cuda; then
local -x CUDAHOSTCXX CUDAHOSTLD
CUDAHOSTCXX="$(cuda_gccdir)"
@@ -278,14 +297,20 @@ src_compile() {
# https://forums.gentoo.org/viewtopic-p-8831646.html
local VERSION
if [[ "${PV}" == *9999* ]]; then
- VERSION=$(
+ VERSION="$(
git describe --tags --first-parent --abbrev=7 --long
--dirty --always \
| sed -e "s/^v//g"
- )
+ )"
else
VERSION="${PVR}"
fi
- GOFLAGS+=" '-ldflags=-w -s
\"-X=github.com/ollama/ollama/version.Version=$VERSION\"
\"-X=github.com/ollama/ollama/server.mode=release\"'"
+ local EXTRA_GOFLAGS_LD=(
+ "-w"
+ "-s"
+ "\"-X=github.com/ollama/ollama/version.Version=${VERSION}\""
+ "\"-X=github.com/ollama/ollama/server.mode=release\""
+ )
+ GOFLAGS+=" '-ldflags=${EXTRA_GOFLAGS_LD[*]}'"
ego build