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