| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen/xen-4.1.1-r2.ebuild,v 1.7 2011/11/08 23:46:38 mr_bones_ Exp $ |
| 4 |
|
| 5 |
EAPI="4" |
| 6 |
|
| 7 |
inherit eutils mount-boot flag-o-matic toolchain-funcs |
| 8 |
|
| 9 |
if [[ $PV == *9999 ]]; then |
| 10 |
KEYWORDS="" |
| 11 |
REPO="xen-unstable.hg" |
| 12 |
EHG_REPO_URI="http://xenbits.xensource.com/${REPO}" |
| 13 |
S="${WORKDIR}/${REPO}" |
| 14 |
inherit mercurial |
| 15 |
else |
| 16 |
KEYWORDS="amd64 x86" |
| 17 |
SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz" |
| 18 |
fi |
| 19 |
|
| 20 |
DESCRIPTION="The Xen virtual machine monitor" |
| 21 |
HOMEPAGE="http://xen.org/" |
| 22 |
|
| 23 |
LICENSE="GPL-2" |
| 24 |
SLOT="0" |
| 25 |
IUSE="custom-cflags debug flask pae xsm" |
| 26 |
|
| 27 |
RDEPEND="|| ( sys-boot/grub |
| 28 |
sys-boot/grub-static )" |
| 29 |
PDEPEND="~app-emulation/xen-tools-${PV}" |
| 30 |
|
| 31 |
RESTRICT="test" |
| 32 |
|
| 33 |
# Approved by QA team in bug #144032 |
| 34 |
QA_WX_LOAD="boot/xen-syms-${PV}" |
| 35 |
|
| 36 |
REQUIRED_USE=" |
| 37 |
flask? ( xsm ) |
| 38 |
" |
| 39 |
|
| 40 |
pkg_setup() { |
| 41 |
if [[ -z ${XEN_TARGET_ARCH} ]]; then |
| 42 |
if use x86 && use amd64; then |
| 43 |
die "Confusion! Both x86 and amd64 are set in your use flags!" |
| 44 |
elif use x86; then |
| 45 |
export XEN_TARGET_ARCH="x86_32" |
| 46 |
elif use amd64; then |
| 47 |
export XEN_TARGET_ARCH="x86_64" |
| 48 |
else |
| 49 |
die "Unsupported architecture!" |
| 50 |
fi |
| 51 |
fi |
| 52 |
|
| 53 |
if use flask ; then |
| 54 |
export "XSM_ENABLE=y" |
| 55 |
export "FLASK_ENABLE=y" |
| 56 |
elif use xsm ; then |
| 57 |
export "XSM_ENABLE=y" |
| 58 |
fi |
| 59 |
} |
| 60 |
|
| 61 |
src_prepare() { |
| 62 |
# Drop .config |
| 63 |
sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop" |
| 64 |
# if the user *really* wants to use their own custom-cflags, let them |
| 65 |
if use custom-cflags; then |
| 66 |
einfo "User wants their own CFLAGS - removing defaults" |
| 67 |
# try and remove all the default custom-cflags |
| 68 |
find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \ |
| 69 |
-e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \ |
| 70 |
-e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \ |
| 71 |
-e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \ |
| 72 |
-e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \ |
| 73 |
-e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \ |
| 74 |
-i {} \; || die "failed to set custom-cflags" |
| 75 |
fi |
| 76 |
|
| 77 |
# remove -Werror for gcc-4.6's sake |
| 78 |
find "${S}" -name 'Makefile*' -o -name '*.mk' -o -name 'common.make' | \ |
| 79 |
xargs sed -i 's/ *-Werror */ /' || die "failed to remove -Werror" |
| 80 |
# not strictly necessary to fix this |
| 81 |
sed -i 's/, "-Werror"//' "${S}/tools/python/setup.py" || die "failed to remove -Werror on setup.py" |
| 82 |
|
| 83 |
# Add sccurity fix bug #379241 |
| 84 |
epatch "${FILESDIR}/${P}-iommu_sec_fix.patch" |
| 85 |
} |
| 86 |
|
| 87 |
src_configure() { |
| 88 |
use debug && myopt="${myopt} debug=y" |
| 89 |
use pae && myopt="${myopt} pae=y" |
| 90 |
|
| 91 |
if use custom-cflags; then |
| 92 |
filter-flags -fPIE -fstack-protector |
| 93 |
replace-flags -O3 -O2 |
| 94 |
else |
| 95 |
unset CFLAGS |
| 96 |
fi |
| 97 |
} |
| 98 |
|
| 99 |
src_compile() { |
| 100 |
# Send raw LDFLAGS so that --as-needed works |
| 101 |
emake CC="$(tc-getCC)" LDFLAGS="$(raw-ldflags)" LD="$(tc-getLD)" -C xen ${myopt} |
| 102 |
} |
| 103 |
|
| 104 |
src_install() { |
| 105 |
local myopt |
| 106 |
use debug && myopt="${myopt} debug=y" |
| 107 |
use pae && myopt="${myopt} pae=y" |
| 108 |
|
| 109 |
emake LDFLAGS="$(raw-ldflags)" DESTDIR="${D}" -C xen ${myopt} install |
| 110 |
} |
| 111 |
|
| 112 |
pkg_postinst() { |
| 113 |
elog "Official Xen Guide and the unoffical wiki page:" |
| 114 |
elog " http://www.gentoo.org/doc/en/xen-guide.xml" |
| 115 |
elog " http://en.gentoo-wiki.com/wiki/Xen/" |
| 116 |
|
| 117 |
if use pae; then |
| 118 |
echo |
| 119 |
ewarn "This is a PAE build of Xen. It will *only* boot PAE kernels!" |
| 120 |
fi |
| 121 |
} |