| 1 |
floppym |
1.86 |
# Copyright 1999-2013 Gentoo Foundation
|
| 2 |
vapier |
1.1 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
floppym |
1.93 |
# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.92 2013/04/29 01:13:49 floppym Exp $
|
| 4 |
vapier |
1.21 |
|
| 5 |
floppym |
1.89 |
EAPI=5
|
| 6 |
|
|
AUTOTOOLS_AUTO_DEPEND=yes
|
| 7 |
vapier |
1.1 |
|
| 8 |
floppym |
1.89 |
inherit autotools-utils eutils flag-o-matic multibuild pax-utils toolchain-funcs
|
| 9 |
|
|
|
| 10 |
|
|
if [[ ${PV} != 9999 ]]; then
|
| 11 |
scarabeus |
1.37 |
MY_P=${P/_/\~}
|
| 12 |
floppym |
1.68 |
if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
|
| 13 |
floppym |
1.52 |
SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
|
| 14 |
floppym |
1.50 |
else
|
| 15 |
|
|
SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
|
| 16 |
floppym |
1.89 |
mirror://gentoo/${MY_P}.tar.xz"
|
| 17 |
floppym |
1.50 |
fi
|
| 18 |
floppym |
1.73 |
KEYWORDS="~amd64 ~x86"
|
| 19 |
scarabeus |
1.37 |
S=${WORKDIR}/${MY_P}
|
| 20 |
floppym |
1.89 |
PATCHES=(
|
| 21 |
|
|
"${FILESDIR}/${P}-parallel-make.patch" #424231
|
| 22 |
|
|
"${FILESDIR}/${P}-no-gets.patch" #424703
|
| 23 |
|
|
"${FILESDIR}/${P}-config-quoting.patch" #426364
|
| 24 |
|
|
"${FILESDIR}/${P}-tftp-endian.patch" # 438612
|
| 25 |
|
|
"${FILESDIR}/${P}-hardcoded-awk.patch" #424137
|
| 26 |
|
|
"${FILESDIR}/${P}-freebsd.patch" #442050
|
| 27 |
|
|
"${FILESDIR}/${P}-compression.patch" #424527
|
| 28 |
|
|
"${FILESDIR}/${P}-zfs-feature-flag-support-r1.patch" #455358
|
| 29 |
|
|
"${FILESDIR}/${P}-20_linux_xen.patch" #463992
|
| 30 |
|
|
"${FILESDIR}/${P}-dmraid.patch" #430748
|
| 31 |
|
|
"${FILESDIR}/${P}-texinfo.patch"
|
| 32 |
|
|
)
|
| 33 |
|
|
else
|
| 34 |
|
|
inherit bzr
|
| 35 |
|
|
EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
|
| 36 |
vapier |
1.1 |
fi
|
| 37 |
|
|
|
| 38 |
vapier |
1.32 |
DESCRIPTION="GNU GRUB boot loader"
|
| 39 |
vapier |
1.1 |
HOMEPAGE="http://www.gnu.org/software/grub/"
|
| 40 |
|
|
|
| 41 |
vapier |
1.4 |
LICENSE="GPL-3"
|
| 42 |
scarabeus |
1.37 |
SLOT="2"
|
| 43 |
floppym |
1.93 |
IUSE="custom-cflags debug device-mapper doc efiemu mount +multislot nls static sdl test truetype libzfs"
|
| 44 |
scarabeus |
1.37 |
|
| 45 |
floppym |
1.89 |
GRUB_ALL_PLATFORMS=(
|
| 46 |
vapier |
1.47 |
# everywhere:
|
| 47 |
|
|
emu
|
| 48 |
|
|
# mips only:
|
| 49 |
|
|
qemu-mips yeeloong
|
| 50 |
|
|
# amd64, x86, ppc, ppc64:
|
| 51 |
|
|
ieee1275
|
| 52 |
|
|
# amd64, x86:
|
| 53 |
|
|
coreboot multiboot efi-32 pc qemu
|
| 54 |
floppym |
1.56 |
# amd64, ia64:
|
| 55 |
vapier |
1.47 |
efi-64
|
| 56 |
|
|
)
|
| 57 |
floppym |
1.89 |
IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
|
| 58 |
scarabeus |
1.37 |
|
| 59 |
floppym |
1.86 |
REQUIRED_USE="grub_platforms_qemu? ( truetype )
|
| 60 |
|
|
grub_platforms_yeeloong? ( truetype )"
|
| 61 |
floppym |
1.71 |
|
| 62 |
scarabeus |
1.37 |
# os-prober: Used on runtime to detect other OSes
|
| 63 |
|
|
# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
|
| 64 |
|
|
RDEPEND="
|
| 65 |
floppym |
1.73 |
app-arch/xz-utils
|
| 66 |
scarabeus |
1.37 |
>=sys-libs/ncurses-5.2-r5
|
| 67 |
vapier |
1.32 |
debug? (
|
| 68 |
|
|
sdl? ( media-libs/libsdl )
|
| 69 |
|
|
)
|
| 70 |
|
|
device-mapper? ( >=sys-fs/lvm2-2.02.45 )
|
| 71 |
floppym |
1.50 |
libzfs? ( sys-fs/zfs )
|
| 72 |
|
|
mount? ( sys-fs/fuse )
|
| 73 |
floppym |
1.62 |
truetype? (
|
| 74 |
|
|
media-libs/freetype
|
| 75 |
scarabeus |
1.69 |
media-fonts/dejavu
|
| 76 |
floppym |
1.62 |
>=media-fonts/unifont-5
|
| 77 |
|
|
)
|
| 78 |
josejx |
1.64 |
ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
|
| 79 |
|
|
ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
|
| 80 |
floppym |
1.62 |
"
|
| 81 |
vapier |
1.9 |
DEPEND="${RDEPEND}
|
| 82 |
floppym |
1.89 |
app-misc/pax-utils
|
| 83 |
mattst88 |
1.35 |
>=dev-lang/python-2.5.2
|
| 84 |
scarabeus |
1.37 |
sys-devel/flex
|
| 85 |
floppym |
1.70 |
sys-devel/bison
|
| 86 |
floppym |
1.75 |
sys-apps/help2man
|
| 87 |
flameeyes |
1.45 |
sys-apps/texinfo
|
| 88 |
floppym |
1.89 |
>=sys-devel/autogen-5.10
|
| 89 |
floppym |
1.62 |
static? (
|
| 90 |
|
|
truetype? (
|
| 91 |
|
|
app-arch/bzip2[static-libs(+)]
|
| 92 |
|
|
media-libs/freetype[static-libs(+)]
|
| 93 |
|
|
sys-libs/zlib[static-libs(+)]
|
| 94 |
|
|
)
|
| 95 |
|
|
)
|
| 96 |
floppym |
1.92 |
test? (
|
| 97 |
|
|
dev-libs/libisoburn
|
| 98 |
|
|
app-emulation/qemu
|
| 99 |
|
|
)
|
| 100 |
scarabeus |
1.37 |
"
|
| 101 |
floppym |
1.55 |
RDEPEND+="
|
| 102 |
floppym |
1.86 |
kernel_linux? (
|
| 103 |
|
|
grub_platforms_efi-32? ( sys-boot/efibootmgr )
|
| 104 |
|
|
grub_platforms_efi-64? ( sys-boot/efibootmgr )
|
| 105 |
|
|
)
|
| 106 |
floppym |
1.89 |
!multislot? ( !sys-boot/grub:0 )
|
| 107 |
floppym |
1.55 |
"
|
| 108 |
scarabeus |
1.37 |
|
| 109 |
floppym |
1.89 |
STRIP_MASK="*/grub/*/*.{mod,img}"
|
| 110 |
floppym |
1.50 |
|
| 111 |
scarabeus |
1.37 |
QA_EXECSTACK="
|
| 112 |
floppym |
1.50 |
usr/bin/grub*
|
| 113 |
|
|
usr/sbin/grub*
|
| 114 |
|
|
usr/lib*/grub/*/*.mod
|
| 115 |
floppym |
1.89 |
usr/lib*/grub/*/*.module
|
| 116 |
floppym |
1.50 |
usr/lib*/grub/*/kernel.exec
|
| 117 |
|
|
usr/lib*/grub/*/kernel.img
|
| 118 |
scarabeus |
1.37 |
"
|
| 119 |
|
|
|
| 120 |
scarabeus |
1.41 |
QA_WX_LOAD="
|
| 121 |
floppym |
1.50 |
usr/lib*/grub/*/kernel.exec
|
| 122 |
|
|
usr/lib*/grub/*/kernel.img
|
| 123 |
|
|
usr/lib*/grub/*/*.image
|
| 124 |
|
|
"
|
| 125 |
|
|
|
| 126 |
|
|
QA_PRESTRIPPED="
|
| 127 |
|
|
usr/lib.*/grub/.*/kernel.img
|
| 128 |
scarabeus |
1.41 |
"
|
| 129 |
|
|
|
| 130 |
floppym |
1.85 |
pkg_pretend() {
|
| 131 |
|
|
if [[ ${MERGE_TYPE} != binary ]]; then
|
| 132 |
|
|
# Bug 439082
|
| 133 |
|
|
if $(tc-getLD) --version | grep -q "GNU gold"; then
|
| 134 |
|
|
eerror "GRUB does not function correctly when built with the gold linker."
|
| 135 |
|
|
eerror "Please select the bfd linker with binutils-config."
|
| 136 |
|
|
die "GNU gold detected"
|
| 137 |
|
|
fi
|
| 138 |
|
|
fi
|
| 139 |
|
|
}
|
| 140 |
|
|
|
| 141 |
vapier |
1.33 |
src_prepare() {
|
| 142 |
floppym |
1.89 |
[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
|
| 143 |
|
|
sed -i -e /autoreconf/d autogen.sh || die
|
| 144 |
|
|
epatch_user
|
| 145 |
|
|
bash autogen.sh || die
|
| 146 |
|
|
autopoint() { return 0; }
|
| 147 |
|
|
eautoreconf
|
| 148 |
|
|
}
|
| 149 |
|
|
|
| 150 |
|
|
grub_configure() {
|
| 151 |
|
|
local platform
|
| 152 |
floppym |
1.75 |
|
| 153 |
floppym |
1.89 |
case ${MULTIBUILD_VARIANT} in
|
| 154 |
|
|
efi-32)
|
| 155 |
|
|
platform=efi
|
| 156 |
|
|
if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
|
| 157 |
|
|
local CTARGET=${CTARGET:-i386}
|
| 158 |
|
|
fi ;;
|
| 159 |
|
|
efi-64)
|
| 160 |
|
|
platform=efi
|
| 161 |
|
|
if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
|
| 162 |
|
|
local CTARGET=${CTARGET:-x86_64}
|
| 163 |
|
|
local TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
|
| 164 |
|
|
local TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
|
| 165 |
|
|
export TARGET_CFLAGS TARGET_CPPFLAGS
|
| 166 |
|
|
fi ;;
|
| 167 |
|
|
guessed) ;;
|
| 168 |
|
|
*) platform=${MULTIBUILD_VARIANT} ;;
|
| 169 |
|
|
esac
|
| 170 |
floppym |
1.65 |
|
| 171 |
floppym |
1.89 |
local myeconfargs=(
|
| 172 |
|
|
--disable-werror
|
| 173 |
|
|
--program-prefix=
|
| 174 |
floppym |
1.90 |
--libdir="${EPREFIX}"/usr/lib
|
| 175 |
|
|
--htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
|
| 176 |
floppym |
1.89 |
$(use_enable debug mm-debug)
|
| 177 |
|
|
$(use_enable debug grub-emu-usb)
|
| 178 |
|
|
$(use_enable efiemu)
|
| 179 |
|
|
$(use_enable mount grub-mount)
|
| 180 |
|
|
$(use_enable nls)
|
| 181 |
|
|
$(use_enable truetype grub-mkfont)
|
| 182 |
|
|
$(use_enable libzfs)
|
| 183 |
|
|
$(use sdl && use_enable debug grub-emu-sdl)
|
| 184 |
|
|
${platform:+--with-platform=}${platform}
|
| 185 |
|
|
)
|
| 186 |
vapier |
1.7 |
|
| 187 |
floppym |
1.89 |
if use multislot; then
|
| 188 |
|
|
myeconfargs+=(
|
| 189 |
|
|
--program-transform-name="s,grub,grub2,"
|
| 190 |
|
|
--with-grubdir=grub2
|
| 191 |
|
|
)
|
| 192 |
vapier |
1.17 |
fi
|
| 193 |
vapier |
1.34 |
|
| 194 |
floppym |
1.89 |
autotools-utils_src_configure
|
| 195 |
vapier |
1.6 |
}
|
| 196 |
|
|
|
| 197 |
vapier |
1.33 |
src_configure() {
|
| 198 |
floppym |
1.76 |
use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
|
| 199 |
vapier |
1.1 |
use static && append-ldflags -static
|
| 200 |
|
|
|
| 201 |
floppym |
1.89 |
tc-export CC NM OBJCOPY STRIP
|
| 202 |
|
|
export TARGET_CC=${TARGET_CC:-${CC}}
|
| 203 |
floppym |
1.74 |
|
| 204 |
floppym |
1.89 |
# Portage will take care of cleaning up GRUB_PLATFORMS
|
| 205 |
|
|
MULTIBUILD_VARIANTS=( ${GRUB_PLATFORMS:-guessed} )
|
| 206 |
|
|
multibuild_parallel_foreach_variant grub_configure
|
| 207 |
vapier |
1.33 |
}
|
| 208 |
|
|
|
| 209 |
|
|
src_compile() {
|
| 210 |
floppym |
1.89 |
multibuild_foreach_variant autotools-utils_src_compile
|
| 211 |
floppym |
1.79 |
|
| 212 |
floppym |
1.89 |
use doc && multibuild_for_best_variant \
|
| 213 |
|
|
autotools-utils_src_compile -C docs html
|
| 214 |
vapier |
1.1 |
}
|
| 215 |
|
|
|
| 216 |
floppym |
1.91 |
src_test() {
|
| 217 |
floppym |
1.92 |
# The qemu dependency is a bit complex.
|
| 218 |
|
|
# You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
|
| 219 |
floppym |
1.91 |
multibuild_foreach_variant autotools-utils_src_test
|
| 220 |
|
|
}
|
| 221 |
|
|
|
| 222 |
vapier |
1.1 |
src_install() {
|
| 223 |
floppym |
1.89 |
multibuild_foreach_variant autotools-utils_src_install \
|
| 224 |
|
|
bashcompletiondir=/usr/share/bash-completion
|
| 225 |
scarabeus |
1.37 |
|
| 226 |
floppym |
1.89 |
use doc && multibuild_for_best_variant run_in_build_dir \
|
| 227 |
|
|
emake -C docs DESTDIR="${D}" install-html
|
| 228 |
scarabeus |
1.37 |
|
| 229 |
floppym |
1.89 |
if use multislot; then
|
| 230 |
floppym |
1.90 |
mv "${ED%/}"/usr/share/info/grub{,2}.info || die
|
| 231 |
floppym |
1.89 |
fi
|
| 232 |
alexxy |
1.40 |
|
| 233 |
scarabeus |
1.37 |
insinto /etc/default
|
| 234 |
scarabeus |
1.69 |
newins "${FILESDIR}"/grub.default-2 grub
|
| 235 |
scarabeus |
1.44 |
|
| 236 |
floppym |
1.89 |
cd "${ED}" || die
|
| 237 |
|
|
pax-mark mpes $(scanelf -BF %F usr/{bin,sbin})
|
| 238 |
floppym |
1.86 |
}
|
| 239 |
|
|
|
| 240 |
floppym |
1.50 |
pkg_postinst() {
|
| 241 |
|
|
elog "For information on how to configure grub-2 please refer to the guide:"
|
| 242 |
floppym |
1.60 |
elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
|
| 243 |
floppym |
1.89 |
if [[ -z ${REPLACING_VERSIONS} ]]; then
|
| 244 |
|
|
if ! has_version sys-boot/os-prober; then
|
| 245 |
|
|
elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
|
| 246 |
|
|
fi
|
| 247 |
|
|
if ! has_version dev-libs/libisoburn; then
|
| 248 |
|
|
elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
|
| 249 |
|
|
fi
|
| 250 |
floppym |
1.86 |
fi
|
| 251 |
vapier |
1.3 |
}
|