sys-apps/net-tools: run install manually for prefix #567300
[gentoo.git] / app-emulation / qemu / qemu-2.4.1-r2.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="ncurses,readline"
9
10 inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
11         user udev fcaps readme.gentoo pax-utils
12
13 BACKPORTS=
14
15 if [[ ${PV} = *9999* ]]; then
16         EGIT_REPO_URI="git://git.qemu.org/qemu.git"
17         inherit git-2
18         SRC_URI=""
19 else
20         SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
21         ${BACKPORTS:+
22                 https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
23         KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
24 fi
25
26 DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
27 HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
28
29 LICENSE="GPL-2 LGPL-2 BSD-2"
30 SLOT="0"
31 IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
32 gtk gtk2 infiniband iscsi +jpeg \
33 kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
34 +png pulseaudio python \
35 rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
36 static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
37 virtfs +vnc vte xattr xen xfs"
38
39 COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
40 mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
41 x86_64"
42 IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
43 IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
44
45 use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
46 use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
47 IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
48
49 # Allow no targets to be built so that people can get a tools-only build.
50 # Block USE flag configurations known to not work.
51 REQUIRED_USE="${PYTHON_REQUIRED_USE}
52         gtk2? ( gtk )
53         qemu_softmmu_targets_arm? ( fdt )
54         qemu_softmmu_targets_microblaze? ( fdt )
55         qemu_softmmu_targets_ppc? ( fdt )
56         qemu_softmmu_targets_ppc64? ( fdt )
57         sdl2? ( sdl )
58         static? ( static-softmmu static-user )
59         static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
60         virtfs? ( xattr )
61         vte? ( gtk )"
62
63 # Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
64 #
65 # The attr lib isn't always linked in (although the USE flag is always
66 # respected).  This is because qemu supports using the C library's API
67 # when available rather than always using the extranl library.
68 COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
69         sys-libs/zlib[static-libs(+)]
70         xattr? ( sys-apps/attr[static-libs(+)] )"
71 SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
72         >=x11-libs/pixman-0.28.0[static-libs(+)]
73         accessibility? ( app-accessibility/brltty[static-libs(+)] )
74         aio? ( dev-libs/libaio[static-libs(+)] )
75         alsa? ( >=media-libs/alsa-lib-1.0.13 )
76         bluetooth? ( net-wireless/bluez )
77         caps? ( sys-libs/libcap-ng[static-libs(+)] )
78         curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
79         fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
80         glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
81         gtk? (
82                 gtk2? (
83                         x11-libs/gtk+:2
84                         vte? ( x11-libs/vte:0 )
85                 )
86                 !gtk2? (
87                         x11-libs/gtk+:3
88                         vte? ( x11-libs/vte:2.90 )
89                 )
90         )
91         infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
92         iscsi? ( net-libs/libiscsi )
93         jpeg? ( virtual/jpeg:=[static-libs(+)] )
94         lzo? ( dev-libs/lzo:2[static-libs(+)] )
95         ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
96         nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
97         numa? ( sys-process/numactl[static-libs(+)] )
98         opengl? (
99                 virtual/opengl
100                 media-libs/libepoxy[static-libs(+)]
101                 media-libs/mesa[static-libs(+)]
102                 media-libs/mesa[egl,gles2]
103         )
104         png? ( media-libs/libpng:0=[static-libs(+)] )
105         pulseaudio? ( media-sound/pulseaudio )
106         rbd? ( sys-cluster/ceph[static-libs(+)] )
107         sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
108         sdl? (
109                 !sdl2? (
110                         media-libs/libsdl[X]
111                         >=media-libs/libsdl-1.2.11[static-libs(+)]
112                 )
113                 sdl2? (
114                         media-libs/libsdl2[X]
115                         media-libs/libsdl2[static-libs(+)]
116                 )
117         )
118         seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
119         smartcard? ( dev-libs/nss !app-emulation/libcacard )
120         snappy? ( app-arch/snappy[static-libs(+)] )
121         spice? (
122                 >=app-emulation/spice-protocol-0.12.3
123                 >=app-emulation/spice-0.12.0[static-libs(+)]
124         )
125         ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
126         tls? ( net-libs/gnutls[static-libs(+)] )
127         usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
128         usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
129         uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
130         vde? ( net-misc/vde[static-libs(+)] )
131         virtfs? ( sys-libs/libcap )
132         xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
133 USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
134 X86_FIRMWARE_DEPEND="
135         >=sys-firmware/ipxe-1.0.0_p20130624
136         pin-upstream-blobs? (
137                 ~sys-firmware/seabios-1.8.2
138                 ~sys-firmware/sgabios-0.1_pre8
139                 ~sys-firmware/vgabios-0.7a
140         )
141         !pin-upstream-blobs? (
142                 sys-firmware/seabios
143                 sys-firmware/sgabios
144                 sys-firmware/vgabios
145         )"
146 CDEPEND="
147         !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
148         !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
149         qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
150         qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
151         python? ( ${PYTHON_DEPS} )
152         systemtap? ( dev-util/systemtap )
153         xen? ( app-emulation/xen-tools:= )"
154 DEPEND="${CDEPEND}
155         dev-lang/perl
156         =dev-lang/python-2*
157         sys-apps/texinfo
158         virtual/pkgconfig
159         kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
160         gtk? ( nls? ( sys-devel/gettext ) )
161         static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
162         static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
163         test? (
164                 dev-libs/glib[utils]
165                 sys-devel/bc
166         )"
167 RDEPEND="${CDEPEND}
168         selinux? ( sec-policy/selinux-qemu )
169 "
170
171 STRIP_MASK="/usr/share/qemu/palcode-clipper"
172
173 QA_PREBUILT="
174         usr/share/qemu/openbios-ppc
175         usr/share/qemu/openbios-sparc64
176         usr/share/qemu/openbios-sparc32
177         usr/share/qemu/palcode-clipper
178         usr/share/qemu/s390-ccw.img
179         usr/share/qemu/u-boot.e500
180 "
181
182 QA_WX_LOAD="usr/bin/qemu-i386
183         usr/bin/qemu-x86_64
184         usr/bin/qemu-alpha
185         usr/bin/qemu-arm
186         usr/bin/qemu-cris
187         usr/bin/qemu-m68k
188         usr/bin/qemu-microblaze
189         usr/bin/qemu-microblazeel
190         usr/bin/qemu-mips
191         usr/bin/qemu-mipsel
192         usr/bin/qemu-or32
193         usr/bin/qemu-ppc
194         usr/bin/qemu-ppc64
195         usr/bin/qemu-ppc64abi32
196         usr/bin/qemu-sh4
197         usr/bin/qemu-sh4eb
198         usr/bin/qemu-sparc
199         usr/bin/qemu-sparc64
200         usr/bin/qemu-armeb
201         usr/bin/qemu-sparc32plus
202         usr/bin/qemu-s390x
203         usr/bin/qemu-unicore32"
204
205 DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
206 you have the kernel module loaded before running kvm. The easiest way to
207 ensure that the kernel module is loaded is to load it on boot.\n
208 For AMD CPUs the module is called 'kvm-amd'\n
209 For Intel CPUs the module is called 'kvm-intel'\n
210 Please review /etc/conf.d/modules for how to load these\n\n
211 Make sure your user is in the 'kvm' group\n
212 Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
213
214 qemu_support_kvm() {
215         if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
216                 use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
217                 use qemu_softmmu_targets_s390x; then
218                 return 0
219         fi
220
221         return 1
222 }
223
224 pkg_pretend() {
225         if use kernel_linux && kernel_is lt 2 6 25; then
226                 eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
227         elif use kernel_linux; then
228                 if ! linux_config_exists; then
229                         eerror "Unable to check your kernel for KVM support"
230                 else
231                         CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
232                         ERROR_KVM="You must enable KVM in your kernel to continue"
233                         ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
234                         ERROR_KVM_AMD+=" your kernel configuration."
235                         ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
236                         ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
237                         ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
238                         ERROR_TUN+=" into your kernel or loaded as a module to use the"
239                         ERROR_TUN+=" virtual network device if using -net tap."
240                         ERROR_BRIDGE="You will also need support for 802.1d"
241                         ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
242                         use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
243                         ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
244                         ERROR_VHOST_NET+=" support"
245
246                         if use amd64 || use x86 || use amd64-linux || use x86-linux; then
247                                 CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
248                         fi
249
250                         use python && CONFIG_CHECK+=" ~DEBUG_FS"
251                         ERROR_DEBUG_FS="debugFS support required for kvm_stat"
252
253                         # Now do the actual checks setup above
254                         check_extra_config
255                 fi
256         fi
257
258         if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
259                 eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
260                 eerror "instances are still pointing to it.  Please update your"
261                 eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
262                 eerror "and the right system binary (e.g. qemu-system-x86_64)."
263                 die "update your virt configs to not use qemu-kvm"
264         fi
265 }
266
267 pkg_setup() {
268         enewgroup kvm 78
269 }
270
271 # Sanity check to make sure target lists are kept up-to-date.
272 check_targets() {
273         local var=$1 mak=$2
274         local detected sorted
275
276         pushd "${S}"/default-configs >/dev/null || die
277
278         # Force C locale until glibc is updated. #564936
279         detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
280         sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
281         if [[ ${sorted} != "${detected}" ]] ; then
282                 eerror "The ebuild needs to be kept in sync."
283                 eerror "${var}: ${sorted}"
284                 eerror "$(printf '%-*s' ${#var} configure): ${detected}"
285                 die "sync ${var} to the list of targets"
286         fi
287
288         popd >/dev/null
289 }
290
291 src_prepare() {
292         check_targets IUSE_SOFTMMU_TARGETS softmmu
293         check_targets IUSE_USER_TARGETS linux-user
294
295         # Alter target makefiles to accept CFLAGS set via flag-o
296         sed -i -r \
297                 -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
298                 Makefile Makefile.target || die
299
300         # Cheap hack to disable gettext .mo generation.
301         use nls || rm -f po/*.po
302
303         epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
304         epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-{7504,7512}.patch #567144
305         epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-8345.patch #566792
306         epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-8504.patch #567828
307         epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-7549.patch #568214
308         epatch "${FILESDIR}"/${PN}-2.4-mips-* #563162
309         [[ -n ${BACKPORTS} ]] && \
310                 EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
311                         epatch
312
313         # Fix ld and objcopy being called directly
314         tc-export AR LD OBJCOPY
315
316         # Verbose builds
317         MAKEOPTS+=" V=1"
318
319         epatch_user
320 }
321
322 ##
323 # configures qemu based on the build directory and the build type
324 # we are using.
325 #
326 qemu_src_configure() {
327         debug-print-function ${FUNCNAME} "$@"
328
329         local buildtype=$1
330         local builddir="${S}/${buildtype}-build"
331         local static_flag="static-${buildtype}"
332
333         mkdir "${builddir}"
334
335         local conf_opts=(
336                 --prefix=/usr
337                 --sysconfdir=/etc
338                 --libdir=/usr/$(get_libdir)
339                 --docdir=/usr/share/doc/${PF}/html
340                 --disable-bsd-user
341                 --disable-guest-agent
342                 --disable-strip
343                 --disable-werror
344                 --python="${PYTHON}"
345                 --cc="$(tc-getCC)"
346                 --cxx="$(tc-getCXX)"
347                 --host-cc="$(tc-getBUILD_CC)"
348                 $(use_enable debug debug-info)
349                 $(use_enable debug debug-tcg)
350                 --enable-docs
351                 $(use_enable tci tcg-interpreter)
352                 $(use_enable xattr attr)
353         )
354
355         # Disable options not used by user targets as the default configure
356         # options will autoprobe and try to link in a bunch of unused junk.
357         conf_softmmu() {
358                 if [[ ${buildtype} == "user" ]] ; then
359                         echo "--disable-${2:-$1}"
360                 else
361                         use_enable "$@"
362                 fi
363         }
364         conf_opts+=(
365                 $(conf_softmmu accessibility brlapi)
366                 $(conf_softmmu aio linux-aio)
367                 $(conf_softmmu bluetooth bluez)
368                 $(conf_softmmu caps cap-ng)
369                 $(conf_softmmu curl)
370                 $(conf_softmmu fdt)
371                 $(conf_softmmu glusterfs)
372                 $(conf_softmmu gtk)
373                 $(conf_softmmu infiniband rdma)
374                 $(conf_softmmu iscsi libiscsi)
375                 $(conf_softmmu jpeg vnc-jpeg)
376                 $(conf_softmmu kernel_linux kvm)
377                 $(conf_softmmu lzo)
378                 $(conf_softmmu ncurses curses)
379                 $(conf_softmmu nfs libnfs)
380                 $(conf_softmmu numa)
381                 $(conf_softmmu opengl)
382                 $(conf_softmmu png vnc-png)
383                 $(conf_softmmu rbd)
384                 $(conf_softmmu sasl vnc-sasl)
385                 $(conf_softmmu sdl)
386                 $(conf_softmmu seccomp)
387                 $(conf_softmmu smartcard smartcard-nss)
388                 $(conf_softmmu snappy)
389                 $(conf_softmmu spice)
390                 $(conf_softmmu ssh libssh2)
391                 $(conf_softmmu tls vnc-tls)
392                 $(conf_softmmu usb libusb)
393                 $(conf_softmmu usbredir usb-redir)
394                 $(conf_softmmu uuid)
395                 $(conf_softmmu vde)
396                 $(conf_softmmu vhost-net)
397                 $(conf_softmmu virtfs)
398                 $(conf_softmmu vnc)
399                 $(conf_softmmu vte)
400                 $(conf_softmmu xen)
401                 $(conf_softmmu xen xen-pci-passthrough)
402                 $(conf_softmmu xfs xfsctl)
403         )
404
405         case ${buildtype} in
406         user)
407                 conf_opts+=(
408                         --enable-linux-user
409                         --disable-system
410                         --disable-blobs
411                         --disable-tools
412                 )
413                 ;;
414         softmmu)
415                 # audio options
416                 local audio_opts="oss"
417                 use alsa && audio_opts="alsa,${audio_opts}"
418                 use sdl && audio_opts="sdl,${audio_opts}"
419                 use pulseaudio && audio_opts="pa,${audio_opts}"
420
421                 conf_opts+=(
422                         --disable-linux-user
423                         --enable-system
424                         --with-system-pixman
425                         --audio-drv-list="${audio_opts}"
426                 )
427                 use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
428                 use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
429                 ;;
430         tools)
431                 conf_opts+=(
432                         --disable-linux-user
433                         --disable-system
434                         --disable-blobs
435                 )
436                 static_flag="static"
437                 ;;
438         esac
439
440         local targets="${buildtype}_targets"
441         [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
442
443         # Add support for SystemTAP
444         use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
445
446         # We always want to attempt to build with PIE support as it results
447         # in a more secure binary. But it doesn't work with static or if
448         # the current GCC doesn't have PIE support.
449         if use ${static_flag}; then
450                 conf_opts+=( --static --disable-pie )
451         else
452                 gcc-specs-pie && conf_opts+=( --enable-pie )
453         fi
454
455         echo "../configure ${conf_opts[*]}"
456         cd "${builddir}"
457         ../configure "${conf_opts[@]}" || die "configure failed"
458
459         # FreeBSD's kernel does not support QEMU assigning/grabbing
460         # host USB devices yet
461         use kernel_FreeBSD && \
462                 sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
463 }
464
465 src_configure() {
466         local target
467
468         python_setup
469
470         softmmu_targets= softmmu_bins=()
471         user_targets= user_bins=()
472
473         for target in ${IUSE_SOFTMMU_TARGETS} ; do
474                 if use "qemu_softmmu_targets_${target}"; then
475                         softmmu_targets+=",${target}-softmmu"
476                         softmmu_bins+=( "qemu-system-${target}" )
477                 fi
478         done
479
480         for target in ${IUSE_USER_TARGETS} ; do
481                 if use "qemu_user_targets_${target}"; then
482                         user_targets+=",${target}-linux-user"
483                         user_bins+=( "qemu-${target}" )
484                 fi
485         done
486
487         softmmu_targets=${softmmu_targets#,}
488         user_targets=${user_targets#,}
489
490         [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
491         [[ -n ${user_targets}    ]] && qemu_src_configure "user"
492         [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
493 }
494
495 src_compile() {
496         if [[ -n ${user_targets} ]]; then
497                 cd "${S}/user-build"
498                 default
499         fi
500
501         if [[ -n ${softmmu_targets} ]]; then
502                 cd "${S}/softmmu-build"
503                 default
504         fi
505
506         if [[ -z ${softmmu_targets}${user_targets} ]]; then
507                 cd "${S}/tools-build"
508                 default
509         fi
510 }
511
512 src_test() {
513         if [[ -n ${softmmu_targets} ]]; then
514                 cd "${S}/softmmu-build"
515                 pax-mark m */qemu-system-* #515550
516                 emake -j1 check
517                 emake -j1 check-report.html
518         fi
519 }
520
521 qemu_python_install() {
522         python_domodule "${S}/scripts/qmp/qmp.py"
523
524         python_doscript "${S}/scripts/kvm/kvm_stat"
525         python_doscript "${S}/scripts/kvm/vmxcap"
526         python_doscript "${S}/scripts/qmp/qmp-shell"
527         python_doscript "${S}/scripts/qmp/qemu-ga-client"
528 }
529
530 src_install() {
531         if [[ -n ${user_targets} ]]; then
532                 cd "${S}/user-build"
533                 emake DESTDIR="${ED}" install
534
535                 # Install binfmt handler init script for user targets
536                 newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
537         fi
538
539         if [[ -n ${softmmu_targets} ]]; then
540                 cd "${S}/softmmu-build"
541                 emake DESTDIR="${ED}" install
542
543                 # This might not exist if the test failed. #512010
544                 [[ -e check-report.html ]] && dohtml check-report.html
545
546                 if use kernel_linux; then
547                         udev_dorules "${FILESDIR}"/65-kvm.rules
548                 fi
549
550                 if use python; then
551                         python_foreach_impl qemu_python_install
552                 fi
553         fi
554
555         if [[ -z ${softmmu_targets}${user_targets} ]]; then
556                 cd "${S}/tools-build"
557                 emake DESTDIR="${ED}" install
558         fi
559
560         # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
561         pushd "${ED}"/usr/bin >/dev/null
562         pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
563         popd >/dev/null
564
565         # Install config file example for qemu-bridge-helper
566         insinto "/etc/qemu"
567         doins "${FILESDIR}/bridge.conf"
568
569         # Remove the docdir placed qmp-commands.txt
570         mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
571
572         cd "${S}"
573         dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
574         newdoc pc-bios/README README.pc-bios
575         dodoc docs/qmp/*.txt
576
577         if [[ -n ${softmmu_targets} ]]; then
578                 # Remove SeaBIOS since we're using the SeaBIOS packaged one
579                 rm "${ED}/usr/share/qemu/bios.bin"
580                 if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
581                         dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
582                 fi
583
584                 # Remove vgabios since we're using the vgabios packaged one
585                 rm "${ED}/usr/share/qemu/vgabios.bin"
586                 rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
587                 rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
588                 rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
589                 rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
590                 if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
591                         dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
592                         dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
593                         dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
594                         dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
595                         dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
596                 fi
597
598                 # Remove sgabios since we're using the sgabios packaged one
599                 rm "${ED}/usr/share/qemu/sgabios.bin"
600                 if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
601                         dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
602                 fi
603
604                 # Remove iPXE since we're using the iPXE packaged one
605                 rm "${ED}"/usr/share/qemu/pxe-*.rom
606                 if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
607                         dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
608                         dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
609                         dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
610                         dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
611                         dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
612                         dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
613                 fi
614         fi
615
616         qemu_support_kvm && readme.gentoo_create_doc
617 }
618
619 pkg_postinst() {
620         if qemu_support_kvm; then
621                 readme.gentoo_print_elog
622         fi
623
624         if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
625                 udev_reload
626         fi
627
628         fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
629 }
630
631 pkg_info() {
632         echo "Using:"
633         echo "  $(best_version app-emulation/spice-protocol)"
634         echo "  $(best_version sys-firmware/ipxe)"
635         echo "  $(best_version sys-firmware/seabios)"
636         if has_version 'sys-firmware/seabios[binary]'; then
637                 echo "    USE=binary"
638         else
639                 echo "    USE=''"
640         fi
641         echo "  $(best_version sys-firmware/vgabios)"
642 }