KBaba7/llama.cpp
0
1# SRPM for building from source and packaging an RPM for RPM-based distros.2# https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages3# Built and maintained by John Boero - boeroboy@gmail.com4# In honor of Seth Vidal https://www.redhat.com/it/blog/thank-you-seth-vidal5 6# Notes for llama.cpp:7# 1. Tags are currently based on hash - which will not sort asciibetically.8# We need to declare standard versioning if people want to sort latest releases.9# In the meantime, YYYYMMDD format will be used.10# 2. Builds for CUDA/OpenCL support are separate, with different depenedencies.11# 3. NVidia's developer repo must be enabled with nvcc, cublas, clblas, etc installed.12# Example: https://developer.download.nvidia.com/compute/cuda/repos/fedora37/x86_64/cuda-fedora37.repo13# 4. OpenCL/CLBLAST support simply requires the ICD loader and basic opencl libraries.14# It is up to the user to install the correct vendor-specific support.15 16Name: llama.cpp17Version: %( date "+%%Y%%m%%d" )18Release: 1%{?dist}19Summary: CPU Inference of LLaMA model in pure C/C++ (no CUDA/OpenCL)20License: MIT21Source0: https://github.com/ggerganov/llama.cpp/archive/refs/heads/master.tar.gz22BuildRequires: coreutils make gcc-c++ git libstdc++-devel23Requires: libstdc++24URL: https://github.com/ggerganov/llama.cpp25 26%define debug_package %{nil}27%define source_date_epoch_from_changelog 028 29%description30CPU inference for Meta's Lllama2 models using default options.31Models are not included in this package and must be downloaded separately.32 33%prep34%setup -n llama.cpp-master35 36%build37make -j38 39%install40mkdir -p %{buildroot}%{_bindir}/41cp -p llama-cli %{buildroot}%{_bindir}/llama-cli42cp -p llama-server %{buildroot}%{_bindir}/llama-server43cp -p llama-simple %{buildroot}%{_bindir}/llama-simple44 45mkdir -p %{buildroot}/usr/lib/systemd/system46%{__cat} <<EOF > %{buildroot}/usr/lib/systemd/system/llama.service47[Unit]48Description=Llama.cpp server, CPU only (no GPU support in this build).49After=syslog.target network.target local-fs.target remote-fs.target nss-lookup.target50 51[Service]52Type=simple53EnvironmentFile=/etc/sysconfig/llama54ExecStart=/usr/bin/llama-server $LLAMA_ARGS55ExecReload=/bin/kill -s HUP $MAINPID56Restart=never57 58[Install]59WantedBy=default.target60EOF61 62mkdir -p %{buildroot}/etc/sysconfig63%{__cat} <<EOF > %{buildroot}/etc/sysconfig/llama64LLAMA_ARGS="-m /opt/llama2/ggml-model-f32.bin"65EOF66 67%clean68rm -rf %{buildroot}69rm -rf %{_builddir}/*70 71%files72%{_bindir}/llama-cli73%{_bindir}/llama-server74%{_bindir}/llama-simple75/usr/lib/systemd/system/llama.service76%config /etc/sysconfig/llama77 78%pre79 80%post81 82%preun83%postun84 85%changelog86 