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: 1623415740.d0af1e15c58c107b46bbdb82f5b390c0fbac01c0.whissi@gentoo
1 commit: d0af1e15c58c107b46bbdb82f5b390c0fbac01c0
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Wed Jun 9 07:15:53 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 11 12:49:00 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0af1e15
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.14.2-r1.ebuild | 525 +++++++++++++++++++++
15 2 files changed, 526 insertions(+)
16
17 diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest
18 index 41c35f702a0..92df906498e 100644
19 --- a/app-emulation/xen-tools/Manifest
20 +++ b/app-emulation/xen-tools/Manifest
21 @@ -7,6 +7,7 @@ DIST ipxe-git-988d2c13cdf0f0b4140685af35ced70ac5b3283c.tar.gz 3931642 BLAKE2B bf
22 DIST seabios-1.12.0.tar.gz 613542 BLAKE2B f145c2db716996bfa9e5c014086ccfaa8ae96ebc158f34303b122b7bf209408c567665d8691364df8d8e886f63e0e72a3f3cd319dfa86ef581023201b5d94e53 SHA512 e52c5363e5bb37b5286e55545aa06bd126218f9d0e3a06ac2e189de68fe3de3256c11ca1bb13357a9c384d7e3af6284083ff3aa587688b5de04ef11b97bdfa27
23 DIST seabios-1.14.0.tar.gz 628985 BLAKE2B cc1126925dab1551a655680d20d06ebf28c12c386500d1ee4df9e1a99403b4c5bc6a66c2cc5ef58b4c3d6d7226f35007506a6a1855c2cf2742469dcb7aba05bb SHA512 215c42f59425f8abd062be7b11fc0e39c977cee5001a2381551b0f851ac337d0dd53c065267e6dee0e710ffd700fa635f9007b89da8dfce0f47122c984ee8146
24 DIST xen-4.13.3.tar.gz 39044539 BLAKE2B 5d0e57c76e12e1b86b78bbf561e947d70b9569a24412617a640346d2358b141a2741e7a3be454df52d198ad63e58b1519288de62330417c70e72445703f3fac2 SHA512 622127d824b9c49b57282a887fb404e0bad05ff60bccade82e4e0e9b5ad975ff9aa1fba83392e6d8379e9a15340e8ae9785c0913eb11027816e4600432eea6b6
25 +DIST xen-4.14.2-upstream-patches-0.tar.xz 23304 BLAKE2B 954e0a49e5c3ec122aefe52afe328f440b8a4c8db966e0fa91e0b6d6cb3c0462b75fb99b3e7392811bd2e680cd7945e8a4d68317245fd42fdf0ad6cab33fbc68 SHA512 64d243f0c8acfec87812e4d78e3d8b24a86315824853f4f3b17122b7119425d180650695bc12e1a30f5b30c6ef684be7c08b2bc677ca2f0668d0335d92e2bf78
26 DIST xen-4.14.2.tar.gz 39973157 BLAKE2B db5d3570f79e0fd97872f5e5dd57a4eb39e005728387bfef3b51fabe1c693cfd8108d09b1026f5a5a7eb79de71be6f4af36d252f7e0b35a65a1567b7949e3e29 SHA512 83c9333b70dbee3e29c6bf08e5ad030676e6c4a32b976f3f5e6a8f8d0dd9e4898bac88dd8e1c9d2ad3509cebb5d212e1745f9392a469d7afeb841d79801ccf39
27 DIST xen-4.15.0-upstream-patches-0.tar.xz 15744 BLAKE2B e2abb68524a7c190db8d91beb79731aea5290e82f54fb21218739dab666f6f5ea85c203575ec248b46830f1862408d50d3ceea1104fcd9325babfccf3574c515 SHA512 f1a2800d15a61f08eda4d6bafaead95a9d72cc9e4d90a19278d89c696b7e2d5d6353b28dba7ed0eb0c9aeb8604d3697db6a8f4ac38047e2510279d88181752f9
28 DIST xen-4.15.0.tar.gz 40785399 BLAKE2B 8b0530f5516c39656506f4bb705952da0555a8ab7f47323473b171caeb7692f3107e9d94f13171d40576600064589eed35f4d210af02db4cc4706dd4fc202100 SHA512 93683b8a97387ca5f003c635a11d163e61c87dbdc9a03081f9155fe87b49f1dfa74ce243fcd5e04dc009353a36e2375b786f1ebde828b5951a094cd64197b4c7
29
30 diff --git a/app-emulation/xen-tools/xen-tools-4.14.2-r1.ebuild b/app-emulation/xen-tools/xen-tools-4.14.2-r1.ebuild
31 new file mode 100644
32 index 00000000000..6499239c8c1
33 --- /dev/null
34 +++ b/app-emulation/xen-tools/xen-tools-4.14.2-r1.ebuild
35 @@ -0,0 +1,525 @@
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=0
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/share/qemu-xen/qemu/hppa-firmware.img
189 + usr/share/qemu-xen/qemu/s390-ccw.img
190 + usr/share/qemu-xen/qemu/u-boot.e500
191 +"
192 +
193 +QA_PREBUILT="
194 + usr/libexec/xen/bin/elf2dmp
195 + usr/libexec/xen/bin/ivshmem-client
196 + usr/libexec/xen/bin/ivshmem-server
197 + usr/libexec/xen/bin/qemu-edid
198 + usr/libexec/xen/bin/qemu-img
199 + usr/libexec/xen/bin/qemu-io
200 + usr/libexec/xen/bin/qemu-keymap
201 + usr/libexec/xen/bin/qemu-nbd
202 + usr/libexec/xen/bin/qemu-pr-helper
203 + usr/libexec/xen/bin/qemu-system-i386
204 + usr/libexec/xen/bin/virtfs-proxy-helper
205 + usr/libexec/xen/libexec/xen-bridge-helper
206 + usr/share/qemu-xen/qemu/s390-ccw.img
207 + usr/share/qemu-xen/qemu/s390-netboot.img
208 + usr/share/qemu-xen/qemu/u-boot.e500
209 +"
210 +
211 +RESTRICT="test"
212 +
213 +pkg_setup() {
214 + python_setup
215 + export "CONFIG_LOMOUNT=y"
216 +
217 + #bug 522642, disable compile tools/tests
218 + export "CONFIG_TESTS=n"
219 +
220 + if [[ -z ${XEN_TARGET_ARCH} ]] ; then
221 + if use x86 && use amd64; then
222 + die "Confusion! Both x86 and amd64 are set in your use flags!"
223 + elif use x86; then
224 + export XEN_TARGET_ARCH="x86_32"
225 + elif use amd64 ; then
226 + export XEN_TARGET_ARCH="x86_64"
227 + elif use arm; then
228 + export XEN_TARGET_ARCH="arm32"
229 + elif use arm64; then
230 + export XEN_TARGET_ARCH="arm64"
231 + else
232 + die "Unsupported architecture!"
233 + fi
234 + fi
235 +}
236 +
237 +src_prepare() {
238 + local i
239 +
240 + # Upstream's patchset
241 + if [[ -n ${UPSTREAM_VER} ]]; then
242 + einfo "Try to apply Xen Upstream patch set"
243 + eapply "${WORKDIR}"/patches-upstream
244 + fi
245 +
246 + # Security patchset
247 + if [[ -n ${SECURITY_VER} ]]; then
248 + einfo "Try to apply Xen Security patch set"
249 + # apply main xen patches
250 + # Two parallel systems, both work side by side
251 + # Over time they may concdense into one. This will suffice for now
252 + EPATCH_SUFFIX="patch"
253 + EPATCH_FORCE="yes"
254 +
255 + source "${WORKDIR}"/patches-security/${PV}.conf || die
256 +
257 + for i in ${XEN_SECURITY_MAIN}; do
258 + eapply "${WORKDIR}"/patches-security/xen/$i
259 + done
260 +
261 + # apply qemu-xen/upstream patches
262 + pushd "${S}"/tools/qemu-xen/ > /dev/null
263 + for i in ${XEN_SECURITY_QEMUU}; do
264 + eapply "${WORKDIR}"/patches-security/qemuu/$i
265 + done
266 + popd > /dev/null
267 +
268 + # apply qemu-traditional patches
269 + pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
270 + for i in ${XEN_SECURITY_QEMUT}; do
271 + eapply "${WORKDIR}"/patches-security/qemut/$i
272 + done
273 + popd > /dev/null
274 + fi
275 +
276 + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
277 + mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
278 + pushd tools/firmware/ > /dev/null
279 + ln -s seabios-dir-remote seabios-dir || die
280 + popd > /dev/null
281 +
282 + # Gentoo's patchset
283 + if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
284 + einfo "Try to apply Gentoo specific patch set"
285 + source "${FILESDIR}"/gentoo-patches.conf || die
286 + _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
287 + for i in ${!_gpv}; do
288 + eapply "${WORKDIR}"/patches-gentoo/$i
289 + done
290 + fi
291 +
292 + # Ovmf's patchset
293 + if use ovmf; then
294 + if [[ -n ${OVMF_VER} ]];then
295 + einfo "Try to apply Ovmf patch set"
296 + pushd "${WORKDIR}"/edk2-*/ > /dev/null
297 + eapply "${WORKDIR}"/patches-ovmf
298 + popd > /dev/null
299 + fi
300 + mv ../edk2-${EDK2_COMMIT} tools/firmware/ovmf-dir-remote || die
301 + rm -r tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
302 + rm -r tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
303 + rm -r tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
304 + rm -r tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
305 + mv ../openssl-OpenSSL_${EDK2_OPENSSL_VERSION} tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
306 + mv ../berkeley-softfloat-3-${EDK2_SOFTFLOAT_COMMIT} tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
307 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
308 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
309 + cp tools/firmware/ovmf-makefile tools/firmware/ovmf-dir-remote/Makefile || die
310 + fi
311 +
312 + # ipxe
313 + if use ipxe; then
314 + cp "${DISTDIR}/ipxe-git-${IPXE_COMMIT}.tar.gz" tools/firmware/etherboot/_ipxe.tar.gz || die
315 +
316 + # gcc 11
317 + cp "${WORKDIR}/patches-gentoo/xen-tools-4.15.0-ipxe-gcc11.patch" tools/firmware/etherboot/patches/ipxe-gcc11.patch || die
318 + echo ipxe-gcc11.patch >> tools/firmware/etherboot/patches/series || die
319 + fi
320 +
321 + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
322 +
323 + # Fix texi2html build error with new texi2html, qemu.doc.html
324 + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
325 +
326 + use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
327 + sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
328 + -i tools/firmware/Makefile || die
329 +
330 + # Drop .config, fixes to gcc-4.6
331 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
332 +
333 + # drop flags
334 + unset CFLAGS
335 + unset LDFLAGS
336 + unset ASFLAGS
337 + unset CPPFLAGS
338 +
339 + if ! use pygrub; then
340 + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
341 + fi
342 +
343 + if ! use python; then
344 + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
345 + fi
346 +
347 + if ! use hvm; then
348 + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
349 + # Bug 351648
350 + elif ! use x86 && ! has x86 $(get_all_abis); then
351 + mkdir -p "${WORKDIR}"/extra-headers/gnu || die
352 + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
353 + export CPATH="${WORKDIR}"/extra-headers
354 + fi
355 +
356 + if use qemu; then
357 + if use sdl; then
358 + sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
359 + tools/Makefile || die
360 + else
361 + sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
362 + tools/qemu-xen-traditional/xen-setup || die
363 + sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
364 + tools/Makefile || die
365 + fi
366 + else
367 + # Don't bother with qemu, only needed for fully virtualised guests
368 + sed -i '/SUBDIRS-$(CONFIG_QEMU_XEN)/s/^/#/g' tools/Makefile || die
369 + fi
370 +
371 + # Reset bash completion dir; Bug 472438
372 + sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
373 + -i Config.mk || die
374 + sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
375 +
376 + # xencommons, Bug #492332, sed lighter weight than patching
377 + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
378 + -i tools/hotplug/Linux/init.d/xencommons.in || die
379 +
380 + # fix bashishm
381 + sed -e '/Usage/s/\$//g' \
382 + -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
383 +
384 + # respect multilib, usr/lib/libcacard.so.0.0.0
385 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
386 + -i tools/qemu-xen/configure || die
387 +
388 + #bug 518136, don't build 32bit exactuable for nomultilib profile
389 + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
390 + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
391 + fi
392 +
393 + # uncomment lines in xl.conf
394 + sed -e 's:^#autoballoon=:autoballoon=:' \
395 + -e 's:^#lockfile=:lockfile=:' \
396 + -e 's:^#vif.default.script=:vif.default.script=:' \
397 + -i tools/examples/xl.conf || die
398 +
399 + # disable capstone (Bug #673474)
400 + sed -e "s:\$\$source/configure:\0 --disable-capstone:" \
401 + -i tools/Makefile || die
402 +
403 + # disable glusterfs
404 + sed -e "s:\$\$source/configure:\0 --disable-glusterfs:" \
405 + -i tools/Makefile || die
406 +
407 + # disable jpeg automagic
408 + sed -e "s:\$\$source/configure:\0 --disable-vnc-jpeg:" \
409 + -i tools/Makefile || die
410 +
411 + # disable png automagic
412 + sed -e "s:\$\$source/configure:\0 --disable-vnc-png:" \
413 + -i tools/Makefile || die
414 +
415 + # disable docker (Bug #732970)
416 + sed -e "s:\$\$source/configure:\0 --disable-containers:" \
417 + -i tools/Makefile || die
418 +
419 + default
420 +}
421 +
422 +src_configure() {
423 + local myconf="--prefix=${PREFIX}/usr \
424 + --libdir=${PREFIX}/usr/$(get_libdir) \
425 + --libexecdir=${PREFIX}/usr/libexec \
426 + --localstatedir=${EPREFIX}/var \
427 + --disable-golang \
428 + --disable-werror \
429 + --disable-xen \
430 + --enable-tools \
431 + --enable-docs \
432 + $(use_enable api xenapi) \
433 + $(use_enable ipxe) \
434 + $(usex system-ipxe '--with-system-ipxe=/usr/share/ipxe' '') \
435 + $(use_enable ocaml ocamltools) \
436 + $(use_enable ovmf) \
437 + $(use_enable pam) \
438 + $(use_enable rombios) \
439 + --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
440 + "
441 +
442 + use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
443 + use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
444 + use amd64 && myconf+=" $(use_enable qemu-traditional)"
445 + tc-ld-disable-gold # Bug 669570
446 + econf ${myconf}
447 +}
448 +
449 +src_compile() {
450 + local myopt
451 + use debug && myopt="${myopt} debug=y"
452 + use python && myopt="${myopt} XENSTAT_PYTHON_BINDINGS=y"
453 +
454 + if test-flag-CC -fno-strict-overflow; then
455 + append-flags -fno-strict-overflow
456 + fi
457 +
458 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
459 +
460 + if use doc; then
461 + emake -C docs build
462 + else
463 + emake -C docs man-pages
464 + fi
465 +}
466 +
467 +src_install() {
468 + # Override auto-detection in the build system, bug #382573
469 + export INITD_DIR=/tmp/init.d
470 + export CONFIG_LEAF_DIR=../tmp/default
471 +
472 + # Let the build system compile installed Python modules.
473 + local PYTHONDONTWRITEBYTECODE
474 + export PYTHONDONTWRITEBYTECODE
475 +
476 + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
477 + XEN_PYTHON_NATIVE_INSTALL=y install-tools
478 +
479 + # Created at runtime
480 + rm -rv "${ED}/var/run" || die
481 +
482 + # Fix the remaining Python shebangs.
483 + python_fix_shebang "${D}"
484 +
485 + # Remove RedHat-specific stuff
486 + rm -rf "${D}"/tmp || die
487 +
488 + if use doc; then
489 + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
490 + dodoc -r docs/{pdf,txt}
491 + else
492 + emake -C docs DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-man-pages # Bug 668032
493 + fi
494 + dodoc ${DOCS[@]}
495 +
496 + newconfd "${FILESDIR}"/xendomains.confd xendomains
497 + newconfd "${FILESDIR}"/xenstored.confd xenstored
498 + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
499 + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
500 + newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
501 + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
502 + newinitd "${FILESDIR}"/xencommons.initd xencommons
503 + newconfd "${FILESDIR}"/xencommons.confd xencommons
504 + newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
505 + newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
506 + newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
507 +
508 + if use screen; then
509 + cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
510 + cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
511 + keepdir /var/log/xen-consoles
512 + fi
513 +
514 + # For -static-libs wrt Bug 384355
515 + if ! use static-libs; then
516 + rm -f "${D}"/usr/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/ocaml/*/*.a
517 + fi
518 +
519 + # for xendomains
520 + keepdir /etc/xen/auto
521 +
522 + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
523 + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
524 + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
525 +
526 + keepdir /var/lib/xen/dump
527 + keepdir /var/lib/xen/xenpaging
528 + keepdir /var/lib/xenstored
529 + keepdir /var/log/xen
530 +
531 + if use python; then
532 + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/xenstat.py"
533 + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/_xenstat.so"
534 + fi
535 +
536 + python_optimize
537 +}
538 +
539 +pkg_postinst() {
540 + elog "Official Xen Guide and the offical wiki page:"
541 + elog "https://wiki.gentoo.org/wiki/Xen"
542 + elog "https://wiki.xen.org/wiki/Main_Page"
543 + elog ""
544 + elog "Recommended to utilise the xencommons script to config system at boot"
545 + elog "Add by use of rc-update on completion of the install"
546 +
547 + if ! use hvm; then
548 + echo
549 + elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
550 + elog "support enable the hvm use flag."
551 + elog "An x86 or amd64 system is required to build HVM support."
552 + fi
553 +
554 + if use qemu; then
555 + elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
556 + elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
557 + elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
558 + elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
559 + fi
560 +}