1 # Copyright 2020-2023 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit kernel-build python-any-r1 toolchain-funcs
8 PYTHON_COMPAT
=( python3_
{9.
.11} )
10 #Note: to bump xanmod, check GENPATCHES_P in sys-kernel/gentoo-kernel
11 GENPATCHES_P
=genpatches-
${PV%.*}-$
((${PV##*.} + 6))
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"
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 )"
29 >=virtual/dist-kernel-${PV}"
31 QA_FLAGS_IGNORED
="usr/src/linux-.*/scripts/gcc-plugins/.*.so"
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."
42 python-any-r1_pkg_setup
"$@"
43 if use clang
&& ! tc-is-clang
; then
50 export OBJCOPY
=llvm-objcopy
51 export OBJDUMP
=llvm-objdump
52 export READELF
=llvm-readelf
53 export STRIP
=llvm-strip
61 # delete linux version patches
62 rm "${WORKDIR}"/*${MY_P}*.
patch || die
68 "${WORKDIR}"/patch-${PV}-xanmod${XV}
71 PATCHES+=("${DISTDIR}/cjktty-
${PV%.*}.
patch")
75 # prepare the default config
78 if use x86-64-v1; then
79 cp "${S}/CONFIGS
/xanmod
/gcc
/config_x86-64-v1
" .config || die
81 elif use x86-64-v2; then
82 cp "${S}/CONFIGS
/xanmod
/gcc
/config_x86-64-v2
" .config || die
84 elif use x86-64-v3; then
85 cp "${S}/CONFIGS
/xanmod
/gcc
/config_x86-64-v3
" .config || die
87 elif use x86-64-v4; then
88 cp "${S}/CONFIGS
/xanmod
/gcc
/config_x86-64-v4
" .config || die
93 die "Unsupported arch
${ARCH}"
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