sci-misc/llama-cpp: version bump

Signed-off-by: Adam Pimentel <adam.pimentel@protonmail.com>
This commit is contained in:
Adam Pimentel
2026-07-06 13:53:20 -04:00
parent d03b63516a
commit f450104052
2 changed files with 178 additions and 0 deletions

View File

@@ -6,3 +6,4 @@ DIST llama-cpp-0_pre7924.tar.gz 28899921 BLAKE2B b89c8c170d1c2d52390dfef35a4e085
DIST llama-cpp-0_pre8198.tar.gz 29091642 BLAKE2B b5d02310a7e71fec88e29094aa7936cb520530fb9f81cef58f87c97948e6116734f9a19da5ad8daba1027f8e26308e5fa1f3e91e33a49539929f6e3475b08429 SHA512 bc8aef7cb29a32e0acf90d50cbf426c1a42d99659747203449ebf85f0c9c2fed98fd23b7e50b963dd537d3d6edecf17936d0cf7ae04266df4723e2d4a5c7ecfa
DIST llama-cpp-0_pre8628.tar.gz 29611654 BLAKE2B 5efeb855b5833ca7a0ba552a142e9fac08773e0f0f31d9d3188c03840d91c91aa22edaf310a6472c9077cd4fb2a48c82371887374fb6d417dd022a18c51ff9e2 SHA512 7b86c37b3f926a0983fe6648629019e9f32001dbf474de9278d94d5e1a9e4c37dfaa9832557555724941c32c437efcbf2e91b0b0ad558936657e14ec5e52f8f0
DIST llama-cpp-0_pre8838.tar.gz 33811834 BLAKE2B 1223a15237186dc8e11c454d76adfd875a9d6b3ee56c046fc0cf63415c7ebbb4b0dc2da49b7e697ecd9908dad6adcb4f2a5bd4665b7118d2c2508e3b215c1f39 SHA512 d345a2645dcad2564f94efdef45a7681b85f4079d30e68297b42a529ccfe4f50429067dce8685791c914cd59d00843c8e5d02c6ef7ce2d97bb990d6c896f5e9f
DIST llama-cpp-0_pre9888.tar.gz 35116234 BLAKE2B 2ecc7b8a594441c83501ac91adf29182c1c308e74d52c57a0992b24526fab5639cf5844f3c04affa6864f576444b5c4aa2ed6f562927030d9144738dd56a3ad7 SHA512 c19994dad5415fe12d7215d16a4a32104b6320f0f004af86463b4c8f47e7529b3b32eac948ce6b3a3354c388a9d33db34d9d7d3d7f166f89130897567d441ce6

View File

@@ -0,0 +1,177 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
ROCM_VERSION="6.3"
inherit cmake cuda rocm linux-info
TINY_LLAMAS_COMMIT="99dd1a73db5a37100bd4ae633f4cfce6560e1567"
DESCRIPTION="Port of Facebook's LLaMA model in C/C++"
HOMEPAGE="https://github.com/ggml-org/llama.cpp"
if [[ ${PV} == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/ggml-org/llama.cpp.git"
else
MY_PV="b${PV#0_pre}"
SRC_URI="
https://github.com/ggml-org/llama.cpp/archive/refs/tags/${MY_PV}.tar.gz -> ${P}.tar.gz
webui? https://huggingface.co/buckets/ggml-org/llama-ui/resolve/b0
"
S="${WORKDIR}/llama.cpp-${MY_PV}"
KEYWORDS="~amd64"
fi
SRC_URI+="
examples? (
https://huggingface.co/ggml-org/tiny-llamas/resolve/${TINY_LLAMAS_COMMIT}/stories15M-q4_0.gguf
-> ggml-org_models_tinyllamas_stories15M-q4_0-${TINY_LLAMAS_COMMIT}.gguf
)
"
LICENSE="MIT"
SLOT="0"
CPU_FLAGS_X86=( avx avx2 f16c )
# wwma USE explained here: https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md#hip
IUSE="curl openblas +openmp blis rocm cuda opencl openssl vulkan flexiblas wmma examples"
REQUIRED_USE="
?? (
openblas
blis
flexiblas
)
wmma? (
rocm
)
"
# curl is needed for pulling models from huggingface
# numpy is used by convert_hf_to_gguf.py
CDEPEND="
curl? ( net-misc/curl:= )
openblas? ( sci-libs/openblas:= )
openmp? ( llvm-runtimes/openmp:= )
blis? ( sci-libs/blis:= )
flexiblas? ( sci-libs/flexiblas:= )
rocm? (
>=dev-util/hip-${ROCM_VERSION}:=
>=sci-libs/hipBLAS-${ROCM_VERSION}:=
wmma? (
>=sci-libs/rocWMMA-${ROCM_VERSION}:=
)
)
cuda? ( dev-util/nvidia-cuda-toolkit:= )
openssl? ( dev-libs/openssl:= )
"
DEPEND="${CDEPEND}
opencl? ( dev-util/opencl-headers )
vulkan? (
dev-util/spirv-headers
dev-util/vulkan-headers
)
"
RDEPEND="${CDEPEND}
dev-python/numpy
opencl? ( dev-libs/opencl-icd-loader )
vulkan? ( media-libs/vulkan-loader )
"
BDEPEND="media-libs/shaderc"
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_prepare() {
use cuda && cuda_src_prepare
cmake_src_prepare
if use examples; then
mkdir -p "${BUILD_DIR}/tinyllamas" || die
cp "${DISTDIR}/ggml-org_models_tinyllamas_stories15M-q4_0-${TINY_LLAMAS_COMMIT}.gguf" \
"${BUILD_DIR}/tinyllamas/stories15M-q4_0.gguf" || die
fi
}
src_configure() {
local mycmakeargs=(
-DLLAMA_BUILD_TESTS=OFF
-DLLAMA_BUILD_EXAMPLES=$(usex examples)
-DLLAMA_BUILD_SERVER=ON
-DCMAKE_SKIP_BUILD_RPATH=ON
-DGGML_NATIVE=0 # don't set march
-DGGML_RPC=ON
-DLLAMA_CURL=$(usex curl)
-DLLAMA_OPENSSL=$(usex openssl)
-DBUILD_NUMBER="1"
-DGENTOO_REMOVE_CMAKE_BLAS_HACK=ON
-DGGML_CUDA=$(usex cuda)
-DGGML_OPENCL=$(usex opencl)
-DGGML_OPENMP=$(usex openmp)
-DGGML_VULKAN=$(usex vulkan)
# avoid clashing with whisper.cpp
-DCMAKE_INSTALL_LIBDIR="${EPREFIX}/usr/$(get_libdir)/llama.cpp"
-DCMAKE_INSTALL_RPATH="${EPREFIX}/usr/$(get_libdir)/llama.cpp"
)
if use webui ; then
mycmakeargs+=(
-DLLAMA_USE_PREBUILT_UI=ON
)
fi
if use openblas ; then
mycmakeargs+=(
-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
)
fi
if use blis ; then
mycmakeargs+=(
-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FLAME
)
fi
if use flexiblas; then
mycmakeargs+=(
-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=FlexiBLAS
)
fi
if use cuda; then
local -x CUDAHOSTCXX="$(cuda_gccdir)"
# tries to recreate dev symlinks
cuda_add_sandbox
addpredict "/dev/char/"
fi
if use rocm; then
rocm_use_hipcc
mycmakeargs+=(
-DGGML_HIP=ON -DAMDGPU_TARGETS=$(get_amdgpu_flags)
-DGGML_HIP_ROCWMMA_FATTN=$(usex wmma)
)
fi
cmake_src_configure
}
src_install() {
cmake_src_install
dobin "${BUILD_DIR}/bin/rpc-server"
# avoid clashing with whisper.cpp
rm -rf "${ED}/usr/include"
}