llama-cpp.srpm.spec 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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-packages
  3. # Built and maintained by John Boero - boeroboy@gmail.com
  4. # In honor of Seth Vidal https://www.redhat.com/it/blog/thank-you-seth-vidal
  5. # Notes for llama.cpp:
  6. # 1. Tags are currently based on hash - which will not sort asciibetically.
  7. # We need to declare standard versioning if people want to sort latest releases.
  8. # In the meantime, YYYYMMDD format will be used.
  9. # 2. Builds for CUDA/OpenCL support are separate, with different depenedencies.
  10. # 3. NVidia's developer repo must be enabled with nvcc, cublas, clblas, etc installed.
  11. # Example: https://developer.download.nvidia.com/compute/cuda/repos/fedora37/x86_64/cuda-fedora37.repo
  12. # 4. OpenCL/CLBLAST support simply requires the ICD loader and basic opencl libraries.
  13. # It is up to the user to install the correct vendor-specific support.
  14. Name: llama.cpp
  15. Version: %( date "+%%Y%%m%%d" )
  16. Release: 1%{?dist}
  17. Summary: CPU Inference of LLaMA model in pure C/C++ (no CUDA/OpenCL)
  18. License: MIT
  19. Source0: https://github.com/ggml-org/llama.cpp/archive/refs/heads/master.tar.gz
  20. BuildRequires: coreutils make gcc-c++ git libstdc++-devel
  21. Requires: libstdc++
  22. URL: https://github.com/ggml-org/llama.cpp
  23. %define debug_package %{nil}
  24. %define source_date_epoch_from_changelog 0
  25. %description
  26. CPU inference for Meta's Lllama2 models using default options.
  27. Models are not included in this package and must be downloaded separately.
  28. %prep
  29. %setup -n llama.cpp-master
  30. %build
  31. make -j
  32. %install
  33. mkdir -p %{buildroot}%{_bindir}/
  34. cp -p llama-cli %{buildroot}%{_bindir}/llama-cli
  35. cp -p llama-server %{buildroot}%{_bindir}/llama-server
  36. cp -p llama-simple %{buildroot}%{_bindir}/llama-simple
  37. mkdir -p %{buildroot}/usr/lib/systemd/system
  38. %{__cat} <<EOF > %{buildroot}/usr/lib/systemd/system/llama.service
  39. [Unit]
  40. Description=Llama.cpp server, CPU only (no GPU support in this build).
  41. After=syslog.target network.target local-fs.target remote-fs.target nss-lookup.target
  42. [Service]
  43. Type=simple
  44. EnvironmentFile=/etc/sysconfig/llama
  45. ExecStart=/usr/bin/llama-server $LLAMA_ARGS
  46. ExecReload=/bin/kill -s HUP $MAINPID
  47. Restart=never
  48. [Install]
  49. WantedBy=default.target
  50. EOF
  51. mkdir -p %{buildroot}/etc/sysconfig
  52. %{__cat} <<EOF > %{buildroot}/etc/sysconfig/llama
  53. LLAMA_ARGS="-m /opt/llama2/ggml-model-f32.bin"
  54. EOF
  55. %clean
  56. rm -rf %{buildroot}
  57. rm -rf %{_builddir}/*
  58. %files
  59. %{_bindir}/llama-cli
  60. %{_bindir}/llama-server
  61. %{_bindir}/llama-simple
  62. /usr/lib/systemd/system/llama.service
  63. %config /etc/sysconfig/llama
  64. %pre
  65. %post
  66. %preun
  67. %postun
  68. %changelog