* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-07 18:22 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-07 18:22 UTC (permalink / raw
To: gentoo-commits
commit: 4c15d8ccb15dbf406efdfda4048901c4e687d8c1
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr 7 18:09:33 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr 7 18:12:53 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4c15d8cc
sci-ml/ollama: filter flags in go file comments
Closes: https://bugs.gentoo.org/953049
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/ollama-0.6.3.ebuild | 4 ++++
sci-ml/ollama/ollama-9999.ebuild | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/sci-ml/ollama/ollama-0.6.3.ebuild b/sci-ml/ollama/ollama-0.6.3.ebuild
index 9f07083dd..cf664c756 100644
--- a/sci-ml/ollama/ollama-0.6.3.ebuild
+++ b/sci-ml/ollama/ollama-0.6.3.ebuild
@@ -93,6 +93,10 @@ src_prepare() {
-e "/PRE_INCLUDE_REGEXES.*hip/d" \
-i CMakeLists.txt || die sed
+ sed \
+ -e "s/-O3/${CFLAGS}/g" \
+ -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
if use amd64; then
if ! 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
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 7147e4cc8..6726a5970 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -93,6 +93,10 @@ src_prepare() {
-e "/PRE_INCLUDE_REGEXES.*hip/d" \
-i CMakeLists.txt || die sed
+ sed \
+ -e "s/-O3/${CFLAGS}/g" \
+ -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
if use amd64; then
if ! 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
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-07 18:22 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-07 18:22 UTC (permalink / raw
To: gentoo-commits
commit: 2b8d876eb74b90e7f4925304df1e5df6193b1529
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr 7 18:08:46 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr 7 18:12:53 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2b8d876e
sci-ml/ollama: add missing USE-dep to 0.6.3 to put user in video group
Closes: https://bugs.gentoo.org/953074
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/ollama-0.6.3.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sci-ml/ollama/ollama-0.6.3.ebuild b/sci-ml/ollama/ollama-0.6.3.ebuild
index b4969fb21..9f07083dd 100644
--- a/sci-ml/ollama/ollama-0.6.3.ebuild
+++ b/sci-ml/ollama/ollama-0.6.3.ebuild
@@ -68,7 +68,7 @@ DEPEND="
RDEPEND="
${COMMON_DEPEND}
acct-group/${PN}
- acct-user/${PN}
+ acct-user/${PN}[cuda?]
"
PATCHES=(
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-07 18:22 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-07 18:22 UTC (permalink / raw
To: gentoo-commits
commit: 7938f65683c3c090abb864090a53a11c97ef36b8
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr 7 18:09:54 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr 7 18:12:53 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=7938f656
sci-ml/ollama: add 0.6.4
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.6.4.ebuild | 305 ++++++++++++++++++++++++++++++++++++++
2 files changed, 307 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 88cd835f1..57079a8a0 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,2 +1,4 @@
DIST ollama-0.6.3-vendor.tar.xz 4417068 BLAKE2B 33aabb08f8582c7f211ebfc51c95af96d7ce1402c6350b656fb0114fe849901ea65f22bf833175a87aa318a685f35c0941b236dfcbf84c81d7766a91d66f6db3 SHA512 79044b751daba3d463d7890792d5a6581e96317951de763191b128237e90e81dac578b674654d527e70d48fa059cb62f40831554c432a2a424d659790dbd7a10
DIST ollama-0.6.3.gh.tar.gz 7950300 BLAKE2B 4a14bab714b11104753caafe58a1301490d6a24d7af90a374741b6977fafb47792a50fa570e0883b13d5275f621ae1516f2d4055f6c32583e42821725d65e59f SHA512 28a0688f1aa35a161e09af19b643b2a53115fa29ce0b522ed2bd76bcaedc710553a266af2370886bc23408025935f786d13f07297ffb3e783b13132237f10712
+DIST ollama-0.6.4-vendor.tar.xz 4414140 BLAKE2B 72452a0143863afc6a748a78ece63d8e33842b8f53ae041b2a0e5d727765cf452ac95e81fff4af2fddbc86da793864ef1d2489f7feb15092b5732f1bcae1f698 SHA512 acb179bc8816e843cd78858be6af828496932385a4f1c7877af1de1ad38c68f55b789c2b0ab81b7ce92e0aea9e2224bc004d18b3fbce1ff81e2bc904234d9d48
+DIST ollama-0.6.4.gh.tar.gz 7958849 BLAKE2B 1cc6b1490913c3d11d1abe3ad99f44db0cc953ca58e507949b4cef02e37a1be20e7621627f999426a0d224a5a1a41de6186254730a2507f200540340f621e034 SHA512 ee2de90c51f4c85e6bacab8c570ffe3d0adc59369423127c0875cd328ea1469899f7ee847eb00c5e35856adba50d8c2d2e8de88df2389a043313d6f0edcbf5db
diff --git a/sci-ml/ollama/ollama-0.6.4.ebuild b/sci-ml/ollama/ollama-0.6.4.ebuild
new file mode 100644
index 000000000..cf664c756
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.6.4.ebuild
@@ -0,0 +1,305 @@
+# 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=(
+ avx
+ f16c
+ avx2
+ fma3
+ avx512f
+ avx512vbmi
+ avx512_vnni
+ avx512_bf16
+ avx_vnni
+ amx_tile
+ amx_int8
+)
+CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
+IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
+# IUSE+=" opencl vulkan"
+
+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}[cuda?]
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
+)
+
+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/${CFLAGS}/g" \
+ -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
+ if use amd64; then
+ if ! 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
+ # AVX)
+ fi
+ if
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! 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
+ # AVX F16C AVX2 FMA)
+ fi
+ if
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! 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
+ # AVX F16C AVX2 FMA AVX512)
+ fi
+ if
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! 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
+ # AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
+ fi
+ if
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! 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
+ # AVX F16C AVX2 FMA AVX_VNNI)
+ fi
+
+ if
+ ! use cpu_flags_x86_avx ||
+ ! use cpu_flags_x86_f16c ||
+ ! use cpu_flags_x86_avx2 ||
+ ! use cpu_flags_x86_fma3 ||
+ ! use cpu_flags_x86_avx512f ||
+ ! use cpu_flags_x86_avx512vbmi ||
+ ! use cpu_flags_x86_avx512_vnni ||
+ ! use cpu_flags_x86_avx512_bf16 ||
+ ! use cpu_flags_x86_amx_tile ||
+ ! use cpu_flags_x86_amx_int8 ; then
+ sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+ #AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
+ 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=(
+ -DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
+ -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
+ else
+ mycmakeargs+=(
+ -DCMAKE_CUDA_COMPILER="NOTFOUND"
+ )
+ fi
+
+ if use rocm; then
+ mycmakeargs+=(
+ -DCMAKE_HIP_PLATFORM="amd"
+ )
+
+ local -x HIP_ARCHS HIP_PATH
+ HIP_ARCHS="$(get_amdgpu_flags)"
+ HIP_PATH="${ESYSROOT}/usr"
+
+ check_amdgpu
+ else
+ mycmakeargs+=(
+ -DCMAKE_HIP_COMPILER="NOTFOUND"
+ )
+ fi
+
+ cmake_src_configure
+
+ # if ! use cuda && ! use rocm; then
+ # # to configure and build only CPU variants
+ # set -- cmake --preset Default "${mycmakeargs[@]}"
+ # fi
+
+ # if use cuda; then
+ # # to configure and build only CUDA
+ # set -- cmake --preset CUDA "${mycmakeargs[@]}"
+ # fi
+
+ # if use rocm; then
+ # # to configure and build only ROCm
+ # set -- cmake --preset ROCm "${mycmakeargs[@]}"
+ # fi
+
+ # echo "$@" >&2
+ # "$@" || die -n "${*} failed"
+}
+
+src_compile() {
+ ego build
+
+ cmake_src_compile
+
+ # if ! use cuda && ! use rocm; then
+ # # to configure and build only CPU variants
+ # set -- cmake --build --preset Default -j16
+ # fi
+
+ # if use cuda; then
+ # # to configure and build only CUDA
+ # set -- cmake --build --preset CUDA -j16
+ # fi
+
+ # if use rocm; then
+ # # to configure and build only ROCm
+ # set -- cmake --build --preset ROCm -j16
+ # fi
+
+ # echo "$@" >&2
+ # "$@" || die -n "${*} failed"
+}
+
+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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-10 21:48 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-10 21:48 UTC (permalink / raw
To: gentoo-commits
commit: 362def25a8c2eb028c438b8faf7c25267216fe8e
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Thu Apr 10 21:47:41 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Thu Apr 10 21:47:55 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=362def25
sci-ml/ollama: add 0.6.5
Closes: https://bugs.gentoo.org/953511
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 ++
sci-ml/ollama/{ollama-9999.ebuild => ollama-0.6.5.ebuild} | 3 ++-
sci-ml/ollama/ollama-9999.ebuild | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 57079a8a0..292ef15d2 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -2,3 +2,5 @@ DIST ollama-0.6.3-vendor.tar.xz 4417068 BLAKE2B 33aabb08f8582c7f211ebfc51c95af96
DIST ollama-0.6.3.gh.tar.gz 7950300 BLAKE2B 4a14bab714b11104753caafe58a1301490d6a24d7af90a374741b6977fafb47792a50fa570e0883b13d5275f621ae1516f2d4055f6c32583e42821725d65e59f SHA512 28a0688f1aa35a161e09af19b643b2a53115fa29ce0b522ed2bd76bcaedc710553a266af2370886bc23408025935f786d13f07297ffb3e783b13132237f10712
DIST ollama-0.6.4-vendor.tar.xz 4414140 BLAKE2B 72452a0143863afc6a748a78ece63d8e33842b8f53ae041b2a0e5d727765cf452ac95e81fff4af2fddbc86da793864ef1d2489f7feb15092b5732f1bcae1f698 SHA512 acb179bc8816e843cd78858be6af828496932385a4f1c7877af1de1ad38c68f55b789c2b0ab81b7ce92e0aea9e2224bc004d18b3fbce1ff81e2bc904234d9d48
DIST ollama-0.6.4.gh.tar.gz 7958849 BLAKE2B 1cc6b1490913c3d11d1abe3ad99f44db0cc953ca58e507949b4cef02e37a1be20e7621627f999426a0d224a5a1a41de6186254730a2507f200540340f621e034 SHA512 ee2de90c51f4c85e6bacab8c570ffe3d0adc59369423127c0875cd328ea1469899f7ee847eb00c5e35856adba50d8c2d2e8de88df2389a043313d6f0edcbf5db
+DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
+DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-0.6.5.ebuild
similarity index 98%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.6.5.ebuild
index 6726a5970..f9f8e9cb2 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.6.5.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
-i CMakeLists.txt || die sed
sed \
- -e "s/-O3/${CFLAGS}/g" \
+ -e "s/-O3/$(get-flag O)/g" \
-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
if use amd64; then
@@ -174,6 +174,7 @@ src_prepare() {
src_configure() {
local mycmakeargs=(
+ -DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
-DGGML_CCACHE="no"
# -DGGML_CPU="yes"
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 6726a5970..d8944477e 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
-i CMakeLists.txt || die sed
sed \
- -e "s/-O3/${CFLAGS}/g" \
+ -e "s/-O3/$(get-flag O)/g" \
-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
if use amd64; then
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-16 12:24 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-16 12:24 UTC (permalink / raw
To: gentoo-commits
commit: bf4efd75347fbd1c1fd123823d24ac77864d4054
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Apr 16 12:15:44 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Apr 16 12:15:44 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=bf4efd75
sci-ml/ollama: fix accelerated library lookup path
The go binary discarded libraries not in `lib/ollama`. This only showed when
running with `OLLAMA_DEBUG=1`.
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
...{ollama-0.6.5.ebuild => ollama-0.6.5-r1.ebuild} | 61 ++++++++--------------
sci-ml/ollama/ollama-9999.ebuild | 61 ++++++++--------------
2 files changed, 42 insertions(+), 80 deletions(-)
diff --git a/sci-ml/ollama/ollama-0.6.5.ebuild b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
similarity index 85%
rename from sci-ml/ollama/ollama-0.6.5.ebuild
rename to sci-ml/ollama/ollama-0.6.5-r1.ebuild
index f9f8e9cb2..d5fda71a5 100644
--- a/sci-ml/ollama/ollama-0.6.5.ebuild
+++ b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
@@ -68,7 +68,7 @@ DEPEND="
RDEPEND="
${COMMON_DEPEND}
acct-group/${PN}
- acct-user/${PN}[cuda?]
+ >=acct-user/${PN}-3[cuda?]
"
PATCHES=(
@@ -97,6 +97,19 @@ src_prepare() {
-e "s/-O3/$(get-flag O)/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_avx; then
sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
@@ -218,12 +231,11 @@ src_configure() {
if use rocm; then
mycmakeargs+=(
+ -DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
-DCMAKE_HIP_PLATFORM="amd"
)
- local -x HIP_ARCHS HIP_PATH
- HIP_ARCHS="$(get_amdgpu_flags)"
- HIP_PATH="${ESYSROOT}/usr"
+ local -x HIP_PATH="${ESYSROOT}/usr"
check_amdgpu
else
@@ -233,48 +245,12 @@ src_configure() {
fi
cmake_src_configure
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --preset Default "${mycmakeargs[@]}"
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --preset CUDA "${mycmakeargs[@]}"
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --preset ROCm "${mycmakeargs[@]}"
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
}
src_compile() {
ego build
cmake_src_compile
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --build --preset Default -j16
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --build --preset CUDA -j16
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --build --preset ROCm -j16
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
}
src_install() {
@@ -302,4 +278,9 @@ pkg_postinst() {
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
}
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index d8944477e..085c656fa 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -68,7 +68,7 @@ DEPEND="
RDEPEND="
${COMMON_DEPEND}
acct-group/${PN}
- acct-user/${PN}[cuda?]
+ >=acct-user/${PN}-3[cuda?]
"
PATCHES=(
@@ -97,6 +97,19 @@ src_prepare() {
-e "s/-O3/$(get-flag O)/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_avx; then
sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
@@ -217,12 +230,11 @@ src_configure() {
if use rocm; then
mycmakeargs+=(
+ -DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
-DCMAKE_HIP_PLATFORM="amd"
)
- local -x HIP_ARCHS HIP_PATH
- HIP_ARCHS="$(get_amdgpu_flags)"
- HIP_PATH="${ESYSROOT}/usr"
+ local -x HIP_PATH="${ESYSROOT}/usr"
check_amdgpu
else
@@ -232,48 +244,12 @@ src_configure() {
fi
cmake_src_configure
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --preset Default "${mycmakeargs[@]}"
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --preset CUDA "${mycmakeargs[@]}"
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --preset ROCm "${mycmakeargs[@]}"
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
}
src_compile() {
ego build
cmake_src_compile
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --build --preset Default -j16
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --build --preset CUDA -j16
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --build --preset ROCm -j16
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
}
src_install() {
@@ -301,4 +277,9 @@ pkg_postinst() {
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
}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-16 12:24 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-16 12:24 UTC (permalink / raw
To: gentoo-commits
commit: 3670bb4d97602d491fb10b868c06b5623d7cdf42
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Apr 16 12:16:34 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Apr 16 12:16:34 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3670bb4d
sci-ml/ollama: drop -O2 flag from go file
Closes: https://bugs.gentoo.org/953877
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/ollama-0.6.5-r1.ebuild | 2 +-
sci-ml/ollama/ollama-9999.ebuild | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sci-ml/ollama/ollama-0.6.5-r1.ebuild b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
index d5fda71a5..f0c4ca473 100644
--- a/sci-ml/ollama/ollama-0.6.5-r1.ebuild
+++ b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
-i CMakeLists.txt || die sed
sed \
- -e "s/-O3/$(get-flag O)/g" \
+ -e "s/ -O3//g" \
-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
# fix library location
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 085c656fa..79bdf486b 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
-i CMakeLists.txt || die sed
sed \
- -e "s/-O3/$(get-flag O)/g" \
+ -e "s/ -O3//g" \
-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
# fix library location
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-16 12:24 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-16 12:24 UTC (permalink / raw
To: gentoo-commits
commit: 69efba9ce107ee517eeb05c80adbcc176c6e4440
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Apr 16 12:17:02 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Apr 16 12:17:02 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=69efba9c
sci-ml/ollama: drop 0.6.4 0.6.3
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 4 -
sci-ml/ollama/ollama-0.6.3.ebuild | 305 --------------------------------------
sci-ml/ollama/ollama-0.6.4.ebuild | 305 --------------------------------------
3 files changed, 614 deletions(-)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 292ef15d2..c8ac3ffaf 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,6 +1,2 @@
-DIST ollama-0.6.3-vendor.tar.xz 4417068 BLAKE2B 33aabb08f8582c7f211ebfc51c95af96d7ce1402c6350b656fb0114fe849901ea65f22bf833175a87aa318a685f35c0941b236dfcbf84c81d7766a91d66f6db3 SHA512 79044b751daba3d463d7890792d5a6581e96317951de763191b128237e90e81dac578b674654d527e70d48fa059cb62f40831554c432a2a424d659790dbd7a10
-DIST ollama-0.6.3.gh.tar.gz 7950300 BLAKE2B 4a14bab714b11104753caafe58a1301490d6a24d7af90a374741b6977fafb47792a50fa570e0883b13d5275f621ae1516f2d4055f6c32583e42821725d65e59f SHA512 28a0688f1aa35a161e09af19b643b2a53115fa29ce0b522ed2bd76bcaedc710553a266af2370886bc23408025935f786d13f07297ffb3e783b13132237f10712
-DIST ollama-0.6.4-vendor.tar.xz 4414140 BLAKE2B 72452a0143863afc6a748a78ece63d8e33842b8f53ae041b2a0e5d727765cf452ac95e81fff4af2fddbc86da793864ef1d2489f7feb15092b5732f1bcae1f698 SHA512 acb179bc8816e843cd78858be6af828496932385a4f1c7877af1de1ad38c68f55b789c2b0ab81b7ce92e0aea9e2224bc004d18b3fbce1ff81e2bc904234d9d48
-DIST ollama-0.6.4.gh.tar.gz 7958849 BLAKE2B 1cc6b1490913c3d11d1abe3ad99f44db0cc953ca58e507949b4cef02e37a1be20e7621627f999426a0d224a5a1a41de6186254730a2507f200540340f621e034 SHA512 ee2de90c51f4c85e6bacab8c570ffe3d0adc59369423127c0875cd328ea1469899f7ee847eb00c5e35856adba50d8c2d2e8de88df2389a043313d6f0edcbf5db
DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf
diff --git a/sci-ml/ollama/ollama-0.6.3.ebuild b/sci-ml/ollama/ollama-0.6.3.ebuild
deleted file mode 100644
index cf664c756..000000000
--- a/sci-ml/ollama/ollama-0.6.3.ebuild
+++ /dev/null
@@ -1,305 +0,0 @@
-# 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=(
- avx
- f16c
- avx2
- fma3
- avx512f
- avx512vbmi
- avx512_vnni
- avx512_bf16
- avx_vnni
- amx_tile
- amx_int8
-)
-CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
-# IUSE+=" opencl vulkan"
-
-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}[cuda?]
-"
-
-PATCHES=(
- "${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
-)
-
-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/${CFLAGS}/g" \
- -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
-
- if use amd64; then
- if ! 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
- # AVX)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX_VNNI)
- fi
-
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! use cpu_flags_x86_fma3 ||
- ! use cpu_flags_x86_avx512f ||
- ! use cpu_flags_x86_avx512vbmi ||
- ! use cpu_flags_x86_avx512_vnni ||
- ! use cpu_flags_x86_avx512_bf16 ||
- ! use cpu_flags_x86_amx_tile ||
- ! use cpu_flags_x86_amx_int8 ; then
- sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
- #AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
- 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=(
- -DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
- -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
- else
- mycmakeargs+=(
- -DCMAKE_CUDA_COMPILER="NOTFOUND"
- )
- fi
-
- if use rocm; then
- mycmakeargs+=(
- -DCMAKE_HIP_PLATFORM="amd"
- )
-
- local -x HIP_ARCHS HIP_PATH
- HIP_ARCHS="$(get_amdgpu_flags)"
- HIP_PATH="${ESYSROOT}/usr"
-
- check_amdgpu
- else
- mycmakeargs+=(
- -DCMAKE_HIP_COMPILER="NOTFOUND"
- )
- fi
-
- cmake_src_configure
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --preset Default "${mycmakeargs[@]}"
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --preset CUDA "${mycmakeargs[@]}"
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --preset ROCm "${mycmakeargs[@]}"
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
-}
-
-src_compile() {
- ego build
-
- cmake_src_compile
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --build --preset Default -j16
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --build --preset CUDA -j16
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --build --preset ROCm -j16
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
-}
-
-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
-}
diff --git a/sci-ml/ollama/ollama-0.6.4.ebuild b/sci-ml/ollama/ollama-0.6.4.ebuild
deleted file mode 100644
index cf664c756..000000000
--- a/sci-ml/ollama/ollama-0.6.4.ebuild
+++ /dev/null
@@ -1,305 +0,0 @@
-# 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=(
- avx
- f16c
- avx2
- fma3
- avx512f
- avx512vbmi
- avx512_vnni
- avx512_bf16
- avx_vnni
- amx_tile
- amx_int8
-)
-CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
-# IUSE+=" opencl vulkan"
-
-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}[cuda?]
-"
-
-PATCHES=(
- "${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
-)
-
-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/${CFLAGS}/g" \
- -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
-
- if use amd64; then
- if ! 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
- # AVX)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX_VNNI)
- fi
-
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! use cpu_flags_x86_fma3 ||
- ! use cpu_flags_x86_avx512f ||
- ! use cpu_flags_x86_avx512vbmi ||
- ! use cpu_flags_x86_avx512_vnni ||
- ! use cpu_flags_x86_avx512_bf16 ||
- ! use cpu_flags_x86_amx_tile ||
- ! use cpu_flags_x86_amx_int8 ; then
- sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
- #AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
- 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=(
- -DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
- -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
- else
- mycmakeargs+=(
- -DCMAKE_CUDA_COMPILER="NOTFOUND"
- )
- fi
-
- if use rocm; then
- mycmakeargs+=(
- -DCMAKE_HIP_PLATFORM="amd"
- )
-
- local -x HIP_ARCHS HIP_PATH
- HIP_ARCHS="$(get_amdgpu_flags)"
- HIP_PATH="${ESYSROOT}/usr"
-
- check_amdgpu
- else
- mycmakeargs+=(
- -DCMAKE_HIP_COMPILER="NOTFOUND"
- )
- fi
-
- cmake_src_configure
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --preset Default "${mycmakeargs[@]}"
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --preset CUDA "${mycmakeargs[@]}"
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --preset ROCm "${mycmakeargs[@]}"
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
-}
-
-src_compile() {
- ego build
-
- cmake_src_compile
-
- # if ! use cuda && ! use rocm; then
- # # to configure and build only CPU variants
- # set -- cmake --build --preset Default -j16
- # fi
-
- # if use cuda; then
- # # to configure and build only CUDA
- # set -- cmake --build --preset CUDA -j16
- # fi
-
- # if use rocm; then
- # # to configure and build only ROCm
- # set -- cmake --build --preset ROCm -j16
- # fi
-
- # echo "$@" >&2
- # "$@" || die -n "${*} failed"
-}
-
-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
-}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-28 18:52 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-04-28 18:52 UTC (permalink / raw
To: gentoo-commits
commit: e92cad7ec294d72b3435e5f3aaa52a48da3c57a5
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Apr 27 14:20:05 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr 28 18:48:24 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e92cad7e
sci-ml/ollama: add 0.6.6
Closes: https://bugs.gentoo.org/954399
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 ++
sci-ml/ollama/{ollama-9999.ebuild => ollama-0.6.6.ebuild} | 2 ++
sci-ml/ollama/ollama-9999.ebuild | 3 +++
3 files changed, 7 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index c8ac3ffaf..4ab89af65 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,2 +1,4 @@
DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf
+DIST ollama-0.6.6-vendor.tar.xz 4411192 BLAKE2B 49eb6a51eba9faed05a61cb4769d4696a936b8fec65be56c6b5e95b59c8cfbb2505e1e3a1a15baeed7eac4a2651f4965eb4a70ba7ba36ae8b18955d305e450aa SHA512 319352dcb98195723800da3d5eb3bf12de521a7634a2a484d3d4b89f8e6661fff760bccef734a083f6b81bc837996f043fdbd2d7d1d9dcca5a069ede02f37592
+DIST ollama-0.6.6.gh.tar.gz 8290979 BLAKE2B 3082cca4e9a9e690f792d8286888b4141fe7ada2b91a703503a0330f9da29a80bc29ac78b1308e5276868bd125f4fe68d644fba47ec930fe1373a850373f49d9 SHA512 83df0cd3c76d771d4486ecf9a6789287c309d4b99a0e1e2d2d895f4527592f219b06eb695d4cfc0b4f37446aa26883a407eecfd00ac043355e406ca919d7032b
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-0.6.6.ebuild
similarity index 98%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.6.6.ebuild
index 79bdf486b..8b736f59f 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.6.6.ebuild
@@ -232,6 +232,8 @@ src_configure() {
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"
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 79bdf486b..fcfb09625 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -222,6 +222,7 @@ src_configure() {
CUDAHOSTLD="$(tc-getCXX)"
cuda_add_sandbox -w
+ addpredict "/dev/char/"
else
mycmakeargs+=(
-DCMAKE_CUDA_COMPILER="NOTFOUND"
@@ -232,6 +233,8 @@ src_configure() {
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"
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-05-24 19:26 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-05-24 19:26 UTC (permalink / raw
To: gentoo-commits
commit: 0da2089c80a66f28250afe42a31997d4cbbfeb56
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sat May 24 18:41:32 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sat May 24 19:26:07 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=0da2089c
sci-ml/ollama: add 0.7.1
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.7.1.ebuild | 308 ++++++++++++++++++++++++++++++++++++++
2 files changed, 310 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 1babb40d78..de44f4db0c 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -6,3 +6,5 @@ DIST ollama-0.6.8-vendor.tar.xz 4409824 BLAKE2B 21c0ba500e39e1059b1375cdc3e1ea5f
DIST ollama-0.6.8.gh.tar.gz 8330813 BLAKE2B 97bbf1d9c8b60a040c1965a5d5c808ca920cd64f83b440f14df85bbe1f668e5a185580aa521dc9b81aa1bef99402f80f286340037e0add81568646e0635ac0ce SHA512 b38033b2ff85f11b1acd6d677221e61efc2f61c12919f65b002f8a2f4162fd735305ed7d10d0db97cef870a2eb8759e6ac5b97dbe3adb3abe5809577605b5874
DIST ollama-0.7.0-vendor.tar.xz 4412128 BLAKE2B f7d0836a8c592e644888c9cc8990c3abb77f7c9500a71bc8b29df366642f1ea948ff2dbd6d691ec0c12482c3298ca833618591f7714d03e784d2ba810490e3a5 SHA512 064261c8eeae509babd160e72cffdff0f72da07376dc4d3b4f159660b9f14e023730050da2099de61e509626da807dab2a54c75c13aa8a336669bf06196eefe8
DIST ollama-0.7.0.gh.tar.gz 8349937 BLAKE2B b4f31067e599ad9a3adde8d1d847f5065d1f45a0ee4e8e1332c21629df1b8b2fb61f7e79524adf4bfe4c6fb2413135ce51098fd0f86b44e5a534d19a8fed2af5 SHA512 50b9594660aa13f401eae7d8584c479ebb6c0185e2b518a8f6c6e98de878acb048fa443ec7d480c439a8cfe8bba1eee3bbfaca6746fadb5b1b7b9815747b98dd
+DIST ollama-0.7.1-vendor.tar.xz 4410404 BLAKE2B 5174658814f562ed2d57e4af911231c8a4e98b4059602d616330c38e8729282a79aaed61b4325e48ed9d1c7afec94f6427ddaf697ea016b5efc40cd91c3149b9 SHA512 9e708606098cea14abf59285fc4d477bbc2e3fcb6fb95c83ca45f090ef5a8e10d5f17c7f07d568d9b12da1751359b0e20b14b7e69b50e9f9df9c0a39a4b5796e
+DIST ollama-0.7.1.gh.tar.gz 8359685 BLAKE2B 43a6cbd3d5af6f25fa85263d02573ac843d11e22ffe1dfd16f8129ea4f64b806b37defbaee10e940ddffe4289e949316f135cdbcf9c94d302ff6864d2c904557 SHA512 58f8fcbd65a3457d0bae1106589cb585ef4afca7e637458a538fc21dd402a4b7ad1a0a99979abda330a65dcac238729eff8d0708fa3085554a9af81f70fbd015
diff --git a/sci-ml/ollama/ollama-0.7.1.ebuild b/sci-ml/ollama/ollama-0.7.1.ebuild
new file mode 100644
index 0000000000..81e1307e83
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.7.1.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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-11 11:50 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-11 11:50 UTC (permalink / raw
To: gentoo-commits
commit: 2a976ea0541c11b135d3cc66621983189e1cf1c0
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Jun 1 17:33:49 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Jun 11 11:50:48 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2a976ea0
sci-ml/ollama: add 0.8.0
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.8.0.ebuild | 308 ++++++++++++++++++++++++++++++++++++++
2 files changed, 310 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index de44f4db0c..a3655f32bb 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -8,3 +8,5 @@ DIST ollama-0.7.0-vendor.tar.xz 4412128 BLAKE2B f7d0836a8c592e644888c9cc8990c3ab
DIST ollama-0.7.0.gh.tar.gz 8349937 BLAKE2B b4f31067e599ad9a3adde8d1d847f5065d1f45a0ee4e8e1332c21629df1b8b2fb61f7e79524adf4bfe4c6fb2413135ce51098fd0f86b44e5a534d19a8fed2af5 SHA512 50b9594660aa13f401eae7d8584c479ebb6c0185e2b518a8f6c6e98de878acb048fa443ec7d480c439a8cfe8bba1eee3bbfaca6746fadb5b1b7b9815747b98dd
DIST ollama-0.7.1-vendor.tar.xz 4410404 BLAKE2B 5174658814f562ed2d57e4af911231c8a4e98b4059602d616330c38e8729282a79aaed61b4325e48ed9d1c7afec94f6427ddaf697ea016b5efc40cd91c3149b9 SHA512 9e708606098cea14abf59285fc4d477bbc2e3fcb6fb95c83ca45f090ef5a8e10d5f17c7f07d568d9b12da1751359b0e20b14b7e69b50e9f9df9c0a39a4b5796e
DIST ollama-0.7.1.gh.tar.gz 8359685 BLAKE2B 43a6cbd3d5af6f25fa85263d02573ac843d11e22ffe1dfd16f8129ea4f64b806b37defbaee10e940ddffe4289e949316f135cdbcf9c94d302ff6864d2c904557 SHA512 58f8fcbd65a3457d0bae1106589cb585ef4afca7e637458a538fc21dd402a4b7ad1a0a99979abda330a65dcac238729eff8d0708fa3085554a9af81f70fbd015
+DIST ollama-0.8.0-vendor.tar.xz 4407120 BLAKE2B db48867f9cbb01fff84d79c278bae4c3e6d069f28153fcdeaf0c74a7ecc0bb75d1d4027a0d08b21fe1c1d9b8d1fbaf55fb3c450415d208d20823a577bb739be2 SHA512 8ff8442bcf5fc84f66f39b2208b9b1c3cd7f33df5ce76d1dd1ae0676b95c543407ee08a7258e7c70fff519eb3a22eb5378e04187ebc9d0806868bd51fd060e75
+DIST ollama-0.8.0.gh.tar.gz 8345667 BLAKE2B d04b498ef5e108e6740d7c79efd1e100bf8cf004f736d31964318b9fe3f5860b91e221488e24e07abe2f28668c0d04aa333b9a5829957eaaeb7c00078f76e2c4 SHA512 c5a45fb86ec8472fe27dd2e4f3f597a7bfb5fa4a954332b4cde3ffa961feb8983ffeeec213bd2e59a02896dba683e9462572bb4a1b0e931e67adca3120a0b830
diff --git a/sci-ml/ollama/ollama-0.8.0.ebuild b/sci-ml/ollama/ollama-0.8.0.ebuild
new file mode 100644
index 0000000000..81e1307e83
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.8.0.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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-11 11:50 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-11 11:50 UTC (permalink / raw
To: gentoo-commits
commit: 5551581b60999fdaf3fd50b7990472e2d477f44f
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Jun 8 12:03:03 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Jun 11 11:50:48 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5551581b
sci-ml/ollama: add 0.9.0
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.9.0.ebuild | 308 ++++++++++++++++++++++++++++++++++++++
2 files changed, 310 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index a3655f32bb..8ee307089a 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -10,3 +10,5 @@ DIST ollama-0.7.1-vendor.tar.xz 4410404 BLAKE2B 5174658814f562ed2d57e4af911231c8
DIST ollama-0.7.1.gh.tar.gz 8359685 BLAKE2B 43a6cbd3d5af6f25fa85263d02573ac843d11e22ffe1dfd16f8129ea4f64b806b37defbaee10e940ddffe4289e949316f135cdbcf9c94d302ff6864d2c904557 SHA512 58f8fcbd65a3457d0bae1106589cb585ef4afca7e637458a538fc21dd402a4b7ad1a0a99979abda330a65dcac238729eff8d0708fa3085554a9af81f70fbd015
DIST ollama-0.8.0-vendor.tar.xz 4407120 BLAKE2B db48867f9cbb01fff84d79c278bae4c3e6d069f28153fcdeaf0c74a7ecc0bb75d1d4027a0d08b21fe1c1d9b8d1fbaf55fb3c450415d208d20823a577bb739be2 SHA512 8ff8442bcf5fc84f66f39b2208b9b1c3cd7f33df5ce76d1dd1ae0676b95c543407ee08a7258e7c70fff519eb3a22eb5378e04187ebc9d0806868bd51fd060e75
DIST ollama-0.8.0.gh.tar.gz 8345667 BLAKE2B d04b498ef5e108e6740d7c79efd1e100bf8cf004f736d31964318b9fe3f5860b91e221488e24e07abe2f28668c0d04aa333b9a5829957eaaeb7c00078f76e2c4 SHA512 c5a45fb86ec8472fe27dd2e4f3f597a7bfb5fa4a954332b4cde3ffa961feb8983ffeeec213bd2e59a02896dba683e9462572bb4a1b0e931e67adca3120a0b830
+DIST ollama-0.9.0-vendor.tar.xz 4412428 BLAKE2B 8d84c7020d350cf6aaf67216ef37be69676ca781b30ab8768d36776b19e7b988a662cf34bbebd514809c91f9e81bd6fb2c1e2b17f4fb668cc25e261553597dfd SHA512 7127e2e7fc3e9a13f3b6e0124c5ab8f41f4444a4b5ba30bef24d0c6b7caa52db9840e11133ff09850094997f88c6c6ca9cadf17b5129c65b295f4c34594d37d3
+DIST ollama-0.9.0.gh.tar.gz 8353746 BLAKE2B 14b685fdc017c0a0485917d3690430e5205366de94291623f07cb3b9c9862ba96894b62ba4798876f841cb3a3ee7497dbae71b253bfb513556bdfc9153deb45c SHA512 32ef42663ea831556fa033bc03a481d103f09e8f5c16f611b3f2308ae80c81daec924192800a2f7c22f70ac86c5440377f892a88cce522223cbbdff793114091
diff --git a/sci-ml/ollama/ollama-0.9.0.ebuild b/sci-ml/ollama/ollama-0.9.0.ebuild
new file mode 100644
index 0000000000..81e1307e83
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.9.0.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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-16 14:21 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-16 14:21 UTC (permalink / raw
To: gentoo-commits
commit: 4a45ed272fed4dd9a2706bbc4c6c93cdff5b0ff1
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Jun 16 11:15:07 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Jun 16 14:19:47 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4a45ed27
sci-ml/ollama: drop 0.7.0, 0.6.8, 0.6.6, 0.6.5-r1
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 8 -
sci-ml/ollama/ollama-0.6.5-r1.ebuild | 286 --------------------------------
sci-ml/ollama/ollama-0.6.6.ebuild | 287 --------------------------------
sci-ml/ollama/ollama-0.6.8.ebuild | 308 -----------------------------------
sci-ml/ollama/ollama-0.7.0.ebuild | 308 -----------------------------------
5 files changed, 1197 deletions(-)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 8ee307089a..539c94148a 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,11 +1,3 @@
-DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
-DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf
-DIST ollama-0.6.6-vendor.tar.xz 4411192 BLAKE2B 49eb6a51eba9faed05a61cb4769d4696a936b8fec65be56c6b5e95b59c8cfbb2505e1e3a1a15baeed7eac4a2651f4965eb4a70ba7ba36ae8b18955d305e450aa SHA512 319352dcb98195723800da3d5eb3bf12de521a7634a2a484d3d4b89f8e6661fff760bccef734a083f6b81bc837996f043fdbd2d7d1d9dcca5a069ede02f37592
-DIST ollama-0.6.6.gh.tar.gz 8290979 BLAKE2B 3082cca4e9a9e690f792d8286888b4141fe7ada2b91a703503a0330f9da29a80bc29ac78b1308e5276868bd125f4fe68d644fba47ec930fe1373a850373f49d9 SHA512 83df0cd3c76d771d4486ecf9a6789287c309d4b99a0e1e2d2d895f4527592f219b06eb695d4cfc0b4f37446aa26883a407eecfd00ac043355e406ca919d7032b
-DIST ollama-0.6.8-vendor.tar.xz 4409824 BLAKE2B 21c0ba500e39e1059b1375cdc3e1ea5f886005176c492a150ce546b318aa548d5d9768ab6b8afff0abe1d4cbeb84eab332641bd40943cc2fe30b9fd1a5101c92 SHA512 b1c2a6496daf657f6878ad51dc7e7ff6bbcd835f64ade0388cd5fdceb6bb642c0f479e11022c570beda3cfd5f082eac6cfad09a1652719ed675b8451c078547c
-DIST ollama-0.6.8.gh.tar.gz 8330813 BLAKE2B 97bbf1d9c8b60a040c1965a5d5c808ca920cd64f83b440f14df85bbe1f668e5a185580aa521dc9b81aa1bef99402f80f286340037e0add81568646e0635ac0ce SHA512 b38033b2ff85f11b1acd6d677221e61efc2f61c12919f65b002f8a2f4162fd735305ed7d10d0db97cef870a2eb8759e6ac5b97dbe3adb3abe5809577605b5874
-DIST ollama-0.7.0-vendor.tar.xz 4412128 BLAKE2B f7d0836a8c592e644888c9cc8990c3abb77f7c9500a71bc8b29df366642f1ea948ff2dbd6d691ec0c12482c3298ca833618591f7714d03e784d2ba810490e3a5 SHA512 064261c8eeae509babd160e72cffdff0f72da07376dc4d3b4f159660b9f14e023730050da2099de61e509626da807dab2a54c75c13aa8a336669bf06196eefe8
-DIST ollama-0.7.0.gh.tar.gz 8349937 BLAKE2B b4f31067e599ad9a3adde8d1d847f5065d1f45a0ee4e8e1332c21629df1b8b2fb61f7e79524adf4bfe4c6fb2413135ce51098fd0f86b44e5a534d19a8fed2af5 SHA512 50b9594660aa13f401eae7d8584c479ebb6c0185e2b518a8f6c6e98de878acb048fa443ec7d480c439a8cfe8bba1eee3bbfaca6746fadb5b1b7b9815747b98dd
DIST ollama-0.7.1-vendor.tar.xz 4410404 BLAKE2B 5174658814f562ed2d57e4af911231c8a4e98b4059602d616330c38e8729282a79aaed61b4325e48ed9d1c7afec94f6427ddaf697ea016b5efc40cd91c3149b9 SHA512 9e708606098cea14abf59285fc4d477bbc2e3fcb6fb95c83ca45f090ef5a8e10d5f17c7f07d568d9b12da1751359b0e20b14b7e69b50e9f9df9c0a39a4b5796e
DIST ollama-0.7.1.gh.tar.gz 8359685 BLAKE2B 43a6cbd3d5af6f25fa85263d02573ac843d11e22ffe1dfd16f8129ea4f64b806b37defbaee10e940ddffe4289e949316f135cdbcf9c94d302ff6864d2c904557 SHA512 58f8fcbd65a3457d0bae1106589cb585ef4afca7e637458a538fc21dd402a4b7ad1a0a99979abda330a65dcac238729eff8d0708fa3085554a9af81f70fbd015
DIST ollama-0.8.0-vendor.tar.xz 4407120 BLAKE2B db48867f9cbb01fff84d79c278bae4c3e6d069f28153fcdeaf0c74a7ecc0bb75d1d4027a0d08b21fe1c1d9b8d1fbaf55fb3c450415d208d20823a577bb739be2 SHA512 8ff8442bcf5fc84f66f39b2208b9b1c3cd7f33df5ce76d1dd1ae0676b95c543407ee08a7258e7c70fff519eb3a22eb5378e04187ebc9d0806868bd51fd060e75
diff --git a/sci-ml/ollama/ollama-0.6.5-r1.ebuild b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
deleted file mode 100644
index f0c4ca473e..0000000000
--- a/sci-ml/ollama/ollama-0.6.5-r1.ebuild
+++ /dev/null
@@ -1,286 +0,0 @@
-# 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=(
- avx
- f16c
- avx2
- fma3
- avx512f
- avx512vbmi
- avx512_vnni
- avx512_bf16
- avx_vnni
- amx_tile
- amx_int8
-)
-CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
-# IUSE+=" opencl vulkan"
-
-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"
-)
-
-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_avx; then
- sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
- # AVX)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX_VNNI)
- fi
-
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! use cpu_flags_x86_fma3 ||
- ! use cpu_flags_x86_avx512f ||
- ! use cpu_flags_x86_avx512vbmi ||
- ! use cpu_flags_x86_avx512_vnni ||
- ! use cpu_flags_x86_avx512_bf16 ||
- ! use cpu_flags_x86_amx_tile ||
- ! use cpu_flags_x86_amx_int8 ; then
- sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
- #AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
- 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=(
- -DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
- -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
- else
- mycmakeargs+=(
- -DCMAKE_CUDA_COMPILER="NOTFOUND"
- )
- fi
-
- if use rocm; then
- mycmakeargs+=(
- -DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
- -DCMAKE_HIP_PLATFORM="amd"
- )
-
- 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
-}
diff --git a/sci-ml/ollama/ollama-0.6.6.ebuild b/sci-ml/ollama/ollama-0.6.6.ebuild
deleted file mode 100644
index 8b736f59f0..0000000000
--- a/sci-ml/ollama/ollama-0.6.6.ebuild
+++ /dev/null
@@ -1,287 +0,0 @@
-# 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=(
- avx
- f16c
- avx2
- fma3
- avx512f
- avx512vbmi
- avx512_vnni
- avx512_bf16
- avx_vnni
- amx_tile
- amx_int8
-)
-CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
-# IUSE+=" opencl vulkan"
-
-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"
-)
-
-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_avx; then
- sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
- # AVX)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
- fi
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! 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
- # AVX F16C AVX2 FMA AVX_VNNI)
- fi
-
- if
- ! use cpu_flags_x86_avx ||
- ! use cpu_flags_x86_f16c ||
- ! use cpu_flags_x86_avx2 ||
- ! use cpu_flags_x86_fma3 ||
- ! use cpu_flags_x86_avx512f ||
- ! use cpu_flags_x86_avx512vbmi ||
- ! use cpu_flags_x86_avx512_vnni ||
- ! use cpu_flags_x86_avx512_bf16 ||
- ! use cpu_flags_x86_amx_tile ||
- ! use cpu_flags_x86_amx_int8 ; then
- sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
- #AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
- 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
- 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
-}
diff --git a/sci-ml/ollama/ollama-0.6.8.ebuild b/sci-ml/ollama/ollama-0.6.8.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.6.8.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
diff --git a/sci-ml/ollama/ollama-0.7.0.ebuild b/sci-ml/ollama/ollama-0.7.0.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.7.0.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-24 12:06 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-24 12:06 UTC (permalink / raw
To: gentoo-commits
commit: fe8d6d0eea84736dcdf0a7c6f04889aec139fd37
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Jun 18 14:36:26 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Tue Jun 24 11:32:04 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fe8d6d0e
sci-ml/ollama: add 0.9.1
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.9.1.ebuild | 308 ++++++++++++++++++++++++++++++++++++++
2 files changed, 310 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 539c94148a..db7ff5e1a5 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -4,3 +4,5 @@ DIST ollama-0.8.0-vendor.tar.xz 4407120 BLAKE2B db48867f9cbb01fff84d79c278bae4c3
DIST ollama-0.8.0.gh.tar.gz 8345667 BLAKE2B d04b498ef5e108e6740d7c79efd1e100bf8cf004f736d31964318b9fe3f5860b91e221488e24e07abe2f28668c0d04aa333b9a5829957eaaeb7c00078f76e2c4 SHA512 c5a45fb86ec8472fe27dd2e4f3f597a7bfb5fa4a954332b4cde3ffa961feb8983ffeeec213bd2e59a02896dba683e9462572bb4a1b0e931e67adca3120a0b830
DIST ollama-0.9.0-vendor.tar.xz 4412428 BLAKE2B 8d84c7020d350cf6aaf67216ef37be69676ca781b30ab8768d36776b19e7b988a662cf34bbebd514809c91f9e81bd6fb2c1e2b17f4fb668cc25e261553597dfd SHA512 7127e2e7fc3e9a13f3b6e0124c5ab8f41f4444a4b5ba30bef24d0c6b7caa52db9840e11133ff09850094997f88c6c6ca9cadf17b5129c65b295f4c34594d37d3
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
diff --git a/sci-ml/ollama/ollama-0.9.1.ebuild b/sci-ml/ollama/ollama-0.9.1.ebuild
new file mode 100644
index 0000000000..81e1307e83
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.9.1.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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-24 12:06 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-24 12:06 UTC (permalink / raw
To: gentoo-commits
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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-29 19:32 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-29 19:32 UTC (permalink / raw
To: gentoo-commits
commit: 1dbed55c88d2cdf4a510209c7b1216adaa03c05e
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Fri Jun 27 13:26:19 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sun Jun 29 19:29:42 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=1dbed55c
sci-ml/ollama: add 0.9.3
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 ++
sci-ml/ollama/{ollama-9999.ebuild => ollama-0.9.3.ebuild} | 14 ++++++++++++++
sci-ml/ollama/ollama-9999.ebuild | 14 ++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 4eb171a912..5c53ab7a1b 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -8,3 +8,5 @@ DIST ollama-0.9.1-vendor.tar.xz 4414480 BLAKE2B 60854edfd5f4a0abb674bb4a430694f4
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
+DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d342bf2b33658d2328d0b38f338e26ed9e1ea3eccbb0c8f484f81974f58545623bad15352f17a6aed8bc37d14ba7dabb0 SHA512 e010082df3b6808e4347bf22e8e9d9ecec916e62c4205308cb351ecfde6cf1f52c7a97f369e08c198ebd9f80b3568f740aac6948e9e572a35564eaaa4dc054ce
+DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-0.9.3.ebuild
similarity index 93%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.9.3.ebuild
index 81e1307e83..0a02a80575 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.9.3.ebuild
@@ -270,6 +270,20 @@ src_configure() {
}
src_compile() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
ego build
cmake_src_compile
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 81e1307e83..0a02a80575 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -270,6 +270,20 @@ src_configure() {
}
src_compile() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
ego build
cmake_src_compile
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-06-30 9:15 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-06-30 9:15 UTC (permalink / raw
To: gentoo-commits
commit: 3321f887e0631fcdfdda3f47fee6d853f250be7e
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Jun 30 08:13:39 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Jun 30 08:13:39 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3321f887
sci-ml/ollama: drop 0.9.2 0.9.1 0.9.0 0.8.0 0.7.1
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 10 --
sci-ml/ollama/ollama-0.7.1.ebuild | 308 --------------------------------------
sci-ml/ollama/ollama-0.8.0.ebuild | 308 --------------------------------------
sci-ml/ollama/ollama-0.9.0.ebuild | 308 --------------------------------------
sci-ml/ollama/ollama-0.9.1.ebuild | 308 --------------------------------------
sci-ml/ollama/ollama-0.9.2.ebuild | 308 --------------------------------------
6 files changed, 1550 deletions(-)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 5c53ab7a1b..79cfdd811a 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,12 +1,2 @@
-DIST ollama-0.7.1-vendor.tar.xz 4410404 BLAKE2B 5174658814f562ed2d57e4af911231c8a4e98b4059602d616330c38e8729282a79aaed61b4325e48ed9d1c7afec94f6427ddaf697ea016b5efc40cd91c3149b9 SHA512 9e708606098cea14abf59285fc4d477bbc2e3fcb6fb95c83ca45f090ef5a8e10d5f17c7f07d568d9b12da1751359b0e20b14b7e69b50e9f9df9c0a39a4b5796e
-DIST ollama-0.7.1.gh.tar.gz 8359685 BLAKE2B 43a6cbd3d5af6f25fa85263d02573ac843d11e22ffe1dfd16f8129ea4f64b806b37defbaee10e940ddffe4289e949316f135cdbcf9c94d302ff6864d2c904557 SHA512 58f8fcbd65a3457d0bae1106589cb585ef4afca7e637458a538fc21dd402a4b7ad1a0a99979abda330a65dcac238729eff8d0708fa3085554a9af81f70fbd015
-DIST ollama-0.8.0-vendor.tar.xz 4407120 BLAKE2B db48867f9cbb01fff84d79c278bae4c3e6d069f28153fcdeaf0c74a7ecc0bb75d1d4027a0d08b21fe1c1d9b8d1fbaf55fb3c450415d208d20823a577bb739be2 SHA512 8ff8442bcf5fc84f66f39b2208b9b1c3cd7f33df5ce76d1dd1ae0676b95c543407ee08a7258e7c70fff519eb3a22eb5378e04187ebc9d0806868bd51fd060e75
-DIST ollama-0.8.0.gh.tar.gz 8345667 BLAKE2B d04b498ef5e108e6740d7c79efd1e100bf8cf004f736d31964318b9fe3f5860b91e221488e24e07abe2f28668c0d04aa333b9a5829957eaaeb7c00078f76e2c4 SHA512 c5a45fb86ec8472fe27dd2e4f3f597a7bfb5fa4a954332b4cde3ffa961feb8983ffeeec213bd2e59a02896dba683e9462572bb4a1b0e931e67adca3120a0b830
-DIST ollama-0.9.0-vendor.tar.xz 4412428 BLAKE2B 8d84c7020d350cf6aaf67216ef37be69676ca781b30ab8768d36776b19e7b988a662cf34bbebd514809c91f9e81bd6fb2c1e2b17f4fb668cc25e261553597dfd SHA512 7127e2e7fc3e9a13f3b6e0124c5ab8f41f4444a4b5ba30bef24d0c6b7caa52db9840e11133ff09850094997f88c6c6ca9cadf17b5129c65b295f4c34594d37d3
-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
DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d342bf2b33658d2328d0b38f338e26ed9e1ea3eccbb0c8f484f81974f58545623bad15352f17a6aed8bc37d14ba7dabb0 SHA512 e010082df3b6808e4347bf22e8e9d9ecec916e62c4205308cb351ecfde6cf1f52c7a97f369e08c198ebd9f80b3568f740aac6948e9e572a35564eaaa4dc054ce
DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
diff --git a/sci-ml/ollama/ollama-0.7.1.ebuild b/sci-ml/ollama/ollama-0.7.1.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.7.1.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
diff --git a/sci-ml/ollama/ollama-0.8.0.ebuild b/sci-ml/ollama/ollama-0.8.0.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.8.0.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
diff --git a/sci-ml/ollama/ollama-0.9.0.ebuild b/sci-ml/ollama/ollama-0.9.0.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.9.0.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
diff --git a/sci-ml/ollama/ollama-0.9.1.ebuild b/sci-ml/ollama/ollama-0.9.1.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.9.1.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
diff --git a/sci-ml/ollama/ollama-0.9.2.ebuild b/sci-ml/ollama/ollama-0.9.2.ebuild
deleted file mode 100644
index 81e1307e83..0000000000
--- a/sci-ml/ollama/ollama-0.9.2.ebuild
+++ /dev/null
@@ -1,308 +0,0 @@
-# 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
-}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-08 17:04 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-07-08 17:04 UTC (permalink / raw
To: gentoo-commits
commit: 10e6abedd0fcb4d14f6c28589571796c99d84fdd
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Tue Jul 8 14:31:45 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Tue Jul 8 17:04:22 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=10e6abed
sci-ml/ollama: add 0.9.5
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.9.5.ebuild | 322 ++++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 79cfdd811a..637a92ec98 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,2 +1,4 @@
DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d342bf2b33658d2328d0b38f338e26ed9e1ea3eccbb0c8f484f81974f58545623bad15352f17a6aed8bc37d14ba7dabb0 SHA512 e010082df3b6808e4347bf22e8e9d9ecec916e62c4205308cb351ecfde6cf1f52c7a97f369e08c198ebd9f80b3568f740aac6948e9e572a35564eaaa4dc054ce
DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
+DIST ollama-0.9.5-vendor.tar.xz 4501508 BLAKE2B 5d20b44c55fc0e70688c2e9067e9e0e4349cdf90db9999c117554905ee6ee5cfeed7189508fd9a177c76aab0e8021a340f7713b9361c900dd4cb087abf6f93e1 SHA512 cda9a754198e59d623541abe245ca0b210e6a1287d722fdec36167528b7163acbf8388524e067aec115eecab2abf057679fdd4d1f55feb8027fd6272684d22af
+DIST ollama-0.9.5.gh.tar.gz 8396484 BLAKE2B 74507fbc12d5326338e4cecdc7fdf9150c31211dea5a676a481d0aa8e2a69a4fdda73651cc7aabcf159d2749f5394b38d8084eaca9aee39d4d52c4f27f270c6e SHA512 d540d6aa1eeaf34786652fe3114cac3abc7a7228724c6a630332114a4a221b08ec17ad287e89a18c7f1963f9aa013ec79c62ef48553e3000c744fac67e24595f
diff --git a/sci-ml/ollama/ollama-0.9.5.ebuild b/sci-ml/ollama/ollama-0.9.5.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.9.5.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-11 13:31 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-07-11 13:31 UTC (permalink / raw
To: gentoo-commits
commit: 53a2e93c8e51c2300489fa59427352244c68b54f
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Fri Jul 11 13:30:22 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Fri Jul 11 13:30:32 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=53a2e93c
sci-ml/ollama: add 0.9.6
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.9.6.ebuild | 322 ++++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 637a92ec98..fd564713eb 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -2,3 +2,5 @@ DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d
DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
DIST ollama-0.9.5-vendor.tar.xz 4501508 BLAKE2B 5d20b44c55fc0e70688c2e9067e9e0e4349cdf90db9999c117554905ee6ee5cfeed7189508fd9a177c76aab0e8021a340f7713b9361c900dd4cb087abf6f93e1 SHA512 cda9a754198e59d623541abe245ca0b210e6a1287d722fdec36167528b7163acbf8388524e067aec115eecab2abf057679fdd4d1f55feb8027fd6272684d22af
DIST ollama-0.9.5.gh.tar.gz 8396484 BLAKE2B 74507fbc12d5326338e4cecdc7fdf9150c31211dea5a676a481d0aa8e2a69a4fdda73651cc7aabcf159d2749f5394b38d8084eaca9aee39d4d52c4f27f270c6e SHA512 d540d6aa1eeaf34786652fe3114cac3abc7a7228724c6a630332114a4a221b08ec17ad287e89a18c7f1963f9aa013ec79c62ef48553e3000c744fac67e24595f
+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-0.9.6.ebuild b/sci-ml/ollama/ollama-0.9.6.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.9.6.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-15 7:47 Dawn Xu
0 siblings, 0 replies; 29+ messages in thread
From: Dawn Xu @ 2025-07-15 7:47 UTC (permalink / raw
To: gentoo-commits
commit: 47a79a04751aa2871e19287c60827f24adbe01f4
Author: Dawn Xu <dawn_xu_helloworld <AT> 163 <DOT> com>
AuthorDate: Tue Jul 15 07:42:40 2025 +0000
Commit: Dawn Xu <18202203719 <AT> 163 <DOT> com>
CommitDate: Tue Jul 15 07:46:12 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=47a79a04
sci-ml/ollama:change src_install for non-systemd
Signed-off-by: Dawn Xu <dawn_xu_helloworld <AT> 163.com>
sci-ml/ollama/ollama-0.9.3.ebuild | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sci-ml/ollama/ollama-0.9.3.ebuild b/sci-ml/ollama/ollama-0.9.3.ebuild
index 0a02a80575..88571793fe 100644
--- a/sci-ml/ollama/ollama-0.9.3.ebuild
+++ b/sci-ml/ollama/ollama-0.9.3.ebuild
@@ -293,11 +293,13 @@ src_install() {
dobin ollama
cmake_src_install
+ if use systemd; then
+ systemd_dounit "${FILESDIR}/ollama.service"
+ else
+ newinitd "${FILESDIR}/ollama.init" "${PN}"
+ newconfd "${FILESDIR}/ollama.confd" "${PN}"
+ fi
- newinitd "${FILESDIR}/ollama.init" "${PN}"
- newconfd "${FILESDIR}/ollama.confd" "${PN}"
-
- systemd_dounit "${FILESDIR}/ollama.service"
}
pkg_preinst() {
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-15 12:10 David Roman
0 siblings, 0 replies; 29+ messages in thread
From: David Roman @ 2025-07-15 12:10 UTC (permalink / raw
To: gentoo-commits
commit: cfd1907cda8a26de3ab8be875c239efcb6afc708
Author: David Roman <davidroman96 <AT> gmail <DOT> com>
AuthorDate: Tue Jul 15 12:09:22 2025 +0000
Commit: David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Tue Jul 15 12:10:28 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=cfd1907c
Revert "sci-ml/ollama:change src_install for non-systemd"
This reverts commit 47a79a04751aa2871e19287c60827f24adbe01f4.
Signed-off-by: David Roman <davidroman96 <AT> gmail.com>
sci-ml/ollama/ollama-0.9.3.ebuild | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sci-ml/ollama/ollama-0.9.3.ebuild b/sci-ml/ollama/ollama-0.9.3.ebuild
index 88571793fe..0a02a80575 100644
--- a/sci-ml/ollama/ollama-0.9.3.ebuild
+++ b/sci-ml/ollama/ollama-0.9.3.ebuild
@@ -293,13 +293,11 @@ src_install() {
dobin ollama
cmake_src_install
- if use systemd; then
- systemd_dounit "${FILESDIR}/ollama.service"
- else
- newinitd "${FILESDIR}/ollama.init" "${PN}"
- newconfd "${FILESDIR}/ollama.confd" "${PN}"
- fi
+ newinitd "${FILESDIR}/ollama.init" "${PN}"
+ newconfd "${FILESDIR}/ollama.confd" "${PN}"
+
+ systemd_dounit "${FILESDIR}/ollama.service"
}
pkg_preinst() {
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-31 8:30 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-07-31 8:30 UTC (permalink / raw
To: gentoo-commits
commit: 8d10f3a70206845480682551abb48568e4c936a1
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Thu Jul 31 08:17:13 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Thu Jul 31 08:17:13 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=8d10f3a7
sci-ml/ollama: add 0.10.1
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.10.1.ebuild | 322 +++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index fe80341a75..489d0786f8 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,5 +1,7 @@
DIST ollama-0.10.0-vendor.tar.xz 4498000 BLAKE2B ea3bc6854c127b0c603ff41b021a234ee856c1611e3925c777d5680386092f48919a19d6508a44b688277d6a72d28f1fe3ecb0f96a056b4009881b36916308cd SHA512 5720e9166fb5f48ed5559da408d53159b639c149dc7099ffa73d909c932103fc63f8387b9cbb851e928051f491fe43e59f1a1d3a30df987e7417f51d3968debe
DIST ollama-0.10.0.gh.tar.gz 10426211 BLAKE2B be5a6e56f76cf68f7ffb7719820eda27faaa6ec332455dea49eb30d7dd0feb06ba44d79084f5fcf4dc14174a99c3aae720bd7a56b49b62755b0b4e9fd4dfe1ca SHA512 0e9b04e9265e44e1ff6c039ad5707c50001da8f1a29ac6573f415f4d7ffb156ab4635bab814327a748daa215a3f9c4f7f9ee9c4f0bb2301ef2abd6e36d8f260b
+DIST ollama-0.10.1-vendor.tar.xz 4498556 BLAKE2B 881c7660b0eaf657b69ca40c4fd5514cc64ec9b94395dd226e25551fee0d992e34b282596b1c7fc6124008e20f96547c32c8c2cc248bfa655a3c1990fe7f1e06 SHA512 bbad0722a097e3616c85434ad580b0731640476e9715025509001a00a859b6f62798b754bead7b9d267b65a5acccd85094681a2f44830c41fbdca34689492e5b
+DIST ollama-0.10.1.gh.tar.gz 10426173 BLAKE2B 8ddc4f0c8822e751d7938a957dbf4c5ee03a3abf54215fe109bb2330bb20572861f702835a7b36508c04c7c4551c39876c287d5ffd4956c4d2cb0197c42dd95b SHA512 845fe6756571f77ca08b9725d208ba3213cc36ca13d25ec158540d4c8cd9f683eb3f04364318ee70ba8e581350eb25f4a171262277da75c3db1ecc8e4f2cf496
DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d342bf2b33658d2328d0b38f338e26ed9e1ea3eccbb0c8f484f81974f58545623bad15352f17a6aed8bc37d14ba7dabb0 SHA512 e010082df3b6808e4347bf22e8e9d9ecec916e62c4205308cb351ecfde6cf1f52c7a97f369e08c198ebd9f80b3568f740aac6948e9e572a35564eaaa4dc054ce
DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
DIST ollama-0.9.5-vendor.tar.xz 4501508 BLAKE2B 5d20b44c55fc0e70688c2e9067e9e0e4349cdf90db9999c117554905ee6ee5cfeed7189508fd9a177c76aab0e8021a340f7713b9361c900dd4cb087abf6f93e1 SHA512 cda9a754198e59d623541abe245ca0b210e6a1287d722fdec36167528b7163acbf8388524e067aec115eecab2abf057679fdd4d1f55feb8027fd6272684d22af
diff --git a/sci-ml/ollama/ollama-0.10.1.ebuild b/sci-ml/ollama/ollama-0.10.1.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.10.1.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-31 8:30 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-07-31 8:30 UTC (permalink / raw
To: gentoo-commits
commit: c871dadb61ec35eb0a6622aa73fc5c11578e1e22
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Thu Jul 31 08:16:34 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Thu Jul 31 08:16:34 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c871dadb
sci-ml/ollama: add 0.10.0
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.10.0.ebuild | 322 +++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index fd564713eb..fe80341a75 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,3 +1,5 @@
+DIST ollama-0.10.0-vendor.tar.xz 4498000 BLAKE2B ea3bc6854c127b0c603ff41b021a234ee856c1611e3925c777d5680386092f48919a19d6508a44b688277d6a72d28f1fe3ecb0f96a056b4009881b36916308cd SHA512 5720e9166fb5f48ed5559da408d53159b639c149dc7099ffa73d909c932103fc63f8387b9cbb851e928051f491fe43e59f1a1d3a30df987e7417f51d3968debe
+DIST ollama-0.10.0.gh.tar.gz 10426211 BLAKE2B be5a6e56f76cf68f7ffb7719820eda27faaa6ec332455dea49eb30d7dd0feb06ba44d79084f5fcf4dc14174a99c3aae720bd7a56b49b62755b0b4e9fd4dfe1ca SHA512 0e9b04e9265e44e1ff6c039ad5707c50001da8f1a29ac6573f415f4d7ffb156ab4635bab814327a748daa215a3f9c4f7f9ee9c4f0bb2301ef2abd6e36d8f260b
DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d342bf2b33658d2328d0b38f338e26ed9e1ea3eccbb0c8f484f81974f58545623bad15352f17a6aed8bc37d14ba7dabb0 SHA512 e010082df3b6808e4347bf22e8e9d9ecec916e62c4205308cb351ecfde6cf1f52c7a97f369e08c198ebd9f80b3568f740aac6948e9e572a35564eaaa4dc054ce
DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
DIST ollama-0.9.5-vendor.tar.xz 4501508 BLAKE2B 5d20b44c55fc0e70688c2e9067e9e0e4349cdf90db9999c117554905ee6ee5cfeed7189508fd9a177c76aab0e8021a340f7713b9361c900dd4cb087abf6f93e1 SHA512 cda9a754198e59d623541abe245ca0b210e6a1287d722fdec36167528b7163acbf8388524e067aec115eecab2abf057679fdd4d1f55feb8027fd6272684d22af
diff --git a/sci-ml/ollama/ollama-0.10.0.ebuild b/sci-ml/ollama/ollama-0.10.0.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.10.0.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-07-31 8:30 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-07-31 8:30 UTC (permalink / raw
To: gentoo-commits
commit: 69a3f96e01b9ba7c75fba09d9c1bd73325b43431
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Thu Jul 31 08:27:50 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Thu Jul 31 08:27:50 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=69a3f96e
sci-ml/ollama: drop 0.9.5 0.9.3
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 4 -
sci-ml/ollama/ollama-0.9.3.ebuild | 322 --------------------------------------
sci-ml/ollama/ollama-0.9.5.ebuild | 322 --------------------------------------
3 files changed, 648 deletions(-)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 489d0786f8..9ca9ba419c 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -2,9 +2,5 @@ DIST ollama-0.10.0-vendor.tar.xz 4498000 BLAKE2B ea3bc6854c127b0c603ff41b021a234
DIST ollama-0.10.0.gh.tar.gz 10426211 BLAKE2B be5a6e56f76cf68f7ffb7719820eda27faaa6ec332455dea49eb30d7dd0feb06ba44d79084f5fcf4dc14174a99c3aae720bd7a56b49b62755b0b4e9fd4dfe1ca SHA512 0e9b04e9265e44e1ff6c039ad5707c50001da8f1a29ac6573f415f4d7ffb156ab4635bab814327a748daa215a3f9c4f7f9ee9c4f0bb2301ef2abd6e36d8f260b
DIST ollama-0.10.1-vendor.tar.xz 4498556 BLAKE2B 881c7660b0eaf657b69ca40c4fd5514cc64ec9b94395dd226e25551fee0d992e34b282596b1c7fc6124008e20f96547c32c8c2cc248bfa655a3c1990fe7f1e06 SHA512 bbad0722a097e3616c85434ad580b0731640476e9715025509001a00a859b6f62798b754bead7b9d267b65a5acccd85094681a2f44830c41fbdca34689492e5b
DIST ollama-0.10.1.gh.tar.gz 10426173 BLAKE2B 8ddc4f0c8822e751d7938a957dbf4c5ee03a3abf54215fe109bb2330bb20572861f702835a7b36508c04c7c4551c39876c287d5ffd4956c4d2cb0197c42dd95b SHA512 845fe6756571f77ca08b9725d208ba3213cc36ca13d25ec158540d4c8cd9f683eb3f04364318ee70ba8e581350eb25f4a171262277da75c3db1ecc8e4f2cf496
-DIST ollama-0.9.3-vendor.tar.xz 4498620 BLAKE2B f064eb1fc8d226fa1cb916bdc0bb161d342bf2b33658d2328d0b38f338e26ed9e1ea3eccbb0c8f484f81974f58545623bad15352f17a6aed8bc37d14ba7dabb0 SHA512 e010082df3b6808e4347bf22e8e9d9ecec916e62c4205308cb351ecfde6cf1f52c7a97f369e08c198ebd9f80b3568f740aac6948e9e572a35564eaaa4dc054ce
-DIST ollama-0.9.3.gh.tar.gz 8397536 BLAKE2B 296cf7916bd5dc222d42ebb7e946f50b6008662e09b197e33475d6b024d7311758d443a7930e737a8b72f47db5c3d1312117c40fc9bac776dc9e7faf42c90eb4 SHA512 981d2d1369cd931de1f856cf071de5575f3a14f9b05631f78b6aae4bb127cc544fce8ef2ee8d72ace921acada75e91e7a667d0369a36738775b3fe20704f6122
-DIST ollama-0.9.5-vendor.tar.xz 4501508 BLAKE2B 5d20b44c55fc0e70688c2e9067e9e0e4349cdf90db9999c117554905ee6ee5cfeed7189508fd9a177c76aab0e8021a340f7713b9361c900dd4cb087abf6f93e1 SHA512 cda9a754198e59d623541abe245ca0b210e6a1287d722fdec36167528b7163acbf8388524e067aec115eecab2abf057679fdd4d1f55feb8027fd6272684d22af
-DIST ollama-0.9.5.gh.tar.gz 8396484 BLAKE2B 74507fbc12d5326338e4cecdc7fdf9150c31211dea5a676a481d0aa8e2a69a4fdda73651cc7aabcf159d2749f5394b38d8084eaca9aee39d4d52c4f27f270c6e SHA512 d540d6aa1eeaf34786652fe3114cac3abc7a7228724c6a630332114a4a221b08ec17ad287e89a18c7f1963f9aa013ec79c62ef48553e3000c744fac67e24595f
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-0.9.3.ebuild b/sci-ml/ollama/ollama-0.9.3.ebuild
deleted file mode 100644
index 0a02a80575..0000000000
--- a/sci-ml/ollama/ollama-0.9.3.ebuild
+++ /dev/null
@@ -1,322 +0,0 @@
-# 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() {
- # export version information
- # https://github.com/gentoo/guru/pull/205
- # https://forums.gentoo.org/viewtopic-p-8831646.html
- local VERSION
- if [[ "${PV}" == *9999* ]]; then
- 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\"'"
-
- 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
-}
diff --git a/sci-ml/ollama/ollama-0.9.5.ebuild b/sci-ml/ollama/ollama-0.9.5.ebuild
deleted file mode 100644
index 0a02a80575..0000000000
--- a/sci-ml/ollama/ollama-0.9.5.ebuild
+++ /dev/null
@@ -1,322 +0,0 @@
-# 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() {
- # export version information
- # https://github.com/gentoo/guru/pull/205
- # https://forums.gentoo.org/viewtopic-p-8831646.html
- local VERSION
- if [[ "${PV}" == *9999* ]]; then
- 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\"'"
-
- 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
-}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-08-09 14:20 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-08-09 14:20 UTC (permalink / raw
To: gentoo-commits
commit: 8babfeb76a558509973ab04b17e4a26e3bb6cb5f
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sat Aug 9 14:19:25 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sat Aug 9 14:19:25 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=8babfeb7
sci-ml/ollama: add 0.11.4
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.11.4.ebuild | 322 +++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 9ca9ba419c..7d35efd7be 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -2,5 +2,7 @@ DIST ollama-0.10.0-vendor.tar.xz 4498000 BLAKE2B ea3bc6854c127b0c603ff41b021a234
DIST ollama-0.10.0.gh.tar.gz 10426211 BLAKE2B be5a6e56f76cf68f7ffb7719820eda27faaa6ec332455dea49eb30d7dd0feb06ba44d79084f5fcf4dc14174a99c3aae720bd7a56b49b62755b0b4e9fd4dfe1ca SHA512 0e9b04e9265e44e1ff6c039ad5707c50001da8f1a29ac6573f415f4d7ffb156ab4635bab814327a748daa215a3f9c4f7f9ee9c4f0bb2301ef2abd6e36d8f260b
DIST ollama-0.10.1-vendor.tar.xz 4498556 BLAKE2B 881c7660b0eaf657b69ca40c4fd5514cc64ec9b94395dd226e25551fee0d992e34b282596b1c7fc6124008e20f96547c32c8c2cc248bfa655a3c1990fe7f1e06 SHA512 bbad0722a097e3616c85434ad580b0731640476e9715025509001a00a859b6f62798b754bead7b9d267b65a5acccd85094681a2f44830c41fbdca34689492e5b
DIST ollama-0.10.1.gh.tar.gz 10426173 BLAKE2B 8ddc4f0c8822e751d7938a957dbf4c5ee03a3abf54215fe109bb2330bb20572861f702835a7b36508c04c7c4551c39876c287d5ffd4956c4d2cb0197c42dd95b SHA512 845fe6756571f77ca08b9725d208ba3213cc36ca13d25ec158540d4c8cd9f683eb3f04364318ee70ba8e581350eb25f4a171262277da75c3db1ecc8e4f2cf496
+DIST ollama-0.11.4-vendor.tar.xz 4504352 BLAKE2B 7f79eb8c0a8a611801e46a14d67209345e94bcdcfe1edf7894ff431d26ff68845dac110ebc998f166abec155c9074767651b562d9247343989ac93f7472369f9 SHA512 94b4619384c44519eebd2ae89ffcb61ccb4cc90b8104f3256c5fea723916d3be1154aab7e26df8fcdced29fefaad4cdd548b05846565d766ed312cb610a7fb70
+DIST ollama-0.11.4.gh.tar.gz 10471532 BLAKE2B 916f45548978076be949eac83a5068c7f86824928d30766c1f8c79e59b0f958ee8b0e73c4eac59bdd980605964e8f87f953cf39f81c609fcd3f53e4146bf0696 SHA512 586d6d641b6ae76fbf450be299f6a7032bf83017654df257bfdf97e9a04ad642045fd7f250eb97d55958d2b48844d6f32728e37ac35641dba208797cd5133ea8
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-0.11.4.ebuild b/sci-ml/ollama/ollama-0.11.4.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.11.4.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-09-07 7:32 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-09-07 7:32 UTC (permalink / raw
To: gentoo-commits
commit: ae0da435e79aac382a6c5637dbc703dd75642e9e
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Aug 24 08:08:33 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sun Sep 7 07:32:00 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=ae0da435
sci-ml/ollama: add 0.11.5
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.11.5.ebuild | 322 +++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 7d35efd7be..fd90880fa1 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -4,5 +4,7 @@ DIST ollama-0.10.1-vendor.tar.xz 4498556 BLAKE2B 881c7660b0eaf657b69ca40c4fd5514
DIST ollama-0.10.1.gh.tar.gz 10426173 BLAKE2B 8ddc4f0c8822e751d7938a957dbf4c5ee03a3abf54215fe109bb2330bb20572861f702835a7b36508c04c7c4551c39876c287d5ffd4956c4d2cb0197c42dd95b SHA512 845fe6756571f77ca08b9725d208ba3213cc36ca13d25ec158540d4c8cd9f683eb3f04364318ee70ba8e581350eb25f4a171262277da75c3db1ecc8e4f2cf496
DIST ollama-0.11.4-vendor.tar.xz 4504352 BLAKE2B 7f79eb8c0a8a611801e46a14d67209345e94bcdcfe1edf7894ff431d26ff68845dac110ebc998f166abec155c9074767651b562d9247343989ac93f7472369f9 SHA512 94b4619384c44519eebd2ae89ffcb61ccb4cc90b8104f3256c5fea723916d3be1154aab7e26df8fcdced29fefaad4cdd548b05846565d766ed312cb610a7fb70
DIST ollama-0.11.4.gh.tar.gz 10471532 BLAKE2B 916f45548978076be949eac83a5068c7f86824928d30766c1f8c79e59b0f958ee8b0e73c4eac59bdd980605964e8f87f953cf39f81c609fcd3f53e4146bf0696 SHA512 586d6d641b6ae76fbf450be299f6a7032bf83017654df257bfdf97e9a04ad642045fd7f250eb97d55958d2b48844d6f32728e37ac35641dba208797cd5133ea8
+DIST ollama-0.11.5-vendor.tar.xz 4495744 BLAKE2B ef1d55de3ba6e7116d56a1a0178eea436d23466693497797a460525d69b7b680efe848a2fbab832ec31aa21cd5b7f5b6ab02467907b161171ec20367dff6542e SHA512 836cfb064173a27204d20b54d8988deed4f50af87c7e436c111e95c687e8c05664e098a3fac38a0346ce0c06eff24e47577679d9356410fcc9dd2673cf3261dc
+DIST ollama-0.11.5.gh.tar.gz 10981612 BLAKE2B 0ade2ca5722289c6f1e32eb3af6c310cc1d6a0cd33a4bab98c385e4a62b73dc7e727149cc1dd34d26fc7eb36c081f9482ad396a007e9ba81fade143fb028ca65 SHA512 f05d0ce0105f185050e797c824b536b3d93012df6483c8b637571190832e2b1d96826e824829c3d62a691061da9b2bdda756229e2ffaa713af7335903b6b272d
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-0.11.5.ebuild b/sci-ml/ollama/ollama-0.11.5.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.11.5.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-09-07 7:32 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-09-07 7:32 UTC (permalink / raw
To: gentoo-commits
commit: 180a5f229502535b00b5e0de4bb66dced512168e
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Aug 24 08:09:00 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sun Sep 7 07:32:00 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=180a5f22
sci-ml/ollama: add 0.11.6
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 +
sci-ml/ollama/ollama-0.11.6.ebuild | 322 +++++++++++++++++++++++++++++++++++++
2 files changed, 324 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index fd90880fa1..ea3f5f1e41 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -6,5 +6,7 @@ DIST ollama-0.11.4-vendor.tar.xz 4504352 BLAKE2B 7f79eb8c0a8a611801e46a14d672093
DIST ollama-0.11.4.gh.tar.gz 10471532 BLAKE2B 916f45548978076be949eac83a5068c7f86824928d30766c1f8c79e59b0f958ee8b0e73c4eac59bdd980605964e8f87f953cf39f81c609fcd3f53e4146bf0696 SHA512 586d6d641b6ae76fbf450be299f6a7032bf83017654df257bfdf97e9a04ad642045fd7f250eb97d55958d2b48844d6f32728e37ac35641dba208797cd5133ea8
DIST ollama-0.11.5-vendor.tar.xz 4495744 BLAKE2B ef1d55de3ba6e7116d56a1a0178eea436d23466693497797a460525d69b7b680efe848a2fbab832ec31aa21cd5b7f5b6ab02467907b161171ec20367dff6542e SHA512 836cfb064173a27204d20b54d8988deed4f50af87c7e436c111e95c687e8c05664e098a3fac38a0346ce0c06eff24e47577679d9356410fcc9dd2673cf3261dc
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.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-0.11.6.ebuild b/sci-ml/ollama/ollama-0.11.6.ebuild
new file mode 100644
index 0000000000..0a02a80575
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.11.6.ebuild
@@ -0,0 +1,322 @@
+# 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() {
+ # export version information
+ # https://github.com/gentoo/guru/pull/205
+ # https://forums.gentoo.org/viewtopic-p-8831646.html
+ local VERSION
+ if [[ "${PV}" == *9999* ]]; then
+ 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\"'"
+
+ 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
+}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-09-07 7:32 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-09-07 7:32 UTC (permalink / raw
To: gentoo-commits
commit: cace8000e578c2d4de79cc01b76c1d54c638684a
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Sep 7 07:30:38 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sun Sep 7 07:32:00 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=cace8000
sci-ml/ollama: add 0.11.10, fix 962445
Use rocm_use_hipcc to strip unsupported FLAGS.
Closes: https://bugs.gentoo.org/962445
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/Manifest | 2 ++
sci-ml/ollama/{ollama-9999.ebuild => ollama-0.11.10.ebuild} | 3 +++
sci-ml/ollama/ollama-9999.ebuild | 3 +++
3 files changed, 8 insertions(+)
diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index ea3f5f1e41..e844b2c4d2 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -2,6 +2,8 @@ DIST ollama-0.10.0-vendor.tar.xz 4498000 BLAKE2B ea3bc6854c127b0c603ff41b021a234
DIST ollama-0.10.0.gh.tar.gz 10426211 BLAKE2B be5a6e56f76cf68f7ffb7719820eda27faaa6ec332455dea49eb30d7dd0feb06ba44d79084f5fcf4dc14174a99c3aae720bd7a56b49b62755b0b4e9fd4dfe1ca SHA512 0e9b04e9265e44e1ff6c039ad5707c50001da8f1a29ac6573f415f4d7ffb156ab4635bab814327a748daa215a3f9c4f7f9ee9c4f0bb2301ef2abd6e36d8f260b
DIST ollama-0.10.1-vendor.tar.xz 4498556 BLAKE2B 881c7660b0eaf657b69ca40c4fd5514cc64ec9b94395dd226e25551fee0d992e34b282596b1c7fc6124008e20f96547c32c8c2cc248bfa655a3c1990fe7f1e06 SHA512 bbad0722a097e3616c85434ad580b0731640476e9715025509001a00a859b6f62798b754bead7b9d267b65a5acccd85094681a2f44830c41fbdca34689492e5b
DIST ollama-0.10.1.gh.tar.gz 10426173 BLAKE2B 8ddc4f0c8822e751d7938a957dbf4c5ee03a3abf54215fe109bb2330bb20572861f702835a7b36508c04c7c4551c39876c287d5ffd4956c4d2cb0197c42dd95b SHA512 845fe6756571f77ca08b9725d208ba3213cc36ca13d25ec158540d4c8cd9f683eb3f04364318ee70ba8e581350eb25f4a171262277da75c3db1ecc8e4f2cf496
+DIST ollama-0.11.10-vendor.tar.xz 4500504 BLAKE2B 16e1419638499310d824ee1425304f1d6087cfffce79b1ed39e8b0852ea61e9cb086fad35abca8de9df089f1a2e2a7bfb724993566d47f8b72356cc8da34a0d8 SHA512 abe2269d7759d074f0e702e9ced37abc733bb656027f2125c8d9a06a14c3ee23f06ee8c1737a33d7eb98538d07dd9a3f51958819e2c3e31a98ca0b04bdd289b9
+DIST ollama-0.11.10.gh.tar.gz 10991167 BLAKE2B 1473f43bb6d03bce490f4769199fd64eed64087544f9f418577dfdb8809704d8f63975c420be25910a2ffe82ae131d9a56926d99ac65530d0866f1bf7016a982 SHA512 e3f03c0d3c989c71e30c634de2a21bcd4b4ea8708be26b34620f6a23e2f4011487e1b5dda0fea0a0fc46ff2d6b27d42a8851bc894fca177ad15eb4d9636d0125
DIST ollama-0.11.4-vendor.tar.xz 4504352 BLAKE2B 7f79eb8c0a8a611801e46a14d67209345e94bcdcfe1edf7894ff431d26ff68845dac110ebc998f166abec155c9074767651b562d9247343989ac93f7472369f9 SHA512 94b4619384c44519eebd2ae89ffcb61ccb4cc90b8104f3256c5fea723916d3be1154aab7e26df8fcdced29fefaad4cdd548b05846565d766ed312cb610a7fb70
DIST ollama-0.11.4.gh.tar.gz 10471532 BLAKE2B 916f45548978076be949eac83a5068c7f86824928d30766c1f8c79e59b0f958ee8b0e73c4eac59bdd980605964e8f87f953cf39f81c609fcd3f53e4146bf0696 SHA512 586d6d641b6ae76fbf450be299f6a7032bf83017654df257bfdf97e9a04ad642045fd7f250eb97d55958d2b48844d6f32728e37ac35641dba208797cd5133ea8
DIST ollama-0.11.5-vendor.tar.xz 4495744 BLAKE2B ef1d55de3ba6e7116d56a1a0178eea436d23466693497797a460525d69b7b680efe848a2fbab832ec31aa21cd5b7f5b6ab02467907b161171ec20367dff6542e SHA512 836cfb064173a27204d20b54d8988deed4f50af87c7e436c111e95c687e8c05664e098a3fac38a0346ce0c06eff24e47577679d9356410fcc9dd2673cf3261dc
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-0.11.10.ebuild
similarity index 99%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.11.10.ebuild
index 0a02a80575..924b9b7b40 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.11.10.ebuild
@@ -250,6 +250,9 @@ src_configure() {
fi
if use rocm; then
+ # 962445
+ rocm_use_hipcc
+
mycmakeargs+=(
-DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
-DCMAKE_HIP_PLATFORM="amd"
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 0a02a80575..924b9b7b40 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -250,6 +250,9 @@ src_configure() {
fi
if use rocm; then
+ # 962445
+ rocm_use_hipcc
+
mycmakeargs+=(
-DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
-DCMAKE_HIP_PLATFORM="amd"
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-10-04 21:12 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-10-04 21:12 UTC (permalink / raw
To: gentoo-commits
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
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-10-05 20:46 Paul Zander
0 siblings, 0 replies; 29+ messages in thread
From: Paul Zander @ 2025-10-05 20:46 UTC (permalink / raw
To: gentoo-commits
commit: d3c8289ac3334d951357c2ad54545bc134648370
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Oct 5 20:43:39 2025 +0000
Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Sun Oct 5 20:45:52 2025 +0000
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=d3c8289a
sci-ml/ollama: use hip -> rocm
Fixes: b4149d3fdc886c847c50a5c2e5b950716bc7d9d7
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
sci-ml/ollama/ollama-0.12.3.ebuild | 2 +-
sci-ml/ollama/ollama-9999.ebuild | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sci-ml/ollama/ollama-0.12.3.ebuild b/sci-ml/ollama/ollama-0.12.3.ebuild
index e180d3d88b..555959976c 100644
--- a/sci-ml/ollama/ollama-0.12.3.ebuild
+++ b/sci-ml/ollama/ollama-0.12.3.ebuild
@@ -95,7 +95,7 @@ pkg_pretend() {
}
pkg_setup() {
- if use hip; then
+ if use rocm; then
linux-info_pkg_setup
if linux-info_get_any_version && linux_config_exists; then
if ! linux_chkconfig_present HSA_AMD_SVM; then
diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index e180d3d88b..555959976c 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -95,7 +95,7 @@ pkg_pretend() {
}
pkg_setup() {
- if use hip; then
+ if use rocm; then
linux-info_pkg_setup
if linux-info_get_any_version && linux_config_exists; then
if ! linux_chkconfig_present HSA_AMD_SVM; then
^ permalink raw reply related [flat|nested] 29+ messages in thread
end of thread, other threads:[~2025-10-05 20:47 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31 8:30 [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/ Paul Zander
-- strict thread matches above, loose matches on Subject: below --
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-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-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-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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox