version bump sci-ml/ollama-0.40.4
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
DIST llama.cpp-b11351.tar.gz 37755766 BLAKE2B e3bc8a2809c9b4ccb490c53212993562e40a3599c84de2deaccc05631f4b0d7a8b1e069cbded88258229761b74726056bfd76169871a5b109d2f6cd3ebacd295 SHA512 74595f963f71bcda1cdf20f3bbed510cf053dc7068803bae73ab86eb77c8ca1426577d2d53554548a3fa18c5d003c5257cc527fa29321735362c848e696f2975
|
||||
DIST ollama-0.40.4-deps.tar.xz 77648092 BLAKE2B e8e87c098bb15aad0a1366538e2e6f3909069dd460f45b3f1e2a76db632436f24a2bbf1bc463168b94aa8b5b4994e797387ce560a622f4d18bcec0e9b5ebcb4f SHA512 e168c6e1e16482ebfe41ffa9f1794933c5881d49eb7f5ca348df46e909b85df327717979c835232a0782c3d40f2b1cfc6ec2b9eced820417a2d0d18251be7956
|
||||
DIST ollama-0.40.4.gh.tar.gz 26665774 BLAKE2B a94aeac95c3b7c184486f9c99b9e6bad8606b8c366853dba2875e191f466332c1cfb202c462cac721dc6613934bb5eca74232d0b67322f74d3a0d511e02c3bb1 SHA512 7afeda63d41a35720ef012f082b2985a034a5f9d373a72892ef4aa48201b69c2ec251891cad703b40315dadf0b7fbb3d8b01655794a35f349fa9adb2c1688aa5
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/common/common.h 2026-07-04 12:25:21.565559439 +0200
|
||||
+++ b/common/common.h 2026-07-04 12:25:43.052343559 +0200
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "ggml.h"
|
||||
|
||||
#include <set>
|
||||
+#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/llama/server/CMakeLists.txt 2026-07-04 07:08:27.528453937 +0200
|
||||
+++ b/llama/server/CMakeLists.txt 2026-07-04 07:09:07.889047823 +0200
|
||||
@@ -508,7 +508,7 @@
|
||||
# RUNTIME covers executables and Windows DLLs; LIBRARY covers .so on Linux
|
||||
install(TARGETS llama-server llama-quantize
|
||||
RUNTIME DESTINATION ${_base_dest} COMPONENT llama-server OPTIONAL)
|
||||
- set(_llama_server_base_libs ggml-base ggml llama mtmd)
|
||||
+ set(_llama_server_base_libs llama mtmd)
|
||||
if(TARGET llama-common)
|
||||
list(APPEND _llama_server_base_libs llama-common)
|
||||
endif()
|
||||
@@ -0,0 +1,8 @@
|
||||
--- a/mlx/CMakeLists.txt 2026-07-04 13:53:35.494218027 +0200
|
||||
+++ b/mlx/CMakeLists.txt 2026-07-04 13:54:08.428885766 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 3.5)
|
||||
+cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(mlx)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# Ollama allows cross-origin requests from 127.0.0.1 and 0.0.0.0 by default.
|
||||
# Additional origins can be configured with OLLAMA_ORIGINS.
|
||||
# export OLLAMA_ORIGINS="<ip>"
|
||||
# Allow connections from any origin (or specify exact domains/IPs like "http://192.168.1.50:*")
|
||||
# export OLLAMA_ORIGINS="*"
|
||||
# Explicitly bind to all network interfaces (needed if running behind a proxy or remote API access)
|
||||
# export OLLAMA_HOST="0.0.0.0"
|
||||
|
||||
# log to syslog
|
||||
# output_logger="logger -t \"$RC_SVCNAME\" -p daemon.info"
|
||||
# error_logger="logger -t \"$RC_SVCNAME\" -p daemon.err"
|
||||
|
||||
# log to file
|
||||
output_log="/var/log/ollama/ollama.log"
|
||||
error_log="/var/log/ollama/ollama.log"
|
||||
|
||||
# Set the default context size - default is 4096 token
|
||||
# export OLLAMA_CONTEXT_LENGTH=8192
|
||||
# export OLLAMA_CONTEXT_LENGTH=16384
|
||||
# export OLLAMA_CONTEXT_LENGTH=32768
|
||||
# export OLLAMA_CONTEXT_LENGTH=131072
|
||||
# export OLLAMA_CONTEXT_LENGTH=262144
|
||||
|
||||
# Optimizations
|
||||
#
|
||||
# Enable Flash Attention (drastically reduces VRAM usage for long contexts)
|
||||
# export OLLAMA_FLASH_ATTENTION=true
|
||||
# Compress the Key-Value cache (saves VRAM at a tiny precision cost) default is f16
|
||||
# export OLLAMA_KV_CACHE_TYPE=q4_0
|
||||
#
|
||||
# Number of parallel model requests.
|
||||
# export OLLAMA_NUM_PARALLEL=1
|
||||
#
|
||||
# export OLLAMA_VULKAN=false
|
||||
# export OLLAMA_DEBUG=INFO
|
||||
# export OLLAMA_DEBUG=1
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License, v2
|
||||
|
||||
supervisor=supervise-daemon
|
||||
description="Ollama Service"
|
||||
command="/usr/bin/ollama"
|
||||
command_args="serve"
|
||||
command_user="ollama:ollama"
|
||||
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Ollama Service
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/ollama serve
|
||||
User=ollama
|
||||
Group=ollama
|
||||
# GPU access: render -> /dev/dri/renderD* + /dev/kfd (ROCm), video -> legacy/NVIDIA
|
||||
SupplementaryGroups=render video
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>tupone@gentoo.org</email>
|
||||
<name>Tupone Alfredo</name>
|
||||
</maintainer>
|
||||
<upstream>
|
||||
<remote-id type="github">ollama/ollama</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
@@ -0,0 +1,161 @@
|
||||
# Copyright 2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit cmake go-module systemd
|
||||
|
||||
DESCRIPTION="Get up and running with Llama 3, Mistral, Gemma, and other language models"
|
||||
HOMEPAGE="https://ollama.com"
|
||||
|
||||
LLAMA_CPP_tag=b11351
|
||||
|
||||
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
|
||||
https://github.com/ggml-org/llama.cpp/archive/refs/tags/${LLAMA_CPP_tag}.tar.gz
|
||||
-> llama.cpp-${LLAMA_CPP_tag}.tar.gz
|
||||
"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64"
|
||||
|
||||
RESTRICT="mirror test"
|
||||
|
||||
DEPEND="
|
||||
acct-group/ollama
|
||||
acct-user/ollama
|
||||
>=sci-ml/ggml-0.25.3:=
|
||||
"
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
net-misc/curl:=
|
||||
"
|
||||
BDEPEND="
|
||||
>=dev-lang/go-1.26.0
|
||||
dev-libs/stb
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-0.31.1-ggml.patch
|
||||
"${FILESDIR}"/${PN}-0.34.2-cmake.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
cmake_src_prepare
|
||||
|
||||
local llama_src="${BUILD_DIR}/_deps/llama_cpp-src"
|
||||
local llama_patch_dir="${WORKDIR}/${P}/llama/compat"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"/_deps || die
|
||||
|
||||
ln -s "${WORKDIR}"/llama.cpp-${LLAMA_CPP_tag} "${llama_src}" || die
|
||||
|
||||
# Switch to the llama.cpp source directory
|
||||
pushd "${llama_src}" > /dev/null || die
|
||||
eapply "${llama_patch_dir}"/*.patch \
|
||||
"${FILESDIR}"/${PN}-0.31.1-gcc17.patch
|
||||
|
||||
# Remove vendored
|
||||
cmake_comment_add_subdirectory -f vendor stb
|
||||
rm -r vendor/stb || die
|
||||
sed -i \
|
||||
-e "s|vendor::stb ||" \
|
||||
tools/mtmd/CMakeLists.txt \
|
||||
|| die
|
||||
popd > /dev/null || die
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# Configure Embedded local Server
|
||||
local llama_src="${BUILD_DIR}/_deps/llama_cpp-src"
|
||||
local mycmakeargs=(
|
||||
-DCMAKE_INSTALL_PREFIX="${BUILD_DIR}"
|
||||
-DOLLAMA_RUNNER_DIR=""
|
||||
-DFETCHCONTENT_SOURCE_DIR_LLAMA_CPP="${llama_src}"
|
||||
-DOLLAMA_LLAMA_CPP_SKIP_COMPAT_PATCH=ON
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DLLAMA_USE_SYSTEM_GGML=ON
|
||||
)
|
||||
local CMAKE_USE_DIR="${S}/llama/server"
|
||||
local BUILD_DIR="${BUILD_DIR}/llama-server-local"
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
local SAVE_BUILD_DIR="${BUILD_DIR}"
|
||||
|
||||
# Compile Embedded Local Server
|
||||
local BUILD_DIR="${BUILD_DIR}"/llama-server-local
|
||||
local cmake_src_compile_opts=(
|
||||
--target llama-server
|
||||
--target llama-quantize
|
||||
)
|
||||
cmake_src_compile
|
||||
|
||||
# Install/Stage Local Server Component
|
||||
"${CMAKE_BINARY}" \
|
||||
--install "${BUILD_DIR}" \
|
||||
--prefix "${SAVE_BUILD_DIR}" \
|
||||
--component llama-server \
|
||||
|| die "Failed to stage server component"
|
||||
|
||||
# Expose CGO to Go and establish compiler optimization paths
|
||||
export CGO_ENABLED=1
|
||||
|
||||
# Replicate the linker flags dynamically from your ebuild version
|
||||
local mygoldflags="-X github.com/ollama/ollama/version.Version=${PV} \
|
||||
-X github.com/ollama/ollama/server.mode=release"
|
||||
|
||||
# Call the Go build engine natively with standard Gentoo flags
|
||||
ego build \
|
||||
-trimpath \
|
||||
-ldflags "${mygoldflags}" \
|
||||
-o "${BUILD_DIR}/ollama" \
|
||||
. || die "Go build failed"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
dobin "${BUILD_DIR}"/llama-server-local/ollama
|
||||
insinto usr
|
||||
doins -r "${BUILD_DIR}"/lib
|
||||
local libdir="/usr/lib/ollama"
|
||||
fperms -R +x ${libdir}
|
||||
|
||||
# Symlink system GGML libraries into Ollama's expected path
|
||||
# Bug 983804
|
||||
for lib in "${EPREFIX}"/usr/$(get_libdir)/libggml*.so; do
|
||||
local libname=$(basename "${lib}")
|
||||
dosym ../../$(get_libdir)/${libname} /usr/lib/ollama/${libname}
|
||||
done
|
||||
|
||||
einstalldocs
|
||||
|
||||
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
|
||||
|
||||
einfo
|
||||
einfo "Ollama binds 127.0.0.1 port 11434 by default."
|
||||
einfo "Change the bind address with the OLLAMA_HOST environment variable."
|
||||
einfo "See https://docs.ollama.com/faq for more info"
|
||||
einfo
|
||||
}
|
||||
Reference in New Issue
Block a user