blob: 702f06683a274625eeae2961ff4f463792dff280 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# Copyright 2007 Bryan Østergaard <bryan.ostergaard@gmail.com>
# Distributed under the terms of the GNU General Public License v2
require gnu [ suffix=tar.xz ] \
flag-o-matic \
autotools [ supported_autoconf=[ 2.5 ] supported_automake=[ 1.16 1.15 ] ]
if ever is_scm ; then
DOWNLOADS=""
SCM_REPOSITORY="https://git.savannah.gnu.org/git/${PN}.git"
require scm-git
fi
export_exlib_phases pkg_setup src_prepare src_configure src_compile src_install
SUMMARY="GRUB (Grand Unified Boot) bootloader"
LICENCES="GPL-3"
MYOPTIONS="
device-mapper [[ description = [ Ability to detect and use device-mapper devices ] ]]
efi [[ description = [ Build EFI platform support ] ]]
grub-mount [[ description = [ FUSE driver for filesystems that GRUB understands ] ]]
mkfont [[ description = [ Build grub-mkfont which can create GRUB font files ] ]]
pc [[ description = [ Build PC platform support ] ]]
( providers: eudev systemd ) [[ number-selected = exactly-one ]]
( efi pc ) [[ number-selected = at-least-one ]]
"
# TODO: needs qemu-system-i386
RESTRICT="test"
DEPENDENCIES="
build:
sys-apps/help2man [[ note = [ man pages won't get created otherwise resulting in empty man dirs ] ]]
sys-devel/bison
sys-devel/flex[>=2.5.35]
sys-devel/make
device-mapper? ( sys-fs/lvm2 )
grub-mount? ( sys-fs/fuse:0 )
mkfont? (
fonts/unifont
media-libs/freetype:2
)
build+run:
app-arch/xz
sys-devel/gettext [[ note = [ required for grub-mkconfig, grep gettext in /etc/grub.d ] ]]
!sys-boot/grub-static [[ description = [ /sbin/grub-install collides ] resolution = manual ]]
providers:eudev? ( sys-apps/eudev )
providers:systemd? ( sys-apps/systemd )
run:
efi? ( sys-boot/efibootmgr )
suggestion:
sys-boot/os-prober [[
description = [ Ability to add other OSs automatically to grub.cfg via grub-mkconf ]
]]
"
AT_M4DIR=( m4 )
grub_pkg_setup() {
# grub2 should be compiled with -Os, other optimizations may result in oversized core images
replace-flags -O* -Os
# retpoline flag is incompatible with the -mcmodel=large flag used by grub
filter-flags -mindirect-branch=thunk
}
grub_src_prepare() {
edo sed \
-e "s/.*Running autoreconf.*/exit 0/" \
-i autogen.sh
edo ./autogen.sh
autotools_src_prepare
}
grub_src_multibuild_prepare() {
if option efi; then
cp -ax "${WORK}" "${WORK}"-efi
fi
if option pc; then
cp -ax "${WORK}" "${WORK}"-pc
fi
}
grub_src_configure() {
filter-flags -mfloat-abi=hard
unset CFLAGS CPPFLAGS LDFLAGS
grub_src_multibuild_prepare
if option efi; then
pushd "${WORK}"-efi
myconf=(
"CPP=${CC} -E"
BUILD_CC=$(exhost --build)-cc
BUILD_CFLAGS="$(print-build-flags CFLAGS)"
BUILD_CPPFLAGS="$(print-build-flags CPPFLAGS)"
BUILD_LDFLAGS="$(print-build-flags LDFLAGS)"
--with-bootdir=/boot
--with-grubdir=grub
--with-platform=efi
--enable-cache-stats
--disable-libzfs
--disable-werror
# TODO: for now disable emulation utils
--disable-efiemu
--disable-grub-emu-sdl
--disable-grub-emu-pci
--disable-mm-debug
gt_cv_func_gnugettext{1,2}_libc=yes
)
econf "${myconf[@]}" \
$(option_enable device-mapper) \
$(option_enable grub-mount) \
$(option_enable mkfont grub-mkfont)
fi
if option pc; then
pushd "${WORK}"-pc
myconf=(
"CPP=${CC} -E"
BUILD_CC=$(exhost --build)-cc
BUILD_CFLAGS="$(print-build-flags CFLAGS)"
BUILD_CPPFLAGS="$(print-build-flags CPPFLAGS)"
BUILD_LDFLAGS="$(print-build-flags LDFLAGS)"
--with-bootdir=/boot
--with-grubdir=grub
--with-platform=pc
--enable-cache-stats
--disable-libzfs
--disable-werror
# TODO: for now disable emulation utils
--disable-efiemu
--disable-grub-emu-sdl
--disable-grub-emu-pci
--disable-mm-debug
gt_cv_func_gnugettext{1,2}_libc=yes
)
econf "${myconf[@]}" \
$(option_enable device-mapper) \
$(option_enable grub-mount) \
$(option_enable mkfont grub-mkfont)
fi
}
grub_src_compile() {
if option efi; then
pushd "${WORK}"-efi
emake
fi
if option pc; then
pushd "${WORK}"-pc
emake
fi
}
grub_src_install() {
if option efi; then
pushd "${WORK}"-efi
emake DESTDIR="${IMAGE}" install
edo rm -rf "${WORK}"-efi
fi
if option pc; then
pushd "${WORK}"-pc
emake DESTDIR="${IMAGE}" install
edo rm -rf "${WORK}"-pc
fi
dodoc "${WORK}"/docs/grub.cfg
edo rm -f "${IMAGE}"/usr/$(exhost --target)/lib/charset.alias
edo rm "${IMAGE%/}"/etc/bash_completion.d/${PN}
edo rmdir "${IMAGE%/}"/etc/bash_completion.d/
}
|