2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-11-15 11:10:08 -07:00
repo/core/grub/build
Dylan Araps 0d1aa38232
grub: correctly strip -march=native
Turns out grub also uses CXXFLAGS.
2020-09-13 22:16:06 +03:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/sh -e
# 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' ./*/Makefile.in
# Strip '-march' from 'CFLAGS' as per advice from upstream.
# Fixes build fails on specific hardware.
CFLAGS=$(printf %s "$CFLAGS" | sed 's/-march=[^ ]*//g')
CFLAGS=$(printf %s "$CXXFLAGS" | sed 's/-march=[^ ]*//g')
# Grub is built in a function so the script argument
# needs to be stored.
pkg_dir=$1
build_grub() (
cd "grub-${1##*=}"
./configure \
--prefix=/usr \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--disable-werror \
--disable-nls \
--disable-grub-mkfont \
--disable-grub-mount \
"$@"
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.
(
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
)