fedora-zen-custom/SPECS/linux-zen.spec

93 lines
2.3 KiB
RPMSpec

%global debug_package %{nil}
Name: linux-zen
Version: 6.7.2
Release: 1%{?dist}
Summary: Linux kernel and modules with Zen patches
License: GPL-2.0-only
URL: http://www.zen-kernel.org/
Source0: v%{version}-zen1.tar.gz
Patch0: 0000-NTPatch.patch
Patch1: 0001-NTPatch.patch
Patch2: 0002-NTPatch.patch
Patch3: 0003-NTPatch.patch
Patch4: 0004-NTPatch.patch
Patch5: 0005-NTPatch.patch
Patch6: 0006-NTPatch.patch
Patch7: 0007-NTPatch.patch
Patch8: 0008-NTPatch.patch
BuildRequires: gcc, make, flex, bison, ncurses-devel, elfutils-libelf-devel, openssl-devel
%description
Linux kernel and modules with Zen patches (%{version} series) compiled with Clang.
%prep
%setup -q -n zen-kernel-%{version}-zen1
cp %{_sourcedir}/.config .config
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
# Set environment variables for Clang and LLVM tools
export CC=clang
export CXX=clang++
export LD=ld.lld
export AR=llvm-ar
export NM=llvm-nm
export STRIP=llvm-strip
export OBJCOPY=llvm-objcopy
export OBJDUMP=llvm-objdump
export HOSTCC=clang
export HOSTCXX=clang++
export HOSTLD=ld.lld
export HOSTAR=llvm-ar
export HOSTNM=llvm-nm
export HOSTSTRIP=llvm-strip
export HOSTOBJCOPY=llvm-objcopy
export HOSTOBJDUMP=llvm-objdump
# Adjust CFLAGS and LDFLAGS to remove unsupported and unused arguments when using Clang
%if "%{__cc}" == "clang"
export CFLAGS=$(echo %{optflags} | sed 's/-ffat-lto-objects//')
export CXXFLAGS=$(echo %{optflags} | sed 's/-ffat-lto-objects//')
export LDFLAGS=$(echo %{__global_ldflags} | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-hardened-ld//')
%else
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
export LDFLAGS="%{__global_ldflags}"
%endif
make LLVM=1 %{?_smp_mflags}
%install
make modules_install INSTALL_MOD_PATH=%{buildroot}
# Define the path for vmlinuz file
VMLINUX_PATH=%{buildroot}/boot
# Create the boot directory
mkdir -p $VMLINUX_PATH
# Navigate to the directory where vmlinux is located
cd %{_builddir}/zen-kernel-%{version}-zen1
# Compress vmlinux and move it to the vmlinuz path
gzip -c vmlinux > $VMLINUX_PATH/vmlinuz-%{version}-zen1
%files
/boot/vmlinuz-%{version}-zen1
/lib/modules/*
%changelog
* Fri Jan 27 2024 Wizzard <rich@bandaholics.cash>
- Initial package version