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

85 lines
2.2 KiB
RPMSpec
Raw Normal View History

2024-01-27 22:44:24 -05:00
%global debug_package %{nil}
2024-01-27 22:59:53 -05:00
%global zen zen1
2024-01-27 22:44:24 -05:00
Name: linux-zen
Version: 6.7.6
2024-02-26 14:46:53 -05:00
Release: 2%{?dist}
2024-01-27 22:44:24 -05:00
Summary: Linux kernel and modules with Zen patches
License: GPL-2.0-only
URL: http://www.zen-kernel.org/
2024-01-27 22:59:53 -05:00
Source0: v%{version}-%{zen}.tar.gz
2024-01-27 22:44:24 -05:00
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
2024-01-27 22:59:53 -05:00
%setup -q -n zen-kernel-%{version}-%{zen}
2024-01-27 22:44:24 -05:00
cp %{_sourcedir}/.config .config
# Apply all patch files in a shell loop
for patch in %{_sourcedir}/*.patch; do
echo "Applying $patch"
patch -p1 < $patch
done
2024-01-27 22:44:24 -05:00
%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}
VMLINUX_PATH=%{buildroot}/boot
mkdir -p $VMLINUX_PATH
cd %{_builddir}/zen-kernel-%{version}-zen1/arch/x86/boot
2024-01-27 22:44:24 -05:00
cp bzImage $VMLINUX_PATH/vmlinuz-%{version}-%{zen}.fc39.x86_64
cd %{_builddir}/zen-kernel-%{version}-zen1
2024-01-27 22:44:24 -05:00
2024-01-28 13:11:53 -05:00
cp %{_sourcedir}/.config $VMLINUX_PATH/config-%{version}-%{zen}.fc39.x86_64
2024-02-26 12:38:31 -05:00
make headers_install INSTALL_HDR_PATH=%{buildroot}/usr/include
2024-01-27 22:44:24 -05:00
%files
/boot/vmlinuz-%{version}-%{zen}.fc39.x86_64
/boot/config-%{version}-%{zen}.fc39.x86_64
2024-01-27 22:44:24 -05:00
/lib/modules/*
2024-02-26 12:38:31 -05:00
/usr/include/*
2024-01-27 22:44:24 -05:00
%changelog
* Fri Jan 27 2024 Wizzard <rich@bandaholics.cash>
- Initial package version