f9986ed5d4
[ci skip]
190 lines
5.3 KiB
Bash
190 lines
5.3 KiB
Bash
# Template file for 'grub'
|
|
pkgname=grub
|
|
version=2.02
|
|
revision=4
|
|
hostmakedepends="flex freetype-devel"
|
|
makedepends="libusb-compat-devel ncurses-devel freetype-devel
|
|
liblzma-devel device-mapper-devel font-unifont-bdf fuse-devel"
|
|
depends="os-prober"
|
|
conf_files="/etc/default/grub /etc/grub.d/*"
|
|
short_desc="GRand Unified Bootloader 2"
|
|
maintainer="Juan RP <xtraeme@voidlinux.org>"
|
|
license="GPL-3"
|
|
homepage="https://www.gnu.org/software/grub/"
|
|
distfiles="${GNU_SITE}/grub/grub-${version}.tar.xz"
|
|
checksum=810b3798d316394f94096ec2797909dbf23c858e48f7b3830826b8daa06b7b0f
|
|
|
|
archs="i686* x86_64* aarch64* ppc ppc-musl ppc64*"
|
|
nopie=yes
|
|
|
|
subpackages="grub-utils"
|
|
# _SUPPLEMENTARY_BUILDS is a list of <TARGET>-<PLATFORN> version of grub to build
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
x86_64*)
|
|
_NATIVE_PLATFORM=pc
|
|
_SUPPLEMENTARY_BUILDS="i386-efi x86_64-efi"
|
|
subpackages+=" grub-i386-efi grub-x86_64-efi"
|
|
;;
|
|
i686*)
|
|
CFLAGS="-D_FILE_OFFSET_BITS=64"
|
|
configure_args+=" ac_cv_sizeof_off_t=8"
|
|
_NATIVE_PLATFORM=pc
|
|
_SUPPLEMENTARY_BUILDS="i386-efi"
|
|
subpackages+=" grub-i386-efi"
|
|
;;
|
|
aarch64*)
|
|
_NATIVE_PLATFORM=efi
|
|
subpackages+=" grub-arm64-efi"
|
|
;;
|
|
ppc*)
|
|
_NATIVE_PLATFORM=ieee1275
|
|
subpackages+=" grub-powerpc-ieee1275"
|
|
;;
|
|
esac
|
|
|
|
post_extract() {
|
|
sed -i -e 's,freetype/ftsynth.h,freetype2/ftsynth.h,' util/grub-mkfont.c
|
|
}
|
|
|
|
do_configure() {
|
|
unset CC AS LD RANLIB CPP
|
|
CFLAGS="$CFLAGS -fno-stack-protector"
|
|
|
|
configure_args+=" --enable-device-mapper --enable-cache-stats --enable-nls
|
|
--enable-grub-mkfont --enable-grub-mount --disable-werror
|
|
--sbindir=/usr/bin"
|
|
|
|
# fix unifont.bdf location so grub-mkfont can create *.pf2 files
|
|
sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|' configure
|
|
|
|
# build tools
|
|
_configure_args=${configure_args}
|
|
if [ -n "${_NATIVE_PLATFORM}" ]; then
|
|
_configure_args="--with-platform=${_NATIVE_PLATFORM} ${_configure_args}"
|
|
fi
|
|
msg_normal "Configuring grub tools...\n"
|
|
mkdir $wrksrc/build
|
|
cd $wrksrc/build
|
|
../configure --host=${XBPS_TARGET_MACHINE} ${_configure_args}
|
|
|
|
for _SUPP_BUILD in ${_SUPPLEMENTARY_BUILDS}; do
|
|
_TARGET=${_SUPP_BUILD%%-*}
|
|
_PLATFORM=${_SUPP_BUILD##*-}
|
|
msg_normal "Configuring ${_TARGET} ${_PLATFORM} grub...\n"
|
|
mkdir $wrksrc/${_PLATFORM}_${_TARGET}_build
|
|
cd $wrksrc/${_PLATFORM}_${_TARGET}_build
|
|
../configure --host=${XBPS_TARGET_MACHINE} --target=${_TARGET} --with-platform=${_PLATFORM} ${configure_args} \
|
|
--disable-efiemu \
|
|
--libdir=/usr/lib
|
|
done
|
|
}
|
|
|
|
do_build() {
|
|
# XXX remove the strip wrapper
|
|
rm ${XBPS_WRAPPERDIR}/strip
|
|
|
|
msg_normal "Building grub tools...\n"
|
|
cd $wrksrc/build
|
|
make ${makejobs} &> make.log || tail -n100 make.log
|
|
|
|
for _SUPP_BUILD in ${_SUPPLEMENTARY_BUILDS}; do
|
|
_TARGET=${_SUPP_BUILD%%-*}
|
|
_PLATFORM=${_SUPP_BUILD##*-}
|
|
msg_normal "Building ${_TARGET} ${_PLATFORM} grub...\n"
|
|
cd $wrksrc/${_PLATFORM}_${_TARGET}_build
|
|
make ${makejobs} &> make.log || tail -n100 make.log
|
|
done
|
|
}
|
|
|
|
do_install() {
|
|
# XXX remove the strip wrapper
|
|
rm ${XBPS_WRAPPERDIR}/strip
|
|
|
|
for _SUPP_BUILD in ${_SUPPLEMENTARY_BUILDS}; do
|
|
_TARGET=${_SUPP_BUILD%%-*}
|
|
_GRUB_TARGET=${_TARGET}
|
|
case "${_GRUB_TARGET}" in
|
|
aarch64*)
|
|
_GRUB_TARGET=arm64
|
|
;;
|
|
esac
|
|
_PLATFORM=${_SUPP_BUILD##*-}
|
|
cd $wrksrc/${_PLATFORM}_${_TARGET}_build
|
|
make DESTDIR=$DESTDIR/${_PLATFORM}_${_TARGET} install
|
|
# Remove non-platform specific files
|
|
rm -rf ${DESTDIR}/${_PLATFORM}_${_TARGET}/{boot,etc,usr/{share,bin}}
|
|
rm -f ${DESTDIR}/${_PLATFORM}_${_TARGET}/usr/lib/grub/${_GRUB_TARGET}-${_PLATFORM}/${_GRUB_TARGET}-*
|
|
rm -f ${DESTDIR}/${_PLATFORM}_${_TARGET}/usr/lib/grub/${_GRUB_TARGET}-${_PLATFORM}/*.{module,image}
|
|
cp -r ${DESTDIR}/${_PLATFORM}_${_TARGET}/* ${DESTDIR}
|
|
rm -rf ${DESTDIR}/${_PLATFORM}_${_TARGET}
|
|
done
|
|
|
|
cd $wrksrc/build
|
|
make DESTDIR=$DESTDIR install
|
|
|
|
# Required to compress info files.
|
|
vmkdir usr/share/info
|
|
touch -f ${DESTDIR}/usr/share/info/dir
|
|
|
|
vinstall ${FILESDIR}/grub.default 644 etc/default grub
|
|
# Kernel hooks.
|
|
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
|
|
etc/kernel.d/post-install 50-grub
|
|
vinstall ${FILESDIR}/kernel.d/grub.post 750 \
|
|
etc/kernel.d/post-remove 50-grub
|
|
|
|
# update-grub for noobs.
|
|
printf "#!/bin/sh\ngrub-mkconfig -o /boot/grub/grub.cfg\nexit \$?\n" >> \
|
|
${DESTDIR}/usr/bin/update-grub
|
|
chmod 755 ${DESTDIR}/usr/bin/update-grub
|
|
|
|
vmkdir usr/share/bash-completion/completions
|
|
mv ${DESTDIR}/etc/bash_completion.d/grub \
|
|
${DESTDIR}/usr/share/bash-completion/completions
|
|
|
|
# Remove useless tools
|
|
rm ${DESTDIR}/usr/bin/grub-ofpathname
|
|
rm ${DESTDIR}/usr/bin/grub-sparc64-setup
|
|
}
|
|
|
|
grub-utils_package() {
|
|
short_desc+=" - additional utilities"
|
|
depends="grub>=${version}"
|
|
pkg_install() {
|
|
vmove usr/bin/grub-menulst2cfg
|
|
vmove usr/bin/grub-fstest
|
|
vmove usr/bin/grub-mkfont
|
|
}
|
|
}
|
|
grub-x86_64-efi_package() {
|
|
archs=noarch
|
|
depends="grub>=$version dosfstools efibootmgr"
|
|
short_desc+=" - x86_64 EFI support"
|
|
pkg_install() {
|
|
vmove usr/lib/grub/x86_64-efi
|
|
}
|
|
}
|
|
grub-i386-efi_package() {
|
|
archs=noarch
|
|
depends="grub>=$version dosfstools efibootmgr"
|
|
short_desc+=" - i386 EFI support"
|
|
pkg_install() {
|
|
vmove usr/lib/grub/i386-efi
|
|
}
|
|
}
|
|
grub-arm64-efi_package() {
|
|
archs=noarch
|
|
depends="grub>=$version dosfstools efibootmgr"
|
|
short_desc+=" - arm64 EFI support"
|
|
pkg_install() {
|
|
vmove usr/lib/grub/arm64-efi
|
|
}
|
|
}
|
|
grub-powerpc-ieee1275_package() {
|
|
archs=noarch
|
|
depends="grub>=$version powerpc-utils"
|
|
short_desc+=" - powerpc Open Firmware support"
|
|
pkg_install() {
|
|
vmove usr/lib/grub/powerpc-ieee1275
|
|
}
|
|
}
|