blob: a0ad1cecb2b85a59341894dd5ceb94cad0eb441e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
inherit mount-boot flag-o-matic distutils eutils multilib
DESCRIPTION="Xend daemon and tools"
HOMEPAGE="http://xen.sourceforge.net"
SRC_URI="http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/xen-${PV}-src.tgz"
S="${WORKDIR}/xen-${PV}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc debug screen custom-cflags hardened vnc sdl"
CDEPEND="dev-lang/python
sys-libs/zlib
sdl? ( media-libs/libsdl )
vnc? ( media-libs/libsdl )"
DEPEND="${CDEPEND}
sys-devel/gcc
dev-lang/perl
app-misc/pax-utils
doc? (
dev-tex/latex2html
media-gfx/transfig
)
vnc? ( net-libs/libvncserver )"
RDEPEND="${CDEPEND}
>=app-emulation/xen-3.0.2
sys-apps/iproute2
net-misc/bridge-utils
screen? (
app-misc/screen
app-admin/logrotate
)
|| ( sys-fs/udev sys-apps/hotplug )"
PYTHON_MODNAME="xen grub"
pkg_setup() {
if use vnc && ! use sdl ; then
ewarn "You have the 'vnc' USE flag set, but not 'sdl'."
ewarn "VNC functionality requires SDL support, so it"
ewarn "will be enabled anyway."
fi
if [[ "$(scanelf -s __guard -q `which python`)" ]] ; then
ewarn "xend may not work when python is built with stack smashing protection (ssp)."
ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
fi
if [[ -z ${XEN_TARGET_ARCH} ]] ; then
if use x86 ; then
export XEN_TARGET_ARCH="x86_32"
elif use amd64 ; then
export XEN_TARGET_ARCH="x86_64"
else
die "Unsupported architecture!"
fi
fi
}
src_unpack() {
unpack ${A}
cd "${S}"
# if the user *really* wants to use their own custom-cflags, let them
if use custom-cflags; then
einfo "User wants their own CFLAGS - removing defaults"
# try and remove all the default custom-cflags
find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \
-e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
-e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
-e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
-e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
-e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
-i {} \;
fi
# xen tries to be smart and filter out CFLAGs not supported by gcc.
# It's not smart enough to catch no* flags, though, so we force them.
if use hardened; then
HARDFLAGS="-nopie -fno-stack-protector -fno-stack-protector-all"
sed -e "s/CFLAGS :=/CFLAGS := ${HARDFLAGS}/" \
-i "${S}"/tools/firmware/hvmloader/Makefile \
"${S}"/tools/firmware/vmxassist/Makefile
fi
# Disable the 32bit-only vmxassist if we are not on x86
# and we don't support the x86 ABI
if ! use x86 && ! has x86 $(get_all_abis); then
sed -i -e "/SUBDIRS += vmxassist/d" "${S}"tools/firmware/Makefile
fi
# Fixes for hardened and amd64
epatch "${FILESDIR}"/${P}-bxclobber.patch
epatch "${FILESDIR}"/${P}-pushpop.patch
# Allow --as-needed LDFLAGS
epatch "${FILESDIR}/${P}"--as-needed.patch
# Allow building with python-2.5 (bug #149138)
# Backported from upstream - should be in 3.0.3
sed -i 's/\.2|^2\.3|^2\.4/.[2345]/' "${S}"/tools/check/check_python
# Fix upstream's broken test cases (bug #141233)
epatch "${FILESDIR}/${P}"-test-uuid.patch
epatch "${FILESDIR}/${P}"-test-xauthority.patch
}
src_compile() {
local myopt myconf
use debug && myopt="${myopt} debug=y"
myconf="${myconf} $(use_enable vnc)"
if use vnc ; then
myconf="${myconf} --enable-sdl"
else
myconf="${myconf} $(use_enable sdl)"
fi
use custom-cflags || unset CFLAGS
gcc-specs-ssp && append-flags -fno-stack-protector -fno-stack-protector-all
(cd tools/ioemu && econf ${myconf}) || die "configure failured"
emake -C tools ${myopt} || die "compile failed"
if use doc; then
sh ./docs/check_pkgs || die "package check failed"
emake -C docs || die "compiling docs failed"
fi
emake -C docs man-pages || die "make man-pages failed"
}
src_install() {
local myopt="XEN_PYTHON_NATIVE_INSTALL=1"
make DESTDIR="${D}" ${myopt} install-tools \
|| die "install failed"
# Remove RedHat-specific stuff
rm -rf "${D}"/etc/sysconfig
if use doc; then
make DESTDIR="${D}" -C docs install || die "install docs failed"
# Rename doc/xen to the Gentoo-style doc/xen-x.y
mv "${D}"/usr/share/doc/{${PN},${PF}}
fi
doman docs/man?/*
newinitd "${FILESDIR}/${PVR}"/xend.initd xend
newconfd "${FILESDIR}"/xendomains.confd xendomains
newinitd "${FILESDIR}/${PVR}"/xendomains.initd xendomains
if use screen; then
cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains
cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/
keepdir /var/log/xen-consoles
fi
# xend expects these to exist
keepdir /var/run/xenstored /var/lib/xenstored /var/xen/dump
}
pkg_postinst() {
elog "Please visit the Xen and Gentoo wiki:"
elog "http://gentoo-wiki.com/HOWTO_Xen_and_Gentoo"
if ! built_with_use dev-lang/python ncurses; then
echo
ewarn "NB: Your dev-lang/python is built without USE=ncurses."
ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
fi
if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
echo
elog "xensv is broken upstream (Gentoo bug #142011)."
elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
fi
}
|