Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/xen-tools/
Date: Fri, 11 Jun 2021 12:53:25
Message-Id: 1623415741.316ef08bd466a967a2b16f46d2815a0669949288.whissi@gentoo
1 commit: 316ef08bd466a967a2b16f46d2815a0669949288
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Wed Jun 9 07:17:08 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 11 12:49:01 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=316ef08b
7
8 app-emulation/xen-tools: add upstream security patches
9
10 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 app-emulation/xen-tools/Manifest | 1 +
14 app-emulation/xen-tools/xen-tools-4.15.0-r1.ebuild | 532 +++++++++++++++++++++
15 2 files changed, 533 insertions(+)
16
17 diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest
18 index 92df906498e..7361faa508b 100644
19 --- a/app-emulation/xen-tools/Manifest
20 +++ b/app-emulation/xen-tools/Manifest
21 @@ -10,6 +10,7 @@ DIST xen-4.13.3.tar.gz 39044539 BLAKE2B 5d0e57c76e12e1b86b78bbf561e947d70b9569a2
22 DIST xen-4.14.2-upstream-patches-0.tar.xz 23304 BLAKE2B 954e0a49e5c3ec122aefe52afe328f440b8a4c8db966e0fa91e0b6d6cb3c0462b75fb99b3e7392811bd2e680cd7945e8a4d68317245fd42fdf0ad6cab33fbc68 SHA512 64d243f0c8acfec87812e4d78e3d8b24a86315824853f4f3b17122b7119425d180650695bc12e1a30f5b30c6ef684be7c08b2bc677ca2f0668d0335d92e2bf78
23 DIST xen-4.14.2.tar.gz 39973157 BLAKE2B db5d3570f79e0fd97872f5e5dd57a4eb39e005728387bfef3b51fabe1c693cfd8108d09b1026f5a5a7eb79de71be6f4af36d252f7e0b35a65a1567b7949e3e29 SHA512 83c9333b70dbee3e29c6bf08e5ad030676e6c4a32b976f3f5e6a8f8d0dd9e4898bac88dd8e1c9d2ad3509cebb5d212e1745f9392a469d7afeb841d79801ccf39
24 DIST xen-4.15.0-upstream-patches-0.tar.xz 15744 BLAKE2B e2abb68524a7c190db8d91beb79731aea5290e82f54fb21218739dab666f6f5ea85c203575ec248b46830f1862408d50d3ceea1104fcd9325babfccf3574c515 SHA512 f1a2800d15a61f08eda4d6bafaead95a9d72cc9e4d90a19278d89c696b7e2d5d6353b28dba7ed0eb0c9aeb8604d3697db6a8f4ac38047e2510279d88181752f9
25 +DIST xen-4.15.0-upstream-patches-1.tar.xz 35180 BLAKE2B eb3b2a44b717a04daa4a2f158040cce78b42cba5a72c437d7b2f8f1237b808f6f13c2140d82e95056818db6c0eb706ebd7dead822a6a4e689e5d5e7c83523fdb SHA512 a7cfe2dbc82b15c48fa781a77b3ca1622fc2feac3874bf17cf56e82be46e9817913f94992e0e1a1cd2be2e719d4abb9a15744c8a1017e30c0d5c01d7db64dbb5
26 DIST xen-4.15.0.tar.gz 40785399 BLAKE2B 8b0530f5516c39656506f4bb705952da0555a8ab7f47323473b171caeb7692f3107e9d94f13171d40576600064589eed35f4d210af02db4cc4706dd4fc202100 SHA512 93683b8a97387ca5f003c635a11d163e61c87dbdc9a03081f9155fe87b49f1dfa74ce243fcd5e04dc009353a36e2375b786f1ebde828b5951a094cd64197b4c7
27 DIST xen-gentoo-patches-21.tar.xz 18280 BLAKE2B 95446da72fc16cb82e4e51df8796c64db05a30894a351a98dbd6700ce354c34956ca09a1af98125a4e56c337936e8fae296d806519b8afa23a82b078aa0db8f1 SHA512 3cffac162606a09b10b47dca604f167897e6ac8d153411d3464ef29a7a4d46ac5b92340884cb21279cb2d053b131f1ea5cb2111e3e9a21b3298b5ab3320ee34d
28 DIST xen-gentoo-patches-23.tar.xz 20536 BLAKE2B 0064f79f8794a21ab13047a4ee296e37efa616e16ca6cd65b31fdafeb458fd9b80f0443758343c8328b1901d7169618346becfe75f16dcaeff08fc975f1d08d5 SHA512 09248e17ff7865feb2a505169d62ee5c8c60bd672fa8c4c7c4e3a2e4af58bfad0379d37b395bab3e3393af8d53d882f56749dfeb560edeea6b7ab56c902a3c49
29
30 diff --git a/app-emulation/xen-tools/xen-tools-4.15.0-r1.ebuild b/app-emulation/xen-tools/xen-tools-4.15.0-r1.ebuild
31 new file mode 100644
32 index 00000000000..c062f81eb41
33 --- /dev/null
34 +++ b/app-emulation/xen-tools/xen-tools-4.15.0-r1.ebuild
35 @@ -0,0 +1,532 @@
36 +# Copyright 1999-2021 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=7
40 +
41 +PYTHON_COMPAT=( python3_{7..9} )
42 +PYTHON_REQ_USE='ncurses,xml,threads(+)'
43 +
44 +inherit bash-completion-r1 flag-o-matic multilib python-single-r1 toolchain-funcs
45 +
46 +MY_PV=${PV/_/-}
47 +
48 +if [[ ${PV} == *9999 ]]; then
49 + inherit git-r3
50 + REPO="xen.git"
51 + EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
52 + S="${WORKDIR}/${REPO}"
53 +else
54 + KEYWORDS="~amd64 ~arm ~arm64 ~x86"
55 + UPSTREAM_VER=1
56 + SECURITY_VER=
57 + # xen-tools's gentoo patches tarball
58 + GENTOO_VER=23
59 + # xen-tools's gentoo patches version which apply to this specific ebuild
60 + GENTOO_GPV=0
61 + # xen-tools ovmf's patches
62 + OVMF_VER=
63 +
64 + SEABIOS_VER="1.14.0"
65 + EDK2_COMMIT="06dc822d045c2bb42e497487935485302486e151"
66 + EDK2_OPENSSL_VERSION="1_1_1g"
67 + EDK2_SOFTFLOAT_COMMIT="b64af41c3276f97f0e181920400ee056b9c88037"
68 + EDK2_BROTLI_COMMIT="666c3280cc11dc433c303d79a83d4ffbdd12cc8d"
69 + IPXE_COMMIT="988d2c13cdf0f0b4140685af35ced70ac5b3283c"
70 +
71 + [[ -n ${UPSTREAM_VER} ]] && \
72 + UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz
73 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
74 + [[ -n ${SECURITY_VER} ]] && \
75 + SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz
76 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-security-patches-${SECURITY_VER}.tar.xz"
77 + [[ -n ${GENTOO_VER} ]] && \
78 + GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz
79 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
80 + [[ -n ${OVMF_VER} ]] && \
81 + OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
82 +
83 + SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
84 + https://www.seabios.org/downloads/seabios-${SEABIOS_VER}.tar.gz
85 + ipxe? ( http://xenbits.xen.org/xen-extfiles/ipxe-git-${IPXE_COMMIT}.tar.gz )
86 + ovmf? ( https://github.com/tianocore/edk2/archive/${EDK2_COMMIT}.tar.gz -> edk2-${EDK2_COMMIT}.tar.gz
87 + https://github.com/openssl/openssl/archive/OpenSSL_${EDK2_OPENSSL_VERSION}.tar.gz
88 + https://github.com/ucb-bar/berkeley-softfloat-3/archive/${EDK2_SOFTFLOAT_COMMIT}.tar.gz -> berkeley-softfloat-${EDK2_SOFTFLOAT_COMMIT}.tar.gz
89 + https://github.com/google/brotli/archive/${EDK2_BROTLI_COMMIT}.tar.gz -> brotli-${EDK2_BROTLI_COMMIT}.tar.gz
90 + ${OVMF_PATCHSET_URI} )
91 + ${UPSTREAM_PATCHSET_URI}
92 + ${SECURITY_PATCHSET_URI}
93 + ${GENTOO_PATCHSET_URI}"
94 +
95 + S="${WORKDIR}/xen-${MY_PV}"
96 +fi
97 +
98 +DESCRIPTION="Xen tools including QEMU and xl"
99 +HOMEPAGE="https://www.xenproject.org"
100 +DOCS=( README )
101 +
102 +LICENSE="GPL-2"
103 +SLOT="0/$(ver_cut 1-2)"
104 +# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
105 +# >=dev-lang/ocaml-4 stable
106 +# Masked in profiles/eapi-5-files instead
107 +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"
108 +
109 +REQUIRED_USE="
110 + ${PYTHON_REQUIRED_USE}
111 + ipxe? ( rombios )
112 + ovmf? ( hvm )
113 + pygrub? ( python )
114 + rombios? ( hvm )
115 + system-ipxe? ( rombios )
116 + ?? ( ipxe system-ipxe )
117 + ?? ( qemu system-qemu )"
118 +
119 +COMMON_DEPEND="
120 + sys-apps/pciutils
121 + dev-libs/lzo:2
122 + dev-libs/glib:2
123 + dev-libs/yajl
124 + dev-libs/libaio
125 + dev-libs/libgcrypt:0
126 + sys-libs/zlib
127 + ${PYTHON_DEPS}
128 +"
129 +
130 +DEPEND="${COMMON_DEPEND}
131 + app-misc/pax-utils
132 + dev-lang/perl
133 + >=sys-kernel/linux-headers-4.11
134 + x11-libs/pixman
135 + $(python_gen_cond_dep '
136 + dev-python/lxml[${PYTHON_MULTI_USEDEP}]
137 + pam? ( dev-python/pypam[${PYTHON_MULTI_USEDEP}] )
138 + ')
139 + x86? ( sys-devel/dev86
140 + system-ipxe? ( sys-firmware/ipxe[qemu] )
141 + sys-power/iasl )
142 + api? ( dev-libs/libxml2
143 + net-misc/curl )
144 +
145 + ovmf? (
146 + !arm? ( !arm64? ( dev-lang/nasm ) )
147 + $(python_gen_impl_dep sqlite)
148 + )
149 + !amd64? ( >=sys-apps/dtc-1.4.0 )
150 + amd64? ( sys-power/iasl
151 + system-seabios? ( sys-firmware/seabios )
152 + system-ipxe? ( sys-firmware/ipxe[qemu] )
153 + rombios? ( sys-devel/bin86 sys-devel/dev86 ) )
154 + doc? (
155 + app-text/ghostscript-gpl
156 + app-text/pandoc
157 + $(python_gen_cond_dep '
158 + dev-python/markdown[${PYTHON_MULTI_USEDEP}]
159 + ')
160 + dev-texlive/texlive-latexextra
161 + media-gfx/transfig
162 + )
163 + hvm? ( x11-base/xorg-proto )
164 + qemu? (
165 + app-arch/snappy:=
166 + sdl? (
167 + media-libs/libsdl[X]
168 + media-libs/libsdl2[X]
169 + )
170 + )
171 + system-qemu? ( app-emulation/qemu[xen] )
172 + ocaml? ( dev-ml/findlib
173 + >=dev-lang/ocaml-4 )
174 + python? ( >=dev-lang/swig-4.0.0 )"
175 +
176 +RDEPEND="${COMMON_DEPEND}
177 + sys-apps/iproute2[-minimal]
178 + net-misc/bridge-utils
179 + screen? (
180 + app-misc/screen
181 + app-admin/logrotate
182 + )"
183 +
184 +# hvmloader is used to bootstrap a fully virtualized kernel
185 +# Approved by QA team in bug #144032
186 +QA_WX_LOAD="
187 + usr/libexec/xen/boot/hvmloader
188 + usr/libexec/xen/boot/xen-shim
189 + usr/share/qemu-xen/qemu/hppa-firmware.img
190 + usr/share/qemu-xen/qemu/s390-ccw.img
191 + usr/share/qemu-xen/qemu/u-boot.e500
192 +"
193 +
194 +QA_PREBUILT="
195 + usr/libexec/xen/bin/elf2dmp
196 + usr/libexec/xen/bin/ivshmem-client
197 + usr/libexec/xen/bin/ivshmem-server
198 + usr/libexec/xen/bin/qemu-edid
199 + usr/libexec/xen/bin/qemu-img
200 + usr/libexec/xen/bin/qemu-io
201 + usr/libexec/xen/bin/qemu-keymap
202 + usr/libexec/xen/bin/qemu-nbd
203 + usr/libexec/xen/bin/qemu-pr-helper
204 + usr/libexec/xen/bin/qemu-storage-daemon
205 + usr/libexec/xen/bin/qemu-system-i386
206 + usr/libexec/xen/bin/virtfs-proxy-helper
207 + usr/libexec/xen/boot/xen-shim
208 + usr/libexec/xen/libexec/qemu-pr-helper
209 + usr/libexec/xen/libexec/virtfs-proxy-helper
210 + usr/libexec/xen/libexec/virtiofsd
211 + usr/libexec/xen/libexec/xen-bridge-helper
212 + usr/share/qemu-xen/qemu/s390-ccw.img
213 + usr/share/qemu-xen/qemu/s390-netboot.img
214 + usr/share/qemu-xen/qemu/u-boot.e500
215 +"
216 +
217 +RESTRICT="test"
218 +
219 +pkg_setup() {
220 + python_setup
221 + export "CONFIG_LOMOUNT=y"
222 +
223 + #bug 522642, disable compile tools/tests
224 + export "CONFIG_TESTS=n"
225 +
226 + if [[ -z ${XEN_TARGET_ARCH} ]] ; then
227 + if use x86 && use amd64; then
228 + die "Confusion! Both x86 and amd64 are set in your use flags!"
229 + elif use x86; then
230 + export XEN_TARGET_ARCH="x86_32"
231 + elif use amd64 ; then
232 + export XEN_TARGET_ARCH="x86_64"
233 + elif use arm; then
234 + export XEN_TARGET_ARCH="arm32"
235 + elif use arm64; then
236 + export XEN_TARGET_ARCH="arm64"
237 + else
238 + die "Unsupported architecture!"
239 + fi
240 + fi
241 +}
242 +
243 +src_prepare() {
244 + local i
245 +
246 + # Upstream's patchset
247 + if [[ -n ${UPSTREAM_VER} ]]; then
248 + einfo "Try to apply Xen Upstream patch set"
249 + eapply "${WORKDIR}"/patches-upstream
250 + fi
251 +
252 + # Security patchset
253 + if [[ -n ${SECURITY_VER} ]]; then
254 + einfo "Try to apply Xen Security patch set"
255 + # apply main xen patches
256 + # Two parallel systems, both work side by side
257 + # Over time they may concdense into one. This will suffice for now
258 + EPATCH_SUFFIX="patch"
259 + EPATCH_FORCE="yes"
260 +
261 + source "${WORKDIR}"/patches-security/${PV}.conf || die
262 +
263 + for i in ${XEN_SECURITY_MAIN}; do
264 + eapply "${WORKDIR}"/patches-security/xen/$i
265 + done
266 +
267 + # apply qemu-xen/upstream patches
268 + pushd "${S}"/tools/qemu-xen/ > /dev/null
269 + for i in ${XEN_SECURITY_QEMUU}; do
270 + eapply "${WORKDIR}"/patches-security/qemuu/$i
271 + done
272 + popd > /dev/null
273 +
274 + # apply qemu-traditional patches
275 + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
276 + for i in ${XEN_SECURITY_QEMUT}; do
277 + eapply "${WORKDIR}"/patches-security/qemut/$i
278 + done
279 + popd > /dev/null
280 + fi
281 +
282 + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
283 + mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
284 + pushd tools/firmware/ > /dev/null
285 + ln -s seabios-dir-remote seabios-dir || die
286 + popd > /dev/null
287 +
288 + # Gentoo's patchset
289 + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
290 + einfo "Try to apply Gentoo specific patch set"
291 + source "${FILESDIR}"/gentoo-patches.conf || die
292 + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
293 + for i in ${!_gpv}; do
294 + eapply "${WORKDIR}"/patches-gentoo/$i
295 + done
296 + fi
297 +
298 + # Ovmf's patchset
299 + if use ovmf; then
300 + if [[ -n ${OVMF_VER} ]];then
301 + einfo "Try to apply Ovmf patch set"
302 + pushd "${WORKDIR}"/edk2-*/ > /dev/null
303 + eapply "${WORKDIR}"/patches-ovmf
304 + popd > /dev/null
305 + fi
306 + mv ../edk2-${EDK2_COMMIT} tools/firmware/ovmf-dir-remote || die
307 + rm -r tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
308 + rm -r tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
309 + rm -r tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
310 + rm -r tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
311 + mv ../openssl-OpenSSL_${EDK2_OPENSSL_VERSION} tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
312 + mv ../berkeley-softfloat-3-${EDK2_SOFTFLOAT_COMMIT} tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
313 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
314 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
315 + cp tools/firmware/ovmf-makefile tools/firmware/ovmf-dir-remote/Makefile || die
316 + fi
317 +
318 + # ipxe
319 + if use ipxe; then
320 + cp "${DISTDIR}/ipxe-git-${IPXE_COMMIT}.tar.gz" tools/firmware/etherboot/_ipxe.tar.gz || die
321 +
322 + # gcc 11
323 + cp "${WORKDIR}/patches-gentoo/${P}-ipxe-gcc11.patch" tools/firmware/etherboot/patches/ipxe-gcc11.patch || die
324 + echo ipxe-gcc11.patch >> tools/firmware/etherboot/patches/series || die
325 + fi
326 +
327 + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
328 +
329 + # Fix texi2html build error with new texi2html, qemu.doc.html
330 + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
331 +
332 + use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
333 + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
334 + -i tools/firmware/Makefile || die
335 +
336 + # Drop .config, fixes to gcc-4.6
337 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
338 +
339 + # drop flags
340 + unset CFLAGS
341 + unset LDFLAGS
342 + unset ASFLAGS
343 + unset CPPFLAGS
344 +
345 + if ! use pygrub; then
346 + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
347 + fi
348 +
349 + if ! use python; then
350 + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
351 + fi
352 +
353 + if ! use hvm; then
354 + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
355 + # Bug 351648
356 + elif ! use x86 && ! has x86 $(get_all_abis); then
357 + mkdir -p "${WORKDIR}"/extra-headers/gnu || die
358 + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
359 + export CPATH="${WORKDIR}"/extra-headers
360 + fi
361 +
362 + if use qemu; then
363 + if use sdl; then
364 + sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
365 + tools/Makefile || die
366 + else
367 + sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
368 + tools/qemu-xen-traditional/xen-setup || die
369 + sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
370 + tools/Makefile || die
371 + fi
372 + else
373 + # Don't bother with qemu, only needed for fully virtualised guests
374 + sed -i '/SUBDIRS-$(CONFIG_QEMU_XEN)/s/^/#/g' tools/Makefile || die
375 + fi
376 +
377 + # Reset bash completion dir; Bug 472438
378 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
379 + -i Config.mk || die
380 +
381 + # xencommons, Bug #492332, sed lighter weight than patching
382 + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
383 + -i tools/hotplug/Linux/init.d/xencommons.in || die
384 +
385 + # fix bashishm
386 + sed -e '/Usage/s/\$//g' \
387 + -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
388 +
389 + # respect multilib, usr/lib/libcacard.so.0.0.0
390 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
391 + -i tools/qemu-xen/configure || die
392 +
393 + #bug 518136, don't build 32bit exactuable for nomultilib profile
394 + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
395 + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
396 + fi
397 +
398 + # uncomment lines in xl.conf
399 + sed -e 's:^#autoballoon=:autoballoon=:' \
400 + -e 's:^#lockfile=:lockfile=:' \
401 + -e 's:^#vif.default.script=:vif.default.script=:' \
402 + -i tools/examples/xl.conf || die
403 +
404 + # disable capstone (Bug #673474)
405 + sed -e "s:\$\$source/configure:\0 --disable-capstone:" \
406 + -i tools/Makefile || die
407 +
408 + # disable glusterfs
409 + sed -e "s:\$\$source/configure:\0 --disable-glusterfs:" \
410 + -i tools/Makefile || die
411 +
412 + # disable jpeg automagic
413 + sed -e "s:\$\$source/configure:\0 --disable-vnc-jpeg:" \
414 + -i tools/Makefile || die
415 +
416 + # disable png automagic
417 + sed -e "s:\$\$source/configure:\0 --disable-vnc-png:" \
418 + -i tools/Makefile || die
419 +
420 + # disable docker (Bug #732970)
421 + sed -e "s:\$\$source/configure:\0 --disable-containers:" \
422 + -i tools/Makefile || die
423 +
424 + default
425 +}
426 +
427 +src_configure() {
428 + local myconf="--prefix=${PREFIX}/usr \
429 + --libdir=${PREFIX}/usr/$(get_libdir) \
430 + --libexecdir=${PREFIX}/usr/libexec \
431 + --localstatedir=${EPREFIX}/var \
432 + --disable-golang \
433 + --disable-werror \
434 + --disable-xen \
435 + --enable-tools \
436 + --enable-docs \
437 + $(use_enable api xenapi) \
438 + $(use_enable ipxe) \
439 + $(usex system-ipxe '--with-system-ipxe=/usr/share/ipxe' '') \
440 + $(use_enable ocaml ocamltools) \
441 + $(use_enable ovmf) \
442 + $(use_enable pam) \
443 + $(use_enable rombios) \
444 + --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
445 + "
446 +
447 + use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
448 + use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
449 + use amd64 && myconf+=" $(use_enable qemu-traditional)"
450 + tc-ld-disable-gold # Bug 669570
451 + econf ${myconf}
452 +}
453 +
454 +src_compile() {
455 + local myopt
456 + use debug && myopt="${myopt} debug=y"
457 + # Currently broken
458 + #use python && myopt="${myopt} XENSTAT_PYTHON_BINDINGS=y"
459 +
460 + if test-flag-CC -fno-strict-overflow; then
461 + append-flags -fno-strict-overflow
462 + fi
463 +
464 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
465 +
466 + if use doc; then
467 + emake -C docs build
468 + else
469 + emake -C docs man-pages
470 + fi
471 +}
472 +
473 +src_install() {
474 + # Override auto-detection in the build system, bug #382573
475 + export INITD_DIR=/tmp/init.d
476 + export CONFIG_LEAF_DIR=../tmp/default
477 +
478 + # Let the build system compile installed Python modules.
479 + local PYTHONDONTWRITEBYTECODE
480 + export PYTHONDONTWRITEBYTECODE
481 +
482 + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
483 + XEN_PYTHON_NATIVE_INSTALL=y install-tools
484 +
485 + # Created at runtime
486 + rm -rv "${ED}/var/run" || die
487 +
488 + # Fix the remaining Python shebangs.
489 + python_fix_shebang "${D}"
490 +
491 + # Remove RedHat-specific stuff
492 + rm -rf "${D}"/tmp || die
493 +
494 + if use doc; then
495 + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
496 + dodoc -r docs/{pdf,txt}
497 + else
498 + emake -C docs DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-man-pages # Bug 668032
499 + fi
500 + dodoc ${DOCS[@]}
501 +
502 + newconfd "${FILESDIR}"/xendomains.confd xendomains
503 + newconfd "${FILESDIR}"/xenstored.confd xenstored
504 + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
505 + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
506 + newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
507 + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
508 + newinitd "${FILESDIR}"/xencommons.initd xencommons
509 + newconfd "${FILESDIR}"/xencommons.confd xencommons
510 + newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
511 + newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
512 + newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
513 +
514 + if use screen; then
515 + cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
516 + cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
517 + keepdir /var/log/xen-consoles
518 + fi
519 +
520 + # For -static-libs wrt Bug 384355
521 + if ! use static-libs; then
522 + rm -f "${D}"/usr/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/ocaml/*/*.a
523 + fi
524 +
525 + # for xendomains
526 + keepdir /etc/xen/auto
527 +
528 + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
529 + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
530 + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
531 +
532 + keepdir /var/lib/xen/dump
533 + keepdir /var/lib/xen/xenpaging
534 + keepdir /var/lib/xenstored
535 + keepdir /var/log/xen
536 +
537 + # Currently broken
538 + #if use python; then
539 + #python_domodule "${S}/tools/libs/stat/bindings/swig/python/xenstat.py"
540 + #python_domodule "${S}/tools/libs/stat/bindings/swig/python/_xenstat.so"
541 + #fi
542 +
543 + python_optimize
544 +}
545 +
546 +pkg_postinst() {
547 + elog "Official Xen Guide and the offical wiki page:"
548 + elog "https://wiki.gentoo.org/wiki/Xen"
549 + elog "https://wiki.xen.org/wiki/Main_Page"
550 + elog ""
551 + elog "Recommended to utilise the xencommons script to config system at boot"
552 + elog "Add by use of rc-update on completion of the install"
553 +
554 + if ! use hvm; then
555 + echo
556 + elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
557 + elog "support enable the hvm use flag."
558 + elog "An x86 or amd64 system is required to build HVM support."
559 + fi
560 +
561 + if use qemu; then
562 + elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
563 + elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
564 + elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
565 + elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
566 + fi
567 +}