Files
grub/source.sh
T

55 lines
2.3 KiB
Bash

# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
DOWNLOAD="https://ftp.gnu.org/gnu/grub/grub-${BPM_PKG_VERSION}.tar.xz"
UNIFONT_VERSION=13.0.06
DOWNLOAD_FONT="https://unifoundry.com/pub/unifont/unifont-13.0.06/font-builds/unifont-${UNIFONT_VERSION}.pcf.gz"
FILENAME="${DOWNLOAD##*/}"
FILENAME_FONT="${DOWNLOAD##*/}"
# The prepare function is executed in the root of the temp directory
# This function is used for downloading files and putting them into the correct location
prepare() {
wget "$DOWNLOAD"
wget "$DOWNLOAD_FONT" -O unifont.pcf.gz
tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE"
mkdir -p "$BPM_OUTPUT"/usr/share/fonts/unifont/
gunzip -c unifont.pcf.gz > "$BPM_OUTPUT"/usr/share/fonts/unifont/unifont.pcf
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
unset {C,CPP,CXX,LD}FLAGS
echo depends bli part_gpt > grub-core/extra_deps.lst
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-efiemu \
--disable-werror \
--disable-efiemu \
--enable-grub-mkfont \
--with-platform=efi \
--target=x86_64
make
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make DESTDIR="$BPM_OUTPUT" install
# Install bash completions
install -dm755 "$BPM_OUTPUT"/usr/share/bash-completion/completions/
mv "$BPM_OUTPUT"/etc/bash_completion.d/grub "$BPM_OUTPUT"/usr/share/bash-completion/completions
# Install grub default file
install -Dm644 "$BPM_WORKDIR"/grub.default "$BPM_OUTPUT"/etc/default/grub
# Install BPM hook
install -Dm644 "$BPM_WORKDIR"/20-grub.bpmhook "$BPM_OUTPUT"/var/lib/bpm/hooks/20-grub.bpmhook
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/grub/COPYING
}