Fix clang package
This commit is contained in:
parent
f51a83dc93
commit
f7d584b47c
|
@ -1,40 +1,32 @@
|
|||
# Description
|
||||
# Template file for 'linux6.5-zen'
|
||||
pkgname=linux6.5-zen
|
||||
version=6.5.7
|
||||
revision=2
|
||||
revision=5
|
||||
zen=1
|
||||
python_version=3
|
||||
wrksrc="linux-${version}-zen${zen}"
|
||||
short_desc="Linux kernel and modules with Zen patches (${version%.*} series) compiled with Clang"
|
||||
maintainer="Wizzard <retard@deadzone.lol>"
|
||||
license="GPL-2.0-only"
|
||||
homepage="https://github.com/zen-kernel/zen-kernel"
|
||||
homepage="http://www.zen-kernel.org/"
|
||||
distfiles="https://github.com/zen-kernel/zen-kernel/archive/refs/tags/v${version}-zen${zen}.tar.gz"
|
||||
# Update checksum once you get the actual one for the Zen version
|
||||
checksum="21b881332c189ce3994bbfa3496daae0fa0890f478814b20c045f3180b4ff12c" # replace with the correct checksum
|
||||
archs="x86_64* i686* ppc* aarch64*"
|
||||
checksum="21b881332c189ce3994bbfa3496daae0fa0890f478814b20c045f3180b4ff12c"
|
||||
python_version=3
|
||||
patch_args="-Np1"
|
||||
|
||||
# Standard kernel template setup
|
||||
nodebug=yes
|
||||
nodebug=yes # -dbg package is generated below manually
|
||||
nostrip=yes
|
||||
noverifyrdeps=yes
|
||||
noshlibprovides=yes
|
||||
preserve=yes
|
||||
|
||||
# Set compiler to Clang
|
||||
export CC=clang
|
||||
export HOSTCC=clang
|
||||
export CXX=clang++
|
||||
export HOSTCXX=clang++
|
||||
hostmakedepends="tar xz lz4 bc-gh elfutils-devel flex gmp-devel kmod libmpc-devel
|
||||
openssl-devel perl uboot-mkimage cpio clang llvm lld pahole python3 which"
|
||||
|
||||
# Dependencies
|
||||
hostmakedepends="tar xz lz4 bc-gh elfutils-devel flex gmp-devel kmod libmpc-devel openssl-devel perl uboot-mkimage cpio pahole python3 clang"
|
||||
|
||||
# This denotes the version for various hooks and scripts
|
||||
_kernver="${version}-zen${zen}_${revision}"
|
||||
triggers="kernel-hooks"
|
||||
kernel_hooks_version="${_kernver}"
|
||||
|
||||
# These files could be modified when an external module is built.
|
||||
mutable_files="
|
||||
/usr/lib/modules/${_kernver}/modules.builtin.bin
|
||||
/usr/lib/modules/${_kernver}/modules.builtin.alias.bin
|
||||
|
@ -47,6 +39,7 @@ mutable_files="
|
|||
/usr/lib/modules/${_kernver}/modules.alias.bin
|
||||
/usr/lib/modules/${_kernver}/modules.devname"
|
||||
|
||||
# reproducible build
|
||||
export KBUILD_BUILD_TIMESTAMP=${SOURCE_DATE_EPOCH:-0}
|
||||
export KBUILD_BUILD_USER=voidlinux
|
||||
export KBUILD_BUILD_HOST=zen
|
||||
|
@ -59,18 +52,9 @@ if [ "${_patchver}" ]; then
|
|||
fi
|
||||
|
||||
do_configure() {
|
||||
# Clang specific configurations
|
||||
echo "CONFIG_CC_IS_CLANG=y" >> .config
|
||||
echo "CONFIG_CLANG_VERSION=$(clang --version | head -n1 | awk '{print $3}' | sed 's/\..*//')" >> .config
|
||||
echo "CONFIG_LTO_CLANG=y" >> .config
|
||||
echo "CONFIG_LTO_THIN=y" >> .config
|
||||
|
||||
|
||||
|
||||
# If there's a file called <arch>-dotconfig, use it to
|
||||
# configure the kernel; otherwise use arch defaults and all stuff
|
||||
# as modules (allmodconfig).
|
||||
|
||||
local arch subarch
|
||||
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
|
@ -87,18 +71,18 @@ do_configure() {
|
|||
if [ -f ${FILESDIR}/${subarch:-$arch}-dotconfig-custom ]; then
|
||||
msg_normal "Detected a custom .config file for your arch, using it.\n"
|
||||
cp -f ${FILESDIR}/${subarch:-$arch}-dotconfig-custom .config
|
||||
make ${makejobs} ARCH=$arch ${_args} oldconfig
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=$arch ${_args} oldconfig
|
||||
elif [ -f ${FILESDIR}/${subarch:-$arch}-dotconfig ]; then
|
||||
msg_normal "Detected a .config file for your arch, using it.\n"
|
||||
cp -f ${FILESDIR}/${subarch:-$arch}-dotconfig .config
|
||||
make ${makejobs} ARCH=$arch ${_args} oldconfig
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=$arch ${_args} oldconfig
|
||||
elif [ -f ${FILESDIR}/${XBPS_TARGET_MACHINE%%-musl}-dotconfig ]; then
|
||||
msg_normal "Detected a .config file for your cpu family, using it.\n"
|
||||
cp -f ${FILESDIR}/${XBPS_TARGET_MACHINE%%-musl}-dotconfig .config
|
||||
make ${makejobs} ARCH=$arch ${_args} oldconfig
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=$arch ${_args} oldconfig
|
||||
else
|
||||
msg_normal "Defaulting to 'allmodconfig'.\n"
|
||||
make ${makejobs} ARCH=$arch ${_args} allmodconfig
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=$arch ${_args} allmodconfig
|
||||
fi
|
||||
# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
|
||||
sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
|
||||
|
@ -116,8 +100,8 @@ do_build() {
|
|||
mips*) _args="uImage modules dtbs"; arch=mips;;
|
||||
esac
|
||||
export LDFLAGS=
|
||||
make ${makejobs} CC=clang HOSTCC=clang ARCH=$arch ${_args} ${_version} ${_cross} prepare
|
||||
make ${makejobs} CC=clang HOSTCC=clang ARCH=$arch ${_args} ${_version} ${_cross} ${_args}
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ARCH=$arch ${_version} ${_cross} ${makejobs} prepare
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ARCH=$arch ${_version} ${_cross} ${makejobs} ${_args}
|
||||
}
|
||||
|
||||
do_install() {
|
||||
|
@ -136,7 +120,7 @@ do_install() {
|
|||
sed -i '2iexit 0' scripts/depmod.sh
|
||||
|
||||
# Install kernel, firmware and modules
|
||||
make ${makejobs} ARCH=${subarch:-$arch} INSTALL_MOD_PATH=${DESTDIR} modules_install
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=${subarch:-$arch} INSTALL_MOD_PATH=${DESTDIR} modules_install
|
||||
|
||||
hdrdest=${DESTDIR}/usr/src/kernel-headers-${_kernver}
|
||||
|
||||
|
@ -149,11 +133,11 @@ do_install() {
|
|||
;;
|
||||
arm)
|
||||
vinstall arch/arm/boot/zImage 644 boot
|
||||
make ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs/dtbs-${_kernver} dtbs_install
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs/dtbs-${_kernver} dtbs_install
|
||||
;;
|
||||
arm64)
|
||||
vinstall arch/arm64/boot/Image 644 boot vmlinux-${_kernver}
|
||||
make ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs/dtbs-${_kernver} dtbs_install
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs/dtbs-${_kernver} dtbs_install
|
||||
;;
|
||||
powerpc)
|
||||
# zImage on powerpc is useless as it won't load initramfs
|
||||
|
@ -163,7 +147,7 @@ do_install() {
|
|||
;;
|
||||
mips)
|
||||
vinstall arch/mips/boot/uImage.bin 644 boot uImage-${_kernver}
|
||||
make ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs/dtbs-${_kernver} dtbs_install
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=${subarch:-$arch} INSTALL_DTBS_PATH=${DESTDIR}/boot/dtbs/dtbs-${_kernver} dtbs_install
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -207,7 +191,7 @@ do_install() {
|
|||
# if generated files from the scripts/ directory need to be included,
|
||||
# they need to be copied to ${hdrdest} before this step
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
make ${makejobs} ARCH=${subarch:-$arch} _mrproper_scripts
|
||||
make CC=clang AS=clang LD=ld.lld AR=llvm-ar NM=llvm-nm STRIP=llvm-strip OBJCOPY=llvm-objcopy OBJDUMP=llvm-objdump HOSTCC=clang HOSTLD=ld.lld HOSTAR=llvm-ar ${makejobs} ARCH=${subarch:-$arch} _mrproper_scripts
|
||||
# remove host specific objects as well
|
||||
find scripts -name '*.o' -delete
|
||||
fi
|
||||
|
@ -314,7 +298,6 @@ do_install() {
|
|||
# ... and run depmod again.
|
||||
depmod -b ${DESTDIR}/usr -F System.map ${_kernver}
|
||||
}
|
||||
|
||||
linux6.5-zen-headers_package() {
|
||||
preserve=yes
|
||||
nostrip=yes
|
||||
|
|
Loading…
Reference in New Issue