chore: init
This commit is contained in:
100
rpm/mistralrs.spec
Normal file
100
rpm/mistralrs.spec
Normal file
@@ -0,0 +1,100 @@
|
||||
%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
|
||||
|
||||
# Runtime requirements. We link against the CUDA runtime; consumers must have
|
||||
# a matching CUDA installation or the rpmfusion nvidia driver's cuda-libs.
|
||||
# We don't hard-require it at the RPM level because consumers may have CUDA
|
||||
# from multiple sources (nvidia direct, rpmfusion, etc.) — failing to load
|
||||
# libcuda.so at runtime gives a clearer error than RPM dep resolution would.
|
||||
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
|
||||
* Thu Apr 23 2026 Robin Thijssen <grenade@lair.cafe> - %{mistralrs_version}-1
|
||||
- Automated build for %{mistralrs_flavour} flavour
|
||||
Reference in New Issue
Block a user