# Contributions from Arch: https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/qemu pkgbase=qemu pkgname=('qemu' 'qemu-arch-extra' 'qemu-block-iscsi' 'qemu-block-rbd' 'qemu-block-gluster' 'qemu-guest-agent') pkgver=3.0.0 pkgrel=1 arch=('x86_64') license=('GPL2' 'LGPL2.1') url='http://wiki.qemu.org/' makedepends=('pixman' 'libjpeg' 'libpng' 'sdl2' 'alsa-lib' 'nss' 'glib2' 'gnutls' 'bluez-libs' 'vde2' 'util-linux' 'curl' 'libsasl' 'libgl' 'libpulse' 'seabios' 'libcap-ng' 'libaio' 'libseccomp' 'libiscsi' 'libcacard' 'spice' 'spice-protocol' 'python2' 'usbredir' 'ceph' 'glusterfs' 'libssh2' 'lzo2' 'snappy') source=(http://wiki.qemu.org/download/${pkgname}-${pkgver}.tar.bz2 qemu.sysusers qemu-ga.service 65-kvm.rules) sha1sums=('68ad39f46d197a71689417c76d3a50c52a71ce68' '4d74c0477b2f078d6ab0e6887f54a16eeb951662' 'ba9206e96f95330a2578f9f21884d357d6fc3a33' '1162065406654d1e0ff4aef7ae9d430ff7679554') _extra_arches=(aarch64 alpha arm armeb cris lm32 m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el ppc ppc64 ppc64abi32 ppc64le s390x sh4 sh4eb sparc sparc32plus sparc64 moxie ppcemb tricore unicore32 xtensa xtensaeb) _extra_blob=(QEMU,cgthree.bin QEMU,tcx.bin bamboo.dtb openbios-ppc openbios-sparc32 openbios-sparc64 palcode-clipper petalogix-ml605.dtb petalogix-s3adsp1800.dtb ppc_rom.bin s390-ccw.img slof.bin spapr-rtas.bin u-boot.e500) prepare() { for _p in *.patch; do [[ -e "$_p" ]] || continue msg2 "Patching $_p" patch -p1 -d ${pkgname}-${pkgver} < "$_p" done } build () { cd ${pkgbase}-${pkgver} # qemu vs. make 4 == bad export ARFLAGS="rv" # http://permalink.gmane.org/gmane.comp.emulators.qemu/238740 export CFLAGS+=' -fPIC' # gtk gui breaks keymappings at the moment ./configure --prefix=/usr --sysconfdir=/etc --audio-drv-list='pa alsa sdl' \ --python=/usr/bin/python2 --smbd=/usr/bin/smbd \ --enable-docs --libexecdir=/usr/lib/qemu \ --disable-gtk --enable-linux-aio --enable-seccomp \ --enable-spice --localstatedir=/var \ --enable-tpm \ --enable-modules --enable-{rbd,glusterfs,libiscsi,curl} make V=99 } package_qemu() { pkgdesc='A generic and open source processor emulator which achieves a good emulation speed by using dynamic translation' depends=('glibc' 'pixman' 'libjpeg' 'libpng' 'sdl2' 'alsa-lib' 'nss' 'glib2' 'gnutls' 'bluez-libs' 'vde2' 'util-linux' 'libsasl' 'libgl' 'seabios' 'libcap' 'libcap-ng' 'libaio' 'libseccomp' 'libcacard' 'spice' 'usbredir' 'lzo2' 'snappy' 'gcc-libs' 'zlib' 'bzip2' 'nspr' 'ncurses' 'libx11' 'libusb' 'libpulse' 'libssh2' 'curl') replaces=('qemu-kvm') optdepends=('samba: SMB/CIFS server support' 'aqemu: for Qt GUI interface' 'qemu-arch-extra: extra architectures support' 'qemu-block-iscsi: iSCSI block support' 'qemu-block-rbd: RBD block support' 'qemu-block-gluster: glusterfs block support') options=(!strip) install=qemu.install make -C ${pkgname}-${pkgver} DESTDIR="${pkgdir}" libexecdir="/usr/lib/qemu" install cd "${pkgdir}" # provided by seabios package rm usr/share/qemu/bios.bin rm usr/share/qemu/bios-256k.bin rm usr/share/qemu/vgabios-cirrus.bin rm usr/share/qemu/vgabios-qxl.bin rm usr/share/qemu/vgabios-stdvga.bin rm usr/share/qemu/vgabios-vmware.bin # remove conflicting /var/run directory rm -r var # systemd stuff install -D -m644 "${srcdir}/65-kvm.rules" usr/lib/udev/rules.d/65-kvm.rules install -D -m644 "${srcdir}/qemu.sysusers" usr/lib/sysusers.d/qemu.conf # bridge_helper needs suid # https://bugs.archlinux.org/task/32565 chmod u+s usr/lib/qemu/qemu-bridge-helper # remove splitted block modules rm usr/lib/qemu/block-{iscsi,rbd,gluster}.so # remove guest agent rm usr/bin/qemu-ga # remove extra arch for _arch in "${_extra_arches[@]}"; do rm -f usr/bin/qemu-${_arch} usr/bin/qemu-system-${_arch} done for _blob in "${_extra_blob[@]}"; do rm usr/share/qemu/${_blob} done } package_qemu-arch-extra() { pkgdesc='QEMU with full support for non x86 architectures' depends=('glibc' 'gcc-libs' 'glib2' 'qemu') options=(!strip) cd qemu-${pkgver} install -dm755 "${pkgdir}"/usr/bin for _arch in "${_extra_arches[@]}"; do install -m755 ${_arch}-*/qemu-*${_arch} "${pkgdir}"/usr/bin done cd pc-bios for _blob in "${_extra_blob[@]}"; do install -Dm644 ${_blob} "${pkgdir}"/usr/share/qemu/${_blob} done # manually stripping find "${pkgdir}"/usr/bin -type f -exec strip {} \; } package_qemu-block-iscsi() { pkgdesc='QEMU iSCSI block module' depends=('glibc' 'glib2' 'libiscsi') install -D qemu-${pkgver}/block-iscsi.so "${pkgdir}"/usr/lib/qemu/block-iscsi.so } package_qemu-block-rbd() { pkgdesc='QEMU RBD block module' depends=('glibc' 'glib2' 'ceph') install -D qemu-${pkgver}/block-rbd.so "${pkgdir}"/usr/lib/qemu/block-rbd.so } package_qemu-block-gluster() { pkgdesc='QEMU GlusterFS block module' depends=('glibc' 'glib2' 'glusterfs') install -D qemu-${pkgver}/block-gluster.so "${pkgdir}"/usr/lib/qemu/block-gluster.so } package_qemu-guest-agent() { pkgdesc='QEMU Guest Agent' depends=('glibc' 'gcc-libs' 'glib2') install -D qemu-${pkgver}/qemu-ga "${pkgdir}"/usr/bin/qemu-ga install -Dm644 qemu-ga.service "${pkgdir}"/usr/lib/systemd/system/qemu-ga.service }