Files
mistralrs-package/rpm/mistralrs.spec
rob thijssen 291596cb71
All checks were successful
poll-upstream / check (push) Successful in 2s
fix: set changelog author and remove hardcoded entry from spec
Set the rpm-changelog action author to the actual maintainer instead
of the default "Gitea Actions". Remove the static changelog entry
from the spec since the action generates entries automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 13:43:36 +03:00

100 lines
3.7 KiB
RPMSpec

%global _build_id_links none
%global debug_package %{nil}
%global __strip /usr/bin/true
# Passed in via --define at rpmbuild time
%{!?mistralrs_version: %global mistralrs_version 0.7.0}
%{!?mistralrs_flavour: %global mistralrs_flavour cuda13}
Name: mistralrs-server-%{mistralrs_flavour}
Version: %{mistralrs_version}
Release: 1%{?dist}
Summary: Fast, flexible LLM inference server (mistral.rs, %{mistralrs_flavour} flavour)
License: MIT
URL: https://github.com/EricLBuehler/mistral.rs
# Pre-built binary (produced in the build job, not rebuilt here)
Source0: mistralrs-server-%{mistralrs_flavour}
Source1: mistralrs@.service
Source2: mistralrs@.conf.example
ExclusiveArch: x86_64
# Suppress auto-detected CUDA library dependencies. The binary links against
# the CUDA runtime, cuDNN, NCCL, etc. but we don't want rpm to pin exact
# soname versions — consumers may have CUDA from multiple sources (nvidia
# direct, rpmfusion, etc.) and different compatible versions. A runtime
# dlopen failure gives a clearer error than rpm dep resolution would.
%global __requires_exclude ^lib(cuda|cudart|cudnn|cublas|cublasLt|curand|nvrtc|nccl)
Requires: systemd
# Flavours are mutually exclusive with other flavours of themselves at the
# same install path, but you can install cuda13, cuda13-fa, cuda13-fa-nccl
# side by side — they all get separate /opt paths.
Provides: mistralrs-server = %{version}-%{release}
%description
mistral.rs is a blazingly fast LLM inference engine written in Rust.
This package provides the %{mistralrs_flavour} flavour, built with features:
cuda, cudnn, and optionally flash-attn and nccl depending on flavour name.
Binary installs to /opt/mistralrs/%{mistralrs_flavour}/bin/ and can coexist
with other flavours. Use `update-alternatives --config mistralrs-server` to
select the default /usr/bin/mistralrs-server symlink target.
%prep
# Nothing to unpack; Source0 is the binary itself
cp %{SOURCE0} .
cp %{SOURCE1} .
cp %{SOURCE2} .
%build
# Already built
%install
install -D -m 0755 mistralrs-server-%{mistralrs_flavour} \
%{buildroot}/opt/mistralrs/%{mistralrs_flavour}/bin/mistralrs-server
install -D -m 0644 mistralrs@.service \
%{buildroot}%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
install -D -m 0644 mistralrs@.conf.example \
%{buildroot}%{_sysconfdir}/mistralrs/%{mistralrs_flavour}.conf.example
# Patch the unit to point at this flavour's binary
sed -i "s|@BINARY@|/opt/mistralrs/%{mistralrs_flavour}/bin/mistralrs-server|g" \
%{buildroot}%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
sed -i "s|@FLAVOUR@|%{mistralrs_flavour}|g" \
%{buildroot}%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
%post
# Register this flavour as an alternative for /usr/bin/mistralrs-server.
# Priority = 10 for cuda13, 20 for cuda13-fa, 30 for cuda13-fa-nccl so that
# "more featureful" wins by default. Consumers can override with
# `update-alternatives --config mistralrs-server`.
priority=10
case "%{mistralrs_flavour}" in
*nccl*) priority=30 ;;
*fa*) priority=20 ;;
esac
update-alternatives --install /usr/bin/mistralrs-server mistralrs-server \
/opt/mistralrs/%{mistralrs_flavour}/bin/mistralrs-server "${priority}"
%systemd_post mistralrs-%{mistralrs_flavour}@.service
%preun
%systemd_preun mistralrs-%{mistralrs_flavour}@.service
%postun
if [ $1 -eq 0 ]; then
update-alternatives --remove mistralrs-server \
/opt/mistralrs/%{mistralrs_flavour}/bin/mistralrs-server
fi
%systemd_postun_with_restart mistralrs-%{mistralrs_flavour}@.service
%files
/opt/mistralrs/%{mistralrs_flavour}/
%{_unitdir}/mistralrs-%{mistralrs_flavour}@.service
%{_sysconfdir}/mistralrs/%{mistralrs_flavour}.conf.example
%changelog