File kernel-cachyos.spec of Package linux-cachyos

# SPDX-License-Identifier: GPL-2.0
# Adapted CachyOS kernel spec for openSUSE build service
# Based on Bieszczaders COPR kernel-cachyos.spec

%define debug_package %{nil}
%define _unpackaged_files_terminate_build 0
%global flavor cachyos
%global kversion 6.16.0

Name:           kernel-%{flavor}
Version:        %{kversion}
Release:        1
Summary:        CachyOS Linux kernel optimized for desktop
License:        GPL-2.0
Group:          System/Kernel
URL:            https://github.com/CachyOS/linux-cachyos
Source0:        linux-%{kversion}.tar.xz
Source1:        config.x86_64

BuildRequires:  bc bison flex
BuildRequires:  libelf-devel
BuildRequires:  openssl-devel dwarves libtirpc-devel
BuildRequires:  gcc make cpio perl rsync
BuildRequires:  xz

Provides:       kernel = %{version}-%{release}
Obsoletes:      kernel-%{flavor} < %{version}-%{release}

%description
This is the CachyOS kernel, optimized for responsiveness and desktop performance.

%prep
%autosetup -n linux-%{kversion} -p1
cp %{SOURCE1} .config

%build
make olddefconfig
make -j$(nproc) KCFLAGS="-O3 -march=native" bzImage modules

%install
mkdir -p %{buildroot}/boot
mkdir -p %{buildroot}/lib/modules/%{kversion}-%{flavor}
make INSTALL_MOD_PATH=%{buildroot} modules_install
cp arch/x86/boot/bzImage %{buildroot}/boot/vmlinuz-%{flavor}-%{kversion}

%files
%defattr(-,root,root)
/boot/vmlinuz-%{flavor}-%{kversion}
/lib/modules/%{kversion}-%{flavor}

%changelog
* Tue Jul 29 2025 Mateusz <chatgpt@ai.local>
- Adapted COPR Fedora spec for openSUSE build system
- Switched to %autosetup -p1
- Simplified modules and boot install
openSUSE Build Service is sponsored by