blob: 24e998e531e4bd59a313510c95efadf5c49da6f7 (
plain) (
blame)
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
|
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=grub
pkgver=2.02
pkgrel=8
pkgdesc="Bootloader with support for Linux, Multiboot and more"
url="https://www.gnu.org/software/grub/"
arch="all !s390x"
# strip handled by grub Makefiles, abuild strip breaks xen pv-grub
options="!check !strip" # Cannot test boot loader.
license="GPL-3.0+"
depends=""
makedepends="bison flex freetype-dev linux-headers lvm2-dev python3 xz unifont
automake autoconf libtool"
# [22:02] <@awilfox> [[sroracle]]: grub breaks without its locale files present
# [22:02] <@awilfox> it cannot be split
subpackages="$pkgname-dev $pkgname-doc"
# currently grub only builds on x86*, aarch64 and ppc* systems
flavors=""
case "$CARCH" in
x86 | pmmx) flavors="efi bios";;
x86_64) flavors="efi bios xenhost";;
aarch64|arm*) flavors="efi";;
ppc*) flavors="ieee1275"; makedepends="$makedepends powerpc-utils" ;;
s390x) flavors="emu" ;;
esac
for f in $flavors; do
subpackages="$subpackages $pkgname-$f"
done
install="$pkgname.post-upgrade"
triggers="$pkgname.trigger=/boot"
source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
fix-gcc-no-pie-specs.patch
grub2-accept-empty-module.patch
grub-xen-host_grub.cfg
the-arch-everyone-uses-and-nobody-loves.patch
x86_64_asm.patch
default-grub
update-grub
"
prepare() {
default_prepare
autoreconf -vif
}
_build_flavor() {
local flavor="$1"
shift
local _configure="$@"
case $CTARGET_ARCH in
ppc64) export CFLAGS="-O2 -ggdb -mcpu=970 -mno-altivec";; # Workaround for http://savannah.gnu.org/bugs/?52629
esac
msg "Building grub for platform $flavor"
mkdir -p "$srcdir"/build-$flavor
cd "$srcdir"/build-$flavor
$builddir/configure \
--build=$CBUILD \
--host=$CHOST \
--target=$CTARGET \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--localstatedir=/var \
--disable-nls \
--disable-werror \
$_configure
make
}
build() {
local f
for f in $flavors; do
case "$f" in
bios) _build_flavor $f --with-platform=pc;;
efi) _build_flavor $f --with-platform=efi --disable-efiemu;;
xenhost) _build_flavor $f --with-platform=xen;;
*) _build_flavor $f --with-platform=$f;;
esac
done
}
_install_xen() {
grub_dir=`mktemp -d`
cfg=`mktemp`
grub_memdisk=`mktemp`
mkdir -p $grub_dir/boot/grub
echo 'normal (memdisk)/grub.cfg' > $cfg
sed -e "s/@@PVBOOT_ARCH@@/$CARCH/g" \
$srcdir/grub-xen-host_grub.cfg \
> $grub_dir/grub.cfg
tar -cf - -C $grub_dir grub.cfg > $grub_memdisk
./grub-mkimage \
-O $CARCH-xen \
-c $cfg \
-d ./grub-core ./grub-core/*.mod \
-m $grub_memdisk \
-o $pkgdir/grub-$CARCH-xen.bin
rm -r "$grub_dir"
rm "$cfg" "$grub_memdisk"
}
_install_flavor() {
local flavor="$1"
cd "$srcdir"/build-$flavor
case $flavor in
xenhost) _install_xen;;
*) make DESTDIR="$pkgdir" install-strip;;
esac
}
package() {
# install BIOS & EFI version into the same directory
# and overwrite similar files.
for f in $flavors; do
_install_flavor $f
done
rm -f "$pkgdir"/usr/lib/charset.alias
install -D -m644 "$srcdir"/default-grub "$pkgdir"/etc/default/grub
install -D -m755 "$srcdir"/update-grub "$pkgdir"/usr/sbin
# remove grub-install warning of missing directory
mkdir -p "$pkgdir"/usr/share/locale
}
bios() {
pkgdesc="$pkgdesc (BIOS version)"
depends="$pkgname"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-pc $subpkgdir/usr/lib/grub/
}
efi() {
pkgdesc="$pkgdesc (EFI version)"
depends="$pkgname efibootmgr efivar"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-efi $subpkgdir/usr/lib/grub/
}
xenhost() {
pkgdesc="$pkgdesc (XEN host version)"
mkdir -p $subpkgdir/usr/lib/grub-xen
mv $pkgdir/*-xen.bin $subpkgdir/usr/lib/grub-xen/
}
ieee1275() {
pkgdesc="$pkgdesc (IEEE1275 version)"
depends="$pkgname powerpc-utils"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-ieee1275 $subpkgdir/usr/lib/grub/
}
emu() {
pkgdesc="$pkgdesc (EMU version)"
depends="$pkgname"
mkdir -p $subpkgdir/usr/lib/grub
mv $pkgdir/usr/lib/grub/*-emu $subpkgdir/usr/lib/grub/
}
sha512sums="cc6eb0a42b5c8df2f671cc128ff725afb3ff1f8832a196022e433cf0d3b75decfca2316d0aa5fabea75747d55e88f3d021dd93508563f8ca80fd7b9e7fe1f088 grub-2.02.tar.xz
f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 fix-gcc-no-pie-specs.patch
2fefc6d5c1388dba6d368451f47c216171136f03891e87777ee392884d7ef53c70b2a2565af676237216565f203f62b79aec0d1a82979b21aa29c4ebf87ac566 grub2-accept-empty-module.patch
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
088455205f2f397d60e43eab19ed73994880ea1f442661f7975846cceaf2b112d92fd1341119d7dbfad3af2174dfd4d4721f31dead1ac35f4a3cb7c0d92f8a04 the-arch-everyone-uses-and-nobody-loves.patch
8752b5e689ec3b7e1f438c7207adc517d7acb4f7d15fda2907bc9177883a686f23994c66641bfc0c7620365415972b5d8b74f511c13dd234f5f3461dda4bb445 x86_64_asm.patch
af771faa02dcc56a0842c6b5244030d0778c80c365c6cafa7ed255346fb2d67e7e95cbb7bcdabe75c96d73ee8a1c9dd6f30e2feac708e621a64fee858b09db51 default-grub
f08e29cb8bc344d62e37ffe003a74c1316c19aa329a4c2af94c99bfc90cb2968a37811244a7617cf1f1c393119f6398200d094b7758c19583cca390630c106ec update-grub"
|