Files

76 lines
3.6 KiB
Bash

# This is the recipe.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
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
# Fix building with GNU EFI 4.x.x
patch -Np1 -i "$BPM_WORKDIR"/0001-gnu-efi-4-compat.patch
# Fix objcopy target options
patch -Np1 -i "$BPM_WORKDIR"/0002-fix-target-option.patch
# Remove the path prefix from the css reference, so that the css can live in the same directory
sed -e 's|../Styles/||g' -i docs/refind/*.html
# Hardcode RefindDir, so that refind-install can find refind_x64.efi
sed -e 's|RefindDir=\"\$ThisDir/refind\"|RefindDir="/usr/share/refind/"|g' -i refind-install
# add vendor line to the sbat file
printf 'refind.%s,%s,%s,refind,%s,%s\n' 'tide' '1' 'Tide Linux' "${epoch:+${epoch}:}${BPM_PKG_VERSION}" 'https://git.enumerated.dev/tidelinux/refind' >> refind-sbat.csv
# Enable TideLinux kernel name matching in the default configuration file
sed -E 's/^#(extra_kernel_version_strings).*$/\1 "linux-stable,linux-lts,linux-mainline"/' -i refind.conf-sample
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
unset CFLGAS CXXFLAGS CPPFLAGS LDFLAGS
make
make gptsync
make fs
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
# Install EFI binaries
install -Dm644 refind/*.efi -t "$BPM_OUTPUT"/usr/share/refind/
install -Dm644 drivers_*/*.efi -t "$BPM_OUTPUT"/usr/share/refind/drivers_x64/
install -Dm644 gptsync/*.efi -t "$BPM_OUTPUT"/usr/share/refind/tools_x64/
# Install sample config
install -Dm644 refind.conf-sample -t "$BPM_OUTPUT"/usr/share/refind/
# Install refind keys
install -Dm644 keys/*{cer,crt} -t "$BPM_OUTPUT"/usr/share/refind/keys/
# Create keys directory
install -dm700 "$BPM_OUTPUT"/etc/refind.d/keys
# Install fonts
install -Dm644 fonts/*.png -t "$BPM_OUTPUT"/usr/share/refind/fonts/
# Install icons
install -Dm644 icons/*.png -t "$BPM_OUTPUT"/usr/share/refind/icons
install -Dm644 icons/svg/*.svg -t "$BPM_OUTPUT"/usr/share/refind/icons/svg/
# Install scripts
install -Dm755 {refind-{install,mkdefault,sb-healthcheck},mkrlconf,mvrefind} -t "$BPM_OUTPUT"/usr/bin/
install -Dm755 fonts/mkfont.sh "$BPM_OUTPUT"/usr/bin/refind-mkfont
# Install man pages
install -Dm644 docs/man/*.8 -t "$BPM_OUTPUT"/usr/share/man/man8/
# Install documentation
install -Dm644 docs/refind/*.{html,png,svg,txt} -t "$BPM_OUTPUT"/usr/share/doc/refind/html/
install -Dm644 docs/Styles/*.css -t "$BPM_OUTPUT"/usr/share/doc/refind/html/
install -Dm644 images/refind-banner.{png,svg} -t "$BPM_OUTPUT"/usr/share/doc/refind/html/
install -Dm644 {CREDITS,NEWS,README}.txt -t "$BPM_OUTPUT"/usr/share/doc/refind/
install -Dm644 fonts/README.txt "$BPM_OUTPUT"/usr/share/doc/refind/README.refind-mkfont.txt
install -Dm644 icons/README "$BPM_OUTPUT"/usr/share/doc/refind/README.icons.txt
install -Dm644 keys/README.txt "$BPM_OUTPUT"/usr/share/doc/refind/README.keys.txt
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE.txt "$BPM_OUTPUT"/usr/share/licenses/refind/LICENSE.txt
}