Gentoo Archives: gentoo-commits

From: "Yixun Lan (dlan)" <dlan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-emulation/xen-tools: xen-tools-4.4.0-r7.ebuild xen-tools-4.3.2-r5.ebuild xen-tools-4.2.4-r6.ebuild ChangeLog xen-tools-4.4.0-r6.ebuild xen-tools-4.4.0-r5.ebuild
Date: Wed, 09 Jul 2014 06:35:48
Message-Id: 20140709063545.3FD3C2004E@flycatcher.gentoo.org
1 dlan 14/07/09 06:35:45
2
3 Modified: ChangeLog
4 Added: xen-tools-4.4.0-r7.ebuild xen-tools-4.3.2-r5.ebuild
5 xen-tools-4.2.4-r6.ebuild
6 Removed: xen-tools-4.4.0-r6.ebuild xen-tools-4.4.0-r5.ebuild
7 Log:
8 bump stable/security patches
9
10 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 0xAABEFD55)
11
12 Revision Changes Path
13 1.248 app-emulation/xen-tools/ChangeLog
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/ChangeLog?rev=1.248&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/ChangeLog?rev=1.248&content-type=text/plain
17 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/ChangeLog?r1=1.247&r2=1.248
18
19 Index: ChangeLog
20 ===================================================================
21 RCS file: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/ChangeLog,v
22 retrieving revision 1.247
23 retrieving revision 1.248
24 diff -u -r1.247 -r1.248
25 --- ChangeLog 15 Jun 2014 19:55:21 -0000 1.247
26 +++ ChangeLog 9 Jul 2014 06:35:45 -0000 1.248
27 @@ -1,6 +1,15 @@
28 # ChangeLog for app-emulation/xen-tools
29 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
30 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/ChangeLog,v 1.247 2014/06/15 19:55:21 robbat2 Exp $
31 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/ChangeLog,v 1.248 2014/07/09 06:35:45 dlan Exp $
32 +
33 +*xen-tools-4.4.0-r7 (09 Jul 2014)
34 +*xen-tools-4.3.2-r5 (09 Jul 2014)
35 +*xen-tools-4.2.4-r6 (09 Jul 2014)
36 +
37 + 09 Jul 2014; Yixun Lan <dlan@g.o> +xen-tools-4.2.4-r6.ebuild,
38 + +xen-tools-4.3.2-r5.ebuild, -xen-tools-4.4.0-r5.ebuild,
39 + -xen-tools-4.4.0-r6.ebuild, +xen-tools-4.4.0-r7.ebuild:
40 + bump stable/security patches
41
42 15 Jun 2014; Robin H. Johnson <robbat2@g.o> files/xendomains.initd-r2,
43 files/xenstored.initd:
44
45
46
47 1.1 app-emulation/xen-tools/xen-tools-4.4.0-r7.ebuild
48
49 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/xen-tools-4.4.0-r7.ebuild?rev=1.1&view=markup
50 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/xen-tools-4.4.0-r7.ebuild?rev=1.1&content-type=text/plain
51
52 Index: xen-tools-4.4.0-r7.ebuild
53 ===================================================================
54 # Copyright 1999-2014 Gentoo Foundation
55 # Distributed under the terms of the GNU General Public License v2
56 # $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/xen-tools-4.4.0-r7.ebuild,v 1.1 2014/07/09 06:35:44 dlan Exp $
57
58 EAPI=5
59
60 MY_PV=${PV/_/-}
61
62 PYTHON_COMPAT=( python2_7 )
63 PYTHON_REQ_USE='xml,threads'
64
65 if [[ $PV == *9999 ]]; then
66 KEYWORDS=""
67 REPO="xen-unstable.hg"
68 EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
69 S="${WORKDIR}/${REPO}"
70 live_eclass="mercurial"
71 else
72 KEYWORDS="~amd64 ~arm -x86"
73 UPSTREAM_VER=4
74 GENTOO_VER=
75 SEABIOS_VER=1.7.3.1
76
77 [[ -n ${UPSTREAM_VER} ]] && \
78 UPSTRAM_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
79 [[ -n ${GENTOO_VER} ]] && \
80 GENTOO_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
81
82 SRC_URI="http://bits.xensource.com/oss-xen/release/${MY_PV}/xen-${MY_PV}.tar.gz
83 http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
84 http://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
85 ${UPSTRAM_PATCHSET_URI}
86 ${GENTOO_PATCHSET_URI}"
87 S="${WORKDIR}/xen-${MY_PV}"
88 fi
89
90 inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass}
91
92 DESCRIPTION="Xend daemon and tools"
93 HOMEPAGE="http://xen.org/"
94 DOCS=( README docs/README.xen-bugtool )
95
96 LICENSE="GPL-2"
97 SLOT="0"
98 # Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
99 # >=dev-lang/ocaml-4 stable
100 # Masked in profiles/eapi-5-files instead
101 IUSE="api custom-cflags debug doc flask hvm qemu ocaml +pam python pygrub screen static-libs system-qemu system-seabios"
102
103 REQUIRED_USE="hvm? ( || ( qemu system-qemu ) )
104 ${PYTHON_REQUIRED_USE}
105 pygrub? ( python )
106 qemu? ( !system-qemu )"
107
108 COMMON_DEPEND="
109 dev-libs/lzo:2
110 dev-libs/glib:2
111 dev-libs/yajl
112 dev-libs/libaio
113 dev-libs/libgcrypt:0
114 sys-libs/zlib
115 "
116
117 DEPEND="${COMMON_DEPEND}
118 dev-python/lxml[${PYTHON_USEDEP}]
119 pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
120 hvm? ( media-libs/libsdl )
121 ${PYTHON_DEPS}
122 api? ( dev-libs/libxml2
123 net-misc/curl )
124 pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} )
125 arm? ( >=sys-apps/dtc-1.4.0 )
126 !arm? ( sys-devel/bin86
127 system-seabios? ( sys-firmware/seabios )
128 sys-firmware/ipxe
129 sys-devel/dev86
130 sys-power/iasl )
131 dev-lang/perl
132 app-misc/pax-utils
133 dev-python/markdown
134 doc? (
135 app-doc/doxygen
136 dev-tex/latex2html[png,gif]
137 media-gfx/graphviz
138 dev-tex/xcolor
139 media-gfx/transfig
140 dev-texlive/texlive-latexextra
141 virtual/latex-base
142 dev-tex/latexmk
143 dev-texlive/texlive-latex
144 dev-texlive/texlive-pictures
145 dev-texlive/texlive-latexrecommended
146 )
147 hvm? ( x11-proto/xproto
148 !net-libs/libiscsi )
149 qemu? ( x11-libs/pixman )
150 system-qemu? ( app-emulation/qemu[xen] )
151 ocaml? ( dev-ml/findlib
152 >=dev-lang/ocaml-4 )"
153
154 RDEPEND="${COMMON_DEPEND}
155 sys-apps/iproute2
156 net-misc/bridge-utils
157 screen? (
158 app-misc/screen
159 app-admin/logrotate
160 )
161 virtual/udev"
162
163 # hvmloader is used to bootstrap a fully virtualized kernel
164 # Approved by QA team in bug #144032
165 QA_WX_LOAD="usr/lib/xen/boot/hvmloader
166 usr/share/qemu-xen/qemu/s390-ccw.img"
167
168 RESTRICT="test"
169
170 pkg_setup() {
171 python-single-r1_pkg_setup
172 export "CONFIG_LOMOUNT=y"
173
174 if has_version dev-libs/libgcrypt:0; then
175 export "CONFIG_GCRYPT=y"
176 fi
177
178 if [[ -z ${XEN_TARGET_ARCH} ]] ; then
179 if use x86 && use amd64; then
180 die "Confusion! Both x86 and amd64 are set in your use flags!"
181 elif use x86; then
182 export XEN_TARGET_ARCH="x86_32"
183 elif use amd64 ; then
184 export XEN_TARGET_ARCH="x86_64"
185 elif use arm; then
186 export XEN_TARGET_ARCH="arm32"
187 else
188 die "Unsupported architecture!"
189 fi
190 fi
191 #bug 472438
192 export BASH_COMPLETION_DIR=/usr/share/bash-completion
193 }
194
195 src_prepare() {
196 # Upstream's patchset
197 if [[ -n ${UPSTREAM_VER} ]]; then
198 EPATCH_SUFFIX="patch" \
199 EPATCH_FORCE="yes" \
200 EPATCH_OPTS="-p1" \
201 epatch "${WORKDIR}"/patches-upstream
202 fi
203
204 # Gentoo's patchset
205 if [[ -n ${GENTOO_VER} ]]; then
206 EPATCH_SUFFIX="patch" \
207 EPATCH_FORCE="yes" \
208 epatch "${WORKDIR}"/patches-gentoo
209 fi
210
211 # Fix texi2html build error with new texi2html, qemu.doc.html
212 epatch "${FILESDIR}"/${PN}-4-docfix.patch
213
214 # Fix network broadcast on bridged networks
215 epatch "${FILESDIR}/${PN}-3.4.0-network-bridge-broadcast.patch"
216
217 # Bug 496708
218 epatch "${FILESDIR}"/${PN}-4-unbundle-ipxe.patch
219
220 # Fix bridge by idella4, bug #362575
221 epatch "${FILESDIR}/${PN}-4.1.1-bridge.patch"
222
223 # Prevent double stripping of files at install
224 epatch "${FILESDIR}"/${PN/-tools/}-4.4-nostrip.patch
225
226 # fix jobserver in Makefile
227 epatch "${FILESDIR}"/${PN/-tools/}-4.3-jserver.patch
228
229 # Set dom0-min-mem to kb; Bug #472982
230 epatch "${FILESDIR}"/${PN/-tools/}-4.2-configsxp.patch
231
232 # Bug 477676
233 epatch "${FILESDIR}"/${PN}-4.3-ar-cc.patch
234
235 # Bug 379537
236 epatch "${FILESDIR}"/fix-gold-ld.patch
237
238 # Prevent file collision with qemu package Bug 478064
239 epatch "${FILESDIR}"/xen-4.4-qemu-bridge.patch
240 mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
241
242 epatch "${FILESDIR}"/${PN}-4.4-api-fix.patch
243
244 # Fix po file collision with app-emulation/qemu, while USE=qemu is enabled, Bug 508302
245 epatch "${FILESDIR}"/${PN}-4-qemu-fix-po-collision.patch
246
247 # bundled seabios
248 epatch "${FILESDIR}"/${PN}-4-anti-seabios-download.patch
249 mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
250 pushd tools/firmware/ > /dev/null
251 ln -s seabios-dir-remote seabios-dir || die
252 popd > /dev/null
253
254 use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
255 sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
256 -i tools/firmware/Makefile || die
257
258 # Drop .config, fixes to gcc-4.6
259 sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
260
261 # if the user *really* wants to use their own custom-cflags, let them
262 if use custom-cflags; then
263 einfo "User wants their own CFLAGS - removing defaults"
264
265 # try and remove all the default cflags
266 find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
267 -exec sed \
268 -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
269 -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
270 -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
271 -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
272 -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
273 -i {} + || die "failed to re-set custom-cflags"
274 fi
275
276 if ! use pygrub; then
277 sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
278 fi
279
280 if ! use python; then
281 sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
282 fi
283
284 if ! use hvm; then
285 sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
286 # Bug 351648
287 elif ! use x86 && ! has x86 $(get_all_abis); then
288 mkdir -p "${WORKDIR}"/extra-headers/gnu || die
289 touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
290 export CPATH="${WORKDIR}"/extra-headers
291 fi
292
293 # Don't bother with qemu, only needed for fully virtualised guests
294 if ! use qemu; then
295 sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
296 fi
297
298 # Bug 472438
299 sed -e 's:^BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(SHARE_DIR)/bash-completion:' \
300 -i Config.mk || die
301
302 # xencommons, Bug #492332, sed lighter weight than patching
303 sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
304 -i tools/hotplug/Linux/init.d/xencommons || die
305
306 # respect multilib, usr/lib/libcacard.so.0.0.0
307 sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
308 -i tools/qemu-xen/configure || die
309
310 # fix QA warning, create /var/run/, /var/lock dynamically
311 sed -i -e "/\$(INSTALL_DIR) \$(DESTDIR)\$(XEN_RUN_DIR)/d" \
312 tools/libxl/Makefile || die
313
314 sed -i -e "/\/var\/run\//d" \
315 tools/xenstore/Makefile \
316 tools/pygrub/Makefile || die
317
318 sed -i -e "/\/var\/lock\/subsys/d" \
319 tools/Makefile || die
320
321 epatch_user
322 }
323
324 src_configure() {
325 local myconf="--prefix=/usr \
326 --libdir=/usr/$(get_libdir) \
327 --disable-werror \
328 --disable-xen \
329 --enable-tools \
330 --enable-docs \
331 --disable-qemu-traditional \
332 $(use_with system-qemu) \
333 $(use_enable pam) \
334 $(use_enable api xenapi) \
335 $(use_enable ocaml ocamltools) \
336 "
337 use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
338 use qemu || myconf+=" --with-system-qemu"
339 econf ${myconf}
340 }
341
342 src_compile() {
343 export VARTEXFONTS="${T}/fonts"
344 local myopt
345 use debug && myopt="${myopt} debug=y"
346
347 use custom-cflags || unset CFLAGS
348 if test-flag-CC -fno-strict-overflow; then
349 append-flags -fno-strict-overflow
350 fi
351
352 unset LDFLAGS
353 unset CFLAGS
354 emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt}
355
356 use doc && emake -C docs txt html
357 emake -C docs man-pages
358 }
359
360 src_install() {
361 # Override auto-detection in the build system, bug #382573
362 export INITD_DIR=/tmp/init.d
363 export CONFIG_LEAF_DIR=../tmp/default
364
365 # Let the build system compile installed Python modules.
366 local PYTHONDONTWRITEBYTECODE
367 export PYTHONDONTWRITEBYTECODE
368
369 emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
370 XEN_PYTHON_NATIVE_INSTALL=y install-tools
371
372 # Fix the remaining Python shebangs.
373 python_fix_shebang "${D}"
374
375 # Remove RedHat-specific stuff
376 rm -rf "${D}"tmp || die
377
378 # uncomment lines in xl.conf
379 sed -e 's:^#autoballoon=1:autoballoon=1:' \
380 -e 's:^#lockfile="/var/lock/xl":lockfile="/var/lock/xl":' \
381 -e 's:^#vifscript="vif-bridge":vifscript="vif-bridge":' \
382 -i tools/examples/xl.conf || die
383
384 # Reset bash completion dir; Bug 472438
385 mv "${D}"bash-completion "${D}"usr/share/ || die
386
387 if use doc; then
388 emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
389
390 dohtml -r docs/
391 docinto pdf
392 dodoc ${DOCS[@]}
393 [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html
394 fi
395
396 rm -rf "${D}"/usr/share/doc/xen/
397 doman docs/man?/*
398
399 newconfd "${FILESDIR}"/xendomains.confd xendomains
400 newconfd "${FILESDIR}"/xenstored.confd xenstored
401 newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
402 newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
403 newinitd "${FILESDIR}"/xenstored.initd xenstored
404 newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
405 newinitd "${FILESDIR}"/xencommons.initd xencommons
406 newconfd "${FILESDIR}"/xencommons.confd xencommons
407 newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
408 newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
409
410 if use screen; then
411 cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
412 cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
413 keepdir /var/log/xen-consoles
414 fi
415
416 # Move files built with use qemu, Bug #477884
417 if [[ "${ARCH}" == 'amd64' ]] && use qemu; then
418 mkdir -p "${D}"usr/$(get_libdir)/xen/bin || die
419 mv "${D}"usr/lib/xen/bin/* "${D}"usr/$(get_libdir)/xen/bin/ || die
420 fi
421
422 # For -static-libs wrt Bug 384355
423 if ! use static-libs; then
424 rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
425 fi
426
427 # xend expects these to exist
428 keepdir /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen
429
430 # for xendomains
431 keepdir /etc/xen/auto
432
433 # Temp QA workaround
434 dodir "$(udev_get_udevdir)"
435 mv "${D}"/etc/udev/* "${D}/$(udev_get_udevdir)"
436 rm -rf "${D}"/etc/udev
437
438 # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
439 find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
440 -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
441 }
442
443 pkg_postinst() {
444 elog "Official Xen Guide and the offical wiki page:"
445 elog "https://wiki.gentoo.org/wiki/Xen"
446 elog "http://wiki.xen.org/wiki/Main_Page"
447 elog ""
448 elog "Recommended to utilise the xencommons script to config sytem At boot"
449 elog "Add by use of rc-update on completion of the install"
450
451 if [[ "$(scanelf -s __guard -q "${PYTHON}")" ]] ; then
452 echo
453 ewarn "xend may not work when python is built with stack smashing protection (ssp)."
454 ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
455 ewarn "This problem may be resolved as of Xen 3.0.4, if not post in the bug."
456 fi
457
458 # TODO: we need to have the current Python slot here.
459 if ! has_version "dev-lang/python[ncurses]"; then
460 echo
461 ewarn "NB: Your dev-lang/python is built without USE=ncurses."
462 ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
463 fi
464
465 if has_version "sys-apps/iproute2[minimal]"; then
466 echo
467 ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
468 ewarn "will not work until you rebuild iproute2 without USE=minimal."
469 fi
470
471 if ! use hvm; then
472 echo
473 elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
474 elog "support enable the hvm use flag."
475 elog "An x86 or amd64 system is required to build HVM support."
476 fi
477
478 if use qemu; then
479 elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
480 elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
481 elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
482 elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
483 fi
484
485 if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
486 echo
487 elog "xensv is broken upstream (Gentoo bug #142011)."
488 elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
489 fi
490 }
491
492
493
494 1.1 app-emulation/xen-tools/xen-tools-4.3.2-r5.ebuild
495
496 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/xen-tools-4.3.2-r5.ebuild?rev=1.1&view=markup
497 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/xen-tools-4.3.2-r5.ebuild?rev=1.1&content-type=text/plain
498
499 Index: xen-tools-4.3.2-r5.ebuild
500 ===================================================================
501 # Copyright 1999-2014 Gentoo Foundation
502 # Distributed under the terms of the GNU General Public License v2
503 # $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/xen-tools-4.3.2-r5.ebuild,v 1.1 2014/07/09 06:35:45 dlan Exp $
504
505 EAPI=5
506
507 PYTHON_COMPAT=( python{2_6,2_7} )
508 PYTHON_REQ_USE='xml,threads'
509
510 if [[ $PV == *9999 ]]; then
511 KEYWORDS=""
512 REPO="xen-unstable.hg"
513 EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
514 S="${WORKDIR}/${REPO}"
515 live_eclass="mercurial"
516 else
517 KEYWORDS="~amd64 -x86"
518 UPSTREAM_VER=3
519 GENTOO_VER=
520 SEABIOS_VER=1.7.1-stable-xen
521
522 [[ -n ${UPSTREAM_VER} ]] && \
523 UPSTREAM_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
524 [[ -n ${GENTOO_VER} ]] && \
525 GENTOO_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
526
527 SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz
528 http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
529 http://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
530 ${UPSTREAM_PATCHSET_URI}
531 ${GENTOO_PATCHSET_URI}"
532 S="${WORKDIR}/xen-${PV}"
533 fi
534
535 inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass}
536
537 DESCRIPTION="Xend daemon and tools"
538 HOMEPAGE="http://xen.org/"
539 DOCS=( README docs/README.xen-bugtool )
540
541 LICENSE="GPL-2"
542 SLOT="0"
543 # Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
544 # >=dev-lang/ocaml-4 stable
545 # Masked in profiles/eapi-5-files instead
546 IUSE="api custom-cflags debug doc flask hvm qemu ocaml +pam python pygrub screen static-libs xend system-seabios"
547
548 REQUIRED_USE="hvm? ( qemu )
549 ${PYTHON_REQUIRED_USE}
550 pygrub? ( python )"
551
552 DEPEND="dev-libs/lzo:2
553 dev-libs/glib:2
554 dev-libs/yajl
555 dev-libs/libgcrypt:0
556 dev-python/lxml[${PYTHON_USEDEP}]
557 pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
558 sys-libs/zlib
559 sys-power/iasl
560 system-seabios? ( sys-firmware/seabios )
561 sys-firmware/ipxe
562 hvm? ( media-libs/libsdl )
563 ${PYTHON_DEPS}
564 api? ( dev-libs/libxml2
565 net-misc/curl )
566 pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} )
567 sys-devel/bin86
568 sys-devel/dev86
569 dev-lang/perl
570 app-misc/pax-utils
571 dev-python/markdown
572 doc? (
573 app-doc/doxygen
574 dev-tex/latex2html[png,gif]
575 media-gfx/graphviz
576 dev-tex/xcolor
577 media-gfx/transfig
578 dev-texlive/texlive-latexextra
579 virtual/latex-base
580 dev-tex/latexmk
581 dev-texlive/texlive-latex
582 dev-texlive/texlive-pictures
583 dev-texlive/texlive-latexrecommended
584 )
585 hvm? ( x11-proto/xproto
586 !net-libs/libiscsi )
587 qemu? ( x11-libs/pixman )
588 ocaml? ( dev-ml/findlib
589 >=dev-lang/ocaml-4 )"
590 RDEPEND="sys-apps/iproute2
591 net-misc/bridge-utils
592 screen? (
593 app-misc/screen
594 app-admin/logrotate
595 )
596 virtual/udev"
597
598 # hvmloader is used to bootstrap a fully virtualized kernel
599 # Approved by QA team in bug #144032
600 QA_WX_LOAD="usr/lib/xen/boot/hvmloader"
601
602 RESTRICT="test"
603
604 pkg_setup() {
605 python-single-r1_pkg_setup
606 export "CONFIG_LOMOUNT=y"
607
608 if has_version dev-libs/libgcrypt:0; then
609 export "CONFIG_GCRYPT=y"
610 fi
611
612 if use qemu; then
613 export "CONFIG_IOEMU=y"
614 else
615 export "CONFIG_IOEMU=n"
616 fi
617
618 if [[ -z ${XEN_TARGET_ARCH} ]] ; then
619 if use x86 && use amd64; then
620 die "Confusion! Both x86 and amd64 are set in your use flags!"
621 elif use x86; then
622 export XEN_TARGET_ARCH="x86_32"
623 elif use amd64 ; then
624 export XEN_TARGET_ARCH="x86_64"
625 else
626 die "Unsupported architecture!"
627 fi
628 fi
629 }
630
631 src_prepare() {
632 # Upstream's patchset
633 if [[ -n ${UPSTREAM_VER} ]]; then
634 EPATCH_SUFFIX="patch" \
635 EPATCH_FORCE="yes" \
636 EPATCH_OPTS="-p1" \
637 epatch "${WORKDIR}"/patches-upstream
638 fi
639
640 # Gentoo's patchset
641 if [[ -n ${GENTOO_VER} ]]; then
642 EPATCH_SUFFIX="patch" \
643 EPATCH_FORCE="yes" \
644 epatch "${WORKDIR}"/patches-gentoo
645 fi
646
647 # Drop .config, fixes to gcc-4.6
648 epatch "${FILESDIR}"/${PN/-tools/}-4.3-fix_dotconfig-gcc.patch
649
650 # Fix texi2html build error with new texi2html, qemu.doc.html
651 epatch "${FILESDIR}"/${PN}-4-docfix.patch \
652 "${FILESDIR}"/${PN}-4-qemu-xen-doc.patch
653
654 # Fix network broadcast on bridged networks
655 epatch "${FILESDIR}/${PN}-3.4.0-network-bridge-broadcast.patch"
656
657 # Bug 496708
658 epatch "${FILESDIR}"/${PN}-4-unbundle-ipxe.patch
659 use system-seabios && epatch "${FILESDIR}"/${PN}-4-unbundle-seabios.patch
660
661 # Fix bridge by idella4, bug #362575
662 epatch "${FILESDIR}/${PN}-4.1.1-bridge.patch"
663
664 # Prevent double stripping of files at install
665 epatch "${FILESDIR}"/${PN/-tools/}-4.2.0-nostrip.patch
666
667 # fix jobserver in Makefile
668 epatch "${FILESDIR}"/${PN/-tools/}-4.3-jserver.patch
669
670 # add missing header
671 epatch "${FILESDIR}"/xen-4-ulong.patch
672
673 # Set dom0-min-mem to kb; Bug #472982
674 epatch "${FILESDIR}"/${PN/-tools/}-4.2-configsxp.patch
675
676 # Bug 477676
677 epatch "${FILESDIR}"/${PN}-4.3-ar-cc.patch
678
679 # Bug 379537
680 epatch "${FILESDIR}"/fix-gold-ld.patch
681
682 # Prevent file collision with qemu package Bug 478064
683 epatch "${FILESDIR}"/qemu-bridge.patch
684 mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
685
686 # bundled seabios
687 epatch "${FILESDIR}"/${PN}-4-anti-seabios-download.patch
688 mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
689 pushd tools/firmware/ > /dev/null
690 ln -s seabios-dir-remote seabios-dir || die
691 popd > /dev/null
692
693 # Xend
694 if ! use xend; then
695 sed -e 's:xm xen-bugtool xen-python-path xend:xen-bugtool xen-python-path:' \
696 -i tools/misc/Makefile || die "Disabling xend failed"
697 sed -e 's:^XEND_INITD:#XEND_INITD:' \
698 -i tools/examples/Makefile || die "Disabling xend failed"
699 fi
700
701 # if the user *really* wants to use their own custom-cflags, let them
702 if use custom-cflags; then
703 einfo "User wants their own CFLAGS - removing defaults"
704
705 # try and remove all the default cflags
706 find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
707 -exec sed \
708 -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
709 -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
710 -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
711 -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
712 -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
713 -i {} + || die "failed to re-set custom-cflags"
714 fi
715
716 if ! use pygrub; then
717 sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
718 fi
719
720 if ! use python; then
721 sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
722 fi
723
724 # Disable hvm support on systems that don't support x86_32 binaries.
725 if ! use hvm; then
726 sed -e '/^CONFIG_IOEMU := y$/d' -i config/*.mk || die
727 sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
728 # Bug 351648
729 elif ! use x86 && ! has x86 $(get_all_abis); then
730 mkdir -p "${WORKDIR}"/extra-headers/gnu || die
731 touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
732 export CPATH="${WORKDIR}"/extra-headers
733 fi
734
735 # Don't bother with qemu, only needed for fully virtualised guests
736 if ! use qemu; then
737 sed -e "/^CONFIG_IOEMU := y$/d" -i config/*.mk || die
738 sed -e "s:install-tools\: tools/ioemu-dir:install-tools\: :g" -i Makefile || die
739 fi
740
741 # Bug 472438
742 sed -e 's:^BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(SHARE_DIR)/bash-completion:' \
743 -i Config.mk || die
744
745 use flask || sed -e "/SUBDIRS-y += flask/d" -i tools/Makefile || die
746 use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
747 sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
748 -i tools/firmware/Makefile || die
749
750 # xencommons, Bug #492332, sed lighter weight than patching
751 sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
752 -i tools/hotplug/Linux/init.d/xencommons || die
753
754 # Bug 493232 fix from http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1844
755 sed -e 's:bl->argsspace = 7 + :bl->argsspace = 9 + :' \
756 -i tools/libxl/libxl_bootloader.c || die
757
758 # fix QA warning, create /var/run/, /var/lock dynamically
759 sed -i -e "/\$(INSTALL_DIR) \$(DESTDIR)\$(XEN_RUN_DIR)/d" \
760 tools/libxl/Makefile || die
761
762 sed -i -e "/\/var\/run\//d" \
763 tools/xenstore/Makefile \
764 tools/pygrub/Makefile || die
765
766 sed -i -e "/\/var\/lock\/subsys/d" \
767 tools/Makefile || die
768
769 epatch_user
770 }
771
772 src_configure() {
773 local myconf="--prefix=/usr --disable-werror"
774
775 if use ocaml
776 then
777 myconf="${myconf} $(use_enable ocaml ocamltools)"
778 else
779 myconf="${myconf} --disable-ocamltools"
780 fi
781
782 if ! use pam
783 then
784 myconf="${myconf} --disable-pam"
785 fi
786
787 econf ${myconf}
788 }
789
790 src_compile() {
791 export VARTEXFONTS="${T}/fonts"
792 local myopt
793 use debug && myopt="${myopt} debug=y"
794
795 use custom-cflags || unset CFLAGS
796 if test-flag-CC -fno-strict-overflow; then
797 append-flags -fno-strict-overflow
798 fi
799
800 unset LDFLAGS
801 unset CFLAGS
802 emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt}
803
804 use doc && emake -C docs txt html
805 emake -C docs man-pages
806 }
807
808 src_install() {
809 # Override auto-detection in the build system, bug #382573
810 export INITD_DIR=/tmp/init.d
811 export CONFIG_LEAF_DIR=../tmp/default
812
813 # Let the build system compile installed Python modules.
814 local PYTHONDONTWRITEBYTECODE
815 export PYTHONDONTWRITEBYTECODE
816
817 emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
818 XEN_PYTHON_NATIVE_INSTALL=y install-tools
819
820 # Fix the remaining Python shebangs.
821 python_fix_shebang "${D}"
822
823 # Remove RedHat-specific stuff
824 rm -rf "${D}"tmp || die
825
826 # uncomment lines in xl.conf
827 sed -e 's:^#autoballoon=1:autoballoon=1:' \
828 -e 's:^#lockfile="/var/lock/xl":lockfile="/var/lock/xl":' \
829 -e 's:^#vifscript="vif-bridge":vifscript="vif-bridge":' \
830 -i tools/examples/xl.conf || die
831
832 # Reset bash completion dir; Bug 472438
833 mv "${D}"bash-completion "${D}"usr/share/ || die
834
835 if use doc; then
836 emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
837
838 dohtml -r docs/
839 docinto pdf
840 dodoc ${DOCS[@]}
841 [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html
842 fi
843
844 rm -rf "${D}"/usr/share/doc/xen/
845 doman docs/man?/*
846
847 if use xend; then
848 newinitd "${FILESDIR}"/xend.initd-r2 xend || die "Couldn't install xen.initd"
849 fi
850 newconfd "${FILESDIR}"/xendomains.confd xendomains
851 newconfd "${FILESDIR}"/xenstored.confd xenstored
852 newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
853 newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
854 newinitd "${FILESDIR}"/xenstored.initd xenstored
855 newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
856 newinitd "${FILESDIR}"/xencommons.initd xencommons
857 newconfd "${FILESDIR}"/xencommons.confd xencommons
858 newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
859 newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
860
861 if use screen; then
862 cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
863 cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
864 keepdir /var/log/xen-consoles
865 fi
866
867 # Move files built with use qemu, Bug #477884
868 if [[ "${ARCH}" == 'amd64' ]] && use qemu; then
869 mkdir -p "${D}"usr/$(get_libdir)/xen/bin || die
870 mv "${D}"usr/lib/xen/bin/* "${D}"usr/$(get_libdir)/xen/bin/ || die
871 fi
872
873 # For -static-libs wrt Bug 384355
874 if ! use static-libs; then
875 rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
876 fi
877
878 # xend expects these to exist
879 keepdir /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen
880
881 # for xendomains
882 keepdir /etc/xen/auto
883
884 # Temp QA workaround
885 dodir "$(udev_get_udevdir)"
886 mv "${D}"/etc/udev/* "${D}/$(udev_get_udevdir)"
887 rm -rf "${D}"/etc/udev
888
889 # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
890 find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
891 -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
892 }
893
894 pkg_postinst() {
895 elog "Official Xen Guide and the offical wiki page:"
896 elog "https://wiki.gentoo.org/wiki/Xen"
897 elog "http://wiki.xen.org/wiki/Main_Page"
898 elog ""
899 elog "Recommended to utilise the xencommons script to config sytem At boot"
900 elog "Add by use of rc-update on completion of the install"
901
902 if [[ "$(scanelf -s __guard -q "${PYTHON}")" ]] ; then
903 echo
904 ewarn "xend may not work when python is built with stack smashing protection (ssp)."
905 ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
906 ewarn "This problem may be resolved as of Xen 3.0.4, if not post in the bug."
907 fi
908
909 # TODO: we need to have the current Python slot here.
910 if ! has_version "dev-lang/python[ncurses]"; then
911 echo
912 ewarn "NB: Your dev-lang/python is built without USE=ncurses."
913 ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
914 fi
915
916 if has_version "sys-apps/iproute2[minimal]"; then
917 echo
918 ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
919 ewarn "will not work until you rebuild iproute2 without USE=minimal."
920 fi
921
922 if ! use hvm; then
923 echo
924 elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
925 elog "support enable the hvm use flag."
926 elog "An x86 or amd64 system is required to build HVM support."
927 fi
928
929 if use xend; then
930 elog"";elog "xend capability has been enabled and installed"
931 fi
932
933 if use qemu; then
934 elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
935 elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
936 elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
937 elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
938 fi
939
940 if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
941 echo
942 elog "xensv is broken upstream (Gentoo bug #142011)."
943 elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
944 fi
945 }
946
947
948
949 1.1 app-emulation/xen-tools/xen-tools-4.2.4-r6.ebuild
950
951 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/xen-tools-4.2.4-r6.ebuild?rev=1.1&view=markup
952 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-emulation/xen-tools/xen-tools-4.2.4-r6.ebuild?rev=1.1&content-type=text/plain
953
954 Index: xen-tools-4.2.4-r6.ebuild
955 ===================================================================
956 # Copyright 1999-2014 Gentoo Foundation
957 # Distributed under the terms of the GNU General Public License v2
958 # $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/xen-tools-4.2.4-r6.ebuild,v 1.1 2014/07/09 06:35:45 dlan Exp $
959
960 EAPI=5
961
962 PYTHON_COMPAT=( python{2_6,2_7} )
963 PYTHON_REQ_USE='xml,threads'
964
965 if [[ $PV == *9999 ]]; then
966 KEYWORDS=""
967 REPO="xen-unstable.hg"
968 EHG_REPO_URI="http://xenbits.xensource.com/${REPO}"
969 S="${WORKDIR}/${REPO}"
970 live_eclass="mercurial"
971 else
972 KEYWORDS="~amd64 ~x86"
973 UPSTREAM_VER=3
974 GENTOO_VER=
975 SEABIOS_VER=1.6.3.2
976
977 [[ -n ${UPSTREAM_VER} ]] && \
978 UPSTREAM_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
979 [[ -n ${GENTOO_VER} ]] && \
980 GENTOO_PATCHSET_URI="http://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
981
982 SRC_URI="http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz
983 http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
984 http://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
985 ${UPSTREAM_PATCHSET_URI}
986 ${GENTOO_PATCHSET_URI}"
987 S="${WORKDIR}/xen-${PV}"
988 fi
989
990 inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs udev ${live_eclass}
991
992 DESCRIPTION="Xend daemon and tools"
993 HOMEPAGE="http://xen.org/"
994 DOCS=( README docs/README.xen-bugtool )
995
996 LICENSE="GPL-2"
997 SLOT="0"
998 IUSE="api custom-cflags debug doc flask hvm qemu ocaml pygrub screen static-libs xend system-seabios"
999
1000 REQUIRED_USE="hvm? ( qemu )
1001 ${PYTHON_REQUIRED_USE}"
1002
1003 DEPEND="dev-libs/lzo:2
1004 dev-libs/glib:2
1005 dev-libs/yajl
1006 dev-libs/libgcrypt:0
1007 dev-python/lxml[${PYTHON_USEDEP}]
1008 dev-python/pypam[${PYTHON_USEDEP}]
1009 sys-libs/zlib
1010 sys-power/iasl
1011 system-seabios? ( sys-firmware/seabios )
1012 sys-firmware/ipxe
1013 dev-ml/findlib
1014 hvm? ( media-libs/libsdl )
1015 ${PYTHON_DEPS}
1016 api? ( dev-libs/libxml2
1017 net-misc/curl )
1018 ${PYTHON_DEPS}
1019 pygrub? ( ${PYTHON_DEPS//${PYTHON_REQ_USE}/ncurses} )
1020 sys-devel/bin86
1021 sys-devel/dev86
1022 dev-lang/perl
1023 app-misc/pax-utils
1024 doc? (
1025 app-doc/doxygen
1026 dev-tex/latex2html[png,gif]
1027 media-gfx/transfig
1028 media-gfx/graphviz
1029 dev-tex/xcolor
1030 dev-texlive/texlive-latexextra
1031 virtual/latex-base
1032 dev-tex/latexmk
1033 dev-texlive/texlive-latex
1034 dev-texlive/texlive-pictures
1035 dev-texlive/texlive-latexrecommended
1036 )
1037 hvm? ( x11-proto/xproto
1038 !net-libs/libiscsi )"
1039 RDEPEND="sys-apps/iproute2
1040 net-misc/bridge-utils
1041 ocaml? ( >=dev-lang/ocaml-4 )
1042 screen? (
1043 app-misc/screen
1044 app-admin/logrotate
1045 )
1046 virtual/udev"
1047
1048 # hvmloader is used to bootstrap a fully virtualized kernel
1049 # Approved by QA team in bug #144032
1050 QA_WX_LOAD="usr/lib/xen/boot/hvmloader"
1051
1052 RESTRICT="test"
1053
1054 pkg_setup() {
1055 python-single-r1_pkg_setup
1056 export "CONFIG_LOMOUNT=y"
1057
1058 if has_version dev-libs/libgcrypt:0; then
1059 export "CONFIG_GCRYPT=y"
1060 fi
1061
1062 if use qemu; then
1063 export "CONFIG_IOEMU=y"
1064 else
1065 export "CONFIG_IOEMU=n"
1066 fi
1067
1068 if [[ -z ${XEN_TARGET_ARCH} ]] ; then
1069 if use x86 && use amd64; then
1070 die "Confusion! Both x86 and amd64 are set in your use flags!"
1071 elif use x86; then
1072 export XEN_TARGET_ARCH="x86_32"
1073 elif use amd64 ; then
1074 export XEN_TARGET_ARCH="x86_64"
1075 else
1076 die "Unsupported architecture!"
1077 fi
1078 fi
1079
1080 use api && export "LIBXENAPI_BINDINGS=y"
1081 use flask && export "FLASK_ENABLE=y"
1082 }
1083
1084 src_prepare() {
1085 # Upstream's patchset
1086 if [[ -n ${UPSTREAM_VER} ]]; then
1087 EPATCH_SUFFIX="patch" \
1088 EPATCH_FORCE="yes" \
1089 EPATCH_OPTS="-p1" \
1090 epatch "${WORKDIR}"/patches-upstream
1091 fi
1092
1093 # Gentoo's patchset
1094 if [[ -n ${GENTOO_VER} ]]; then
1095 EPATCH_SUFFIX="patch" \
1096 EPATCH_FORCE="yes" \
1097 epatch "${WORKDIR}"/patches-gentoo
1098 fi
1099
1100 # Drop .config, fixes to gcc-4.6
1101 epatch "${FILESDIR}"/${PN/-tools/}-4-fix_dotconfig-gcc.patch
1102
1103 # Xend
1104 if ! use xend; then
1105 sed -e 's:xm xen-bugtool xen-python-path xend:xen-bugtool xen-python-path:' \
1106 -i tools/misc/Makefile || die "Disabling xend failed"
1107 sed -e 's:^XEND_INITD:#XEND_INITD:' \
1108 -i tools/examples/Makefile || die "Disabling xend failed"
1109 fi
1110
1111 # if the user *really* wants to use their own custom-cflags, let them
1112 if use custom-cflags; then
1113 einfo "User wants their own CFLAGS - removing defaults"
1114
1115 # try and remove all the default cflags
1116 find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
1117 -exec sed \
1118 -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
1119 -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
1120 -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
1121 -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
1122 -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
1123 -i {} + || die "failed to re-set custom-cflags"
1124 fi
1125
1126 if ! use pygrub; then
1127 sed -e '/^SUBDIRS-$(PYTHON_TOOLS) += pygrub$/d' -i tools/Makefile || die
1128 fi
1129
1130 # Disable hvm support on systems that don't support x86_32 binaries.
1131 if ! use hvm; then
1132 sed -e '/^CONFIG_IOEMU := y$/d' -i config/*.mk || die
1133 sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
1134 # Bug 351648
1135 elif ! use x86 && ! has x86 $(get_all_abis); then
1136 mkdir -p "${WORKDIR}"/extra-headers/gnu || die
1137 touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
1138 export CPATH="${WORKDIR}"/extra-headers
1139 fi
1140
1141 # Don't bother with qemu, only needed for fully virtualised guests
1142 if ! use qemu; then
1143 sed -e "/^CONFIG_IOEMU := y$/d" -i config/*.mk || die
1144 sed -e "s:install-tools\: tools/ioemu-dir:install-tools\: :g" -i Makefile || die
1145 fi
1146
1147 # Fix texi2html build error with new texi2html, qemu.doc.html
1148 epatch "${FILESDIR}"/${PN}-4-docfix.patch \
1149 "${FILESDIR}"/${PN}-4-qemu-xen-doc.patch
1150
1151 # Fix network broadcast on bridged networks
1152 epatch "${FILESDIR}/${PN}-3.4.0-network-bridge-broadcast.patch"
1153
1154 # Bug 496708
1155 epatch "${FILESDIR}"/${PN}-4-unbundle-ipxe.patch
1156 use system-seabios && epatch "${FILESDIR}"/${PN}-4-unbundle-seabios.patch
1157
1158 # Fix bridge by idella4, bug #362575
1159 epatch "${FILESDIR}/${PN}-4.1.1-bridge.patch"
1160
1161 # Don't build ipxe with pie on hardened, Bug #360805
1162 if gcc-specs-pie; then
1163 epatch "${FILESDIR}"/ipxe-nopie.patch
1164 fi
1165
1166 # Prevent double stripping of files at install
1167 epatch "${FILESDIR}"/${PN/-tools/}-4.2.0-nostrip.patch
1168
1169 # fix jobserver in Makefile
1170 epatch "${FILESDIR}"/${PN/-tools/}-4.2.0-jserver.patch
1171
1172 # add missing header, Bug #467200
1173 epatch "${FILESDIR}"/xen-4-ulong.patch \
1174 "${FILESDIR}"/${PN}-4.2-xen_disk_leak.patch
1175
1176 # Set dom0-min-mem to kb; Bug #472982
1177 epatch "${FILESDIR}"/${PN/-tools/}-4.2-configsxp.patch
1178
1179 # Bug 463840
1180 epatch "${FILESDIR}"/${PN}-4.2.2-install.patch
1181 epatch "${FILESDIR}"/${PN}-4.2.2-rt-link.patch
1182
1183 # Bug 379537
1184 epatch "${FILESDIR}"/fix-gold-ld.patch
1185
1186 # Bug 510976
1187 epatch "${FILESDIR}"/${P}-udev-rules.patch
1188
1189 # bundled seabios
1190 epatch "${FILESDIR}"/${PN}-4-anti-seabios-download.patch
1191 mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
1192 pushd tools/firmware/ > /dev/null
1193 ln -s seabios-dir-remote seabios-dir || die
1194 popd > /dev/null
1195
1196 # Bug 472438
1197 sed -e 's:^BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(SHARE_DIR)/bash-completion:' \
1198 -i Config.mk || die
1199
1200 # Bug 445986
1201 sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' -i tools/firmware/Makefile || die
1202
1203 # fix QA warning, create /var/run/, /var/lock dynamically
1204 sed -i -e "/\$(INSTALL_DIR) \$(DESTDIR)\$(XEN_RUN_DIR)/d" \
1205 tools/libxl/Makefile || die
1206
1207 sed -i -e "/\/var\/run\//d" \
1208 tools/xenstore/Makefile \
1209 tools/pygrub/Makefile || die
1210
1211 sed -i -e "/\/var\/lock\/subsys/d" \
1212 tools/Makefile || die
1213
1214 # xencommons, Bug #492332, sed lighter weight than patching
1215 sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
1216 -i tools/hotplug/Linux/init.d/xencommons || die
1217
1218 epatch_user
1219 }
1220
1221 src_compile() {
1222 export VARTEXFONTS="${T}/fonts"
1223 local myopt
1224 use debug && myopt="${myopt} debug=y"
1225
1226 use custom-cflags || unset CFLAGS
1227 if test-flag-CC -fno-strict-overflow; then
1228 append-flags -fno-strict-overflow
1229 fi
1230
1231 unset LDFLAGS
1232 unset CFLAGS
1233 emake V=1 CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" -C tools ${myopt}
1234
1235 use doc && emake -C docs txt html
1236 emake -C docs man-pages
1237 }
1238
1239 src_install() {
1240 # Override auto-detection in the build system, bug #382573
1241 export INITD_DIR=/tmp/init.d
1242 export CONFIG_LEAF_DIR=../tmp/default
1243
1244 # Let the build system compile installed Python modules.
1245 local PYTHONDONTWRITEBYTECODE
1246 export PYTHONDONTWRITEBYTECODE
1247
1248 emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" install-tools \
1249 XEN_PYTHON_NATIVE_INSTALL=y install-tools
1250 # Fix the remaining Python shebangs.
1251 python_fix_shebang "${ED}"
1252
1253 # Remove RedHat-specific stuff
1254 rm -rf "${D}"tmp || die
1255
1256 # uncomment lines in xl.conf
1257 sed -e 's:^#autoballoon=1:autoballoon=1:' \
1258 -e 's:^#lockfile="/var/lock/xl":lockfile="/var/lock/xl":' \
1259 -e 's:^#vifscript="vif-bridge":vifscript="vif-bridge":' \
1260 -i tools/examples/xl.conf || die
1261
1262 # Reset bash completion dir; Bug 472438
1263 mv "${D}"bash-completion "${D}"usr/share/ || die
1264
1265 if use doc; then
1266 emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
1267
1268 dohtml -r docs/
1269 docinto pdf
1270 dodoc ${DOCS[@]}
1271 [ -d "${D}"/usr/share/doc/xen ] && mv "${D}"/usr/share/doc/xen/* "${D}"/usr/share/doc/${PF}/html
1272 fi
1273
1274 rm -rf "${D}"/usr/share/doc/xen/
1275 doman docs/man?/*
1276
1277 if use xend; then
1278 newinitd "${FILESDIR}"/xend.initd-r2 xend || die "Couldn't install xen.initd"
1279 fi
1280 newconfd "${FILESDIR}"/xendomains.confd xendomains
1281 newconfd "${FILESDIR}"/xenstored.confd xenstored
1282 newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
1283 newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
1284 newinitd "${FILESDIR}"/xenstored.initd xenstored
1285 newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
1286 newinitd "${FILESDIR}"/xencommons.initd xencommons
1287 newconfd "${FILESDIR}"/xencommons.confd xencommons
1288
1289 if use screen; then
1290 cat "${FILESDIR}"/xendomains-screen.confd >> "${ED}"/etc/conf.d/xendomains || die
1291 cp "${FILESDIR}"/xen-consoles.logrotate "${ED}"/etc/xen/ || die
1292 keepdir /var/log/xen-consoles
1293 fi
1294
1295 if [[ "${ARCH}" == 'amd64' ]] && use qemu; then
1296 mkdir -p "${D}"usr/$(get_libdir)/xen/bin || die
1297 mv "${D}"usr/lib/xen/bin/qemu* "${D}"usr/$(get_libdir)/xen/bin/ || die
1298 fi
1299
1300 # For -static-libs wrt Bug 384355
1301 if ! use static-libs; then
1302 rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
1303 fi
1304
1305 # xend expects these to exist
1306 keepdir /var/run/xenstored /var/lib/xenstored /var/xen/dump /var/lib/xen /var/log/xen
1307
1308 # for xendomains
1309 keepdir /etc/xen/auto
1310
1311 # Temp QA workaround
1312 dodir "$(udev_get_udevdir)"
1313 mv "${D}"/etc/udev/* "${D}/$(udev_get_udevdir)"
1314 rm -rf "${D}"/etc/udev
1315
1316 # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
1317 find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
1318 -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
1319 }
1320
1321 pkg_postinst() {
1322 elog "Official Xen Guide and the offical wiki page:"
1323 elog "http://www.gentoo.org/doc/en/xen-gu"${D}"usr/ide.xml"
1324 elog "http://wiki.xen.org/wiki/Main_Page"
1325 elog ""
1326 elog "Recommended to utilise the xencommons script to config sytem at boot."
1327 elog "Add by use of rc-update on completion of the install"
1328
1329 if [[ "$(scanelf -s __guard -q "${PYTHON}")" ]] ; then
1330 echo
1331 ewarn "xend may not work when python is built with stack smashing protection (ssp)."
1332 ewarn "If 'xm create' fails with '<ProtocolError for /RPC2: -1 >', see bug #141866"
1333 ewarn "This problem may be resolved as of Xen 3.0.4, if not post in the bug."
1334 fi
1335
1336 # TODO: we need to have the current Python slot here.
1337 if ! has_version "dev-lang/python[ncurses]"; then
1338 echo
1339 ewarn "NB: Your dev-lang/python is built without USE=ncurses."
1340 ewarn "Please rebuild python with USE=ncurses to make use of xenmon.py."
1341 fi
1342
1343 if has_version "sys-apps/iproute2[minimal]"; then
1344 echo
1345 ewarn "Your sys-apps/iproute2 is built with USE=minimal. Networking"
1346 ewarn "will not work until you rebuild iproute2 without USE=minimal."
1347 fi
1348
1349 if ! use hvm; then
1350 echo
1351 elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
1352 elog "support enable the hvm use flag."
1353 elog "An x86 or amd64 system is required to build HVM support."
1354 fi
1355
1356 if use xend; then
1357 echo
1358 elog "xend capability has been enabled and installed"
1359 fi
1360
1361 if grep -qsF XENSV= "${ROOT}/etc/conf.d/xend"; then
1362 echo
1363 elog "xensv is broken upstream (Gentoo bug #142011)."
1364 elog "Please remove '${ROOT%/}/etc/conf.d/xend', as it is no longer needed."
1365 fi
1366 }