commit: bd8d1300aec6aca25552a04ffcf94f6fe2f74529 Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com> AuthorDate: Thu Dec 4 15:40:52 2025 +0000 Commit: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com> CommitDate: Thu Dec 4 15:40:52 2025 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=bd8d1300
sci-ml/ollama: drop 0.12.10 0.12.6 Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com> sci-ml/ollama/Manifest | 4 - sci-ml/ollama/ollama-0.12.10.ebuild | 352 ------------------------------------ sci-ml/ollama/ollama-0.12.6.ebuild | 349 ----------------------------------- 3 files changed, 705 deletions(-) diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest index 6d66c49443..ca21267ed5 100644 --- a/sci-ml/ollama/Manifest +++ b/sci-ml/ollama/Manifest @@ -1,7 +1,3 @@ -DIST ollama-0.12.10-deps.tar.xz 49906880 BLAKE2B efd7b64921784b1d68a27d07c1de80836a57f163fc4a17748e52ac0e78480c8811f68149d8f75eff9ba2e19c8be62683c9e75d2b92cfef84100a0de2e7818e3c SHA512 0af9f5fc1d5633b6ac9934e5a7d232aa20c5e2f8d4eaeb0152c6fcf77e1922dc7b67fcc039933562832939553dc3861ca35cf2e604fd310934669227666aee3e -DIST ollama-0.12.10.gh.tar.gz 21103971 BLAKE2B e96cdd8956ae93c93ea12041467692b60a857c9d6d8ee2b18d73523f326a8d01069930ec955d8a38cac635b702caf14ec7951a8a277eaf9481f417b091a453bb SHA512 694d618c1db758bca36f46eba744ebe107ddb98ed3c49eab519b265fa26a6e736b3ec3f7fe8ac7729fc691cedab36dabdd142b46073e1963e1f24a4ff76d2e3a -DIST ollama-0.12.6-deps.tar.xz 48057580 BLAKE2B f27521bd7755fe5d7deb57962f305ec17ddbe34b024744152531143eda1128f25a501b5923cee58dc54c832eeaaa50b7135c4a594a1f25f9eec211ac2e55e148 SHA512 cb226f4bbb46c9b76f890f12d7a9671331690a866f74440c10444c6638b2895f3df4036930a98f06401e3a3cfec562e214a4030aca1787600175760f7eaedef8 -DIST ollama-0.12.6.gh.tar.gz 11355405 BLAKE2B 4511a5d2cf199333a63bf1b46f86ab8aa90ea6c156b63b16932c0b7356881bf6d4cd93a01c4b0390da96d18574aa272b5ebcab69b8bb5929145f4b72c0e875c7 SHA512 e9c9234914044a9f1ae0512adf1e5404161d2adc04036ef84da44a3c38d2684e883cd9705f986259199218e739dba01a7af845a93f85eecf949f81b1472eca23 DIST ollama-0.13.0-deps.tar.xz 49906880 BLAKE2B efd7b64921784b1d68a27d07c1de80836a57f163fc4a17748e52ac0e78480c8811f68149d8f75eff9ba2e19c8be62683c9e75d2b92cfef84100a0de2e7818e3c SHA512 0af9f5fc1d5633b6ac9934e5a7d232aa20c5e2f8d4eaeb0152c6fcf77e1922dc7b67fcc039933562832939553dc3861ca35cf2e604fd310934669227666aee3e DIST ollama-0.13.0.gh.tar.gz 20806080 BLAKE2B f5ca8f4a96793d930ea0f8d08c5d1ce33fec6c78eaccdd402aebc2eeb355fac487b944c1befbc38957b06a69aa2327c5d73c05297e232125d7d8297f101e8f82 SHA512 8153dc0256b1cb9b0f180481d40f6ce6f426fc1997bab5d8c435b30eec36a90a87d2e7491927b5351421586c511d7bd5acd9c55ec4ba48798aa20a89e5ad0271 DIST ollama-0.13.1-deps.tar.xz 49906880 BLAKE2B efd7b64921784b1d68a27d07c1de80836a57f163fc4a17748e52ac0e78480c8811f68149d8f75eff9ba2e19c8be62683c9e75d2b92cfef84100a0de2e7818e3c SHA512 0af9f5fc1d5633b6ac9934e5a7d232aa20c5e2f8d4eaeb0152c6fcf77e1922dc7b67fcc039933562832939553dc3861ca35cf2e604fd310934669227666aee3e diff --git a/sci-ml/ollama/ollama-0.12.10.ebuild b/sci-ml/ollama/ollama-0.12.10.ebuild deleted file mode 100644 index 90d23c1390..0000000000 --- a/sci-ml/ollama/ollama-0.12.10.ebuild +++ /dev/null @@ -1,352 +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 flag-o-matic go-module linux-info 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/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-deps.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="blas ${CPU_FLAGS[*]} cuda mkl rocm vulkan" -# IUSE+=" opencl" - -RESTRICT="test" - -COMMON_DEPEND=" - blas? ( - !mkl? ( - virtual/blas - ) - mkl? ( - sci-libs/mkl - ) - ) - cuda? ( - dev-util/nvidia-cuda-toolkit:= - ) - rocm? ( - >=dev-util/hip-${ROCM_VERSION}:= - >=sci-libs/hipBLAS-${ROCM_VERSION}:= - >=sci-libs/rocBLAS-${ROCM_VERSION}:= - ) -" - -DEPEND=" - ${COMMON_DEPEND} - >=dev-lang/go-1.23.4 -" -BDEPEND=" - vulkan? ( - dev-util/vulkan-headers - media-libs/shaderc - ) -" - -RDEPEND=" - ${COMMON_DEPEND} - acct-group/${PN} - >=acct-user/${PN}-3[cuda?] -" - -PATCHES=( - "${FILESDIR}/${PN}-9999-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 -} - -pkg_setup() { - 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 - 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; 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 - 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 "bundle headers sed failed" - - # TODO see src_unpack? - sed \ - -e "s/ -O3//g" \ - -i \ - ml/backend/ggml/ggml/src/ggml-cpu/cpu.go \ - || die "-O3 sed failed" - - # grep -Rl -e 'lib/ollama' -e '"..", "lib"' --include '*.go' - sed \ - -e "s/\"..\", \"lib\"/\"..\", \"$(get_libdir)\"/" \ - -e "s#\"lib/ollama\"#\"$(get_libdir)/ollama\"#" \ - -i \ - ml/backend/ggml/ggml/src/ggml.go \ - ml/path.go \ - || die "libdir sed failed" - - 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 - - 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)" - "$(cmake_use_find_package vulkan 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" - 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 - local EXTRA_GOFLAGS_LD=( - # "-w" # disable DWARF generation - # "-s" # disable symbol table - "-X=github.com/ollama/ollama/version.Version=${VERSION}" - "-X=github.com/ollama/ollama/server.mode=release" - ) - GOFLAGS+=" '-ldflags=${EXTRA_GOFLAGS_LD[*]}'" - - 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.12.6.ebuild b/sci-ml/ollama/ollama-0.12.6.ebuild deleted file mode 100644 index d53e6630eb..0000000000 --- a/sci-ml/ollama/ollama-0.12.6.ebuild +++ /dev/null @@ -1,349 +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 flag-o-matic go-module linux-info 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/gentoo-golang-dist/${PN}/releases/download/v${PV}/${P}-deps.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="blas ${CPU_FLAGS[*]} cuda mkl rocm vulkan" -# IUSE+=" opencl" - -RESTRICT="test" - -COMMON_DEPEND=" - blas? ( - !mkl? ( - virtual/blas - ) - mkl? ( - sci-libs/mkl - ) - ) - cuda? ( - dev-util/nvidia-cuda-toolkit:= - ) - rocm? ( - >=dev-util/hip-${ROCM_VERSION}:= - >=sci-libs/hipBLAS-${ROCM_VERSION}:= - >=sci-libs/rocBLAS-${ROCM_VERSION}:= - ) -" - -DEPEND=" - ${COMMON_DEPEND} - >=dev-lang/go-1.23.4 -" -BDEPEND=" - vulkan? ( - dev-util/vulkan-headers - media-libs/shaderc - ) -" - -RDEPEND=" - ${COMMON_DEPEND} - acct-group/${PN} - >=acct-user/${PN}-3[cuda?] -" - -PATCHES=( - "${FILESDIR}/${PN}-9999-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 -} - -pkg_setup() { - 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 - 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; 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 - 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 - - # TODO see src_unpack? - sed \ - -e "s/ -O3//g" \ - -i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || 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 - - 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)" - "$(cmake_use_find_package vulkan 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" - 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 - local EXTRA_GOFLAGS_LD=( - # "-w" # disable DWARF generation - # "-s" # disable symbol table - "-X=github.com/ollama/ollama/version.Version=${VERSION}" - "-X=github.com/ollama/ollama/server.mode=release" - ) - GOFLAGS+=" '-ldflags=${EXTRA_GOFLAGS_LD[*]}'" - - 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 -}
