# $Id$ PNAME="grub" PVER="0.97" PBUILD="r15" PCATEGORIE="sys-apps" STATE="unstable" DESCRIPTION="GNU GRUB boot loader." HOMEPAGE="http://www.gnu.org/software/grub/" DEPEND=">= sys-libs/ncurses-5.7" SDEPEND=">= sys-dev/automake-4 >= sys-dev/autoconf-5" SRCFILE="${PNAME}-${PVER}.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" MCORE_ONLY_KEEP="boot/* usr/sbin usr/bin" sminclude mtools mcore-split SRC_URI=( ftp://alpha.gnu.org/gnu/${PNAME}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-${PVER}-splash.patch mirror://${PNAME}/${PNAME}-${PVER}-pic.patch mirror://${PNAME}/${PNAME}-${PVER}-initrdmax.patch mirror://${PNAME}/${PNAME}-${PVER}-nxstack.patch mirror://${PNAME}/${PNAME}-${PVER}-unsigned-addresses.patch mirror://${PNAME}/${PNAME}-${PVER}-ext4-3.patch mirror://${PNAME}/${PNAME}-${PVER}-virtio-blk-support-2.patch ) # get only 0.xx versions! UP2DATE="updatecmd ftp://alpha.gnu.org/gnu/${PNAME} | grep -- -0.[0-9].* | lasttarball gz" # grub doesn't like CFLAG optimation, # and do you really want that at your bootloader ?? unset CFLAGS unset CXXFLAGS src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # splash support mpatch ${PNAME}-${PVER}-splash.patch || die # fix pic issues mpatch ${PNAME}-${PVER}-pic.patch || die # do not check initrdmax -> we are using more than 4mb mpatch ${PNAME}-${PVER}-initrdmax.patch || die # fix nx issues on x86_64 mpatch ${PNAME}-${PVER}-nxstack.patch || die # fix issues on systems with more than 2gb of ram mpatch ${PNAME}-${PVER}-unsigned-addresses.patch || die # disabled atm, - broken, needs rework # support booting from ext4 filesystems #mpatch ${PNAME}-${PVER}-ext4-3.patch || die # handle virtio_blk device names in grub-install mpatch ${PNAME}-${PVER}-virtio-blk-support-2.patch || die # rebuild makefiles autoreconf --install --force || die } src_compile() { cd ${SRCDIR} # fixes compilation on x86_64; grub cannot build natively on 64bit # building a static grub, with -m32 in this case if [[ ${ARCH} = x86_64 ]] then export CC="gcc -m32" export LDFLAGS="-static" fi mconfigure || die mmake || die } src_install() { cd ${SRCDIR} # needed directories minstalldir /boot/grub || die mmake DESTDIR=${BINDIR} install || die # stage file locations have changed to /usr/lib # now copying all stage files for i in ${BINDIR}/usr/$(mlibdir)/grub/*/* do [ -f ${i} ] && cp -p ${i} ${BINDIR}/boot/grub || die ${i} done } preinstall() { mount /boot &> /dev/null } postinstall() { # creates some essential links if [ ! -e ${MROOT}/boot/boot ] then ln -sf . ${MROOT}/boot/boot fi if [ ! -e ${MROOT}/boot/grub/menu.lst ] then ln -sf /boot/grub/grub.conf ${MROOT}/boot/grub/menu.lst fi # creates example grub.conf if [ ! -e ${MROOT}/boot/grub/grub.conf.example ] then cat > ${MROOT}/boot/grub/grub.conf.example << "EOF" default 0 timeout 30 title Magellan-Linux root (hd0,0) kernel (hd0,0)/boot/bzImage root=/dev/hda1 EOF fi # update grub grub --batch --device-map=/boot/grub/device.map &/dev/null; }