# Contributor: Valery Kartel # Contributor: Jakub Jirutka # Maintainer: Natanael Copa pkgname=qemu pkgver=2.6.2 pkgrel=0 pkgdesc="QEMU is a generic machine emulator and virtualizer" url="http://qemu.org/" arch="all" license="GPL2 LGPL-2" makedepends=" alsa-lib-dev bison curl-dev flex glib-dev gnutls-dev gtk+3.0-dev libaio-dev libcap-dev libcap-ng-dev libjpeg-turbo-dev libnfs-dev libpng-dev libssh2-dev libusb-dev linux-headers lzo-dev ncurses-dev paxmark snappy-dev spice-dev texinfo usbredir-dev util-linux-dev vde2-dev xfsprogs-dev zlib-dev " depends="" pkggroups="qemu" install="$pkgname.pre-install $pkgname.post-install" options="suid" # needed for qemu-bridge-helper subpackages="$pkgname-doc $pkgname-guest-agent:guest" _subsystems=" aarch64 alpha arm armeb cris i386 m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el or32 ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 system-aarch64 system-alpha system-arm system-cris system-i386 system-lm32 system-m68k system-microblaze system-microblazeel system-mips system-mips64 system-mips64el system-mipsel system-moxie system-or32 system-ppc system-ppc64 system-ppcemb system-s390x system-sh4 system-sh4eb system-sparc system-sparc64 system-tricore system-unicore32 system-x86_64 system-xtensa system-xtensaeb unicore32 x86_64 " for _sub in $_subsystems; do subpackages="$subpackages $pkgname-$_sub:_subsys" done case "$CARCH" in x86) _arch=i386 ;; x86_64) _arch=x86_64 ;; *) _arch="" ;; esac if [ -n "$_arch" ]; then subpackages="$subpackages $pkgname-gtk" gtk() { _subsys system-$_arch-gtk; } fi subpackages="$subpackages $pkgname-img" # -img must be declared the last source="http://wiki.qemu-project.org/download/$pkgname-$pkgver.tar.bz2 0001-elfload-load-PIE-executables-to-right-address.patch 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch musl-F_SHLCK-and-F_EXLCK.patch fix-sigevent-and-sigval_t.patch configure-ifunc.patch $pkgname-guest-agent.confd $pkgname-guest-agent.initd 80-kvm.rules bridge.conf " builddir="$srcdir"/$pkgname-$pkgver prepare() { default_prepare || return 1 # apply patches sed -i 's/^VL_LDFLAGS=$/VL_LDFLAGS=-Wl,-z,execheap/' \ Makefile.target } _compile() { ../configure \ --prefix=/usr \ --localstatedir=/var \ --sysconfdir=/etc \ --libexecdir=/usr/lib/qemu \ --audio-drv-list=oss,alsa \ --enable-kvm \ --enable-vde \ --enable-virtfs \ --enable-curl \ --enable-cap-ng \ --enable-linux-aio \ --enable-usb-redir \ --enable-uuid \ --enable-libssh2 \ --enable-vhost-net \ --enable-pie \ --enable-snappy \ --enable-tpm \ --enable-libnfs \ --enable-lzo \ --enable-docs \ --disable-glusterfs \ --disable-debug-info \ --disable-bsd-user \ --disable-werror \ --disable-sdl \ --disable-xen \ --cc="${CC:-gcc}" \ "$@" \ || return 1 make ARFLAGS="rc" || return 1 } build() { mkdir -p "$builddir"/build \ "$builddir"/build-gtk cd "$builddir"/build _compile \ --enable-vnc \ --enable-vnc-png \ --enable-vnc-jpeg \ --enable-spice \ --enable-linux-user \ --enable-guest-agent \ --disable-gtk \ || return 1 # tests fails on x86 # http://lists.gnu.org/archive/html/qemu-devel/2012-11/msg01429.html # http://web.archiveorange.com/archive/v/21oVv8wOfpQGkyy8EK0N # make check || return 1 if [ -n "$_arch" ]; then cd "$builddir"/build-gtk _compile \ --enable-gtk \ --with-gtkabi=3.0 \ --disable-linux-user \ --disable-vnc \ --disable-spice \ --disable-guest-agent \ --target-list="$_arch-softmmu" \ || return 1 fi } package() { cd "$builddir"/build make DESTDIR="$pkgdir" install || return 1 paxmark -m "$pkgdir"/usr/bin/qemu-system-* || return 1 install -Dm640 -g qemu "$srcdir"/bridge.conf \ "$pkgdir"/etc/qemu/bridge.conf || return 1 install -Dm644 "$srcdir"/80-kvm.rules \ "$pkgdir"/lib/udev/rules.d/80-kvm.rules || return 1 # qemu-bridge-helper needs suid to create tunX devices; # allow only users in the qemu group to run it. chmod 04710 "$pkgdir"/usr/lib/qemu/qemu-bridge-helper || return 1 chgrp qemu "$pkgdir"/usr/lib/qemu/qemu-bridge-helper || return 1 if [ -n "$_arch" ]; then cd "$builddir"/build-gtk install $_arch-softmmu/qemu-system-$_arch \ "$pkgdir"/usr/bin/qemu-system-$_arch-gtk || return 1 fi # Do not install HTML docs. rm "$pkgdir"/usr/share/doc/qemu/*.html } _subsys() { local name=${1:-"${subpkgname#$pkgname-}"} pkgdesc="Qemu ${name/-/ } emulator" depends="qemu" options="" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/qemu-$name "$subpkgdir"/usr/bin/ } img() { pkgdesc="QEMU command line tool for manipulating disk images" replaces="qemu" options="" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/qemu-img \ "$pkgdir"/usr/bin/qemu-io \ "$subpkgdir"/usr/bin/ || return 1 # We exploit the fact that -img subpackage are created last # and check that we done have new systems that belongs in # subpackage. local path= retval=0 for path in "$pkgdir"/usr/bin/qemu-system-*; do if [ -r "$path" ]; then error "Please create a subpackage for ${path##*/}" retval=1 fi done return $retval } guest() { pkgdesc="QEMU guest agent" options="" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/qemu-ga "$subpkgdir"/usr/bin/ || return 1 install -Dm755 "$srcdir"/$pkgname-guest-agent.initd \ "$subpkgdir"/etc/init.d/$pkgname-guest-agent || return 1 install -Dm644 "$srcdir"/$pkgname-guest-agent.confd \ "$subpkgdir"/etc/conf.d/$pkgname-guest-agent || return 1 } md5sums="bdf1f3d0c177ebeb35a079a4bc3fc74e qemu-2.6.2.tar.bz2 672727bb1d8c8ab7b5def65dd1793c33 0001-elfload-load-PIE-executables-to-right-address.patch d364208c4847ad2baeb237900befecd1 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch bc5f2e41ed3b6d6d30b672adab82e3e1 musl-F_SHLCK-and-F_EXLCK.patch 9afbd6c9586229ce64275f012d665e2a fix-sigevent-and-sigval_t.patch cf2692a166a417d021f0966f9421ede2 configure-ifunc.patch 1663bc6977f6886a58394155b1bf3676 qemu-guest-agent.confd ea972f2fc5505488f68320bf386106bb qemu-guest-agent.initd 66660f143235201249dc0648b39b86ee 80-kvm.rules a2f5570453f2489b6e4023e96f70cb7e bridge.conf" sha256sums="9a7ec64f147b9e1e570c410e00ebe271869b5d4c85392ba047db7617c297faa3 qemu-2.6.2.tar.bz2 af35304b165622a53f7557b59ffd8da5030f5fd444e669c862f9410131f3b987 0001-elfload-load-PIE-executables-to-right-address.patch 6af6cf9044997710a6d0fbdba30a35c8d775e30d30c032ec97db672f75ec88ac 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch eefd597197223899d3b12d8274af493153e270fd06ea8622e33d6eaeae063d40 musl-F_SHLCK-and-F_EXLCK.patch 9abdf3410dea742cac3552363950c8a7fbcec8dd2bfd68e3c417a284f4e702f5 fix-sigevent-and-sigval_t.patch 96b7fa37c89d9345328cd60bba3612877c149d2fd06b7de169e71ed9fa2aec33 configure-ifunc.patch d84e53a94584f37f3bd1b21f44077b5de0d07094c6729f26ae20ab1f7b9cc298 qemu-guest-agent.confd 5bef90ccab2e743868fd562eee9a3ded35c8d3e01fa387367ed55a0da95570d5 qemu-guest-agent.initd 37f666f1cdb7d8a62171de69b531681dcb0fba74236729dac8b6c019232eba84 80-kvm.rules 2f05021990014a5f832aa17317c1464806dc97c278f88d8284db88378f53cb32 bridge.conf" sha512sums="7a68b4bf7a3d04a1c4402b09e0b81e37d2431b5dd8a10b07d0e11b28bdf92e6e19800859feee50d54c62dae58bbd85dfd208e9cab4eb0310b4749e6911fcc49f qemu-2.6.2.tar.bz2 405008589cad1c8b609eca004d520bf944366e8525f85a19fc6e283c95b84b6c2429822ba064675823ab69f1406a57377266a65021623d1cd581e7db000134fd 0001-elfload-load-PIE-executables-to-right-address.patch ec84b27648c01c6e58781295dcd0c2ff8e5a635f9836ef50c1da5d0ed125db1afc4cb5b01cb97606d6dd8f417acba93e1560d9a32ca29161a4bb730b302440ea 0006-linux-user-signal.c-define-__SIGRTMIN-MAX-for-non-GN.patch 5de10f7e8abae16d1d7521e5ca1bfb62a8f295b324bea84f122f882b7b9354c21e5a00b20a1c5484c1b737b937e53c4ca6979e55705522f0779a5669725369f5 musl-F_SHLCK-and-F_EXLCK.patch e3f006c28318669356cd5b778f26774f06b0a40a4ac852573379df63efcc8276869958faec16797a38bf96c6061dfc040309e462d8559984f67eaf4af701ca1a fix-sigevent-and-sigval_t.patch 0f887d4b56d8369801bb6b890f75f544eed32fd43b3086337c79b0d1a0c0ca8e25e0ea5e288f6a1891e817d37e1dba72ed5d6a0bc69016c65e6365ee49478999 configure-ifunc.patch d90c034cae3f9097466854ed1a9f32ab4b02089fcdf7320e8f4da13b2b1ff65067233f48809911485e4431d7ec1a22448b934121bc9522a2dc489009e87e2b1f qemu-guest-agent.confd 316b40d97587fea717821852859d81039cfdcb276a658bb6e6fb554e321d5856a833ebb3778149c4732cea625bac320b1008d374c88a9aae35c0fb67977c01b7 qemu-guest-agent.initd 9b7a89b20fcf737832cb7b4d5dc7d8301dd88169cbe5339eda69fbb51c2e537d8cb9ec7cf37600899e734209e63410d50d0821bce97e401421db39c294d97be2 80-kvm.rules 749efa2e764006555b4fd3a8e2f6d1118ad2ea4d45acf99104a41a93cfe66dc9685f72027c17d8211e5716246c2a52322c962cf4b73b27541b69393cd57f53bb bridge.conf"