| 1 |
floppym |
1.48 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
vapier |
1.1 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
scarabeus |
1.51 |
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.50 2012/02/29 01:52:22 floppym Exp $
|
| 4 |
vapier |
1.21 |
|
| 5 |
scarabeus |
1.37 |
EAPI=4
|
| 6 |
vapier |
1.1 |
|
| 7 |
|
|
if [[ ${PV} == "9999" ]] ; then
|
| 8 |
vapier |
1.29 |
EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
|
| 9 |
flameeyes |
1.45 |
LIVE_ECLASS="bzr"
|
| 10 |
vapier |
1.2 |
SRC_URI=""
|
| 11 |
flameeyes |
1.45 |
DO_AUTORECONF="true"
|
| 12 |
vapier |
1.2 |
else
|
| 13 |
scarabeus |
1.37 |
MY_P=${P/_/\~}
|
| 14 |
floppym |
1.50 |
if [[ ${PV} == *_alpha* || ${PV} == *_beta* ]]; then
|
| 15 |
|
|
SRC_URI="http://alpha.gnu.org/gnu/${PN}/${MY_P}.tar.xz"
|
| 16 |
|
|
else
|
| 17 |
|
|
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
|
| 18 |
scarabeus |
1.37 |
mirror://gentoo/${MY_P}.tar.xz"
|
| 19 |
floppym |
1.50 |
fi
|
| 20 |
vapier |
1.47 |
# Masked until documentation guys consolidate the guide and approve
|
| 21 |
|
|
# it for usage.
|
| 22 |
|
|
#KEYWORDS="~amd64 ~mips ~x86"
|
| 23 |
scarabeus |
1.37 |
S=${WORKDIR}/${MY_P}
|
| 24 |
vapier |
1.1 |
fi
|
| 25 |
|
|
|
| 26 |
floppym |
1.50 |
inherit eutils flag-o-matic pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
|
| 27 |
scarabeus |
1.37 |
unset LIVE_ECLASS
|
| 28 |
|
|
|
| 29 |
vapier |
1.32 |
DESCRIPTION="GNU GRUB boot loader"
|
| 30 |
vapier |
1.1 |
HOMEPAGE="http://www.gnu.org/software/grub/"
|
| 31 |
|
|
|
| 32 |
vapier |
1.4 |
LICENSE="GPL-3"
|
| 33 |
scarabeus |
1.37 |
SLOT="2"
|
| 34 |
floppym |
1.50 |
IUSE="custom-cflags debug device-mapper efiemu mount nls static sdl truetype libzfs"
|
| 35 |
scarabeus |
1.37 |
|
| 36 |
vapier |
1.47 |
GRUB_PLATFORMS=(
|
| 37 |
|
|
# everywhere:
|
| 38 |
|
|
emu
|
| 39 |
|
|
# mips only:
|
| 40 |
|
|
qemu-mips yeeloong
|
| 41 |
|
|
# amd64, x86, ppc, ppc64:
|
| 42 |
|
|
ieee1275
|
| 43 |
|
|
# amd64, x86:
|
| 44 |
|
|
coreboot multiboot efi-32 pc qemu
|
| 45 |
|
|
# amd64:
|
| 46 |
|
|
efi-64
|
| 47 |
|
|
)
|
| 48 |
|
|
IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
|
| 49 |
scarabeus |
1.37 |
|
| 50 |
|
|
# os-prober: Used on runtime to detect other OSes
|
| 51 |
|
|
# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
|
| 52 |
|
|
RDEPEND="
|
| 53 |
|
|
dev-libs/libisoburn
|
| 54 |
vapier |
1.18 |
dev-libs/lzo
|
| 55 |
scarabeus |
1.37 |
sys-boot/os-prober
|
| 56 |
|
|
>=sys-libs/ncurses-5.2-r5
|
| 57 |
vapier |
1.32 |
debug? (
|
| 58 |
|
|
sdl? ( media-libs/libsdl )
|
| 59 |
|
|
)
|
| 60 |
|
|
device-mapper? ( >=sys-fs/lvm2-2.02.45 )
|
| 61 |
floppym |
1.50 |
libzfs? ( sys-fs/zfs )
|
| 62 |
|
|
mount? ( sys-fs/fuse )
|
| 63 |
vapier |
1.24 |
truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
|
| 64 |
vapier |
1.9 |
DEPEND="${RDEPEND}
|
| 65 |
mattst88 |
1.35 |
>=dev-lang/python-2.5.2
|
| 66 |
scarabeus |
1.37 |
sys-devel/flex
|
| 67 |
vapier |
1.36 |
virtual/yacc
|
| 68 |
flameeyes |
1.45 |
sys-apps/texinfo
|
| 69 |
scarabeus |
1.37 |
"
|
| 70 |
flameeyes |
1.45 |
if [[ -n ${DO_AUTORECONF} ]] ; then
|
| 71 |
scarabeus |
1.37 |
DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
|
| 72 |
|
|
else
|
| 73 |
|
|
DEPEND+=" app-arch/xz-utils"
|
| 74 |
|
|
fi
|
| 75 |
|
|
|
| 76 |
floppym |
1.50 |
export STRIP_MASK="*/grub/*/*.{mod,img}"
|
| 77 |
|
|
|
| 78 |
scarabeus |
1.37 |
QA_EXECSTACK="
|
| 79 |
floppym |
1.50 |
usr/bin/grub*
|
| 80 |
|
|
usr/sbin/grub*
|
| 81 |
|
|
usr/lib*/grub/*/*.mod
|
| 82 |
|
|
usr/lib*/grub/*/kernel.exec
|
| 83 |
|
|
usr/lib*/grub/*/kernel.img
|
| 84 |
|
|
usr/lib*/grub/*/setjmp.module
|
| 85 |
scarabeus |
1.37 |
"
|
| 86 |
|
|
|
| 87 |
scarabeus |
1.41 |
QA_WX_LOAD="
|
| 88 |
floppym |
1.50 |
usr/lib*/grub/*/kernel.exec
|
| 89 |
|
|
usr/lib*/grub/*/kernel.img
|
| 90 |
|
|
usr/lib*/grub/*/*.image
|
| 91 |
|
|
"
|
| 92 |
|
|
|
| 93 |
|
|
QA_PRESTRIPPED="
|
| 94 |
|
|
usr/lib.*/grub/.*/kernel.img
|
| 95 |
scarabeus |
1.41 |
"
|
| 96 |
|
|
|
| 97 |
scarabeus |
1.37 |
grub_run_phase() {
|
| 98 |
|
|
local phase=$1
|
| 99 |
|
|
local platform=$2
|
| 100 |
|
|
[[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
|
| 101 |
|
|
|
| 102 |
|
|
[[ -d "${WORKDIR}/build-${platform}" ]] || \
|
| 103 |
|
|
{ mkdir "${WORKDIR}/build-${platform}" || die ; }
|
| 104 |
|
|
pushd "${WORKDIR}/build-${platform}" > /dev/null || die
|
| 105 |
|
|
|
| 106 |
|
|
echo ">>> Running ${phase} for platform \"${platform}\""
|
| 107 |
|
|
echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
|
| 108 |
vapier |
1.1 |
|
| 109 |
scarabeus |
1.37 |
grub_${phase} ${platform}
|
| 110 |
|
|
|
| 111 |
|
|
popd > /dev/null || die
|
| 112 |
|
|
}
|
| 113 |
|
|
|
| 114 |
|
|
grub_src_configure() {
|
| 115 |
|
|
local platform=$1
|
| 116 |
|
|
local target
|
| 117 |
floppym |
1.50 |
local transform="grub2"
|
| 118 |
|
|
local with_platform
|
| 119 |
scarabeus |
1.37 |
|
| 120 |
|
|
[[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
|
| 121 |
|
|
|
| 122 |
floppym |
1.50 |
if [[ ${platform} != "guessed" ]]; then
|
| 123 |
|
|
transform="grub2-${platform}"
|
| 124 |
|
|
fi
|
| 125 |
scarabeus |
1.37 |
|
| 126 |
|
|
# check if we have to specify the target (EFI)
|
| 127 |
|
|
# or just append correct --with-platform
|
| 128 |
floppym |
1.50 |
if [[ ${platform} == efi* ]]; then
|
| 129 |
|
|
# EFI platform hack
|
| 130 |
|
|
[[ ${platform/*-} == 32 ]] && target=i386
|
| 131 |
|
|
[[ ${platform/*-} == 64 ]] && target=x86_64
|
| 132 |
|
|
# program-prefix is required empty because otherwise it is equal to
|
| 133 |
|
|
# target variable, which we do not want at all
|
| 134 |
|
|
with_platform="
|
| 135 |
|
|
--with-platform=${platform/-*}
|
| 136 |
|
|
--target=${target}
|
| 137 |
|
|
--program-prefix=
|
| 138 |
|
|
"
|
| 139 |
|
|
elif [[ ${platform} != "guessed" ]]; then
|
| 140 |
|
|
with_platform=" --with-platform=${platform}"
|
| 141 |
scarabeus |
1.37 |
fi
|
| 142 |
|
|
|
| 143 |
floppym |
1.50 |
ECONF_SOURCE="${S}" \
|
| 144 |
scarabeus |
1.37 |
econf \
|
| 145 |
|
|
--disable-werror \
|
| 146 |
floppym |
1.50 |
--program-transform-name="s,grub,${transform}," \
|
| 147 |
|
|
--with-grubdir=grub2 \
|
| 148 |
scarabeus |
1.38 |
$(use_enable debug mm-debug) \
|
| 149 |
|
|
$(use_enable debug grub-emu-usb) \
|
| 150 |
scarabeus |
1.37 |
$(use_enable device-mapper) \
|
| 151 |
scarabeus |
1.38 |
$(use_enable efiemu) \
|
| 152 |
floppym |
1.50 |
$(use_enable mount grub-mount) \
|
| 153 |
scarabeus |
1.38 |
$(use_enable nls) \
|
| 154 |
scarabeus |
1.37 |
$(use_enable truetype grub-mkfont) \
|
| 155 |
floppym |
1.50 |
$(use_enable libzfs) \
|
| 156 |
scarabeus |
1.37 |
$(use sdl && use_enable debug grub-emu-sdl) \
|
| 157 |
floppym |
1.50 |
${with_platform}
|
| 158 |
scarabeus |
1.37 |
}
|
| 159 |
|
|
|
| 160 |
|
|
grub_src_compile() {
|
| 161 |
|
|
default_src_compile
|
| 162 |
floppym |
1.50 |
pax-mark -mpes "${grub_binaries[@]}"
|
| 163 |
scarabeus |
1.37 |
}
|
| 164 |
|
|
|
| 165 |
|
|
grub_src_install() {
|
| 166 |
|
|
default_src_install
|
| 167 |
|
|
}
|
| 168 |
vapier |
1.1 |
|
| 169 |
vapier |
1.33 |
src_prepare() {
|
| 170 |
floppym |
1.50 |
local i j
|
| 171 |
scarabeus |
1.37 |
|
| 172 |
vapier |
1.15 |
epatch_user
|
| 173 |
vapier |
1.7 |
|
| 174 |
flameeyes |
1.45 |
# fix texinfo file name, as otherwise the grub2.info file will be
|
| 175 |
|
|
# useless
|
| 176 |
|
|
sed -i \
|
| 177 |
|
|
-e '/setfilename/s:grub.info:grub2.info:' \
|
| 178 |
|
|
-e 's:(grub):(grub2):' \
|
| 179 |
floppym |
1.50 |
docs/grub.texi
|
| 180 |
flameeyes |
1.45 |
|
| 181 |
vapier |
1.7 |
# autogen.sh does more than just run autotools
|
| 182 |
flameeyes |
1.45 |
if [[ -n ${DO_AUTORECONF} ]] ; then
|
| 183 |
vapier |
1.33 |
sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
|
| 184 |
vapier |
1.17 |
(. ./autogen.sh) || die
|
| 185 |
|
|
fi
|
| 186 |
vapier |
1.34 |
|
| 187 |
|
|
# install into the right dir for eselect #372735
|
| 188 |
|
|
sed -i \
|
| 189 |
|
|
-e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
|
| 190 |
|
|
util/bash-completion.d/Makefile.in || die
|
| 191 |
scarabeus |
1.37 |
|
| 192 |
|
|
# get enabled platforms
|
| 193 |
|
|
GRUB_ENABLED_PLATFORMS=""
|
| 194 |
vapier |
1.47 |
for i in ${GRUB_PLATFORMS[@]}; do
|
| 195 |
scarabeus |
1.37 |
use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
|
| 196 |
|
|
done
|
| 197 |
|
|
[[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
|
| 198 |
scarabeus |
1.44 |
elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
|
| 199 |
vapier |
1.6 |
}
|
| 200 |
|
|
|
| 201 |
vapier |
1.33 |
src_configure() {
|
| 202 |
scarabeus |
1.37 |
local i
|
| 203 |
|
|
|
| 204 |
vapier |
1.1 |
use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
|
| 205 |
floppym |
1.50 |
use libzfs && addpredict /etc/dfs
|
| 206 |
vapier |
1.1 |
use static && append-ldflags -static
|
| 207 |
|
|
|
| 208 |
scarabeus |
1.37 |
for i in ${GRUB_ENABLED_PLATFORMS}; do
|
| 209 |
|
|
grub_run_phase ${FUNCNAME} ${i}
|
| 210 |
|
|
done
|
| 211 |
vapier |
1.33 |
}
|
| 212 |
|
|
|
| 213 |
|
|
src_compile() {
|
| 214 |
floppym |
1.50 |
# Used for pax marking in grub_src_compile
|
| 215 |
|
|
local grub_binaries=(
|
| 216 |
|
|
grub-editenv
|
| 217 |
|
|
grub-fstest
|
| 218 |
|
|
grub-menulst2cfg
|
| 219 |
|
|
grub-mkimage
|
| 220 |
|
|
grub-mklayout
|
| 221 |
|
|
grub-mkpasswd-pbkdf2
|
| 222 |
|
|
grub-mkrelpath
|
| 223 |
|
|
grub-script-check
|
| 224 |
|
|
grub-bios-setup
|
| 225 |
|
|
grub-ofpathname
|
| 226 |
|
|
grub-probe
|
| 227 |
|
|
grub-sparc64-setup
|
| 228 |
|
|
)
|
| 229 |
|
|
use mount && grub_binaries+=( grub-mount )
|
| 230 |
|
|
use truetype && grub_binaries+=( grub-mkfont )
|
| 231 |
|
|
|
| 232 |
scarabeus |
1.37 |
local i
|
| 233 |
|
|
|
| 234 |
|
|
for i in ${GRUB_ENABLED_PLATFORMS}; do
|
| 235 |
|
|
grub_run_phase ${FUNCNAME} ${i}
|
| 236 |
|
|
done
|
| 237 |
vapier |
1.1 |
}
|
| 238 |
|
|
|
| 239 |
|
|
src_install() {
|
| 240 |
scarabeus |
1.37 |
local i
|
| 241 |
|
|
|
| 242 |
|
|
for i in ${GRUB_ENABLED_PLATFORMS}; do
|
| 243 |
|
|
grub_run_phase ${FUNCNAME} ${i}
|
| 244 |
|
|
done
|
| 245 |
|
|
|
| 246 |
floppym |
1.50 |
mv "${ED}"usr/share/info/grub{,2}.info || die
|
| 247 |
alexxy |
1.40 |
|
| 248 |
scarabeus |
1.43 |
# can't be in docs array as we use default_src_install in different builddir
|
| 249 |
vapier |
1.1 |
dodoc AUTHORS ChangeLog NEWS README THANKS TODO
|
| 250 |
scarabeus |
1.37 |
insinto /etc/default
|
| 251 |
|
|
newins "${FILESDIR}"/grub.default grub
|
| 252 |
floppym |
1.50 |
}
|
| 253 |
scarabeus |
1.44 |
|
| 254 |
floppym |
1.50 |
pkg_postinst() {
|
| 255 |
scarabeus |
1.44 |
# display the link to guide
|
| 256 |
floppym |
1.50 |
elog "For information on how to configure grub-2 please refer to the guide:"
|
| 257 |
scarabeus |
1.51 |
elog " http://wiki.gentoo.org/wiki/GRUB2"
|
| 258 |
vapier |
1.3 |
}
|