Felipe97/llama-cpp-compiled
01.1k
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/ggml-org/llama.cpp/archive/refs/heads/master.tar.gz22BuildRequires: coreutils make gcc-c++ git libstdc++-devel23Requires: libstdc++24URL: https://github.com/ggml-org/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-completion %{buildroot}%{_bindir}/llama-completion43cp -p llama-server %{buildroot}%{_bindir}/llama-server44cp -p llama-simple %{buildroot}%{_bindir}/llama-simple45 46mkdir -p %{buildroot}/usr/lib/systemd/system47%{__cat} <<EOF > %{buildroot}/usr/lib/systemd/system/llama.service48[Unit]49Description=Llama.cpp server, CPU only (no GPU support in this build).50After=syslog.target network.target local-fs.target remote-fs.target nss-lookup.target51 52[Service]53Type=simple54EnvironmentFile=/etc/sysconfig/llama55ExecStart=/usr/bin/llama-server $LLAMA_ARGS56ExecReload=/bin/kill -s HUP $MAINPID57Restart=never58 59[Install]60WantedBy=default.target61EOF62 63mkdir -p %{buildroot}/etc/sysconfig64%{__cat} <<EOF > %{buildroot}/etc/sysconfig/llama65LLAMA_ARGS="-m /opt/llama2/ggml-model-f32.bin"66EOF67 68%clean69rm -rf %{buildroot}70rm -rf %{_builddir}/*71 72%files73%{_bindir}/llama-cli74%{_bindir}/llama-completion75%{_bindir}/llama-server76%{_bindir}/llama-simple77/usr/lib/systemd/system/llama.service78%config /etc/sysconfig/llama79 80%pre81 82%post83 84%preun85%postun86 87%changelog88 