Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 543840
Collapse All | Expand All

(-)a/sys-boot/grub/Manifest (+10 lines)
Line 0 Link Here
1
AUX grub-2.00_musl.patch 1728 SHA256 9efd0a83291ed49c30dc82dcc6347ab99c021e7d21e376fbf53f9a5628f6419b SHA512 699aea7d70d62705555c73eb7391c6f8b0b209a2662e21aed886c03c7ae80e9f8023c94434ec5a9c5ec125d8b6bf76b0d506b1b6efe887f216d5e3351d3b5ae8 WHIRLPOOL aaf4cd72019363d27a010766ddf187c46ef9fc9dc55d3cd423d8a501fb807e7d1f8188710825fa2ce4b10acb69ddfcd9b80c9a95b8ad860155e037e4770c72c7
2
AUX grub-2.02-musl-no-error.h.patch 998 SHA256 d17d074f0ee51b9baff417bafdf5a63c96e33ab74aade4ac86ed753c24dec115 SHA512 51278d3c08cb06ed43759d5030df5229b618d6a4bc158f3b98a605ebacfac5172d871518563769987fe857d1730b37d78f84ae09edbd706edbb86860e794d80e WHIRLPOOL 59f9a9a22742a245e5d5d4f993bcbbd17700d975e51b37d71882c7d41b933c2e7d93f8451fc75d9556ad9fa35d1193941895ef4eeda0957d2fff02e2f1ff0a10
3
AUX grub.conf.gentoo 591 SHA256 e656b5716d6a5904a035960b460494431d8c1327df51fcd9ffb39243425fe142 SHA512 23036b9e558b604082d9ae8c848f18ea552181416937e3ef62287e53c38086b8d7ffef0e67d04af04f05f5b23c6da7aaf1f1f23e0ee1cffd5dbd5320e8648cb1 WHIRLPOOL 184284cac00bc039d36c5b2f8d7be0f425e75ba904c4c04c2ec531a094cd191c42cb7382276e73a5d176e1661dcdd1bdc5e3806b9d7abe9b38563575ecb6ee76
4
AUX grub.default-2 1602 SHA256 d1c11fb4decbae9a9827866ec2126b2c11a3d8f6b41278acad139b4dd34338c5 SHA512 15085cdfe706379d931c6841c34403ffcb46765be75425a29b563d69169124447606d8f8444945ed1148ac734da4f12f14a9b18abd6b0501974c1c770ad13c39 WHIRLPOOL 2f72b2a3d4048261cf3d5477b9a33264b3214a803eebcf4b782c33cf71d045e9be878407c64c720c2a7b260a65f8e32a61974c55ebd8d464e0b947133cdf49fd
5
AUX grub.default-3 2189 SHA256 9632dad421161562dd3f2535f173b6c91741168232d9ef97af894377545e86d4 SHA512 5537884998a3a6f9d1bd926aabd33bd017e953594539dc85791aad0dc5c996e40109092aa9937a7dff34294c17b831c22677a7727c3027bbf7a9e840907893e7 WHIRLPOOL eaa9d50e1884ccde412803c2e939d328d64e469f7d3345057ce71eeebbf1c7e19ff62063323f62c274b306c56884e85e0d134e5c0fcba3254b7c1d25440e9a3a
6
DIST dejavu-sans-ttf-2.34.zip 406977 SHA256 242e8c1cb2bdc7458bece02cca898f962c2bc919dcf67d97428149228290184d SHA512 dcd802b9c83cfa749b7542d0855eb1facb665a035af8c05f58830fce3ce37ba8d4a6f0353c07ae924c7fc25460d330b7312cbaffd34a2cb314a8e222de385c1b WHIRLPOOL d8b3289997cc39aca1c909ac1cae79727a19932f07b116a4a0bcc83e4a2f136d05d18c8ef2b05504a2f1f65eba85f93d61d52b0c913be7bb3e23f6a403eb6a82
7
DIST grub-2.02_beta2-gentoo-r2.tar.xz 14200 SHA256 a8033930576386cda0b86c4e487a652f9556b2068d5ce4988619868112ddf732 SHA512 dc375eb3b3f79c2205fe3528d13693c2d2d0df95dd474e6b737f3cec66be8fc8a139f83254289c27abf1640f73f1fa769c21dc6214ba68fd6eeb116a402bdb55 WHIRLPOOL 93686f4fabf41318b4b01c2969f55644dc2978407da999bdd296713e974ac36f5de11a0e7b3e00588a90c03b36777b49fb7a79988d89b9436f582064faad17ec
8
DIST grub-2.02~beta2.tar.xz 5798740 SHA256 f6c702b2a8ea58f27a2b02928bb77973cb5a827af08f63db38c471c0a01b418d SHA512 359903928febce1df53b3bd38aab701b4ea010dfad0dee434e853c865af4bbc60d115e61eac100c79f18d89aa78b2216ef20123f4ef04cc948ecbe226ea1a58c WHIRLPOOL f92e94f43888648484a972a0c82b0a2ac4dc7fbdd6e35ca8b11a6ee92168ac8cf7ee68987b84697ec46ad18189e5c5c9aee8105b91bb131cd7f6f499f45cd58f
9
DIST unifont-7.0.06.pcf.gz 1359006 SHA256 acf516b464928244c25dd1afddd02f6f459686b5135685694d875d7eca8bf4f2 SHA512 a62f21366b51a582d2b5a66710c8a6183bc869407867da78e59ecec9dabcff7a2522a8bc454cf511592d336befea812d36622589ef119160fe3014d927fa11b3 WHIRLPOOL 9f431f9b6af23a87e3291e5c66d6f1e56f8c8ce23222821dbf41aa03edac4d80e8e6c5895c024951cf199d41904e6c9f830103427568a9b0386f68adc0a959d7
10
EBUILD grub-2.02_beta2-r7.ebuild 8405 SHA256 0df4fb66bf9f1eed83108e346c7cf119252b11ffff051f566bfa2c789fdac944 SHA512 fb923c5324c78b2614867198ece5ce5dd89e54777c8c691e6eef7efb4ead896e6402bca31de1eac842044c37b728c722b146f1dd96f9de894274508eaf25727b WHIRLPOOL 174f8b45516e5c0904823cc5f6ec0b905f5c83adcbc64a24c0300ede97faafff08a1d6fe5f1877509267808d5c3d0001fc524af3a6ebcd1703c739403c1a78ac
(-)a/sys-boot/grub/files/grub-2.02-musl-no-error.h.patch (+40 lines)
Line 0 Link Here
1
diff -Naur a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c
2
--- a/grub-core/kern/emu/hostdisk.c	2012-06-25 04:32:04.000000000 -0400
Line 0 Link Here
1
diff --git a/configure.ac b/configure.ac
2
index e4369ce..f699dec 100644
3
--- a/configure.ac
4
+++ b/configure.ac
5
@@ -382,6 +382,7 @@ fi
6
 # Check for functions and headers.
7
 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
8
 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
9
+AC_CHECK_HEADERS([error.h])
10
 
11
 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
12
 #include <sys/param.h>
13
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
14
index 43471b4..2a8ddd7 100644
15
--- a/grub-core/kern/emu/misc.c
16
+++ b/grub-core/kern/emu/misc.c
17
@@ -20,7 +20,21 @@
18
 #include <config.h>
19
 
20
 #include <errno.h>
21
+
22
+#if defined(HAVE_ERROR_H)
23
 #include <error.h>
24
+#else
25
+#include <err.h>
26
+#include <string.h>
27
+#define _musl_error(S, E, F, ...) do { \
28
+	if (E) \
29
+		err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
30
+	else \
31
+		err(S, F, ##__VA_ARGS__); \
32
+} while(0)
33
+#define error _musl_error
34
+#endif
35
+
36
 #include <stdio.h>
37
 #include <stdlib.h>
38
 #include <stdint.h>
(-)a/sys-boot/grub/files/grub.conf.gentoo (+16 lines)
Line 0 Link Here
1
# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
2
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
3
# If you are not using Genkernel and you need help creating this file, you
4
# should consult the handbook. Alternatively, consult the grub.conf.sample that
5
# is included with the Grub documentation.
6
7
default 0
8
timeout 30
9
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
10
11
#title Gentoo Linux 3.8.13
12
#root (hd0,0)
13
#kernel /boot/kernel-genkernel-x86-3.8.13-gentoo root=/dev/sda3
14
#initrd /boot/initramfs-genkernel-x86-3.8.13
15
16
# vim:ft=conf:
(-)a/sys-boot/grub/files/grub.default-2 (+46 lines)
Line 0 Link Here
1
# Copyright 1999-2013 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.4 2013/09/21 18:10:55 floppym Exp $
4
#
5
# To populate all changes in this file you need to regenerate your
6
# grub configuration file afterwards:
7
#     'grub2-mkconfig -o /boot/grub/grub.cfg'
8
#
9
# See the grub info page for documentation on possible variables and
10
# their associated values. 
11
12
GRUB_DISTRIBUTOR="Gentoo"
13
14
GRUB_DEFAULT=0
15
GRUB_HIDDEN_TIMEOUT=0
16
GRUB_HIDDEN_TIMEOUT_QUIET=true
17
GRUB_TIMEOUT=10
18
19
# Append parameters to the linux kernel command line
20
# GRUB_CMDLINE_LINUX=""
21
22
# Append parameters to the linux kernel command line for non-recovery entries
23
#GRUB_CMDLINE_LINUX_DEFAULT=""
24
25
# Uncomment to disable graphical terminal (grub-pc only)
26
#GRUB_TERMINAL=console
27
28
# The resolution used on graphical terminal.
29
# Note that you can use only modes which your graphic card supports via VBE.
30
# You can see them in real GRUB with the command `vbeinfo'.
31
#GRUB_GFXMODE=640x480
32
33
# Path to theme spec txt file.
34
# The starfield is by default provided with use truetype.
35
# NOTE: when enabling custom theme, ensure you have required font/etc.
36
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"
37
38
# Background image used on graphical terminal.
39
# Can be in various bitmap formats.
40
#GRUB_BACKGROUND="/boot/grub/mybackground.png"
41
42
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
43
#GRUB_DISABLE_LINUX_UUID=true
44
45
# Uncomment to disable generation of recovery mode menu entries
46
#GRUB_DISABLE_RECOVERY=true
(-)a/sys-boot/grub/files/grub.default-3 (+63 lines)
Line 0 Link Here
1
# Copyright 1999-2014 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-3,v 1.4 2014/10/16 04:04:02 floppym Exp $
4
#
5
# To populate all changes in this file you need to regenerate your
6
# grub configuration file afterwards:
7
#     'grub2-mkconfig -o /boot/grub/grub.cfg'
8
#
9
# See the grub info page for documentation on possible variables and
10
# their associated values.
11
12
GRUB_DISTRIBUTOR="Gentoo"
13
14
# Default menu entry
15
#GRUB_DEFAULT=0
16
17
# Boot the default entry this many seconds after the menu is displayed
18
#GRUB_TIMEOUT=5
19
#GRUB_TIMEOUT_STYLE=menu
20
21
# Append parameters to the linux kernel command line
22
#GRUB_CMDLINE_LINUX=""
23
#
24
# Examples:
25
#
26
# Boot with network interface renaming disabled
27
# GRUB_CMDLINE_LINUX="net.ifnames=0"
28
#
29
# Boot with systemd instead of sysvinit (openrc)
30
# GRUB_CMDLINE_LINUX="init=/usr/lib/systemd/systemd"
31
32
# Append parameters to the linux kernel command line for non-recovery entries
33
#GRUB_CMDLINE_LINUX_DEFAULT=""
34
35
# Uncomment to disable graphical terminal (grub-pc only)
36
#GRUB_TERMINAL=console
37
38
# The resolution used on graphical terminal.
39
# Note that you can use only modes which your graphic card supports via VBE.
40
# You can see them in real GRUB with the command `vbeinfo'.
41
#GRUB_GFXMODE=640x480
42
43
# Set to 'text' to force the Linux kernel to boot in normal text
44
# mode, 'keep' to preserve the graphics mode set using
45
# 'GRUB_GFXMODE', 'WIDTHxHEIGHT'['xDEPTH'] to set a particular
46
# graphics mode, or a sequence of these separated by commas or
47
# semicolons to try several modes in sequence.
48
#GRUB_GFXPAYLOAD_LINUX=
49
50
# Path to theme spec txt file.
51
# The starfield is by default provided with use truetype.
52
# NOTE: when enabling custom theme, ensure you have required font/etc.
53
#GRUB_THEME="/boot/grub/themes/starfield/theme.txt"
54
55
# Background image used on graphical terminal.
56
# Can be in various bitmap formats.
57
#GRUB_BACKGROUND="/boot/grub/mybackground.png"
58
59
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
60
#GRUB_DISABLE_LINUX_UUID=true
61
62
# Uncomment to disable generation of recovery mode menu entries
63
#GRUB_DISABLE_RECOVERY=true
(-)a/sys-boot/grub/grub-2.02_beta2-r7.ebuild (-1 / +328 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2015 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-2.02_beta2-r7.ebuild,v 1.10 2015/03/17 18:51:49 floppym Exp $
4
5
EAPI=5
6
7
AUTOTOOLS_AUTORECONF=1
8
GRUB_AUTOGEN=1
9
10
if [[ -n ${GRUB_AUTOGEN} ]]; then
11
	PYTHON_COMPAT=( python{2_6,2_7,3_2,3_3,3_4} )
12
	inherit python-any-r1
13
fi
14
15
inherit autotools-utils bash-completion-r1 eutils flag-o-matic mount-boot multibuild pax-utils toolchain-funcs versionator
16
17
if [[ ${PV} != 9999 ]]; then
18
	if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
19
		# The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
20
		MY_P=${P/_/'~'}
21
		SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz
22
			http://dev.gentoo.org/~floppym/dist/${P}-gentoo-r2.tar.xz"
23
		S=${WORKDIR}/${MY_P}
24
	else
25
		SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
26
			http://dev.gentoo.org/~floppym/dist/${P}.tar.xz"
27
		S=${WORKDIR}/${P%_*}
28
	fi
29
	KEYWORDS="amd64 x86"
30
	PATCHES=()
31
else
32
	inherit git-r3
33
	EGIT_REPO_URI="git://git.sv.gnu.org/grub.git
34
		http://git.savannah.gnu.org/r/grub.git"
35
fi
36
37
DEJAVU=dejavu-sans-ttf-2.34
38
UNIFONT=unifont-7.0.06
39
SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz )
40
	themes? ( mirror://sourceforge/dejavu/${DEJAVU}.zip )"
41
42
DESCRIPTION="GNU GRUB boot loader"
43
HOMEPAGE="http://www.gnu.org/software/grub/"
44
45
# Includes licenses for dejavu and unifont
46
LICENSE="GPL-3 fonts? ( GPL-2-with-font-exception ) themes? ( BitstreamVera )"
47
SLOT="2"
48
IUSE="debug device-mapper doc efiemu +fonts mount +multislot nls static sdl test +themes truetype libzfs"
49
50
GRUB_ALL_PLATFORMS=(
51
	# everywhere:
52
	emu
53
	# mips only:
54
	qemu-mips loongson
55
	# amd64, x86, ppc, ppc64:
56
	ieee1275
57
	# amd64, x86:
58
	coreboot multiboot efi-32 pc qemu xen
59
	# amd64, ia64:
60
	efi-64
61
)
62
IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
63
64
REQUIRED_USE="
65
	grub_platforms_coreboot? ( fonts )
66
	grub_platforms_qemu? ( fonts )
67
	grub_platforms_ieee1275? ( fonts )
68
	grub_platforms_loongson? ( fonts )
69
"
70
71
# os-prober: Used on runtime to detect other OSes
72
# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
73
RDEPEND="
74
	app-arch/xz-utils
75
	>=sys-libs/ncurses-5.2-r5
76
	debug? (
77
		sdl? ( media-libs/libsdl )
78
	)
79
	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
80
	libzfs? ( sys-fs/zfs )
81
	mount? ( sys-fs/fuse )
82
	truetype? ( media-libs/freetype:2= )
83
	ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
84
	ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
85
"
86
DEPEND="${RDEPEND}
87
	${PYTHON_DEPS}
88
	app-misc/pax-utils
89
	sys-devel/flex
90
	sys-devel/bison
91
	sys-apps/help2man
92
	sys-apps/texinfo
93
	fonts? ( media-libs/freetype:2 )
94
	grub_platforms_xen? ( app-emulation/xen-tools )
95
	static? (
96
		app-arch/xz-utils[static-libs(+)]
97
		truetype? (
98
			app-arch/bzip2[static-libs(+)]
99
			media-libs/freetype[static-libs(+)]
100
			sys-libs/zlib[static-libs(+)]
101
		)
102
	)
103
	test? (
104
		dev-libs/libisoburn
105
		app-emulation/qemu
106
	)
107
	themes? (
108
		app-arch/unzip
109
		media-libs/freetype:2
110
	)
111
"
112
RDEPEND+="
113
	kernel_linux? (
114
		grub_platforms_efi-32? ( sys-boot/efibootmgr )
115
		grub_platforms_efi-64? ( sys-boot/efibootmgr )
116
	)
117
	!multislot? ( !sys-boot/grub:0 )
118
	nls? ( sys-devel/gettext )
119
"
120
121
DEPEND+=" !!=media-libs/freetype-2.5.4"
122
123
STRIP_MASK="*/grub/*/*.{mod,img}"
124
RESTRICT="test"
125
126
QA_EXECSTACK="
127
	usr/bin/grub*-emu*
128
	usr/lib*/grub/*/*.mod
129
	usr/lib*/grub/*/*.module
130
	usr/lib*/grub/*/kernel.exec
131
	usr/lib*/grub/*/kernel.img
132
"
133
134
QA_WX_LOAD="
135
	usr/lib*/grub/*/kernel.exec
136
	usr/lib*/grub/*/kernel.img
137
	usr/lib*/grub/*/*.image
138
"
139
140
QA_PRESTRIPPED="
141
	usr/lib.*/grub/.*/kernel.img
142
"
143
144
src_unpack() {
145
	if [[ ${PV} == 9999 ]]; then
146
		git-r3_src_unpack
147
	fi
148
	default_src_unpack
149
}
150
151
src_prepare() {
152
	EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch
153
154
	[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
155
156
	sed -i -e /autoreconf/d autogen.sh || die
157
158
	if use multislot; then
159
		# fix texinfo file name, bug 416035
160
		sed -i -e 's/^\* GRUB:/* GRUB2:/' -e 's/(grub)/(grub2)/' docs/grub.texi || die
161
	fi
162
163
	epatch_user
164
165
	epatch "${FILESDIR}/grub-2.02-musl-no-error.h.patch"
166
167
	if [[ -n ${GRUB_AUTOGEN} ]]; then
168
		python_setup
169
		bash autogen.sh || die
170
	fi
171
172
	#if [[ -n ${AUTOTOOLS_AUTORECONF} ]]; then
173
		autopoint() { return 0; }
174
		eautoreconf
175
	#fi
176
}
177
178
setup_fonts() {
179
	ln -s "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die
180
	if use themes; then
181
		ln -s "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die
182
	fi
183
}
184
185
grub_configure() {
186
	local platform
187
188
	case ${MULTIBUILD_VARIANT} in
189
		efi-32)
190
			platform=efi
191
			if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
192
				local CTARGET=${CTARGET:-i386}
193
			fi ;;
194
		efi-64)
195
			platform=efi
196
			if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
197
				local CTARGET=${CTARGET:-x86_64}
198
				local TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
199
				local TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
200
				export TARGET_CFLAGS TARGET_CPPFLAGS
201
			fi ;;
202
		guessed) ;;
203
		*)	platform=${MULTIBUILD_VARIANT} ;;
204
	esac
205
206
	local myeconfargs=(
207
		--disable-werror
208
		--program-prefix=
209
		--libdir="${EPREFIX}"/usr/lib
210
		--htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
211
		$(use_enable debug mm-debug)
212
		$(use_enable debug grub-emu-usb)
213
		$(use_enable device-mapper)
214
		$(use_enable mount grub-mount)
215
		$(use_enable nls)
216
		$(use_enable themes grub-themes)
217
		$(use_enable truetype grub-mkfont)
218
		$(use_enable libzfs)
219
		$(use sdl && use_enable debug grub-emu-sdl)
220
		${platform:+--with-platform=}${platform}
221
222
		# Let configure detect this where supported
223
		$(usex efiemu '' '--disable-efiemu')
224
	)
225
226
	if use multislot; then
227
		myeconfargs+=( --program-transform-name="s,grub,grub2," )
228
	fi
229
230
	mkdir -p "${BUILD_DIR}" || die
231
	run_in_build_dir setup_fonts
232
233
	autotools-utils_src_configure
234
}
235
236
src_configure() {
237
	# Bug 508758.
238
	replace-flags -O3 -O2
239
240
	# We don't want to leak flags onto boot code.
241
	export HOST_CCASFLAGS=${CCASFLAGS}
242
	export HOST_CFLAGS=${CFLAGS}
243
	export HOST_CPPFLAGS=${CPPFLAGS}
244
	export HOST_LDFLAGS=${LDFLAGS}
245
	unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
246
247
	use static && HOST_LDFLAGS+=" -static"
248
249
	tc-ld-disable-gold #439082 #466536 #526348
250
	export TARGET_LDFLAGS+=" ${LDFLAGS}"
251
	unset LDFLAGS
252
253
	tc-export CC NM OBJCOPY STRIP
254
	export TARGET_CC=${TARGET_CC:-${CC}}
255
	tc-export BUILD_CC # Bug 485592
256
257
	# Portage will take care of cleaning up GRUB_PLATFORMS
258
	MULTIBUILD_VARIANTS=( ${GRUB_PLATFORMS:-guessed} )
259
	multibuild_parallel_foreach_variant grub_configure
260
}
261
262
src_compile() {
263
	# Sandbox bug 404013.
264
	use libzfs && addpredict /etc/dfs:/dev/zfs
265
266
	multibuild_foreach_variant autotools-utils_src_compile
267
268
	use doc && multibuild_for_best_variant \
269
		autotools-utils_src_compile -C docs html
270
}
271
272
src_test() {
273
	# The qemu dependency is a bit complex.
274
	# You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
275
	multibuild_foreach_variant autotools-utils_src_test
276
}
277
278
src_install() {
279
	multibuild_foreach_variant autotools-utils_src_install \
280
		bashcompletiondir="$(get_bashcompdir)"
281
282
	local grub=grub
283
	if use multislot; then
284
		grub=grub2
285
		mv "${ED%/}"/usr/share/info/grub{,2}.info || die
286
		mv "${ED%/}"/$(get_bashcompdir)/grub{,2} || die
287
	fi
288
289
	bashcomp_alias ${grub} ${grub}-{install,set-default,mkrescue,reboot,script-check,editenv,sparc64-setup,mkfont,mkpasswd-pbkdf2,mkimage,bios-setup,mkconfig,probe}
290
291
	use doc && multibuild_for_best_variant run_in_build_dir \
292
		emake -C docs DESTDIR="${D}" install-html
293
294
	insinto /etc/default
295
	newins "${FILESDIR}"/grub.default-3 grub
296
}
297
298
pkg_postinst() {
299
	mount-boot_mount_boot_partition
300
301
	if [[ -e "${ROOT%/}/boot/grub2/grub.cfg"  ]]; then
302
		ewarn "The grub directory has changed from /boot/grub2 to /boot/grub."
303
		ewarn "Please run grub2-install and grub2-mkconfig -o /boot/grub/grub.cfg."
304
305
		if [[ ! -e "${ROOT%/}/boot/grub/grub.cfg" ]]; then
306
			mkdir -p "${ROOT%/}/boot/grub"
307
			ln -s ../grub2/grub.cfg "${ROOT%/}/boot/grub/grub.cfg"
308
		fi
309
	fi
310
311
	mount-boot_pkg_postinst
312
313
	elog "For information on how to configure GRUB2 please refer to the guide:"
314
	elog "    http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
315
316
	if has_version 'sys-boot/grub:0'; then
317
		elog "A migration guide for GRUB Legacy users is available:"
318
		elog "    https://wiki.gentoo.org/wiki/GRUB2_Migration"
319
	fi
320
321
	if [[ -z ${REPLACING_VERSIONS} ]]; then
322
		elog
323
		elog "You may consider installing the following optional packages:"
324
		optfeature "Detect other operating systems (grub-mkconfig)" sys-boot/os-prober
325
		optfeature "Create rescue media (grub-mkrescue)" dev-libs/libisoburn
326
		optfeature "Enable RAID device detection" sys-fs/mdadm
327
	fi
328
}

Return to bug 543840