Gentoo Archives: gentoo-commits

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