Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/xen-tools/
Date: Tue, 30 Mar 2021 13:03:15
Message-Id: 1617109384.ba365f2b582cd4f12f650e30281e47b7de9a50ce.juippis@gentoo
1 commit: ba365f2b582cd4f12f650e30281e47b7de9a50ce
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Wed Mar 24 15:31:41 2021 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 30 13:03:04 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba365f2b
7
8 app-emulation/xen-tools: remove png/jpeg automagic
9
10 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
11 Closes: https://github.com/gentoo/gentoo/pull/20104
12 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
13
14 app-emulation/xen-tools/xen-tools-4.13.2-r4.ebuild | 520 +++++++++++++++++++++
15 app-emulation/xen-tools/xen-tools-4.14.1-r2.ebuild | 520 +++++++++++++++++++++
16 2 files changed, 1040 insertions(+)
17
18 diff --git a/app-emulation/xen-tools/xen-tools-4.13.2-r4.ebuild b/app-emulation/xen-tools/xen-tools-4.13.2-r4.ebuild
19 new file mode 100644
20 index 00000000000..50f18d15c45
21 --- /dev/null
22 +++ b/app-emulation/xen-tools/xen-tools-4.13.2-r4.ebuild
23 @@ -0,0 +1,520 @@
24 +# Copyright 1999-2021 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +PYTHON_COMPAT=( python3_{7..9} )
30 +PYTHON_REQ_USE='ncurses,xml,threads(+)'
31 +
32 +inherit bash-completion-r1 flag-o-matic multilib python-single-r1 toolchain-funcs
33 +
34 +MY_PV=${PV/_/-}
35 +
36 +if [[ $PV == *9999 ]]; then
37 + inherit git-r3
38 + REPO="xen.git"
39 + EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
40 + S="${WORKDIR}/${REPO}"
41 +else
42 + KEYWORDS="~amd64 ~arm ~arm64 ~x86"
43 + UPSTREAM_VER=6
44 + SECURITY_VER=29
45 + # xen-tools's gentoo patches tarball
46 + GENTOO_VER=21
47 + # xen-tools's gentoo patches version which apply to this specific ebuild
48 + GENTOO_GPV=1
49 + # xen-tools ovmf's patches
50 + OVMF_VER=
51 +
52 + SEABIOS_VER="1.12.1"
53 + EDK2_COMMIT="06dc822d045c2bb42e497487935485302486e151"
54 + EDK2_OPENSSL_VERSION="1_1_1g"
55 + EDK2_SOFTFLOAT_COMMIT="b64af41c3276f97f0e181920400ee056b9c88037"
56 + EDK2_BROTLI_COMMIT="666c3280cc11dc433c303d79a83d4ffbdd12cc8d"
57 + IPXE_COMMIT="1dd56dbd11082fb622c2ed21cfaced4f47d798a6"
58 +
59 + [[ -n ${UPSTREAM_VER} ]] && \
60 + UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz
61 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
62 + [[ -n ${SECURITY_VER} ]] && \
63 + SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz
64 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-security-patches-${SECURITY_VER}.tar.xz"
65 + [[ -n ${GENTOO_VER} ]] && \
66 + GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz
67 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
68 + [[ -n ${OVMF_VER} ]] && \
69 + OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
70 +
71 + SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
72 + https://github.com/qemu/seabios/archive/rel-${SEABIOS_VER}.tar.gz -> seabios-${SEABIOS_VER}.tar.gz
73 + ipxe? ( http://xenbits.xen.org/xen-extfiles/ipxe-git-${IPXE_COMMIT}.tar.gz )
74 + ovmf? ( https://github.com/tianocore/edk2/archive/${EDK2_COMMIT}.tar.gz -> edk2-${EDK2_COMMIT}.tar.gz
75 + https://github.com/openssl/openssl/archive/OpenSSL_${EDK2_OPENSSL_VERSION}.tar.gz
76 + https://github.com/ucb-bar/berkeley-softfloat-3/archive/${EDK2_SOFTFLOAT_COMMIT}.tar.gz -> berkeley-softfloat-${EDK2_SOFTFLOAT_COMMIT}.tar.gz
77 + https://github.com/google/brotli/archive/${EDK2_BROTLI_COMMIT}.tar.gz -> brotli-${EDK2_BROTLI_COMMIT}.tar.gz
78 + ${OVMF_PATCHSET_URI} )
79 + ${UPSTREAM_PATCHSET_URI}
80 + ${SECURITY_PATCHSET_URI}
81 + ${GENTOO_PATCHSET_URI}"
82 +
83 + S="${WORKDIR}/xen-${MY_PV}"
84 +fi
85 +
86 +DESCRIPTION="Xen tools including QEMU and xl"
87 +HOMEPAGE="https://www.xenproject.org"
88 +DOCS=( README )
89 +
90 +LICENSE="GPL-2"
91 +SLOT="0/$(ver_cut 1-2)"
92 +# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
93 +# >=dev-lang/ocaml-4 stable
94 +# Masked in profiles/eapi-5-files instead
95 +IUSE="api debug doc flask +hvm +ipxe ocaml ovmf +pam pygrub python +qemu +qemu-traditional +rombios screen sdl static-libs system-ipxe system-qemu system-seabios"
96 +
97 +REQUIRED_USE="
98 + ${PYTHON_REQUIRED_USE}
99 + ipxe? ( rombios )
100 + ovmf? ( hvm )
101 + pygrub? ( python )
102 + rombios? ( hvm )
103 + system-ipxe? ( rombios )
104 + ?? ( ipxe system-ipxe )
105 + ?? ( qemu system-qemu )"
106 +
107 +COMMON_DEPEND="
108 + sys-apps/pciutils
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 + ${PYTHON_DEPS}
116 +"
117 +
118 +DEPEND="${COMMON_DEPEND}
119 + >=sys-kernel/linux-headers-4.11
120 + $(python_gen_cond_dep '
121 + dev-python/lxml[${PYTHON_MULTI_USEDEP}]
122 + pam? ( dev-python/pypam[${PYTHON_MULTI_USEDEP}] )
123 + ')
124 + x86? ( sys-devel/dev86
125 + system-ipxe? ( sys-firmware/ipxe[qemu] )
126 + sys-power/iasl )
127 + api? ( dev-libs/libxml2
128 + net-misc/curl )
129 +
130 + ovmf? (
131 + !arm? ( !arm64? ( dev-lang/nasm ) )
132 + $(python_gen_impl_dep sqlite)
133 + )
134 + !amd64? ( >=sys-apps/dtc-1.4.0 )
135 + amd64? ( sys-power/iasl
136 + system-seabios? ( sys-firmware/seabios )
137 + system-ipxe? ( sys-firmware/ipxe[qemu] )
138 + rombios? ( sys-devel/bin86 sys-devel/dev86 ) )
139 + dev-lang/perl
140 + app-misc/pax-utils
141 + doc? (
142 + app-text/ghostscript-gpl
143 + app-text/pandoc
144 + $(python_gen_cond_dep '
145 + dev-python/markdown[${PYTHON_MULTI_USEDEP}]
146 + ')
147 + dev-texlive/texlive-latexextra
148 + media-gfx/transfig
149 + )
150 + hvm? ( x11-base/xorg-proto )
151 + qemu? (
152 + app-arch/snappy:=
153 + x11-libs/pixman
154 + sdl? (
155 + media-libs/libsdl[X]
156 + media-libs/libsdl2[X]
157 + )
158 + )
159 + system-qemu? ( app-emulation/qemu[xen] )
160 + ocaml? ( dev-ml/findlib
161 + >=dev-lang/ocaml-4 )
162 + python? ( >=dev-lang/swig-4.0.0 )"
163 +
164 +RDEPEND="${COMMON_DEPEND}
165 + sys-apps/iproute2[-minimal]
166 + net-misc/bridge-utils
167 + screen? (
168 + app-misc/screen
169 + app-admin/logrotate
170 + )"
171 +
172 +# hvmloader is used to bootstrap a fully virtualized kernel
173 +# Approved by QA team in bug #144032
174 +QA_WX_LOAD="
175 + usr/libexec/xen/boot/hvmloader
176 + usr/share/qemu-xen/qemu/hppa-firmware.img
177 + usr/share/qemu-xen/qemu/s390-ccw.img
178 + usr/share/qemu-xen/qemu/u-boot.e500
179 +"
180 +
181 +QA_PREBUILT="
182 + usr/libexec/xen/bin/elf2dmp
183 + usr/libexec/xen/bin/ivshmem-client
184 + usr/libexec/xen/bin/ivshmem-server
185 + usr/libexec/xen/bin/qemu-edid
186 + usr/libexec/xen/bin/qemu-img
187 + usr/libexec/xen/bin/qemu-io
188 + usr/libexec/xen/bin/qemu-keymap
189 + usr/libexec/xen/bin/qemu-nbd
190 + usr/libexec/xen/bin/qemu-pr-helper
191 + usr/libexec/xen/bin/qemu-system-i386
192 + usr/libexec/xen/bin/virtfs-proxy-helper
193 + usr/libexec/xen/libexec/xen-bridge-helper
194 + usr/share/qemu-xen/qemu/s390-ccw.img
195 + usr/share/qemu-xen/qemu/s390-netboot.img
196 + usr/share/qemu-xen/qemu/u-boot.e500
197 +"
198 +
199 +RESTRICT="test"
200 +
201 +pkg_setup() {
202 + python_setup
203 + export "CONFIG_LOMOUNT=y"
204 +
205 + #bug 522642, disable compile tools/tests
206 + export "CONFIG_TESTS=n"
207 +
208 + if [[ -z ${XEN_TARGET_ARCH} ]] ; then
209 + if use x86 && use amd64; then
210 + die "Confusion! Both x86 and amd64 are set in your use flags!"
211 + elif use x86; then
212 + export XEN_TARGET_ARCH="x86_32"
213 + elif use amd64 ; then
214 + export XEN_TARGET_ARCH="x86_64"
215 + elif use arm; then
216 + export XEN_TARGET_ARCH="arm32"
217 + elif use arm64; then
218 + export XEN_TARGET_ARCH="arm64"
219 + else
220 + die "Unsupported architecture!"
221 + fi
222 + fi
223 +}
224 +
225 +src_prepare() {
226 + local i
227 +
228 + # Upstream's patchset
229 + if [[ -n ${UPSTREAM_VER} ]]; then
230 + einfo "Try to apply Xen Upstream patch set"
231 + eapply "${WORKDIR}"/patches-upstream
232 + fi
233 +
234 + # Security patchset
235 + if [[ -n ${SECURITY_VER} ]]; then
236 + einfo "Try to apply Xen Security patch set"
237 + # apply main xen patches
238 + # Two parallel systems, both work side by side
239 + # Over time they may concdense into one. This will suffice for now
240 + EPATCH_SUFFIX="patch"
241 + EPATCH_FORCE="yes"
242 +
243 + source "${WORKDIR}"/patches-security/${PV}.conf || die
244 +
245 + for i in ${XEN_SECURITY_MAIN}; do
246 + eapply "${WORKDIR}"/patches-security/xen/$i
247 + done
248 +
249 + # apply qemu-xen/upstream patches
250 + pushd "${S}"/tools/qemu-xen/ > /dev/null
251 + for i in ${XEN_SECURITY_QEMUU}; do
252 + eapply "${WORKDIR}"/patches-security/qemuu/$i
253 + done
254 + popd > /dev/null
255 +
256 + # apply qemu-traditional patches
257 + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
258 + for i in ${XEN_SECURITY_QEMUT}; do
259 + eapply "${WORKDIR}"/patches-security/qemut/$i
260 + done
261 + popd > /dev/null
262 + fi
263 +
264 + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
265 + mv ../seabios-rel-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
266 + pushd tools/firmware/ > /dev/null
267 + ln -s seabios-dir-remote seabios-dir || die
268 + popd > /dev/null
269 +
270 + # Gentoo's patchset
271 + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
272 + einfo "Try to apply Gentoo specific patch set"
273 + source "${FILESDIR}"/gentoo-patches.conf || die
274 + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
275 + for i in ${!_gpv}; do
276 + eapply "${WORKDIR}"/patches-gentoo/$i
277 + done
278 + fi
279 +
280 + # Ovmf's patchset
281 + if use ovmf; then
282 + if [[ -n ${OVMF_VER} ]];then
283 + einfo "Try to apply Ovmf patch set"
284 + pushd "${WORKDIR}"/edk2-*/ > /dev/null
285 + eapply "${WORKDIR}"/patches-ovmf
286 + popd > /dev/null
287 + fi
288 + mv ../edk2-${EDK2_COMMIT} tools/firmware/ovmf-dir-remote || die
289 + rm -r tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
290 + rm -r tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
291 + rm -r tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
292 + rm -r tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
293 + mv ../openssl-OpenSSL_${EDK2_OPENSSL_VERSION} tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
294 + mv ../berkeley-softfloat-3-${EDK2_SOFTFLOAT_COMMIT} tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
295 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
296 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
297 + cp tools/firmware/ovmf-makefile tools/firmware/ovmf-dir-remote/Makefile || die
298 + fi
299 +
300 + # ipxe
301 + if use ipxe; then
302 + cp "${DISTDIR}/ipxe-git-${IPXE_COMMIT}.tar.gz" tools/firmware/etherboot/_ipxe.tar.gz || die
303 +
304 + # gcc 10
305 + cp "${WORKDIR}/patches-gentoo/xen-tools-4.13.0-ipxe-gcc10.patch" tools/firmware/etherboot/patches/ipxe-gcc10.patch || die
306 + echo ipxe-gcc10.patch >> tools/firmware/etherboot/patches/series || die
307 + fi
308 +
309 + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
310 +
311 + # Fix texi2html build error with new texi2html, qemu.doc.html
312 + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
313 +
314 + use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
315 + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
316 + -i tools/firmware/Makefile || die
317 +
318 + # Drop .config, fixes to gcc-4.6
319 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
320 +
321 + # drop flags
322 + unset CFLAGS
323 + unset LDFLAGS
324 + unset ASFLAGS
325 + unset CPPFLAGS
326 +
327 + if ! use pygrub; then
328 + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
329 + fi
330 +
331 + if ! use python; then
332 + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
333 + fi
334 +
335 + if ! use hvm; then
336 + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
337 + # Bug 351648
338 + elif ! use x86 && ! has x86 $(get_all_abis); then
339 + mkdir -p "${WORKDIR}"/extra-headers/gnu || die
340 + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
341 + export CPATH="${WORKDIR}"/extra-headers
342 + fi
343 +
344 + if use qemu; then
345 + if use sdl; then
346 + sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
347 + tools/Makefile || die
348 + else
349 + sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
350 + tools/qemu-xen-traditional/xen-setup || die
351 + sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
352 + tools/Makefile || die
353 + fi
354 + else
355 + # Don't bother with qemu, only needed for fully virtualised guests
356 + sed -i '/SUBDIRS-$(CONFIG_QEMU_XEN)/s/^/#/g' tools/Makefile || die
357 + fi
358 +
359 + # Reset bash completion dir; Bug 472438
360 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
361 + -i Config.mk || die
362 + sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
363 +
364 + # xencommons, Bug #492332, sed lighter weight than patching
365 + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
366 + -i tools/hotplug/Linux/init.d/xencommons.in || die
367 +
368 + # fix bashishm
369 + sed -e '/Usage/s/\$//g' \
370 + -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
371 +
372 + # respect multilib, usr/lib/libcacard.so.0.0.0
373 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
374 + -i tools/qemu-xen/configure || die
375 +
376 + #bug 518136, don't build 32bit exactuable for nomultilib profile
377 + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
378 + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
379 + fi
380 +
381 + # uncomment lines in xl.conf
382 + sed -e 's:^#autoballoon=:autoballoon=:' \
383 + -e 's:^#lockfile=:lockfile=:' \
384 + -e 's:^#vif.default.script=:vif.default.script=:' \
385 + -i tools/examples/xl.conf || die
386 +
387 + # disable capstone (Bug #673474)
388 + sed -e "s:\$\$source/configure:\0 --disable-capstone:" \
389 + -i tools/Makefile || die
390 +
391 + # disable glusterfs
392 + sed -e "s:\$\$source/configure:\0 --disable-glusterfs:" \
393 + -i tools/Makefile || die
394 +
395 + # disable jpeg automagic
396 + sed -e "s:\$\$source/configure:\0 --disable-vnc-jpeg:" \
397 + -i tools/Makefile || die
398 +
399 + # disable png automagic
400 + sed -e "s:\$\$source/configure:\0 --disable-vnc-png:" \
401 + -i tools/Makefile || die
402 +
403 + default
404 +}
405 +
406 +src_configure() {
407 + local myconf="--prefix=${PREFIX}/usr \
408 + --libdir=${PREFIX}/usr/$(get_libdir) \
409 + --libexecdir=${PREFIX}/usr/libexec \
410 + --localstatedir=${EPREFIX}/var \
411 + --disable-werror \
412 + --disable-xen \
413 + --enable-tools \
414 + --enable-docs \
415 + $(use_enable api xenapi) \
416 + $(use_enable ipxe) \
417 + $(usex system-ipxe '--with-system-ipxe=/usr/share/ipxe' '') \
418 + $(use_enable ocaml ocamltools) \
419 + $(use_enable ovmf) \
420 + $(use_enable pam) \
421 + $(use_enable rombios) \
422 + --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
423 + "
424 +
425 + use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
426 + use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
427 + use amd64 && myconf+=" $(use_enable qemu-traditional)"
428 + tc-ld-disable-gold # Bug 669570
429 + econf ${myconf}
430 +}
431 +
432 +src_compile() {
433 + local myopt
434 + use debug && myopt="${myopt} debug=y"
435 + use python && myopt="${myopt} XENSTAT_PYTHON_BINDINGS=y"
436 +
437 + if test-flag-CC -fno-strict-overflow; then
438 + append-flags -fno-strict-overflow
439 + fi
440 +
441 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
442 +
443 + if use doc; then
444 + emake -C docs build
445 + else
446 + emake -C docs man-pages
447 + fi
448 +}
449 +
450 +src_install() {
451 + # Override auto-detection in the build system, bug #382573
452 + export INITD_DIR=/tmp/init.d
453 + export CONFIG_LEAF_DIR=../tmp/default
454 +
455 + # Let the build system compile installed Python modules.
456 + local PYTHONDONTWRITEBYTECODE
457 + export PYTHONDONTWRITEBYTECODE
458 +
459 + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
460 + XEN_PYTHON_NATIVE_INSTALL=y install-tools
461 +
462 + # Created at runtime
463 + rm -rv "${ED}/var/run" || die
464 +
465 + # Fix the remaining Python shebangs.
466 + python_fix_shebang "${D}"
467 +
468 + # Remove RedHat-specific stuff
469 + rm -rf "${D}"/tmp || die
470 +
471 + if use doc; then
472 + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
473 + dodoc -r docs/{pdf,txt}
474 + else
475 + emake -C docs DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-man-pages # Bug 668032
476 + fi
477 + dodoc ${DOCS[@]}
478 +
479 + newconfd "${FILESDIR}"/xendomains.confd xendomains
480 + newconfd "${FILESDIR}"/xenstored.confd xenstored
481 + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
482 + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
483 + newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
484 + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
485 + newinitd "${FILESDIR}"/xencommons.initd xencommons
486 + newconfd "${FILESDIR}"/xencommons.confd xencommons
487 + newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
488 + newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
489 + newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
490 +
491 + if use screen; then
492 + cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
493 + cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
494 + keepdir /var/log/xen-consoles
495 + fi
496 +
497 + # For -static-libs wrt Bug 384355
498 + if ! use static-libs; then
499 + rm -f "${D}"/usr/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/ocaml/*/*.a
500 + fi
501 +
502 + # for xendomains
503 + keepdir /etc/xen/auto
504 +
505 + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
506 + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
507 + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
508 +
509 + keepdir /var/lib/xen/dump
510 + keepdir /var/lib/xen/xenpaging
511 + keepdir /var/lib/xenstored
512 + keepdir /var/log/xen
513 +
514 + if use python; then
515 + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/xenstat.py"
516 + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/_xenstat.so"
517 + fi
518 +
519 + python_optimize
520 +}
521 +
522 +pkg_postinst() {
523 + elog "Official Xen Guide and the offical wiki page:"
524 + elog "https://wiki.gentoo.org/wiki/Xen"
525 + elog "https://wiki.xen.org/wiki/Main_Page"
526 + elog ""
527 + elog "Recommended to utilise the xencommons script to config system at boot"
528 + elog "Add by use of rc-update on completion of the install"
529 +
530 + if ! use hvm; then
531 + echo
532 + elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
533 + elog "support enable the hvm use flag."
534 + elog "An x86 or amd64 system is required to build HVM support."
535 + fi
536 +
537 + if use qemu; then
538 + elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
539 + elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
540 + elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
541 + elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
542 + fi
543 +}
544
545 diff --git a/app-emulation/xen-tools/xen-tools-4.14.1-r2.ebuild b/app-emulation/xen-tools/xen-tools-4.14.1-r2.ebuild
546 new file mode 100644
547 index 00000000000..5db1d2c80b5
548 --- /dev/null
549 +++ b/app-emulation/xen-tools/xen-tools-4.14.1-r2.ebuild
550 @@ -0,0 +1,520 @@
551 +# Copyright 1999-2021 Gentoo Authors
552 +# Distributed under the terms of the GNU General Public License v2
553 +
554 +EAPI=7
555 +
556 +PYTHON_COMPAT=( python3_{6..9} )
557 +PYTHON_REQ_USE='ncurses,xml,threads(+)'
558 +
559 +inherit bash-completion-r1 flag-o-matic multilib python-single-r1 toolchain-funcs
560 +
561 +MY_PV=${PV/_/-}
562 +
563 +if [[ $PV == *9999 ]]; then
564 + inherit git-r3
565 + REPO="xen.git"
566 + EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
567 + S="${WORKDIR}/${REPO}"
568 +else
569 + KEYWORDS="~amd64 ~arm ~arm64 ~x86"
570 + UPSTREAM_VER=3
571 + SECURITY_VER=
572 + # xen-tools's gentoo patches tarball
573 + GENTOO_VER=22
574 + # xen-tools's gentoo patches version which apply to this specific ebuild
575 + GENTOO_GPV=0
576 + # xen-tools ovmf's patches
577 + OVMF_VER=
578 +
579 + SEABIOS_VER="1.13.0"
580 + EDK2_COMMIT="06dc822d045c2bb42e497487935485302486e151"
581 + EDK2_OPENSSL_VERSION="1_1_1g"
582 + EDK2_SOFTFLOAT_COMMIT="b64af41c3276f97f0e181920400ee056b9c88037"
583 + EDK2_BROTLI_COMMIT="666c3280cc11dc433c303d79a83d4ffbdd12cc8d"
584 + IPXE_COMMIT="1dd56dbd11082fb622c2ed21cfaced4f47d798a6"
585 +
586 + [[ -n ${UPSTREAM_VER} ]] && \
587 + UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz
588 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
589 + [[ -n ${SECURITY_VER} ]] && \
590 + SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz
591 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-security-patches-${SECURITY_VER}.tar.xz"
592 + [[ -n ${GENTOO_VER} ]] && \
593 + GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz
594 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
595 + [[ -n ${OVMF_VER} ]] && \
596 + OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
597 +
598 + SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
599 + https://github.com/qemu/seabios/archive/rel-${SEABIOS_VER}.tar.gz -> seabios-${SEABIOS_VER}.tar.gz
600 + ipxe? ( http://xenbits.xen.org/xen-extfiles/ipxe-git-${IPXE_COMMIT}.tar.gz )
601 + ovmf? ( https://github.com/tianocore/edk2/archive/${EDK2_COMMIT}.tar.gz -> edk2-${EDK2_COMMIT}.tar.gz
602 + https://github.com/openssl/openssl/archive/OpenSSL_${EDK2_OPENSSL_VERSION}.tar.gz
603 + https://github.com/ucb-bar/berkeley-softfloat-3/archive/${EDK2_SOFTFLOAT_COMMIT}.tar.gz -> berkeley-softfloat-${EDK2_SOFTFLOAT_COMMIT}.tar.gz
604 + https://github.com/google/brotli/archive/${EDK2_BROTLI_COMMIT}.tar.gz -> brotli-${EDK2_BROTLI_COMMIT}.tar.gz
605 + ${OVMF_PATCHSET_URI} )
606 + ${UPSTREAM_PATCHSET_URI}
607 + ${SECURITY_PATCHSET_URI}
608 + ${GENTOO_PATCHSET_URI}"
609 +
610 + S="${WORKDIR}/xen-${MY_PV}"
611 +fi
612 +
613 +DESCRIPTION="Xen tools including QEMU and xl"
614 +HOMEPAGE="https://www.xenproject.org"
615 +DOCS=( README )
616 +
617 +LICENSE="GPL-2"
618 +SLOT="0/$(ver_cut 1-2)"
619 +# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
620 +# >=dev-lang/ocaml-4 stable
621 +# Masked in profiles/eapi-5-files instead
622 +IUSE="api debug doc flask +hvm +ipxe ocaml ovmf +pam pygrub python +qemu +qemu-traditional +rombios screen sdl static-libs system-ipxe system-qemu system-seabios"
623 +
624 +REQUIRED_USE="
625 + ${PYTHON_REQUIRED_USE}
626 + ipxe? ( rombios )
627 + ovmf? ( hvm )
628 + pygrub? ( python )
629 + rombios? ( hvm )
630 + system-ipxe? ( rombios )
631 + ?? ( ipxe system-ipxe )
632 + ?? ( qemu system-qemu )"
633 +
634 +COMMON_DEPEND="
635 + sys-apps/pciutils
636 + dev-libs/lzo:2
637 + dev-libs/glib:2
638 + dev-libs/yajl
639 + dev-libs/libaio
640 + dev-libs/libgcrypt:0
641 + sys-libs/zlib
642 + ${PYTHON_DEPS}
643 +"
644 +
645 +DEPEND="${COMMON_DEPEND}
646 + app-misc/pax-utils
647 + dev-lang/perl
648 + >=sys-kernel/linux-headers-4.11
649 + x11-libs/pixman
650 + $(python_gen_cond_dep '
651 + dev-python/lxml[${PYTHON_MULTI_USEDEP}]
652 + pam? ( dev-python/pypam[${PYTHON_MULTI_USEDEP}] )
653 + ')
654 + x86? ( sys-devel/dev86
655 + system-ipxe? ( sys-firmware/ipxe[qemu] )
656 + sys-power/iasl )
657 + api? ( dev-libs/libxml2
658 + net-misc/curl )
659 +
660 + ovmf? (
661 + !arm? ( !arm64? ( dev-lang/nasm ) )
662 + $(python_gen_impl_dep sqlite)
663 + )
664 + !amd64? ( >=sys-apps/dtc-1.4.0 )
665 + amd64? ( sys-power/iasl
666 + system-seabios? ( sys-firmware/seabios )
667 + system-ipxe? ( sys-firmware/ipxe[qemu] )
668 + rombios? ( sys-devel/bin86 sys-devel/dev86 ) )
669 + doc? (
670 + app-text/ghostscript-gpl
671 + app-text/pandoc
672 + $(python_gen_cond_dep '
673 + dev-python/markdown[${PYTHON_MULTI_USEDEP}]
674 + ')
675 + dev-texlive/texlive-latexextra
676 + media-gfx/transfig
677 + )
678 + hvm? ( x11-base/xorg-proto )
679 + qemu? (
680 + app-arch/snappy:=
681 + sdl? (
682 + media-libs/libsdl[X]
683 + media-libs/libsdl2[X]
684 + )
685 + )
686 + system-qemu? ( app-emulation/qemu[xen] )
687 + ocaml? ( dev-ml/findlib
688 + >=dev-lang/ocaml-4 )
689 + python? ( >=dev-lang/swig-4.0.0 )"
690 +
691 +RDEPEND="${COMMON_DEPEND}
692 + sys-apps/iproute2[-minimal]
693 + net-misc/bridge-utils
694 + screen? (
695 + app-misc/screen
696 + app-admin/logrotate
697 + )"
698 +
699 +# hvmloader is used to bootstrap a fully virtualized kernel
700 +# Approved by QA team in bug #144032
701 +QA_WX_LOAD="
702 + usr/libexec/xen/boot/hvmloader
703 + usr/share/qemu-xen/qemu/hppa-firmware.img
704 + usr/share/qemu-xen/qemu/s390-ccw.img
705 + usr/share/qemu-xen/qemu/u-boot.e500
706 +"
707 +
708 +QA_PREBUILT="
709 + usr/libexec/xen/bin/elf2dmp
710 + usr/libexec/xen/bin/ivshmem-client
711 + usr/libexec/xen/bin/ivshmem-server
712 + usr/libexec/xen/bin/qemu-edid
713 + usr/libexec/xen/bin/qemu-img
714 + usr/libexec/xen/bin/qemu-io
715 + usr/libexec/xen/bin/qemu-keymap
716 + usr/libexec/xen/bin/qemu-nbd
717 + usr/libexec/xen/bin/qemu-pr-helper
718 + usr/libexec/xen/bin/qemu-system-i386
719 + usr/libexec/xen/bin/virtfs-proxy-helper
720 + usr/libexec/xen/libexec/xen-bridge-helper
721 + usr/share/qemu-xen/qemu/s390-ccw.img
722 + usr/share/qemu-xen/qemu/s390-netboot.img
723 + usr/share/qemu-xen/qemu/u-boot.e500
724 +"
725 +
726 +RESTRICT="test"
727 +
728 +pkg_setup() {
729 + python_setup
730 + export "CONFIG_LOMOUNT=y"
731 +
732 + #bug 522642, disable compile tools/tests
733 + export "CONFIG_TESTS=n"
734 +
735 + if [[ -z ${XEN_TARGET_ARCH} ]] ; then
736 + if use x86 && use amd64; then
737 + die "Confusion! Both x86 and amd64 are set in your use flags!"
738 + elif use x86; then
739 + export XEN_TARGET_ARCH="x86_32"
740 + elif use amd64 ; then
741 + export XEN_TARGET_ARCH="x86_64"
742 + elif use arm; then
743 + export XEN_TARGET_ARCH="arm32"
744 + elif use arm64; then
745 + export XEN_TARGET_ARCH="arm64"
746 + else
747 + die "Unsupported architecture!"
748 + fi
749 + fi
750 +}
751 +
752 +src_prepare() {
753 + local i
754 +
755 + # Upstream's patchset
756 + if [[ -n ${UPSTREAM_VER} ]]; then
757 + einfo "Try to apply Xen Upstream patch set"
758 + eapply "${WORKDIR}"/patches-upstream
759 + fi
760 +
761 + # Security patchset
762 + if [[ -n ${SECURITY_VER} ]]; then
763 + einfo "Try to apply Xen Security patch set"
764 + # apply main xen patches
765 + # Two parallel systems, both work side by side
766 + # Over time they may concdense into one. This will suffice for now
767 + EPATCH_SUFFIX="patch"
768 + EPATCH_FORCE="yes"
769 +
770 + source "${WORKDIR}"/patches-security/${PV}.conf || die
771 +
772 + for i in ${XEN_SECURITY_MAIN}; do
773 + eapply "${WORKDIR}"/patches-security/xen/$i
774 + done
775 +
776 + # apply qemu-xen/upstream patches
777 + pushd "${S}"/tools/qemu-xen/ > /dev/null
778 + for i in ${XEN_SECURITY_QEMUU}; do
779 + eapply "${WORKDIR}"/patches-security/qemuu/$i
780 + done
781 + popd > /dev/null
782 +
783 + # apply qemu-traditional patches
784 + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
785 + for i in ${XEN_SECURITY_QEMUT}; do
786 + eapply "${WORKDIR}"/patches-security/qemut/$i
787 + done
788 + popd > /dev/null
789 + fi
790 +
791 + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
792 + mv ../seabios-rel-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
793 + pushd tools/firmware/ > /dev/null
794 + ln -s seabios-dir-remote seabios-dir || die
795 + popd > /dev/null
796 +
797 + # Gentoo's patchset
798 + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
799 + einfo "Try to apply Gentoo specific patch set"
800 + source "${FILESDIR}"/gentoo-patches.conf || die
801 + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
802 + for i in ${!_gpv}; do
803 + eapply "${WORKDIR}"/patches-gentoo/$i
804 + done
805 + fi
806 +
807 + # Ovmf's patchset
808 + if use ovmf; then
809 + if [[ -n ${OVMF_VER} ]];then
810 + einfo "Try to apply Ovmf patch set"
811 + pushd "${WORKDIR}"/edk2-*/ > /dev/null
812 + eapply "${WORKDIR}"/patches-ovmf
813 + popd > /dev/null
814 + fi
815 + mv ../edk2-${EDK2_COMMIT} tools/firmware/ovmf-dir-remote || die
816 + rm -r tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
817 + rm -r tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
818 + rm -r tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
819 + rm -r tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
820 + mv ../openssl-OpenSSL_${EDK2_OPENSSL_VERSION} tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
821 + mv ../berkeley-softfloat-3-${EDK2_SOFTFLOAT_COMMIT} tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
822 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
823 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
824 + cp tools/firmware/ovmf-makefile tools/firmware/ovmf-dir-remote/Makefile || die
825 + fi
826 +
827 + # ipxe
828 + if use ipxe; then
829 + cp "${DISTDIR}/ipxe-git-${IPXE_COMMIT}.tar.gz" tools/firmware/etherboot/_ipxe.tar.gz || die
830 +
831 + # gcc 10
832 + cp "${WORKDIR}/patches-gentoo/xen-tools-4.13.0-ipxe-gcc10.patch" tools/firmware/etherboot/patches/ipxe-gcc10.patch || die
833 + echo ipxe-gcc10.patch >> tools/firmware/etherboot/patches/series || die
834 + fi
835 +
836 + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
837 +
838 + # Fix texi2html build error with new texi2html, qemu.doc.html
839 + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
840 +
841 + use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
842 + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
843 + -i tools/firmware/Makefile || die
844 +
845 + # Drop .config, fixes to gcc-4.6
846 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
847 +
848 + # drop flags
849 + unset CFLAGS
850 + unset LDFLAGS
851 + unset ASFLAGS
852 + unset CPPFLAGS
853 +
854 + if ! use pygrub; then
855 + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
856 + fi
857 +
858 + if ! use python; then
859 + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
860 + fi
861 +
862 + if ! use hvm; then
863 + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
864 + # Bug 351648
865 + elif ! use x86 && ! has x86 $(get_all_abis); then
866 + mkdir -p "${WORKDIR}"/extra-headers/gnu || die
867 + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
868 + export CPATH="${WORKDIR}"/extra-headers
869 + fi
870 +
871 + if use qemu; then
872 + if use sdl; then
873 + sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
874 + tools/Makefile || die
875 + else
876 + sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
877 + tools/qemu-xen-traditional/xen-setup || die
878 + sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
879 + tools/Makefile || die
880 + fi
881 + else
882 + # Don't bother with qemu, only needed for fully virtualised guests
883 + sed -i '/SUBDIRS-$(CONFIG_QEMU_XEN)/s/^/#/g' tools/Makefile || die
884 + fi
885 +
886 + # Reset bash completion dir; Bug 472438
887 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
888 + -i Config.mk || die
889 + sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
890 +
891 + # xencommons, Bug #492332, sed lighter weight than patching
892 + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
893 + -i tools/hotplug/Linux/init.d/xencommons.in || die
894 +
895 + # fix bashishm
896 + sed -e '/Usage/s/\$//g' \
897 + -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
898 +
899 + # respect multilib, usr/lib/libcacard.so.0.0.0
900 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
901 + -i tools/qemu-xen/configure || die
902 +
903 + #bug 518136, don't build 32bit exactuable for nomultilib profile
904 + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
905 + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
906 + fi
907 +
908 + # uncomment lines in xl.conf
909 + sed -e 's:^#autoballoon=:autoballoon=:' \
910 + -e 's:^#lockfile=:lockfile=:' \
911 + -e 's:^#vif.default.script=:vif.default.script=:' \
912 + -i tools/examples/xl.conf || die
913 +
914 + # disable capstone (Bug #673474)
915 + sed -e "s:\$\$source/configure:\0 --disable-capstone:" \
916 + -i tools/Makefile || die
917 +
918 + # disable glusterfs
919 + sed -e "s:\$\$source/configure:\0 --disable-glusterfs:" \
920 + -i tools/Makefile || die
921 +
922 + # disable jpeg automagic
923 + sed -e "s:\$\$source/configure:\0 --disable-vnc-jpeg:" \
924 + -i tools/Makefile || die
925 +
926 + # disable png automagic
927 + sed -e "s:\$\$source/configure:\0 --disable-vnc-png:" \
928 + -i tools/Makefile || die
929 +
930 + default
931 +}
932 +
933 +src_configure() {
934 + local myconf="--prefix=${PREFIX}/usr \
935 + --libdir=${PREFIX}/usr/$(get_libdir) \
936 + --libexecdir=${PREFIX}/usr/libexec \
937 + --localstatedir=${EPREFIX}/var \
938 + --disable-werror \
939 + --disable-xen \
940 + --enable-tools \
941 + --enable-docs \
942 + $(use_enable api xenapi) \
943 + $(use_enable ipxe) \
944 + $(usex system-ipxe '--with-system-ipxe=/usr/share/ipxe' '') \
945 + $(use_enable ocaml ocamltools) \
946 + $(use_enable ovmf) \
947 + $(use_enable pam) \
948 + $(use_enable rombios) \
949 + --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
950 + "
951 +
952 + use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
953 + use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
954 + use amd64 && myconf+=" $(use_enable qemu-traditional)"
955 + tc-ld-disable-gold # Bug 669570
956 + econf ${myconf}
957 +}
958 +
959 +src_compile() {
960 + local myopt
961 + use debug && myopt="${myopt} debug=y"
962 + use python && myopt="${myopt} XENSTAT_PYTHON_BINDINGS=y"
963 +
964 + if test-flag-CC -fno-strict-overflow; then
965 + append-flags -fno-strict-overflow
966 + fi
967 +
968 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
969 +
970 + if use doc; then
971 + emake -C docs build
972 + else
973 + emake -C docs man-pages
974 + fi
975 +}
976 +
977 +src_install() {
978 + # Override auto-detection in the build system, bug #382573
979 + export INITD_DIR=/tmp/init.d
980 + export CONFIG_LEAF_DIR=../tmp/default
981 +
982 + # Let the build system compile installed Python modules.
983 + local PYTHONDONTWRITEBYTECODE
984 + export PYTHONDONTWRITEBYTECODE
985 +
986 + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
987 + XEN_PYTHON_NATIVE_INSTALL=y install-tools
988 +
989 + # Created at runtime
990 + rm -rv "${ED}/var/run" || die
991 +
992 + # Fix the remaining Python shebangs.
993 + python_fix_shebang "${D}"
994 +
995 + # Remove RedHat-specific stuff
996 + rm -rf "${D}"/tmp || die
997 +
998 + if use doc; then
999 + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
1000 + dodoc -r docs/{pdf,txt}
1001 + else
1002 + emake -C docs DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-man-pages # Bug 668032
1003 + fi
1004 + dodoc ${DOCS[@]}
1005 +
1006 + newconfd "${FILESDIR}"/xendomains.confd xendomains
1007 + newconfd "${FILESDIR}"/xenstored.confd xenstored
1008 + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
1009 + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
1010 + newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
1011 + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
1012 + newinitd "${FILESDIR}"/xencommons.initd xencommons
1013 + newconfd "${FILESDIR}"/xencommons.confd xencommons
1014 + newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
1015 + newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
1016 + newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
1017 +
1018 + if use screen; then
1019 + cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
1020 + cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
1021 + keepdir /var/log/xen-consoles
1022 + fi
1023 +
1024 + # For -static-libs wrt Bug 384355
1025 + if ! use static-libs; then
1026 + rm -f "${D}"/usr/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/ocaml/*/*.a
1027 + fi
1028 +
1029 + # for xendomains
1030 + keepdir /etc/xen/auto
1031 +
1032 + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
1033 + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
1034 + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
1035 +
1036 + keepdir /var/lib/xen/dump
1037 + keepdir /var/lib/xen/xenpaging
1038 + keepdir /var/lib/xenstored
1039 + keepdir /var/log/xen
1040 +
1041 + if use python; then
1042 + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/xenstat.py"
1043 + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/_xenstat.so"
1044 + fi
1045 +
1046 + python_optimize
1047 +}
1048 +
1049 +pkg_postinst() {
1050 + elog "Official Xen Guide and the offical wiki page:"
1051 + elog "https://wiki.gentoo.org/wiki/Xen"
1052 + elog "https://wiki.xen.org/wiki/Main_Page"
1053 + elog ""
1054 + elog "Recommended to utilise the xencommons script to config system at boot"
1055 + elog "Add by use of rc-update on completion of the install"
1056 +
1057 + if ! use hvm; then
1058 + echo
1059 + elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
1060 + elog "support enable the hvm use flag."
1061 + elog "An x86 or amd64 system is required to build HVM support."
1062 + fi
1063 +
1064 + if use qemu; then
1065 + elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
1066 + elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
1067 + elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
1068 + elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
1069 + fi
1070 +}