linamh/sys-boot/refit/refit-0.14.2.ebuild

89 lines
2.6 KiB
Bash

# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit eutils versionator
MY_P="${PN}_${PV}"
DESCRIPTION="graphical boot menu for ia32 and x64 EFI systems"
HOMEPAGE="http://refit.sourceforge.net/"
# tarballs use debian versioning format
MY_PN="refit"
MY_PVR=$(replace_version_separator 2 '-' )
MY_PV=${MY_PVR/-*/}
S="${WORKDIR}/${MY_PN}-${MY_PV}"
SRC_URI="https://cloudfront.debian.net/debian-archive/debian/pool/main/r/refit/${MY_PN}_${MY_PV}.orig.tar.gz
https://cloudfront.debian.net/debian-archive/debian/pool/main/r/refit/${MY_PN}_${MY_PVR}.debian.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=">=sys-boot/gnu-efi-0.3a
sys-boot/syslinux"
RDEPEND="sys-boot/efibootmgr
sys-fs/dosfstools"
src_prepare() {
for f in $(<"${WORKDIR}"/debian/patches/series) ; do
EPATCH_OPTS="-p1" epatch "${WORKDIR}"/debian/patches/$f
done
sed -e "s!\$(LIBEG)!!" -i refit/Makefile
}
src_compile() {
local iarch
case $ARCH in
x86) iarch=ia32 ;;
amd64) iarch=x86_64 ;;
*) die "unknown architecture: $ARCH" ;;
esac
# Generate include/syslinux_mbr.h
chmod +x "${WORKDIR}"/debian/mbr/mkmbrhdr.py
"${WORKDIR}"/debian/mbr/mkmbrhdr.py /usr/share/syslinux/mbr.bin > include/syslinux_mbr.h
# Move the AA font in place
cp -f "${WORKDIR}"/debian/font/egemb_font.h libeg/
# Build EFI applications don't add C/LDFLAGS
emake -C libeg SRCDIR="${S}"/libeg CC="$(tc-getCC)" ARCH=${iarch} || die
emake -C refit SRCDIR="${S}"/refit CC="$(tc-getCC)" ARCH=${iarch} DEBVER="${iarch} (Gentoo ${PVR})" || die
emake -C gptsync -f Makefile.gnuefi CC="$(tc-getCC)" SRCDIR="${S}"/gptsync ARCH=${iarch} || die
# Build the gptsync command-line utility
mkdir gptsync/buildux
emake -C gptsync/buildux -f ../Makefile.unix SRCDIR="${S}"/gptsync CC="$(tc-getCC)" \
CFLAGS="-Wall ${CFLAGS}" LDFLAGS="${LDFLAGS}" || die
}
src_install() {
dosbin gptsync/buildux/gptsync
dosbin gptsync/buildux/showpart
# install into the std location as used by other distributins
# the efi partititon is mounted into /boot/efi
# the efi bootloaders are installed into the EFI dir
# the dir name is upper case for Windows compatibility
# at the moment the onyl really supported filesystem on
# all efi bootloader in the efi partition is fat32
# (elilo, refit, grub-efi, ...)
insinto /usr/share/${PN}
doins refit/refit.efi
insinto /usr/share/${PN}/tools
doins gptsync/gptsync.efi
insinto /usr/share/${PN}/${PN}
doins -r icons
doins images/vollabel/refit.vollabel
doins refit.conf
doman gptsync/gptsync.8
doman "${WORKDIR}"/debian/showpart.8
}