sys-kernel/gentoo-kernel: Bump to 5.4.39
[gentoo.git] / sys-kernel / gentoo-kernel / gentoo-kernel-5.4.39.ebuild
1 # Copyright 2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit kernel-build
7
8 MY_P=linux-${PV%.*}
9 GENPATCHES_P=genpatches-${PV%.*}-${PV##*.}
10 # https://git.archlinux.org/svntogit/packages.git/log/trunk/config?h=packages/linux
11 AMD64_CONFIG_VER=5.4.15-arch1
12 AMD64_CONFIG_HASH=dc8d69b59a7a529ec5aaeb6b32b16e59a3cc1569
13 # https://git.archlinux32.org/packages/log/core/linux/config.i686
14 I686_CONFIG_VER=5.4.15-arch1
15 I686_CONFIG_HASH=1ad219bd3f0ab439a81ed01fec7660eeea7daa0e
16
17 DESCRIPTION="Linux kernel built with Gentoo patches"
18 HOMEPAGE="https://www.kernel.org/"
19 SRC_URI+=" https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz
20         https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.base.tar.xz
21         https://dev.gentoo.org/~mpagano/dist/genpatches/${GENPATCHES_P}.extras.tar.xz
22         amd64? (
23                 https://git.archlinux.org/svntogit/packages.git/plain/trunk/config?h=packages/linux&id=${AMD64_CONFIG_HASH}
24                         -> linux-${AMD64_CONFIG_VER}.amd64.config
25         )
26         x86? (
27                 https://git.archlinux32.org/packages/plain/core/linux/config.i686?id=${I686_CONFIG_HASH}
28                         -> linux-${I686_CONFIG_VER}.i686.config
29         )"
30 S=${WORKDIR}/${MY_P}
31
32 LICENSE="GPL-2"
33 KEYWORDS="~amd64 ~x86"
34
35 RDEPEND="
36         !sys-kernel/vanilla-kernel:${SLOT}
37         !sys-kernel/vanilla-kernel-bin:${SLOT}"
38
39 src_prepare() {
40         local PATCHES=(
41                 # meh, genpatches have no directory
42                 "${WORKDIR}"/*.patch
43         )
44         default
45
46         # prepare the default config
47         case ${ARCH} in
48                 amd64)
49                         cp "${DISTDIR}"/linux-${AMD64_CONFIG_VER}.amd64.config .config || die
50                         ;;
51                 x86)
52                         cp "${DISTDIR}"/linux-${I686_CONFIG_VER}.i686.config .config || die
53                         ;;
54                 *)
55                         die "Unsupported arch ${ARCH}"
56                         ;;
57         esac
58
59         local config_tweaks=(
60                 # shove arch under the carpet!
61                 -e 's:^CONFIG_DEFAULT_HOSTNAME=:&"gentoo":'
62                 # we do support x32
63                 -e '/CONFIG_X86_X32/s:.*:CONFIG_X86_X32=y:'
64                 # disable signatures
65                 -e '/CONFIG_MODULE_SIG/d'
66                 -e '/CONFIG_SECURITY_LOCKDOWN/d'
67                 # disable compression to allow stripping
68                 -e '/CONFIG_MODULE_COMPRESS/d'
69                 # disable gcc plugins to unbreak distcc
70                 -e '/CONFIG_GCC_PLUGIN_STRUCTLEAK/d'
71         )
72         sed -i "${config_tweaks[@]}" .config || die
73 }