Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/grub/
Date: Wed, 08 Jun 2022 01:06:00
Message-Id: 1654650165.7bbb9e2ce52ffd701c05daa3752f1fe11ec72f27.floppym@gentoo
1 commit: 7bbb9e2ce52ffd701c05daa3752f1fe11ec72f27
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 8 01:02:45 2022 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 8 01:02:45 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7bbb9e2c
7
8 sys-boot/grub: backport many patches
9
10 Bug: https://bugs.gentoo.org/850535
11 Closes: https://github.com/gentoo/gentoo/pull/25629
12 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
13
14 sys-boot/grub/Manifest | 1 +
15 sys-boot/grub/grub-2.06-r2.ebuild | 319 ++++++++++++++++++++++++++++++++++++++
16 2 files changed, 320 insertions(+)
17
18 diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest
19 index 632fe8590e05..5fa3c6b4854c 100644
20 --- a/sys-boot/grub/Manifest
21 +++ b/sys-boot/grub/Manifest
22 @@ -1,3 +1,4 @@
23 DIST dejavu-sans-ttf-2.37.zip 417746 BLAKE2B c8904f3cd5a49370a7dc10e456684c88aeae998a99090bf4d0a5baa4f36cc8fb8f70586cf6d610a5ffeee97261d28c80f55bbe9dcfc3ed796d5c2d60e79adb58 SHA512 ede5899daa1984c5aa8cacb1c850eb53f189dddef3d9bb78bf9774d8976b7c0d6eb0bcf86237cd7d11f5b36cf5b5058d42cd94d3bd76f2bd0931c7ceb1271fae
24 +DIST grub-2.06-backports.tar.xz 30904 BLAKE2B 05d4e113552d4557dd39160047a4364458a0af6d21a67efbc57379c86b34ce590336ac28ae43241cc290d19a59ddf91126a8ef977a6846895e336608f90dcf75 SHA512 6320521d4c21582b52179ba297e6143502e2a5b983d86bd5fbb11903493419aa6c2a2f0358d09649b869ab3c6c65ca50daf0c0a63c51acf858722e880239604b
25 DIST grub-2.06.tar.xz 6581924 BLAKE2B 2a40b9b03d7bb3b9e7b1309ab274d686f01b3c42e7035ebc6e5a0e59a59c3b7362ba518341664b314cb0dbc8222bb10ea05ce09f08ce9d58a293207cb909e417 SHA512 4f11c648f3078567e53fc0c74d5026fdc6da4be27d188975e79d9a4df817ade0fe5ad2ddd694238a07edc45adfa02943d83c57767dd51548102b375e529e8efe
26 DIST unifont-12.1.02.pcf.gz 1335424 BLAKE2B 97080312468e3f3c8aa6f49cef08f5622641e8c9c035f3ede1e09d8d98de4e78d3b23c8aba2e8070eb46cbebd2d55e8568e467d7f15f35aa8fc8db792b7e5f14 SHA512 b280b2db7cf5f480b0668c331130dede2c0cc87d5e02e44566b77787113d0f6604d0105522858288f2ac6b8e77df7a2d9878725013a6c778dc5bfb183156e2f0
27
28 diff --git a/sys-boot/grub/grub-2.06-r2.ebuild b/sys-boot/grub/grub-2.06-r2.ebuild
29 new file mode 100644
30 index 000000000000..bf83ea7fb219
31 --- /dev/null
32 +++ b/sys-boot/grub/grub-2.06-r2.ebuild
33 @@ -0,0 +1,319 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +# This ebuild uses 3 special global variables:
40 +# GRUB_BOOTSTRAP: Depend on python and invoke bootstrap (gnulib).
41 +# GRUB_AUTOGEN: Depend on python and invoke the autogen.sh.
42 +# GRUB_AUTORECONF: Inherit autotools and invoke eautoreconf.
43 +#
44 +# When applying patches:
45 +# If gnulib is updated, set GRUB_BOOTSTRAP=1
46 +# If *.def is updated, set GRUB_AUTOGEN=1
47 +# If gnulib, *.def, or any autotools files are updated, set GRUB_AUTORECONF=1
48 +#
49 +# If any of the above applies to a user patch, the user should set the
50 +# corresponding variable in make.conf or the environment.
51 +
52 +if [[ ${PV} == 9999 ]]; then
53 + GRUB_BOOTSTRAP=1
54 +fi
55 +
56 +GRUB_AUTORECONF=1
57 +PYTHON_COMPAT=( python{2_7,3_{6,7,8,9}} )
58 +WANT_LIBTOOL=none
59 +
60 +if [[ -n ${GRUB_AUTOGEN} || -n ${GRUB_BOOTSTRAP} ]]; then
61 + inherit python-any-r1
62 +fi
63 +
64 +if [[ -n ${GRUB_AUTORECONF} ]]; then
65 + inherit autotools
66 +fi
67 +
68 +inherit bash-completion-r1 flag-o-matic multibuild optfeature toolchain-funcs
69 +
70 +if [[ ${PV} != 9999 ]]; then
71 + if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
72 + # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
73 + MY_P=${P/_/'~'}
74 + SRC_URI="https://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz"
75 + S=${WORKDIR}/${MY_P}
76 + else
77 + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
78 + S=${WORKDIR}/${P%_*}
79 + fi
80 + KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
81 +else
82 + inherit git-r3
83 + EGIT_REPO_URI="https://git.savannah.gnu.org/git/grub.git"
84 +fi
85 +
86 +SRC_URI+=" https://dev.gentoo.org/~floppym/dist/${P}-backports.tar.xz"
87 +
88 +PATCHES=(
89 + "${WORKDIR}/${P}-backports"
90 + "${FILESDIR}"/gfxpayload.patch
91 + "${FILESDIR}"/grub-2.02_beta2-KERNEL_GLOBS.patch
92 + "${FILESDIR}"/grub-2.06-test-words.patch
93 +)
94 +
95 +DEJAVU=dejavu-sans-ttf-2.37
96 +UNIFONT=unifont-12.1.02
97 +SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz )
98 + themes? ( mirror://sourceforge/dejavu/${DEJAVU}.zip )"
99 +
100 +DESCRIPTION="GNU GRUB boot loader"
101 +HOMEPAGE="https://www.gnu.org/software/grub/"
102 +
103 +# Includes licenses for dejavu and unifont
104 +LICENSE="GPL-3+ BSD MIT fonts? ( GPL-2-with-font-exception ) themes? ( CC-BY-SA-3.0 BitstreamVera )"
105 +SLOT="2/${PVR}"
106 +IUSE="device-mapper doc efiemu +fonts mount nls sdl test +themes truetype libzfs"
107 +
108 +GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot qemu qemu-mips pc uboot xen xen-32 xen-pvh )
109 +IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
110 +
111 +REQUIRED_USE="
112 + grub_platforms_coreboot? ( fonts )
113 + grub_platforms_qemu? ( fonts )
114 + grub_platforms_ieee1275? ( fonts )
115 + grub_platforms_loongson? ( fonts )
116 +"
117 +
118 +BDEPEND="
119 + ${PYTHON_DEPS}
120 + sys-devel/flex
121 + sys-devel/bison
122 + sys-apps/help2man
123 + sys-apps/texinfo
124 + fonts? (
125 + media-libs/freetype:2
126 + virtual/pkgconfig
127 + )
128 + test? (
129 + app-admin/genromfs
130 + app-arch/cpio
131 + app-arch/lzop
132 + app-emulation/qemu
133 + dev-libs/libisoburn
134 + sys-apps/miscfiles
135 + sys-block/parted
136 + sys-fs/squashfs-tools
137 + )
138 + themes? (
139 + app-arch/unzip
140 + media-libs/freetype:2
141 + virtual/pkgconfig
142 + )
143 + truetype? ( virtual/pkgconfig )
144 +"
145 +DEPEND="
146 + app-arch/xz-utils
147 + >=sys-libs/ncurses-5.2-r5:0=
148 + grub_platforms_emu? (
149 + sdl? ( media-libs/libsdl )
150 + )
151 + device-mapper? ( >=sys-fs/lvm2-2.02.45 )
152 + libzfs? ( sys-fs/zfs:= )
153 + mount? ( sys-fs/fuse:0 )
154 + truetype? ( media-libs/freetype:2= )
155 + ppc? ( >=sys-apps/ibm-powerpc-utils-1.3.5 )
156 + ppc64? ( >=sys-apps/ibm-powerpc-utils-1.3.5 )
157 +"
158 +RDEPEND="${DEPEND}
159 + kernel_linux? (
160 + grub_platforms_efi-32? ( sys-boot/efibootmgr )
161 + grub_platforms_efi-64? ( sys-boot/efibootmgr )
162 + )
163 + !sys-boot/grub:0
164 + nls? ( sys-devel/gettext )
165 +"
166 +
167 +RESTRICT="!test? ( test )"
168 +
169 +QA_EXECSTACK="usr/bin/grub-emu* usr/lib/grub/*"
170 +QA_PRESTRIPPED="usr/lib/grub/.*"
171 +QA_MULTILIB_PATHS="usr/lib/grub/.*"
172 +QA_WX_LOAD="usr/lib/grub/*"
173 +
174 +pkg_setup() {
175 + :
176 +}
177 +
178 +src_unpack() {
179 + if [[ ${PV} == 9999 ]]; then
180 + git-r3_src_unpack
181 + pushd "${P}" >/dev/null || die
182 + local GNULIB_URI="https://git.savannah.gnu.org/git/gnulib.git"
183 + local GNULIB_REVISION=$(source bootstrap.conf >/dev/null; echo "${GNULIB_REVISION}")
184 + git-r3_fetch "${GNULIB_URI}" "${GNULIB_REVISION}"
185 + git-r3_checkout "${GNULIB_URI}" gnulib
186 + popd >/dev/null || die
187 + fi
188 + default
189 +}
190 +
191 +src_prepare() {
192 + default
193 +
194 + sed -i -e /autoreconf/d autogen.sh || die
195 +
196 + if [[ -n ${GRUB_AUTOGEN} || -n ${GRUB_BOOTSTRAP} ]]; then
197 + python_setup
198 + else
199 + export PYTHON=true
200 + fi
201 +
202 + if [[ -n ${GRUB_BOOTSTRAP} ]]; then
203 + eautopoint --force
204 + AUTOPOINT=: AUTORECONF=: ./bootstrap || die
205 + elif [[ -n ${GRUB_AUTOGEN} ]]; then
206 + ./autogen.sh || die
207 + fi
208 +
209 + if [[ -n ${GRUB_AUTORECONF} ]]; then
210 + eautoreconf
211 + fi
212 +}
213 +
214 +grub_do() {
215 + multibuild_foreach_variant run_in_build_dir "$@"
216 +}
217 +
218 +grub_do_once() {
219 + multibuild_for_best_variant run_in_build_dir "$@"
220 +}
221 +
222 +grub_configure() {
223 + local platform
224 +
225 + case ${MULTIBUILD_VARIANT} in
226 + efi*) platform=efi ;;
227 + xen-pvh) platform=xen_pvh ;;
228 + xen*) platform=xen ;;
229 + guessed) ;;
230 + *) platform=${MULTIBUILD_VARIANT} ;;
231 + esac
232 +
233 + case ${MULTIBUILD_VARIANT} in
234 + *-32)
235 + if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
236 + local CTARGET=i386
237 + fi ;;
238 + *-64)
239 + if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
240 + local CTARGET=x86_64
241 + local -x TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
242 + local -x TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
243 + fi ;;
244 + esac
245 +
246 + local myeconfargs=(
247 + --disable-werror
248 + --program-prefix=
249 + --libdir="${EPREFIX}"/usr/lib
250 + $(use_enable device-mapper)
251 + $(use_enable mount grub-mount)
252 + $(use_enable nls)
253 + $(use_enable themes grub-themes)
254 + $(use_enable truetype grub-mkfont)
255 + $(use_enable libzfs)
256 + $(use_enable sdl grub-emu-sdl)
257 + ${platform:+--with-platform=}${platform}
258 +
259 + # Let configure detect this where supported
260 + $(usex efiemu '' '--disable-efiemu')
261 + )
262 +
263 + if use fonts; then
264 + ln -rs "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die
265 + fi
266 +
267 + if use themes; then
268 + ln -rs "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die
269 + fi
270 +
271 + local ECONF_SOURCE="${S}"
272 + econf "${myeconfargs[@]}"
273 +}
274 +
275 +src_configure() {
276 + # Bug 508758.
277 + replace-flags -O3 -O2
278 +
279 + # Workaround for bug 829165.
280 + filter-ldflags -pie
281 +
282 + # We don't want to leak flags onto boot code.
283 + export HOST_CCASFLAGS=${CCASFLAGS}
284 + export HOST_CFLAGS=${CFLAGS}
285 + export HOST_CPPFLAGS=${CPPFLAGS}
286 + export HOST_LDFLAGS=${LDFLAGS}
287 + unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
288 +
289 + tc-ld-disable-gold #439082 #466536 #526348
290 + export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}"
291 + unset LDFLAGS
292 +
293 + tc-export CC NM OBJCOPY RANLIB STRIP
294 + tc-export BUILD_CC BUILD_PKG_CONFIG
295 +
296 + MULTIBUILD_VARIANTS=()
297 + local p
298 + for p in "${GRUB_ALL_PLATFORMS[@]}"; do
299 + use "grub_platforms_${p}" && MULTIBUILD_VARIANTS+=( "${p}" )
300 + done
301 + [[ ${#MULTIBUILD_VARIANTS[@]} -eq 0 ]] && MULTIBUILD_VARIANTS=( guessed )
302 + grub_do grub_configure
303 +}
304 +
305 +src_compile() {
306 + # Sandbox bug 404013.
307 + use libzfs && addpredict /etc/dfs:/dev/zfs
308 +
309 + grub_do emake
310 + use doc && grub_do_once emake -C docs html
311 +}
312 +
313 +src_test() {
314 + # The qemu dependency is a bit complex.
315 + # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
316 + grub_do emake check
317 +}
318 +
319 +src_install() {
320 + grub_do emake install DESTDIR="${D}" bashcompletiondir="$(get_bashcompdir)"
321 + use doc && grub_do_once emake -C docs install-html DESTDIR="${D}"
322 +
323 + einstalldocs
324 +
325 + insinto /etc/default
326 + newins "${FILESDIR}"/grub.default-3 grub
327 +
328 + # https://bugs.gentoo.org/231935
329 + dostrip -x /usr/lib/grub
330 +}
331 +
332 +pkg_postinst() {
333 + elog "For information on how to configure GRUB2 please refer to the guide:"
334 + elog " https://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
335 +
336 + if has_version 'sys-boot/grub:0'; then
337 + elog "A migration guide for GRUB Legacy users is available:"
338 + elog " https://wiki.gentoo.org/wiki/GRUB2_Migration"
339 + fi
340 +
341 + if [[ -z ${REPLACING_VERSIONS} ]]; then
342 + elog
343 + optfeature "detecting other operating systems (grub-mkconfig)" sys-boot/os-prober
344 + optfeature "creating rescue media (grub-mkrescue)" dev-libs/libisoburn
345 + optfeature "enabling RAID device detection" sys-fs/mdadm
346 + fi
347 +
348 + if has_version sys-boot/os-prober; then
349 + ewarn "Due to security concerns, os-prober is disabled by default."
350 + ewarn "Set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub to enable it."
351 + fi
352 +}