llama-cpp.srpm.spec 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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-completion %{buildroot}%{_bindir}/llama-completion
  36. cp -p llama-server %{buildroot}%{_bindir}/llama-server
  37. cp -p llama-simple %{buildroot}%{_bindir}/llama-simple
  38. mkdir -p %{buildroot}/usr/lib/systemd/system
  39. %{__cat} <<EOF > %{buildroot}/usr/lib/systemd/system/llama.service
  40. [Unit]
  41. Description=Llama.cpp server, CPU only (no GPU support in this build).
  42. After=syslog.target network.target local-fs.target remote-fs.target nss-lookup.target
  43. [Service]
  44. Type=simple
  45. EnvironmentFile=/etc/sysconfig/llama
  46. ExecStart=/usr/bin/llama-server $LLAMA_ARGS
  47. ExecReload=/bin/kill -s HUP $MAINPID
  48. Restart=never
  49. [Install]
  50. WantedBy=default.target
  51. EOF
  52. mkdir -p %{buildroot}/etc/sysconfig
  53. %{__cat} <<EOF > %{buildroot}/etc/sysconfig/llama
  54. LLAMA_ARGS="-m /opt/llama2/ggml-model-f32.bin"
  55. EOF
  56. %clean
  57. rm -rf %{buildroot}
  58. rm -rf %{_builddir}/*
  59. %files
  60. %{_bindir}/llama-cli
  61. %{_bindir}/llama-completion
  62. %{_bindir}/llama-server
  63. %{_bindir}/llama-simple
  64. /usr/lib/systemd/system/llama.service
  65. %config /etc/sysconfig/llama
  66. %pre
  67. %post
  68. %preun
  69. %postun
  70. %changelog