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