| # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| # Distributed under the terms of the GNU General Public License v2 |
| |
| EAPI=5 |
| CROS_WORKON_COMMIT="a910c096139769e35720174069e81e89bf90fdc6" |
| CROS_WORKON_TREE="e67e7bd1e5eab3eb5cb6643599eb7d5d12c20ddd" |
| CROS_WORKON_REPO="https://cos.googlesource.com" |
| CROS_WORKON_PROJECT="cos/cobble" |
| CROS_WORKON_LOCALNAME="../platform/cobble" |
| CROS_WORKON_SUBTREE="grub-lakitu" |
| |
| inherit autotools eutils toolchain-funcs multiprocessing cros-workon |
| |
| DESCRIPTION="GNU GRUB 2 boot loader" |
| HOMEPAGE="http://www.gnu.org/software/grub/" |
| LICENSE="GPL-3" |
| SLOT="0" |
| KEYWORDS="-* amd64" |
| IUSE="" |
| |
| DEPEND="dev-lang/python" |
| |
| export STRIP_MASK="*.img *.mod *.module" |
| |
| # The ordering doesn't seem to matter. |
| PLATFORMS=( "efi" ) |
| TARGETS=( "${CHOST}" ) |
| |
| src_unpack() { |
| cros-workon_src_unpack |
| S="${WORKDIR}/${P}/grub-lakitu" |
| } |
| |
| src_prepare() { |
| default |
| sed -i -e /autoreconf/d autogen.sh || die |
| bash autogen.sh || die |
| autopoint() { :; } |
| eautoreconf -vi |
| } |
| |
| src_configure() { |
| local platform target |
| # Fix timestamps to prevent unnecessary rebuilding |
| find "${S}" -exec touch -r "${S}/configure" {} + |
| multijob_init |
| for platform in "${PLATFORMS[@]}" ; do |
| for target in "${TARGETS[@]}" ; do |
| # Grub does not search for clang when choosing a cross-compiler; it |
| # only searches for gcc, egcs, and cc (in that order). To work |
| # around this, explicitly set TARGET_CC to the compiler type in CC. |
| export TARGET_CC="${target}-${CC#"${CHOST}-"}" |
| mkdir -p ${target}-${platform}-build |
| pushd ${target}-${platform}-build >/dev/null |
| # GRUB defaults to a --program-prefix set based on target |
| # platform; explicitly set it to nothing to install unprefixed |
| # tools. https://savannah.gnu.org/bugs/?39818 |
| ECONF_SOURCE="${S}" multijob_child_init econf_build \ |
| --disable-werror \ |
| --disable-grub-mkfont \ |
| --disable-grub-mount \ |
| --disable-device-mapper \ |
| --disable-efiemu \ |
| --disable-libzfs \ |
| --disable-nls \ |
| --sbindir=/sbin \ |
| --bindir=/bin \ |
| --libdir=/$(get_libdir) \ |
| --with-platform=${platform} \ |
| --build=${CBUILD} \ |
| --host=${CBUILD} \ |
| --target=${target} \ |
| --prefix="${D}" |
| popd >/dev/null |
| done |
| done |
| multijob_finish |
| } |
| |
| src_compile() { |
| local platform target |
| multijob_init |
| for platform in "${PLATFORMS[@]}" ; do |
| for target in "${TARGETS[@]}" ; do |
| multijob_child_init \ |
| emake -C ${target}-${platform}-build -j1 |
| done |
| done |
| multijob_finish |
| } |
| |
| src_install() { |
| local platform target |
| # The installations have several file conflicts that prevent |
| # parallel installation. |
| for platform in "${PLATFORMS[@]}" ; do |
| for target in "${TARGETS[@]}" ; do |
| emake -C ${target}-${platform}-build DESTDIR="${D}" \ |
| install |
| done |
| done |
| "${D}/bin/grub-mkimage" -O x86_64-efi \ |
| -p "(hd0,gpt12)/efi/boot" \ |
| -c "${FILESDIR}/grub.cfg" \ |
| -d "${D}/$(get_libdir)/grub/x86_64-efi" \ |
| -o "${S}/grub-lakitu.efi" \ |
| part_gpt gptpriority test fat ext2 normal boot \ |
| efi_gop configfile search search_fs_uuid search_label \ |
| terminal echo serial linuxefi tpm |
| rm -Rf "${D}"/* |
| insinto /boot/efi/boot |
| doins "grub-lakitu.efi" |
| } |