2019-08-11 01:38:27 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2020-03-05 17:17:42 +00:00
|
|
|
# Grub expects Python but it isn't actually needed. Give
|
|
|
|
# it something fake so that configure passes.
|
|
|
|
export PYTHON=/bin/true
|
|
|
|
|
|
|
|
# Disable the post-python mv calls as a means of disabling
|
|
|
|
# the Python tooling. The /bin/true above will create a
|
|
|
|
# blank file, this prevents the blank file from overwriting
|
|
|
|
# the existing one.
|
|
|
|
sed -i 's/mv $@.new $@/:/g' grub/Makefile.in
|
|
|
|
|
2020-02-11 16:55:35 +00:00
|
|
|
# Strip '-march' from 'CFLAGS' as per advice from upstream.
|
|
|
|
# Fixes build fails on specific hardware.
|
2020-02-21 22:28:16 +00:00
|
|
|
CFLAGS=$(printf %s "$CFLAGS" | sed 's/-march=[^ ]*//g')
|
2020-02-11 16:55:35 +00:00
|
|
|
|
2020-02-21 22:26:55 +00:00
|
|
|
# Grub is built in a function so the script argument
|
2020-02-11 16:55:35 +00:00
|
|
|
# needs to be stored.
|
2019-08-11 01:38:27 +00:00
|
|
|
pkg_dir=$1
|
|
|
|
|
|
|
|
build_grub() (
|
2019-09-07 15:14:04 +00:00
|
|
|
cp -a grub "grub-${1##*=}"
|
2019-08-11 01:38:27 +00:00
|
|
|
cd "grub-${1##*=}"
|
|
|
|
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sbindir=/usr/bin \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--disable-werror \
|
2020-03-05 16:39:48 +00:00
|
|
|
--disable-nls \
|
2019-08-18 02:18:05 +00:00
|
|
|
--disable-grub-mkfont \
|
|
|
|
--disable-grub-mount \
|
2019-08-11 01:38:27 +00:00
|
|
|
"$@"
|
|
|
|
|
|
|
|
make
|
|
|
|
make DESTDIR="$pkg_dir" install
|
|
|
|
)
|
|
|
|
|
|
|
|
build_grub --with-platform=pc
|
|
|
|
build_grub --with-platform=efi --disable-efiemu
|
|
|
|
|
|
|
|
install -Dm0644 grub.default "$1/etc/default/grub"
|
|
|
|
|
|
|
|
# Remove gdb debugging files.
|
|
|
|
(
|
2019-09-07 15:14:04 +00:00
|
|
|
cd "$pkg_dir/usr/lib"
|
|
|
|
|
|
|
|
rm -f grub/*/*.module
|
|
|
|
rm -f grub/*/*.image
|
|
|
|
rm -f grub/*/kernel.exec
|
|
|
|
rm -f grub/*/gdb_grub
|
|
|
|
rm -f grub/*/gmodule.pl
|
|
|
|
)
|
2020-05-11 16:26:32 +00:00
|
|
|
|
|
|
|
rm -rf "$1/usr/share/info"
|