diff options
Diffstat (limited to 'sys-boot/grub/grub-9999.ebuild')
-rw-r--r-- | sys-boot/grub/grub-9999.ebuild | 104 |
1 files changed, 87 insertions, 17 deletions
diff --git a/sys-boot/grub/grub-9999.ebuild b/sys-boot/grub/grub-9999.ebuild index a00a605..2d41728 100644 --- a/sys-boot/grub/grub-9999.ebuild +++ b/sys-boot/grub/grub-9999.ebuild @@ -2,9 +2,6 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: $ -# FIXME: somehow depend on python-2 only; using python eclass maybe? -# NOTE: good idea would be to move grub-2 to new package called grub2 - EAPI=4 if [[ ${PV} == "9999" ]] ; then @@ -29,6 +26,12 @@ SLOT="0" [[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~x86" IUSE="custom-cflags debug device-mapper nls static sdl truetype" +GRUB_PLATFORMS="coreboot efi emu ieee1275 pc qemu yeeloong" +for i in ${GRUB_PLATFORMS}; do + IUSE+=" grub_platform_${i}" +done +unset i + # os-prober: Used on runtime to detect other OSes # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue RDEPEND=" @@ -59,23 +62,34 @@ QA_EXECSTACK=" bin/grub-fstest " -DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO ) +grub_run_phase() { + local phase=$1 + local platform=$2 + [[ -z ${phase} ]] && die "${FUNCNAME}: Phase is undefined" + [[ -z ${platform} ]] && die "${FUNCNAME}: Platform is undefined" -src_prepare() { - epatch_user + [[ -d "${WORKDIR}/build-${platform}" ]] || \ + { mkdir "${WORKDIR}/build-${platform}" || die ; } + pushd "${WORKDIR}/build-${platform}" > /dev/null || die - # autogen.sh does more than just run autotools - if [[ ${PV} == "9999" ]] ; then - sed -i -e '/^autoreconf/ d' autogen.sh || die - (. ./autogen.sh) || die - eautoreconf - fi + echo ">>> Running ${phase} for platform \"${platform}\"" + echo ">>> Working in: \"${WORKDIR}/build-${platform}\"" + + grub_${phase} ${platform} + + popd > /dev/null || die } -src_configure() { - use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS - use static && append-ldflags -static +grub_src_configure() { + local platform=$1 + [[ -z ${platform} ]] && die "${FUNCNAME}: Platform is undefined" + + [[ ${platform} == "guessed" ]] \ + && platform="" \ + || platform="--with-platform=${platform}" + + ECONF_SOURCE="${WORKDIR}/${P}/" \ econf \ --disable-werror \ --sbindir=/sbin \ @@ -87,12 +101,68 @@ src_configure() { $(use_enable nls) \ $(use_enable debug mm-debug) \ $(use sdl && use_enable debug grub-emu-sdl) \ - $(use_enable debug grub-emu-usb) + $(use_enable debug grub-emu-usb) \ + ${platform} +} + +grub_src_compile() { + default_src_compile +} + +grub_src_install() { + default_src_install +} + +src_prepare() { + local i + + epatch_user + + # autogen.sh does more than just run autotools + if [[ ${PV} == "9999" ]] ; then + sed -i -e '/^autoreconf/ d' autogen.sh || die + (. ./autogen.sh) || die + eautoreconf + fi + + # get enabled platforms + GRUB_ENABLED_PLATFORMS="" + for i in ${GRUB_PLATFORMS}; do + use grub_platform_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}" + done +} + +src_configure() { + local i + + use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS + use static && append-ldflags -static + + [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && grub_run_phase ${FUNCNAME} guessed + for i in ${GRUB_ENABLED_PLATFORMS}; do + grub_run_phase ${FUNCNAME} ${i} + done +} + +src_compile() { + local i + + [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && grub_run_phase ${FUNCNAME} guessed + for i in ${GRUB_ENABLED_PLATFORMS}; do + grub_run_phase ${FUNCNAME} ${i} + done } src_install() { - default + local i + + [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && grub_run_phase ${FUNCNAME} guessed + for i in ${GRUB_ENABLED_PLATFORMS}; do + grub_run_phase ${FUNCNAME} ${i} + done + # can't be in docs array as we use defualt_src_install in different builddir + dodoc AUTHORS ChangeLog NEWS README THANKS TODO insinto /etc/default newins "${FILESDIR}"/grub.default grub cat <<-EOF >> "${D}"/lib*/grub/grub-mkconfig_lib |