app-misc/gpick: add depend
[gentoo-zh.git] / sys-kernel / xanmod-kernel / xanmod-kernel-5.15.38.ebuild
blobf741a731b4a66dbb800cef8bc120a054d89fa9b5
1 # Copyright 2020-2022 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=7
6 inherit kernel-build python-any-r1 toolchain-funcs
8 MY_P=linux-${PV%.*}
9 GENPATCHES_P=genpatches-${PV%.*}-$((${PV##*.} + 4))
10 XV="1"
12 DESCRIPTION="XanMod lts kernel built with Gentoo patches and cjktty"
13 HOMEPAGE="https://www.kernel.org/"
14 SRC_URI+=" https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
15 https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.base.tar.xz
16 https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.extras.tar.xz
17 https://github.com/xanmod/linux/releases/download/${PV}-xanmod${XV}/patch-${PV}-xanmod${XV}.xz
18 https://raw.githubusercontent.com/zhmars/cjktty-patches/master/v5.x/cjktty-${PV%.*}.patch"
19 S=${WORKDIR}/${MY_P}
21 LICENSE="GPL-2"
22 KEYWORDS="~amd64"
23 IUSE="cjk clang"
24 SLOT="stable"
26 BDEPEND="
27 clang? (
28 sys-devel/clang
29 sys-devel/lld
30 sys-devel/llvm
32 PDEPEND="
33 >=virtual/dist-kernel-${PV}"
35 QA_FLAGS_IGNORED="usr/src/linux-.*/scripts/gcc-plugins/.*.so"
37 pkg_setup() {
38 ewarn ""
39 ewarn "${PN} is *not* supported by the Gentoo Kernel Project in any way."
40 ewarn "You have to configure the kernel by yourself."
41 ewarn "Generally emerge this package using default config will fail to boot."
42 ewarn "If you need support, please contact the ${HOMEPAGE} or maintainer directly."
43 ewarn "Do *not* open bugs in Gentoo's bugzilla unless you have issues with"
44 ewarn "the ebuilds. Thank you."
45 ewarn ""
46 python-any-r1_pkg_setup "$@"
47 if use clang && ! tc-is-clang; then
48 export LLVM_IAS=1
49 export LLVM=1
50 export CC=clang
51 export LD=ld.lld
52 export AR=llvm-ar
53 export NM=llvm-nm
54 export OBJCOPY=llvm-objcopy
55 export OBJDUMP=llvm-objdump
56 export READELF=llvm-readelf
57 export STRIP=llvm-strip
58 else
59 tc-export CXX CC
63 src_prepare() {
64 # delete linux version patches
65 rm "${WORKDIR}"/*${MY_P}*.patch || die
66 local PATCHES=(
67 # genpatches
68 "${WORKDIR}"/*.patch
69 # xanmod patches
70 "${WORKDIR}"/patch-${PV}-xanmod${XV}
72 if use cjk; then
73 PATCHES+=("${DISTDIR}/cjktty-${PV%.*}.patch")
75 default
77 # prepare the default config
78 case ${ARCH} in
79 amd64)
80 if use clang; then
81 cp "${S}/CONFIGS/xanmod/clang/config" .config || die
82 else
83 cp "${S}/CONFIGS/xanmod/gcc/config" .config || die
87 die "Unsupported arch ${ARCH}"
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
100 kernel-build_merge_configs "${merge_configs[@]}"
101 # delete localversion
102 rm "${S}/localversion" || die