3f0578579f
(Portage version: 2.2.0_alpha4/svn/Linux x86_64) git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@2745 6952d904-891a-0410-993b-d76249ca496b
166 lines
4.7 KiB
Bash
166 lines
4.7 KiB
Bash
# Copyright 1999-2010 Gentoo Foundation
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
# $Header: $
|
|
|
|
EAPI=2
|
|
|
|
inherit mount-efi 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_BASE="mirror://debian/pool/main/${MY_PN:0:1}/${MY_PN}/"
|
|
SRC_URI="${SRC_URI_BASE}${MY_PN}_${MY_PV}.orig.tar.gz
|
|
${SRC_URI_BASE}${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
|
|
}
|
|
|
|
setup_efi_dir() {
|
|
local boot_dir=$1
|
|
local dir=${boot_dir}
|
|
|
|
mkdir -p "${dir}"
|
|
dir="${dir}/refit"
|
|
if [[ ! -e ${dir} ]] ; then
|
|
mkdir -p "${dir}" || die "${dir} does not exist!"
|
|
fi
|
|
einfo "Copying files from /usr/share/refit to ${dir}"
|
|
for x in \
|
|
"${ROOT}"/usr/share/refit/* ; do
|
|
[[ -f ${x} ]] && cp -p "${x}" "${dir}"/
|
|
done
|
|
|
|
if [[ ! -e ${dir}/refit ]] ; then
|
|
mkdir -p "${dir}/refit" || die "${dir}/refit does not exist!"
|
|
fi
|
|
einfo "Copying files from /usr/share/refit/refit to ${dir}/refit"
|
|
for x in \
|
|
"${ROOT}"/usr/share/refit/refit/* ; do
|
|
[[ -f ${x} ]] && cp -p "${x}" "${dir}/refit/"
|
|
done
|
|
|
|
if [[ ! -e ${dir}/refit/icons/ ]] ; then
|
|
mkdir -p "${dir}/refit/icons/" || die "${dir}/refit/icons/ does not exist!"
|
|
fi
|
|
einfo "Copying files from /usr/share/refit/refit/icons to ${dir}/refit/icons"
|
|
for x in \
|
|
"${ROOT}"/usr/share/refit/refit/icons/* ; do
|
|
[[ -f ${x} ]] && cp -p "${x}" "${dir}/refit/icons/"
|
|
done
|
|
|
|
if [[ ! -e ${dir}/tools ]] ; then
|
|
mkdir -p "${dir}/tools/" || die "${dir}/tools/ does not exist!"
|
|
fi
|
|
einfo "Copying files from /usr/share/refit/tools to ${dir}/tools"
|
|
for x in \
|
|
"${ROOT}"/usr/share/refit/tools/* ; do
|
|
[[ -f ${x} ]] && cp -p "${x}" "${dir}/tools/"
|
|
done
|
|
|
|
}
|
|
|
|
pkg_postinst() {
|
|
if [[ -n ${DONT_MOUNT_EFI} ]]; then
|
|
elog "WARNING: you have DONT_MOUNT_EFI in effect, so you must apply"
|
|
elog "the following instructions for your /boot/efi!"
|
|
elog "Neglecting to do so may cause your system to fail to boot!"
|
|
elog
|
|
else
|
|
setup_efi_dir "${ROOT}"/boot/efi/EFI
|
|
# Trailing output because if this is run from pkg_postinst, it gets mixed into
|
|
# the other output.
|
|
einfo ""
|
|
fi
|
|
elog "To interactively install refit files to another device such as a USB"
|
|
elog "stick, just run the following and specify the directory as prompted:"
|
|
elog " emerge --config =${PF}"
|
|
elog "Alternately, you can export REFIT_ALT_INSTALLDIR=/path/to/use to tell"
|
|
elog "refit where to install in a non-interactive way."
|
|
|
|
}
|
|
|
|
pkg_config() {
|
|
local dir
|
|
if [ ! -d "${REFIT_ALT_INSTALLDIR}" ]; then
|
|
einfo "Enter the directory where you want to setup refit:"
|
|
read dir
|
|
else
|
|
dir="${REFIT_ALT_INSTALLDIR}"/EFI
|
|
fi
|
|
setup_efi_dir "${dir}"
|
|
}
|