From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C702915808A for ; Thu, 31 Jul 2025 10:10:47 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id B05223415DD for ; Thu, 31 Jul 2025 10:10:47 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 85D64110562; Thu, 31 Jul 2025 10:10:38 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 7E132110562 for ; Thu, 31 Jul 2025 10:10:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2345134107F for ; Thu, 31 Jul 2025 10:10:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5836F3280 for ; Thu, 31 Jul 2025 10:10:35 +0000 (UTC) From: "David Roman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "David Roman" Message-ID: <1753950470.69a3f96e01b9ba7c75fba09d9c1bd73325b43431.davidroman@gentoo> Subject: [gentoo-commits] repo/proj/guru:master commit in: sci-ml/ollama/ X-VCS-Repository: repo/proj/guru X-VCS-Files: sci-ml/ollama/Manifest sci-ml/ollama/ollama-0.9.3.ebuild sci-ml/ollama/ollama-0.9.5.ebuild X-VCS-Directories: sci-ml/ollama/ X-VCS-Committer: davidroman X-VCS-Committer-Name: David Roman X-VCS-Revision: 69a3f96e01b9ba7c75fba09d9c1bd73325b43431 X-VCS-Branch: master Date: Thu, 31 Jul 2025 10:10:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b1b3b4b4-9818-4385-8235-bbb736e71622 X-Archives-Hash: fa8da308a11daa4186ef1ba2f8e6ecec commit: 69a3f96e01b9ba7c75fba09d9c1bd73325b43431 Author: Paul Zander gmail com> AuthorDate: Thu Jul 31 08:27:50 2025 +0000 Commit: David Roman gmail 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 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 -}