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