#!/bin/bash # # qemu.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # qemu.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # default settings PACKAGE="qemu" PACKAGE_EXT="bz2" VERSION=${VERSION:=3.1.0} BUILD=${BUILD:=1} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc fi check_required SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT" URL="http://wiki.qemu.org/download/$SRC" get_source $SRC $URL unpack_source $SRC $PACKAGE-$VERSION # Enable only x86* and arm emulation for qemu: if you want to build # all the targets available use TARGETS=all if [ "${TARGETS:-all}" = "all" ]; then targets="" else targets="--target-list=i386-softmmu,x86_64-softmmu,i386-linux-user,x86_64-linux-user,arm-softmmu,arm-linux-user,armeb-linux-user" fi KVMGROUP=${KVMGROUP:-users} # Needed to build man pages if built after plain "su" export PATH=$PATH:/usr/share/texmf/bin # Remove double CFLAGS sed -i "s|^\ \ CFLAGS=\"-O2\ | CFLAGS=\"|" configure || exit 1 # check if spice is there if pkg-config --exists spice-server ; then with_spice="--enable-spice" else with_spice="--disable-spice" fi # check if usbredir is there if pkg-config --exists libusbredirhost ; then with_usbredir="--enable-usb-redir" else with_usbredir="--disable-usb-redir" fi # check if device-tree-compiler is installed if ls /var/log/packages/device-tree-compiler-* 1>/dev/null 2>/dev/null ; then with_fdt="--enable-fdt" else with_fdt="" fi # --libdir is recognized but not advertised in --help CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ --docdir=/usr/doc/$PACKAGE-$VERSION \ --enable-sdl \ --enable-gtk \ --enable-system \ --enable-kvm \ --enable-vde \ --disable-debug-info \ --audio-drv-list=alsa,oss,sdl,pa \ $targets \ $with_spice \ $with_usbredir \ $with_fdt make -j5 V=1 OS_CFLAGS="$SLKCFLAGS" make install DESTDIR=$PKG # let ordinary users use this chmod u+s $PKG/usr/libexec/qemu-bridge-helper # install some udev rules for /dev/kvm mkdir -p $PKG/lib/udev/rules.d/ sed "s/@GROUP@/$KVMGROUP/" $CWD/65-kvm.rules > $PKG/lib/udev/rules.d/65-kvm.rules # create a symlink for qemu-kvm to support aqemu and such frontends # even though qemu now has a gtk gui. if [ "$ARCH" = "i486" ]; then KVMARCH="i386" elif [ "$ARCH" = "i686" ]; then KVMARCH="i386" elif [ "$ARCH" = "x86_64" ]; then KVMARCH="x86_64" fi [ ! -z $KVMARCH ] && ln -s qemu-system-$KVMARCH $PKG/usr/bin/qemu-kvm # Add docs to the proper location mkdir -p $DOCS cp -a Changelog COPYING* LICENSE MAINTAINERS README qemu-*.html docs/* $DOCS fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/$PACKAGE-$VERSION rm -rf $PKG fi