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