Files
2026-06-22 18:17:39 +02:00

82 lines
2.1 KiB
RPMSpec

Name: scx
Version: 1.1.1
Release: 1%{?dist}
Summary: sched_ext schedulers and systemd service
License: GPL-2.0-only
URL: https://github.com/sched-ext/scx
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: scx.service
Patch0: scx-cake-preserve-bpf-cflags.patch
Patch1: scx-config-update-scheduler-list.patch
BuildRequires: bpftool
BuildRequires: clang
BuildRequires: git
BuildRequires: llvm
BuildRequires: lld
BuildRequires: patch
BuildRequires: pkgconfig
BuildRequires: rust+cargo
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(libelf)
BuildRequires: pkgconfig(libbpf)
BuildRequires: pkgconfig(libseccomp)
BuildRequires: pkgconfig(protobuf)
ExclusiveArch: x86_64
%define _lto_cflags %{nil}
%description
scx contains sched_ext schedulers and installs a systemd service unit.
%prep
%autosetup -n %{name}-%{version} -p1
cargo fetch --locked --target "$(rustc --print host-tuple)"
%build
export RUSTFLAGS="${RUSTFLAGS:-} \
--remap-path-prefix=${PWD}=src"
export BPF_EXTRA_CFLAGS_PRE_INCL="${BPF_EXTRA_CFLAGS_PRE_INCL:-} \
-ffile-prefix-map=${PWD}=src \
-fdebug-prefix-map=${PWD}=src \
-fmacro-prefix-map=${PWD}=src"
cargo build \
--release \
--frozen \
--all-features \
--workspace \
--exclude scx_rlfifo \
--exclude scx_mitosis \
--exclude scxcash \
--exclude xtask \
--exclude vmlinux_docify \
--exclude scx_arena_selftests
%install
find target/release \
-maxdepth 1 -type f -executable ! -name '*.so' \
-exec install -Dm0755 -t %{buildroot}%{_bindir} {} +
install -Dm0644 %{SOURCE1} %{buildroot}%{_unitdir}/scx.service
install -Dm0644 services/scx %{buildroot}%{_sysconfdir}/scx/config
install -dm0755 %{buildroot}%{_sysconfdir}/scx/config.d
%pre
%service_add_pre scx.service
%post
%service_add_post scx.service
%preun
%service_del_preun scx.service
%postun
%service_del_postun scx.service
%files
%license LICENSE
%doc README.md OVERVIEW.md
%{_bindir}/*
%{_unitdir}/scx.service
%dir %{_sysconfdir}/scx
%dir %{_sysconfdir}/scx/config.d
%config(noreplace) %{_sysconfdir}/scx/config