1 |
# Copyright 1999-2013 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.2.2.ebuild,v 1.2 2013/05/15 18:36:06 idella4 Exp $ |
4 |
|
5 |
EAPI=5 |
6 |
|
7 |
PYTHON_COMPAT=( python{2_6,2_7} ) |
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 |
live_eclass="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 |
inherit mount-boot flag-o-matic python-single-r1 toolchain-funcs ${live_eclass} |
21 |
|
22 |
DESCRIPTION="The Xen virtual machine monitor" |
23 |
HOMEPAGE="http://xen.org/" |
24 |
LICENSE="GPL-2" |
25 |
SLOT="0" |
26 |
IUSE="custom-cflags debug efi flask pae xsm" |
27 |
|
28 |
DEPEND="efi? ( >=sys-devel/binutils-2.22[multitarget] ) |
29 |
!efi? ( >=sys-devel/binutils-2.22[-multitarget] )" |
30 |
RDEPEND="" |
31 |
PDEPEND="~app-emulation/xen-tools-${PV}" |
32 |
|
33 |
RESTRICT="test" |
34 |
|
35 |
# Approved by QA team in bug #144032 |
36 |
QA_WX_LOAD="boot/xen-syms-${PV}" |
37 |
|
38 |
REQUIRED_USE=" |
39 |
flask? ( xsm ) |
40 |
" |
41 |
|
42 |
pkg_setup() { |
43 |
python-single-r1_pkg_setup |
44 |
if [[ -z ${XEN_TARGET_ARCH} ]]; then |
45 |
if use x86 && use amd64; then |
46 |
die "Confusion! Both x86 and amd64 are set in your use flags!" |
47 |
elif use x86; then |
48 |
export XEN_TARGET_ARCH="x86_32" |
49 |
elif use amd64; then |
50 |
export XEN_TARGET_ARCH="x86_64" |
51 |
else |
52 |
die "Unsupported architecture!" |
53 |
fi |
54 |
fi |
55 |
|
56 |
if use flask ; then |
57 |
export "XSM_ENABLE=y" |
58 |
export "FLASK_ENABLE=y" |
59 |
elif use xsm ; then |
60 |
export "XSM_ENABLE=y" |
61 |
fi |
62 |
} |
63 |
|
64 |
src_prepare() { |
65 |
# Drop .config and fix gcc-4.6 |
66 |
epatch "${FILESDIR}"/${PN/-pvgrub/}-4-fix_dotconfig-gcc.patch |
67 |
|
68 |
if use efi; then |
69 |
epatch "${FILESDIR}"/${PN}-4.2-efi.patch |
70 |
export EFI_VENDOR="gentoo" |
71 |
export EFI_MOUNTPOINT="boot" |
72 |
fi |
73 |
|
74 |
# if the user *really* wants to use their own custom-cflags, let them |
75 |
if use custom-cflags; then |
76 |
einfo "User wants their own CFLAGS - removing defaults" |
77 |
# try and remove all the default custom-cflags |
78 |
find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \ |
79 |
-e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \ |
80 |
-e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \ |
81 |
-e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \ |
82 |
-e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \ |
83 |
-e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \ |
84 |
-i {} \; || die "failed to re-set custom-cflags" |
85 |
fi |
86 |
|
87 |
# not strictly necessary to fix this |
88 |
sed -i 's/, "-Werror"//' "${S}/tools/python/setup.py" || die "failed to re-set setup.py" |
89 |
|
90 |
#Security patches |
91 |
epatch "${FILESDIR}"/${PN}-4-CVE-2013-1918-XSA-45_[1-7].patch |
92 |
|
93 |
epatch_user |
94 |
} |
95 |
|
96 |
src_configure() { |
97 |
use debug && myopt="${myopt} debug=y" |
98 |
use pae && myopt="${myopt} pae=y" |
99 |
|
100 |
if use custom-cflags; then |
101 |
filter-flags -fPIE -fstack-protector |
102 |
replace-flags -O3 -O2 |
103 |
else |
104 |
unset CFLAGS |
105 |
fi |
106 |
} |
107 |
|
108 |
src_compile() { |
109 |
# Send raw LDFLAGS so that --as-needed works |
110 |
emake CC="$(tc-getCC)" LDFLAGS="$(raw-ldflags)" LD="$(tc-getLD)" -C xen ${myopt} |
111 |
} |
112 |
|
113 |
src_install() { |
114 |
local myopt |
115 |
use debug && myopt="${myopt} debug=y" |
116 |
use pae && myopt="${myopt} pae=y" |
117 |
|
118 |
# The 'make install' doesn't 'mkdir -p' the subdirs |
119 |
if use efi; then |
120 |
mkdir -p "${D}"${EFI_MOUNTPOINT}/efi/${EFI_VENDOR} || die |
121 |
fi |
122 |
|
123 |
emake LDFLAGS="$(raw-ldflags)" DESTDIR="${D}" -C xen ${myopt} install |
124 |
} |
125 |
|
126 |
pkg_postinst() { |
127 |
elog "Official Xen Guide and the unoffical wiki page:" |
128 |
elog " http://www.gentoo.org/doc/en/xen-guide.xml" |
129 |
elog " http://en.gentoo-wiki.com/wiki/Xen/" |
130 |
|
131 |
use pae && ewarn "This is a PAE build of Xen. It will *only* boot PAE kernels!" |
132 |
use efi && einfo "The efi executable is installed in boot/efi/gentoo" |
133 |
} |