blob: 66488715d5a0150cc37cb42eb7d83ddd4265ac7f (
plain) (
tree)
|
|
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=grub
pkgver=2.04
pkgrel=4
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 fuse-dev linux-headers lvm2-dev python3
unifont xz
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 $pkgname-mount"
# 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"
source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
adelie-branding.patch
fix-gcc-no-pie-specs.patch
grub2-accept-empty-module.patch
grub-xen-host_grub.cfg
default-grub
update-grub
quirk-01_radeon_agpmode
"
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
for i in "$srcdir"/quirk-*; do
install -Dm755 "$i" \
"$pkgdir"/etc/grub-quirks.d/"${i##"$srcdir"/quirk-}"
done
mkdir -p "$pkgdir"/etc/easy-boot.d
ln -s ../../usr/sbin/update-grub \
"$pkgdir"/etc/easy-boot.d/50-grub
}
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 (IEEE-1275 OpenFirmware 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/
}
mount() {
pkgdesc="Utility to mount filesystems using GRUB modules"
depends="$pkgname"
mkdir -p "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/bin/grub-mount "$subpkgdir"/usr/bin/
}
sha512sums="9c15c42d0cf5d61446b752194e3b628bb04be0fe6ea0240ab62b3d753784712744846e1f7c3651d8e0968d22012e6d713c38c44936d4004ded3ca4d4007babbb grub-2.04.tar.xz
4a6c909a1150b057fb0563f7a0646db33e16f84d6a8c443ef7db4003efd56c211a52f87699c5c95a6ccde65f6db46a8711a5b784f38479db804938dfe3115439 adelie-branding.patch
f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 fix-gcc-no-pie-specs.patch
6e001762f7f562f2fafed56118079122e7602c731c70723241276f523e0882a3930d720fd847143d379ffd85626d2d7d3fa914590c0de1f0903a293695e71c41 grub2-accept-empty-module.patch
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
1cb675fa0af9a1fd8d1a868e3e9de3bfef7eada66c5df0cfef23eca33e93e676eed6e1f67c679690f3e581565b350a9f3ba01aa9b89de66c970ea61ca21bcd65 default-grub
8e5f1cf91da9fd956695438509bb26e45f38170ca90d99a996e859053d72c82b7e4b02cb8979f047fc53498036f47b5400bf54687c390793995a05ded4216d55 update-grub
78b7ec141a364994c7de181e47fedca820add9960c56c7adf4c14ee11d5249a0887fd788ecd5d24b9bdd102b7c40395181e2f7c3fe5ab795dd7c0057ba1115c5 quirk-01_radeon_agpmode"
|