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: Fri, 02 Sep 2022 09:41:29
Message-Id: 1662111679.9b45b841df2577387b2f16c36c473c5b51cd185e.flow@gentoo
1 commit: 9b45b841df2577387b2f16c36c473c5b51cd185e
2 Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 2 09:40:27 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 2 09:41:19 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b45b841
7
8 app-emulation/xen-tools: add 4.16.2
9
10 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
11
12 app-emulation/xen-tools/Manifest | 1 +
13 app-emulation/xen-tools/xen-tools-4.16.2.ebuild | 527 ++++++++++++++++++++++++
14 2 files changed, 528 insertions(+)
15
16 diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest
17 index b542efa7a0c0..1fd894a3b434 100644
18 --- a/app-emulation/xen-tools/Manifest
19 +++ b/app-emulation/xen-tools/Manifest
20 @@ -6,6 +6,7 @@ DIST ipxe-git-3c040ad387099483102708bb1839110bc788cefb.tar.gz 3962725 BLAKE2B a8
21 DIST seabios-1.14.0.tar.gz 628985 BLAKE2B cc1126925dab1551a655680d20d06ebf28c12c386500d1ee4df9e1a99403b4c5bc6a66c2cc5ef58b4c3d6d7226f35007506a6a1855c2cf2742469dcb7aba05bb SHA512 215c42f59425f8abd062be7b11fc0e39c977cee5001a2381551b0f851ac337d0dd53c065267e6dee0e710ffd700fa635f9007b89da8dfce0f47122c984ee8146
22 DIST xen-4.15.3.tar.gz 40793144 BLAKE2B 33932d855a0502cfe2768a7c8ae19d7da285d70b4970d96fd703daf0ee24a77ad47a3d1b4bcf5f465aa81aa7eb7f9295bce96302b2149ca208fa662cd966d6af SHA512 c25903cc263891885ec76500488405226c8e025bb461d2bf0d590b9bd2d7ca5c2693de7ecc38b3655bfd6793cc96314826559f14a09cc139de8cfdbeb914cbd3
23 DIST xen-4.16.1.tar.gz 44964667 BLAKE2B 190d9c330b5dcdd47bae26b6ef42111c9c63b71b8b92e20eae268054c6b40aaabadef78c0c9634cb3c3b1bde32a746cbb1404b5eed2a82ab829ba10632103856 SHA512 eeabba9c263cd2425bca083e32b5ebfc6c716c00553759c144fd4b6f64a89836b260787fa25ba22c1f5c4ea65aaad7c95b8c2c1070d3377b1c43c9517aa7032a
24 +DIST xen-4.16.2.tar.gz 44995249 BLAKE2B a221d1e4578ab6eb3250754b3b0f36fb30133c1c83246532ebb9648c3d025b3f5132227371b5d3dd82099594f4ee738227480528ee944b8de6231d9c89892d15 SHA512 b6cd036c1073798dffa167ca14c954fbdfb4c0ef99662f7c435e7e5de687d1bde8856ff6bd030d0d2e661bd17ab631551f01b2cc728cad7e70b59aaa6e692783
25 DIST xen-gentoo-patches-4.15.3-gentoo-patchset-2.tar.bz2 4681 BLAKE2B 59fe5c2d5f3b975f281778ee96f8771debde7ae738636fc8294e7e2578dffc40938d8c48e4e94f0341762b2ba8e1b6769f71b7783322fb3b2a0a187bbf2b5104 SHA512 8540aa3631277fb652f90c53f6f5b4e9d119a7ed267dec96d7aecca4eac2c465ec3be32b0b82057e79f858cc8115bfdfbf2af5c4879a0be3f98ed68cbe64fdae
26 DIST xen-gentoo-patches-4.16.1-gentoo-patchset-2.tar.bz2 5403 BLAKE2B 7fa3b4aa123b2deed260d02b8d34a35dd205207038edb92569278b25c6fe32e0f0e3857c07755553e047f0eb0d9fe7f8b0816e0f3d7f68aee7929afaf6611dfd SHA512 9e7d25640b24235acf756b031b8b7cee582dded65fe7b94a706c990232e9704d574036c3a9605f285e8e9534578d100a3f38719b27b22775f17ef8f68287997e
27 DIST xen-upstream-patches-4.15.4-pre-patchset-0.1.tar.bz2 28980 BLAKE2B 5bdabed3bce4306fe5f656a965d1e537608c03b4706dc801a0b0b9649d001b875b1a2543c68c6b459483991570f0fbf2490a97ea1776761c9f61e9876f240fdf SHA512 4f6bbf0dab57ad58292f32fab55294b2eedd0442be7f62341a2df922a1d21880fe33cc29956ccbbb8b4aee4c10b38d4aa090e4db9496d6e0f5256e60999cad7d
28
29 diff --git a/app-emulation/xen-tools/xen-tools-4.16.2.ebuild b/app-emulation/xen-tools/xen-tools-4.16.2.ebuild
30 new file mode 100644
31 index 000000000000..f913c45d4312
32 --- /dev/null
33 +++ b/app-emulation/xen-tools/xen-tools-4.16.2.ebuild
34 @@ -0,0 +1,527 @@
35 +# Copyright 1999-2022 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +PYTHON_COMPAT=( python3_{8..10} )
41 +PYTHON_REQ_USE='ncurses,xml,threads(+)'
42 +
43 +inherit bash-completion-r1 flag-o-matic multilib python-single-r1 readme.gentoo-r1 toolchain-funcs
44 +
45 +if [[ ${PV} == *9999 ]]; then
46 + inherit git-r3
47 + REPO="xen.git"
48 + EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
49 + S="${WORKDIR}/${REPO}"
50 +else
51 + KEYWORDS="~amd64 ~arm ~arm64 ~x86"
52 +
53 + SEABIOS_VER="1.14.0"
54 + EDK2_COMMIT="7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5"
55 + EDK2_OPENSSL_VERSION="1_1_1j"
56 + EDK2_SOFTFLOAT_COMMIT="b64af41c3276f97f0e181920400ee056b9c88037"
57 + EDK2_BROTLI_COMMIT="666c3280cc11dc433c303d79a83d4ffbdd12cc8d"
58 + IPXE_COMMIT="3c040ad387099483102708bb1839110bc788cefb"
59 +
60 + XEN_GENTOO_PATCHSET_NUM=2
61 + XEN_GENTOO_PATCHSET_BASE=4.16.1
62 + XEN_PRE_PATCHSET_NUM=
63 + XEN_PRE_VERSION_BASE=
64 +
65 + XEN_BASE_PV="${PV}"
66 + if [[ -n "${XEN_PRE_VERSION_BASE}" ]]; then
67 + XEN_BASE_PV="${XEN_PRE_VERSION_BASE}"
68 + fi
69 +
70 + SRC_URI="
71 + https://downloads.xenproject.org/release/xen/${XEN_BASE_PV}/xen-${XEN_BASE_PV}.tar.gz
72 + https://www.seabios.org/downloads/seabios-${SEABIOS_VER}.tar.gz
73 + ipxe? ( https://xenbits.xen.org/xen-extfiles/ipxe-git-${IPXE_COMMIT}.tar.gz )
74 + ovmf? ( https://github.com/tianocore/edk2/archive/${EDK2_COMMIT}.tar.gz -> edk2-${EDK2_COMMIT}.tar.gz
75 + https://github.com/openssl/openssl/archive/OpenSSL_${EDK2_OPENSSL_VERSION}.tar.gz
76 + https://github.com/ucb-bar/berkeley-softfloat-3/archive/${EDK2_SOFTFLOAT_COMMIT}.tar.gz -> berkeley-softfloat-${EDK2_SOFTFLOAT_COMMIT}.tar.gz
77 + https://github.com/google/brotli/archive/${EDK2_BROTLI_COMMIT}.tar.gz -> brotli-${EDK2_BROTLI_COMMIT}.tar.gz
78 + )
79 + "
80 +
81 + if [[ -n "${XEN_PRE_PATCHSET_NUM}" ]]; then
82 + XEN_UPSTREAM_PATCHES_TAG="$(ver_cut 1-3)-pre-patchset-${XEN_PRE_PATCHSET_NUM}"
83 + XEN_UPSTREAM_PATCHES_NAME="xen-upstream-patches-${XEN_UPSTREAM_PATCHES_TAG}"
84 + SRC_URI+=" https://gitweb.gentoo.org/proj/xen-upstream-patches.git/snapshot/${XEN_UPSTREAM_PATCHES_NAME}.tar.bz2"
85 + XEN_UPSTREAM_PATCHES_DIR="${WORKDIR}/${XEN_UPSTREAM_PATCHES_NAME}"
86 + fi
87 + if [[ -n "${XEN_GENTOO_PATCHSET_NUM}" ]]; then
88 + XEN_GENTOO_PATCHES_TAG="$(ver_cut 1-3 ${XEN_GENTOO_PATCHSET_BASE})-gentoo-patchset-${XEN_GENTOO_PATCHSET_NUM}"
89 + XEN_GENTOO_PATCHES_NAME="xen-gentoo-patches-${XEN_GENTOO_PATCHES_TAG}"
90 + SRC_URI+=" https://gitweb.gentoo.org/proj/xen-gentoo-patches.git/snapshot/${XEN_GENTOO_PATCHES_NAME}.tar.bz2"
91 + XEN_GENTOO_PATCHES_DIR="${WORKDIR}/${XEN_GENTOO_PATCHES_NAME}"
92 + fi
93 +fi
94 +
95 +DESCRIPTION="Xen tools including QEMU and xl"
96 +HOMEPAGE="https://xenproject.org"
97 +DOCS=( README )
98 +
99 +S="${WORKDIR}/xen-$(ver_cut 1-3 ${XEN_BASE_PV})"
100 +
101 +LICENSE="GPL-2"
102 +SLOT="0/$(ver_cut 1-2)"
103 +# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
104 +# >=dev-lang/ocaml-4 stable
105 +# Masked in profiles/eapi-5-files instead
106 +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"
107 +
108 +REQUIRED_USE="
109 + ${PYTHON_REQUIRED_USE}
110 + ipxe? ( rombios )
111 + ovmf? ( hvm )
112 + pygrub? ( python )
113 + rombios? ( hvm )
114 + system-ipxe? ( rombios )
115 + ?? ( ipxe system-ipxe )
116 + ?? ( qemu system-qemu )"
117 +
118 +COMMON_DEPEND="
119 + lzma? ( app-arch/xz-utils )
120 + qemu? (
121 + dev-libs/glib:2
122 + sys-libs/pam
123 + )
124 + zstd? ( app-arch/zstd )
125 + app-arch/bzip2
126 + app-arch/zstd
127 + dev-libs/libnl:3
128 + dev-libs/lzo:2
129 + dev-libs/yajl
130 + sys-apps/util-linux
131 + sys-fs/e2fsprogs
132 + sys-libs/ncurses
133 + sys-libs/zlib
134 + ${PYTHON_DEPS}
135 +"
136 +
137 +RDEPEND="${COMMON_DEPEND}
138 + sys-apps/iproute2[-minimal]
139 + net-misc/bridge-utils
140 + screen? (
141 + app-misc/screen
142 + app-admin/logrotate
143 + )
144 + selinux? ( sec-policy/selinux-xen )"
145 +
146 +DEPEND="${COMMON_DEPEND}
147 + app-misc/pax-utils
148 + >=sys-kernel/linux-headers-4.11
149 + x11-libs/pixman
150 + $(python_gen_cond_dep '
151 + dev-python/lxml[${PYTHON_USEDEP}]
152 + ')
153 + x86? ( sys-devel/dev86
154 + system-ipxe? ( sys-firmware/ipxe[qemu] )
155 + sys-power/iasl )
156 + api? ( dev-libs/libxml2
157 + net-misc/curl )
158 +
159 + ovmf? (
160 + !arm? ( !arm64? ( dev-lang/nasm ) )
161 + $(python_gen_impl_dep sqlite)
162 + )
163 + !amd64? ( >=sys-apps/dtc-1.4.0 )
164 + amd64? ( sys-power/iasl
165 + system-seabios? ( sys-firmware/seabios )
166 + system-ipxe? ( sys-firmware/ipxe[qemu] )
167 + rombios? ( sys-devel/bin86 sys-devel/dev86 ) )
168 + arm64? ( sys-power/iasl
169 + rombios? ( sys-devel/bin86 sys-devel/dev86 ) )
170 + doc? (
171 + app-text/ghostscript-gpl
172 + app-text/pandoc
173 + $(python_gen_cond_dep '
174 + dev-python/markdown[${PYTHON_USEDEP}]
175 + ')
176 + dev-texlive/texlive-latexextra
177 + media-gfx/transfig
178 + )
179 + hvm? ( x11-base/xorg-proto )
180 + qemu? (
181 + app-arch/snappy:=
182 + dev-util/meson
183 + sdl? (
184 + media-libs/libsdl[X]
185 + media-libs/libsdl2[X]
186 + )
187 + )
188 + system-qemu? ( app-emulation/qemu[xen] )
189 + ocaml? ( dev-ml/findlib
190 + dev-lang/ocaml[ocamlopt] )
191 + python? ( >=dev-lang/swig-4.0.0 )"
192 +
193 +BDEPEND="dev-lang/perl
194 + sys-devel/bison
195 + sys-devel/gettext"
196 +
197 +# hvmloader is used to bootstrap a fully virtualized kernel
198 +# Approved by QA team in bug #144032
199 +QA_WX_LOAD="
200 + usr/libexec/xen/boot/hvmloader
201 + usr/libexec/xen/boot/ovmf.bin
202 + usr/libexec/xen/boot/xen-shim
203 + usr/share/qemu-xen/qemu/hppa-firmware.img
204 + usr/share/qemu-xen/qemu/opensbi-riscv32-generic-fw_dynamic.elf
205 + usr/share/qemu-xen/qemu/opensbi-riscv64-generic-fw_dynamic.elf
206 + usr/share/qemu-xen/qemu/s390-ccw.img
207 + usr/share/qemu-xen/qemu/u-boot.e500
208 +"
209 +
210 +QA_EXECSTACK="
211 + usr/share/qemu-xen/qemu/hppa-firmware.img
212 +"
213 +
214 +QA_PREBUILT="
215 + usr/libexec/xen/bin/elf2dmp
216 + usr/libexec/xen/bin/ivshmem-client
217 + usr/libexec/xen/bin/ivshmem-server
218 + usr/libexec/xen/bin/qemu-edid
219 + usr/libexec/xen/bin/qemu-img
220 + usr/libexec/xen/bin/qemu-io
221 + usr/libexec/xen/bin/qemu-keymap
222 + usr/libexec/xen/bin/qemu-nbd
223 + usr/libexec/xen/bin/qemu-pr-helper
224 + usr/libexec/xen/bin/qemu-storage-daemon
225 + usr/libexec/xen/bin/qemu-system-i386
226 + usr/libexec/xen/bin/virtfs-proxy-helper
227 + usr/libexec/xen/boot/ovmf.bin
228 + usr/libexec/xen/boot/xen-shim
229 + usr/libexec/xen/libexec/qemu-pr-helper
230 + usr/libexec/xen/libexec/virtfs-proxy-helper
231 + usr/libexec/xen/libexec/virtiofsd
232 + usr/libexec/xen/libexec/xen-bridge-helper
233 + usr/share/qemu-xen/qemu/s390-ccw.img
234 + usr/share/qemu-xen/qemu/s390-netboot.img
235 + usr/share/qemu-xen/qemu/u-boot.e500
236 +"
237 +
238 +RESTRICT="test"
239 +
240 +pkg_setup() {
241 + python_setup
242 + export "CONFIG_LOMOUNT=y"
243 +
244 + #bug 522642, disable compile tools/tests
245 + export "CONFIG_TESTS=n"
246 +
247 + if [[ -z ${XEN_TARGET_ARCH} ]] ; then
248 + if use x86 && use amd64; then
249 + die "Confusion! Both x86 and amd64 are set in your use flags!"
250 + elif use x86; then
251 + export XEN_TARGET_ARCH="x86_32"
252 + elif use amd64 ; then
253 + export XEN_TARGET_ARCH="x86_64"
254 + elif use arm; then
255 + export XEN_TARGET_ARCH="arm32"
256 + elif use arm64; then
257 + export XEN_TARGET_ARCH="arm64"
258 + else
259 + die "Unsupported architecture!"
260 + fi
261 + fi
262 +}
263 +
264 +src_prepare() {
265 + # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
266 + mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
267 + pushd tools/firmware/ > /dev/null
268 + ln -s seabios-dir-remote seabios-dir || die
269 + popd > /dev/null
270 +
271 + if [[ -v XEN_UPSTREAM_PATCHES_DIR ]]; then
272 + eapply "${XEN_UPSTREAM_PATCHES_DIR}"
273 + fi
274 +
275 + if [[ -v XEN_GENTOO_PATCHES_DIR ]]; then
276 + eapply "${XEN_GENTOO_PATCHES_DIR}"
277 + fi
278 +
279 + # Rename qemu-bridge-helper to xen-bridge-helper to avoid file
280 + # collisions with app-emulation/qemu.
281 + sed -i 's/qemu-bridge-helper/xen-bridge-helper/g' \
282 + tools/qemu-xen/include/net/net.h \
283 + tools/qemu-xen/meson.build \
284 + tools/qemu-xen/qemu-bridge-helper.c \
285 + tools/qemu-xen/qemu-options.hx \
286 + || die
287 + mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
288 +
289 + if use ovmf; then
290 + mv ../edk2-${EDK2_COMMIT} tools/firmware/ovmf-dir-remote || die
291 + rm -r tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
292 + rm -r tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
293 + rm -r tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
294 + rm -r tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
295 + mv ../openssl-OpenSSL_${EDK2_OPENSSL_VERSION} tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die
296 + mv ../berkeley-softfloat-3-${EDK2_SOFTFLOAT_COMMIT} tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die
297 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die
298 + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die
299 + cp tools/firmware/ovmf-makefile tools/firmware/ovmf-dir-remote/Makefile || die
300 +
301 + # Bug #816987
302 + pushd tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli > /dev/null
303 + eapply "${XEN_GENTOO_PATCHES_DIR}/ovmf/${PN}-4.15.1-brotli-gcc11.patch"
304 + popd > /dev/null
305 +
306 + pushd tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli > /dev/null
307 + eapply "${XEN_GENTOO_PATCHES_DIR}/ovmf/${PN}-4.15.1-brotli-gcc11.patch"
308 + popd > /dev/null
309 + fi
310 +
311 + # ipxe
312 + if use ipxe; then
313 + cp "${DISTDIR}/ipxe-git-${IPXE_COMMIT}.tar.gz" tools/firmware/etherboot/ipxe.tar.gz || die
314 +
315 + # gcc 11
316 + cp "${XEN_GENTOO_PATCHES_DIR}/ipxe/${PN}-4.15.0-ipxe-gcc11.patch" tools/firmware/etherboot/patches/ipxe-gcc11.patch || die
317 + echo ipxe-gcc11.patch >> tools/firmware/etherboot/patches/series || die
318 + fi
319 +
320 + # Fix texi2html build error with new texi2html, qemu.doc.html
321 + sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
322 +
323 + # Drop .config, fixes to gcc-4.6
324 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
325 +
326 + # drop flags
327 + unset CFLAGS
328 + unset LDFLAGS
329 + unset ASFLAGS
330 + unset CPPFLAGS
331 +
332 + if ! use pygrub; then
333 + sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
334 + fi
335 +
336 + if ! use python; then
337 + sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
338 + fi
339 +
340 + if ! use hvm; then
341 + sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
342 + # Bug 351648
343 + elif ! use x86 && ! has x86 $(get_all_abis); then
344 + mkdir -p "${WORKDIR}"/extra-headers/gnu || die
345 + touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
346 + export CPATH="${WORKDIR}"/extra-headers
347 + fi
348 +
349 + if use qemu; then
350 + if use sdl; then
351 + sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
352 + tools/Makefile || die
353 + else
354 + sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
355 + tools/qemu-xen-traditional/xen-setup || die
356 + sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
357 + tools/Makefile || die
358 + fi
359 + else
360 + # Don't bother with qemu, only needed for fully virtualised guests
361 + sed -i '/SUBDIRS-$(CONFIG_QEMU_XEN)/s/^/#/g' tools/Makefile || die
362 + fi
363 +
364 + # Reset bash completion dir; Bug 472438
365 + sed -e "s;^BASH_COMPLETION_DIR :=.*;BASH_COMPLETION_DIR := $(get_bashcompdir);" \
366 + -i config/Paths.mk.in || die
367 +
368 + # xencommons, Bug #492332, sed lighter weight than patching
369 + sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
370 + -i tools/hotplug/Linux/init.d/xencommons.in || die
371 +
372 + # fix bashishm
373 + sed -e '/Usage/s/\$//g' \
374 + -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
375 +
376 + # respect multilib, usr/lib/libcacard.so.0.0.0
377 + sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
378 + -i tools/qemu-xen/configure || die
379 +
380 + #bug 518136, don't build 32bit exactuable for nomultilib profile
381 + if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
382 + sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
383 + fi
384 +
385 + # uncomment lines in xl.conf
386 + sed -e 's:^#autoballoon=:autoballoon=:' \
387 + -e 's:^#lockfile=:lockfile=:' \
388 + -e 's:^#vif.default.script=:vif.default.script=:' \
389 + -i tools/examples/xl.conf || die
390 +
391 + # disable capstone (Bug #673474)
392 + sed -e "s:\$\$source/configure:\0 --disable-capstone:" \
393 + -i tools/Makefile || die
394 +
395 + # disable glusterfs
396 + sed -e "s:\$\$source/configure:\0 --disable-glusterfs:" \
397 + -i tools/Makefile || die
398 +
399 + # disable jpeg automagic
400 + sed -e "s:\$\$source/configure:\0 --disable-vnc-jpeg:" \
401 + -i tools/Makefile || die
402 +
403 + # disable png automagic
404 + sed -e "s:\$\$source/configure:\0 --disable-vnc-png:" \
405 + -i tools/Makefile || die
406 +
407 + # disable docker (Bug #732970)
408 + sed -e "s:\$\$source/configure:\0 --disable-containers:" \
409 + -i tools/Makefile || die
410 +
411 + # disable abi-dumper (Bug #791172)
412 + sed -e 's/$(ABI_DUMPER) /echo /g' \
413 + -i tools/libs/libs.mk || die
414 +
415 + # Remove -Werror
416 + find . -type f \( -name Makefile -o -name "*.mk" \) \
417 + -exec sed -i \
418 + -e 's/-Werror //g' \
419 + -e '/^CFLAGS *+= -Werror$/d' \
420 + -e 's/, "-Werror"//' \
421 + {} + || die
422 +
423 + default
424 +}
425 +
426 +src_configure() {
427 + local myconf=(
428 + --libdir="${EPREFIX}/usr/$(get_libdir)"
429 + --libexecdir="${EPREFIX}/usr/libexec"
430 + --localstatedir="${EPREFIX}/var"
431 + --disable-golang
432 + --disable-werror
433 + --disable-xen
434 + --enable-tools
435 + --enable-docs
436 + $(use_enable api xenapi)
437 + $(use_enable ipxe)
438 + $(usex system-ipxe '--with-system-ipxe=/usr/share/ipxe' '')
439 + $(use_enable ocaml ocamltools)
440 + $(use_enable ovmf)
441 + $(use_enable rombios)
442 + $(use_enable systemd)
443 + --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored')
444 + )
445 +
446 + use system-seabios && myconf+=( --with-system-seabios=/usr/share/seabios/bios.bin )
447 + use system-qemu && myconf+=( --with-system-qemu=/usr/bin/qemu-system-x86_64 )
448 + use amd64 && myconf+=( $(use_enable qemu-traditional) )
449 + tc-ld-disable-gold # Bug 669570
450 + econf ${myconf[@]}
451 +}
452 +
453 +src_compile() {
454 + local myopt
455 + use debug && myopt="${myopt} debug=y"
456 + use python && myopt="${myopt} XENSTAT_PYTHON_BINDINGS=y"
457 +
458 + if test-flag-CC -fno-strict-overflow; then
459 + append-flags -fno-strict-overflow
460 + fi
461 +
462 + # bug #845099
463 + if use ipxe; then
464 + local -x NO_WERROR=1
465 + fi
466 +
467 + emake \
468 + HOSTCC="$(tc-getBUILD_CC)" \
469 + HOSTCXX="$(tc-getBUILD_CXX)" \
470 + CC="$(tc-getCC)" \
471 + CXX="$(tc-getCXX)" \
472 + LD="$(tc-getLD)" \
473 + AR="$(tc-getAR)" \
474 + OBJDUMP="$(tc-getOBJDUMP)" \
475 + RANLIB="$(tc-getRANLIB)" \
476 + build-tools ${myopt}
477 +
478 + if use doc; then
479 + emake -C docs build
480 + else
481 + emake -C docs man-pages
482 + fi
483 +}
484 +
485 +src_install() {
486 + # Override auto-detection in the build system, bug #382573
487 + export INITD_DIR=/tmp/init.d
488 + export CONFIG_LEAF_DIR=../tmp/default
489 +
490 + # Let the build system compile installed Python modules.
491 + local PYTHONDONTWRITEBYTECODE
492 + export PYTHONDONTWRITEBYTECODE
493 +
494 + emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
495 + XEN_PYTHON_NATIVE_INSTALL=y install-tools
496 +
497 + # Created at runtime
498 + rm -rv "${ED}/var/run" || die
499 +
500 + # Fix the remaining Python shebangs.
501 + python_fix_shebang "${D}"
502 +
503 + # Remove RedHat-specific stuff
504 + rm -rf "${D}"/tmp || die
505 +
506 + if use doc; then
507 + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
508 + dodoc -r docs/{pdf,txt}
509 + else
510 + emake -C docs DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-man-pages # Bug 668032
511 + fi
512 + dodoc ${DOCS[@]}
513 +
514 + newconfd "${FILESDIR}"/xendomains.confd xendomains
515 + newconfd "${FILESDIR}"/xenstored.confd xenstored
516 + newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
517 + newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
518 + newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
519 + newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
520 + newinitd "${FILESDIR}"/xencommons.initd xencommons
521 + newconfd "${FILESDIR}"/xencommons.confd xencommons
522 + newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
523 + newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
524 + newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
525 +
526 + if use screen; then
527 + cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
528 + cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
529 + keepdir /var/log/xen-consoles
530 + fi
531 +
532 + # For -static-libs wrt Bug 384355
533 + if ! use static-libs; then
534 + rm -f "${D}"/usr/$(get_libdir)/*.a "${D}"/usr/$(get_libdir)/ocaml/*/*.a
535 + fi
536 +
537 + # for xendomains
538 + keepdir /etc/xen/auto
539 +
540 + # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
541 + find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
542 + -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
543 +
544 + keepdir /var/lib/xen/dump
545 + keepdir /var/lib/xen/xenpaging
546 + keepdir /var/lib/xenstored
547 + keepdir /var/log/xen
548 +
549 + if use python; then
550 + python_domodule "${S}/tools/libs/stat/bindings/swig/python/xenstat.py"
551 + python_domodule "${S}/tools/libs/stat/bindings/swig/python/_xenstat.so"
552 + fi
553 +
554 + python_optimize
555 +
556 + readme.gentoo_create_doc
557 +}
558 +
559 +pkg_postinst() {
560 + readme.gentoo_print_elog
561 +}