sys-kernel/xanmod-{kernel, sources}: bump to 6.9.6
[gentoo-zh.git] / sys-kernel / xanmod-kernel / xanmod-kernel-6.9.6.ebuild
blob832bdd511d53702c0ca615e5f48b8894dad4319f
1 # Copyright 2020-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 inherit kernel-build toolchain-funcs
8 MY_P=linux-${PV%.*}
9 #Note: to bump xanmod, check GENPATCHES_P in sys-kernel/gentoo-kernel
10 GENPATCHES_P=genpatches-${PV%.*}-$((${PV##*.} + 1))
11 XV="1"
13 DESCRIPTION="XanMod lts kernel built with Gentoo patches and cjktty"
14 HOMEPAGE="https://www.kernel.org/"
15 SRC_URI+=" https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
16         https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.base.tar.xz
17         https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.extras.tar.xz
18         https://download.sourceforge.net/xanmod/patch-${PV}-xanmod1.xz"
19 S=${WORKDIR}/${MY_P}
21 LICENSE="GPL-2"
22 KEYWORDS="~amd64"
23 IUSE="clang debug +x86-64-v1 x86-64-v2 x86-64-v3 x86-64-v4"
24 REQUIRED_USE="^^ ( x86-64-v1 x86-64-v2 x86-64-v3 x86-64-v4 )"
26 PDEPEND="
27         >=virtual/dist-kernel-${PV}"
29 QA_FLAGS_IGNORED="usr/src/linux-.*/scripts/gcc-plugins/.*.so"
31 pkg_setup() {
32         ewarn ""
33         ewarn "${PN} is *not* supported by the Gentoo Kernel Project in any way."
34         ewarn "You have to configure the kernel by yourself."
35         ewarn "Generally emerge this package using default config will fail to boot."
36         ewarn "If you need support, please contact the ${HOMEPAGE} or maintainer directly."
37         ewarn "Do *not* open bugs in Gentoo's bugzilla unless you have issues with"
38         ewarn "the ebuilds. Thank you."
39         ewarn ""
40         if use clang && ! tc-is-clang; then
41                 export LLVM_IAS=1
42                 export LLVM=1
43                 export CC=clang
44                 export LD=ld.lld
45                 export AR=llvm-ar
46                 export NM=llvm-nm
47                 export OBJCOPY=llvm-objcopy
48                 export OBJDUMP=llvm-objdump
49                 export READELF=llvm-readelf
50                 export STRIP=llvm-strip
51         else
52                 tc-export CXX CC
53         fi
57 src_prepare() {
58         # delete linux version patches
59         rm "${WORKDIR}"/*${MY_P}*.patch
61         local PATCHES=(
62                 # genpatches
63                 "${WORKDIR}"/*.patch
64                 # xanmod patches
65                 "${WORKDIR}"/patch-${PV}-xanmod${XV}
66         )
67         default
69         # prepare the default config
70         case ${ARCH} in
71         amd64)
72                 if use x86-64-v1; then
73                         cp "${S}/CONFIGS/xanmod/gcc/config_x86-64-v1" .config || die
74                         XV="${XV}-x64v1"
75                 elif use x86-64-v2; then
76                         cp "${S}/CONFIGS/xanmod/gcc/config_x86-64-v2" .config || die
77                         XV="${XV}-x64v2"
78                 elif use x86-64-v3; then
79                         cp "${S}/CONFIGS/xanmod/gcc/config_x86-64-v3" .config || die
80                         XV="${XV}-x64v3"
81                 elif use x86-64-v4; then
82                         cp "${S}/CONFIGS/xanmod/gcc/config_x86-64-v4" .config || die
83                         XV="${XV}-x64v4"
84                 fi
85                 ;;
86         *)
87                 die "Unsupported arch ${ARCH}"
88                 ;;
89         esac
91         local myversion="-xanmod${XV}"
92         echo "CONFIG_LOCALVERSION=\"${myversion}\"" >"${T}"/version.config || die
93         echo "CONFIG_MODPROBE_PATH=\"/sbin/modprobe\"" >"${T}"/modprobe.config || die
95         local merge_configs=(
96                 "${T}"/version.config
97                 "${T}"/modprobe.config
98         )
100         kernel-build_merge_configs "${merge_configs[@]}"
101         # delete localversion
102         rm "${S}/localversion" || die