File scx.spec of Package scx
#
# spec file for package scx
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: scx
Version: 1.0.5
Release: 0
Summary: Sched_ext CPU schedulers
License: GPL-2.0
URL: https://github.com/sched-ext/scx
Source0: scx-%version.tar.zst
Source1: vendor.tar.zst
BuildRequires: meson
BuildRequires: ninja
BuildRequires: lld
BuildRequires: clang
BuildRequires: cargo
BuildRequires: jq
BuildRequires: zstd
BuildRequires: bpftool >= 7.4.0
BuildRequires: pkgconfig(libbpf) >= 1.4.0
BuildRequires: libbpf-devel >= 1.4.0
BuildRequires: pkgconfig(systemd)
%description
sched_ext is a Linux kernel feature which enables implementing kernel thread schedulers in BPF and dynamically loading them. This package contains various scheduler implementations and support utilities.
%package devel
Summary: Development files for sched-ext
%description devel
Header files needed to develop a sched-ext scheduler in C.
%prep
%setup -qa1
%build
# meson macros use set_build_flags which makes the linker fail during build,
# using without macros for now.
meson setup --prefix=%{_prefix} -Doffline=true -Dbpftool=/usr/sbin/bpftool -Dlibbpf_a=disabled -Dopenrc=disabled --buildtype=release build
meson compile -C build -v
%install
meson install -C build --destdir=%{buildroot}
mkdir -p %{buildroot}/%{_prefix}/include/scx
cp -r scheds/include/scx/* %{buildroot}/%{_prefix}/include/scx/
cp -L scheds/include/vmlinux/vmlinux.h %{buildroot}/%{_prefix}/include/scx/vmlinux.h
%pre
%service_add_pre scx.service
%service_add_pre scx_loader.service
%post
%service_add_post scx.service
%service_add_post scx_loader.service
%preun
%service_del_preun scx.service
%service_del_preun scx_loader.service
%postun
%service_del_postun scx.service
%service_del_postun scx_loader.service
%files
%license LICENSE
%doc README.md
%{_bindir}/*
%{_prefix}/lib/systemd/system/scx.service
%{_prefix}/lib/systemd/system/scx_loader.service
%{_prefix}/share/dbus-1/system-services/org.scx.Loader.service
%{_prefix}/share/dbus-1/system.d/org.scx.Loader.conf
%{_sysconfdir}/default/%{name}
%config %{_sysconfdir}/default/%{name}
%files devel
%license LICENSE
%doc README.md
%{_prefix}/include/scx
%changelog