%global rustflags_debuginfo 1 %undefine _include_frame_pointers %global toolchain clang %global scheds %{shrink: scx_bpfland scx_cosmos scx_flash scx_lavd scx_rusty } Name: scx-scheds Version: 1.0.16 Release: 2%{?dist} Summary: Sched_ext Schedulers and Tools License: GPL-2.0-only URL: https://github.com/sched-ext/scx Source: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz BuildRequires: /usr/bin/protoc BuildRequires: bpftool BuildRequires: cargo BuildRequires: clang BuildRequires: elfutils-libelf-devel BuildRequires: jq BuildRequires: libbpf-static BuildRequires: lld BuildRequires: llvm BuildRequires: pkgconfig(libseccomp) BuildRequires: python BuildRequires: rust BuildRequires: systemd-rpm-macros BuildRequires: zlib-devel %description sched_ext is a Linux kernel feature which enables implementing kernel thread schedulers in BPF and dynamically loading them. %prep %autosetup -n scx-%{version} -p1 %build export CARGO_HOME=.cargo for sched in %{scheds}; do cargo build --locked --release -p "${sched}" done %install for sched in %{scheds}; do install -Dpm0755 target/release/"${sched}" -t %{buildroot}%{_bindir} done install -Dpm644 services/scx -t %{buildroot}%{_sysconfdir}/default install -Dpm644 services/systemd/scx.service -t %{buildroot}%{_unitdir} echo 'enable scx.service' | install -Dpm0644 /dev/stdin %{buildroot}%{_prefix}/lib/systemd/system-preset/70-%{name}.preset sed -i '/SCX_SCHEDULER=/s/scx_flash/scx_cosmos/' %{buildroot}%{_sysconfdir}/default/scx sed -i 's/\(List of scx_schedulers:\).*/\1 %{scheds}/' %{buildroot}%{_sysconfdir}/default/scx %post %systemd_post scx.service %preun %systemd_preun scx.service %postun %systemd_postun_with_restart scx.service %files %config(noreplace) %{_sysconfdir}/default/scx %{_bindir}/scx* %{_unitdir}/scx.service %{_prefix}/lib/systemd/system-preset/70-%{name}.preset %changelog %autochangelog