qemu: 2.2.2 -> 2.3.0

This commit is contained in:
William A. Kennington III 2015-05-20 12:46:14 -07:00
parent d6c6253be0
commit 19c259161b
7 changed files with 236 additions and 55 deletions

View file

@ -1,70 +1,240 @@
{ stdenv, fetchurl, python, zlib, pkgconfig, glib, ncurses, perl, pixman { stdenv, fetchurl, pkgconfig, libtool, python, perl, texinfo, flex, bison
, attr, libcap, vde2, alsaLib, texinfo, libuuid, flex, bison, lzo, snappy , gettext, makeWrapper, glib, zlib, pixman
, libseccomp, libaio, libcap_ng, gnutls
, makeWrapper # Optional Arguments
, pulseSupport ? true, pulseaudio , SDL2 ? null, gtk ? null, gnutls ? null, cyrus_sasl ? null, libjpeg ? null
, sdlSupport ? true, SDL , libpng ? null, ncurses ? null, curl ? null, libcap ? null, attr ? null
, vncSupport ? true, libjpeg, libpng , bluez ? null, libibverbs ? null, librdmacm ? null, libuuid ? null, vde2 ? null
, spiceSupport ? true, spice, spice_protocol, usbredir , libaio ? null, libcap_ng ? null, spice ? null, spice_protocol ? null
, x86Only ? false , libceph ? null, libxfs ? null, nss ? null, nspr ? null, libusb ? null
, usbredir ? null, mesa ? null, lzo ? null, snappy ? null, bzip2 ? null
, libseccomp ? null, glusterfs ? null, libssh2 ? null, numactl ? null
# Audio libraries
, libpulseaudio ? null, alsaLib ? null
#, pixman ? null
#, python, zlib, glib, ncurses, perl
#, attr, libcap, vde2, alsaLib, texinfo, libuuid, flex, bison, lzo, snappy
#, libseccomp, libaio, libcap_ng, gnutls
#, makeWrapper
#, pulseSupport ? true, pulseaudio
#, sdlSupport ? true, SDL
#, vncSupport ? true, libjpeg, libpng
#, spiceSupport ? true, spice, spice_protocol, usbredir
# Extra options
, type ? ""
}: }:
with stdenv.lib; with stdenv.lib;
let let
n = "qemu-2.2.1"; n = "qemu-2.3.0";
audio = optionalString (hasSuffix "linux" stdenv.system) "alsa,"
+ optionalString pulseSupport "pa," mkFlag = trueStr: falseStr: cond: name: val:
+ optionalString sdlSupport "sdl,"; if cond == null then null else
"--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
mkEnable = mkFlag "enable-" "disable-";
mkWith = mkFlag "with-" "without-";
mkOther = mkFlag "" "" true;
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
optSDL2 = if type == "nix" then null else shouldUsePkg SDL2;
optGtk = if type == "nix" then null else shouldUsePkg gtk;
optLibcap = if type == "nix" then null else shouldUsePkg libcap;
optAttr = if type == "nix" then null else shouldUsePkg attr;
optGnutls = if type == "nix" then null else shouldUsePkg gnutls;
optCyrus_sasl = if type == "nix" then null else shouldUsePkg cyrus_sasl;
optLibjpeg = if type == "nix" then null else shouldUsePkg libjpeg;
optLibpng = if type == "nix" then null else shouldUsePkg libpng;
optNcurses = if type == "nix" then null else shouldUsePkg ncurses;
optCurl = if type == "nix" then null else shouldUsePkg curl;
optBluez = if type == "nix" then null else shouldUsePkg bluez;
optLibibverbs = if type == "nix" then null else shouldUsePkg libibverbs;
optLibrdmacm = if type == "nix" then null else shouldUsePkg librdmacm;
optLibuuid = if type == "nix" then null else shouldUsePkg libuuid;
optVde2 = if type == "nix" then null else shouldUsePkg vde2;
optLibaio = shouldUsePkg libaio;
optLibcap_ng = shouldUsePkg libcap_ng;
optSpice = if type == "nix" then null else shouldUsePkg spice;
optSpice_protocol = if type == "nix" then null else shouldUsePkg spice_protocol;
optLibceph = if type == "nix" then null else shouldUsePkg libceph;
optLibxfs = if type == "nix" then null else shouldUsePkg libxfs;
optNss = if type == "nix" then null else shouldUsePkg nss;
optNspr = if type == "nix" then null else shouldUsePkg nspr;
optLibusb = if type == "nix" then null else shouldUsePkg libusb;
optUsbredir = if type == "nix" then null else shouldUsePkg usbredir;
optMesa = if type == "nix" then null else shouldUsePkg mesa;
optLzo = if type == "nix" then null else shouldUsePkg lzo;
optSnappy = if type == "nix" then null else shouldUsePkg snappy;
optBzip2 = if type == "nix" then null else shouldUsePkg bzip2;
optLibseccomp = if type == "nix" then null else shouldUsePkg libseccomp;
optGlusterfs = if type == "nix" then null else shouldUsePkg glusterfs;
optLibssh2 = if type == "nix" then null else shouldUsePkg libssh2;
optNumactl = if type == "nix" then null else shouldUsePkg numactl;
hasSDLAbi = if optSDL2 != null then true else null;
hasVirtfs = stdenv.isLinux && optLibcap != null && optAttr != null;
hasVnc = type != "nix";
hasVncTls = hasVnc && optGnutls != null;
hasVncSasl = hasVnc && optCyrus_sasl != null;
hasVncJpeg = hasVnc && optLibjpeg != null;
hasVncPng = hasVnc && optLibpng != null;
hasVncWs = hasVnc && optGnutls != null;
hasFdt = type != "nix";
hasRdma = optLibibverbs != null && optLibrdmacm != null;
hasLinuxAio = stdenv.isLinux && optLibaio != null;
hasSpice = optSpice != null && optSpice_protocol != null;
hasNss = optNss != null && optNspr != null;
optLibpulseaudio = if type == "nix" then null else shouldUsePkg libpulseaudio;
optAlsaLib = if type == "nix" then null else shouldUsePkg alsaLib;
audio = concatStringsSep "," (
optional (optSDL2 != null) "sdl"
++ optional (optLibpulseaudio != null) "pa"
++ optional (optAlsaLib != null) "alsa"
);
systemBinary = if stdenv.system == "x86_64-linux" then "x86_64"
else if stdenv.system == "i686-linux" then "i386"
else null;
targetList = if stdenv.system == "x86_64-linux" then "x86_64-softmmu,i386-softmmu"
else if stdenv.system == "i686-linux" then "i386-softmmu"
else null;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = n + (if x86Only then "-x86-only" else ""); name = "${n}${optionalString (type != null && type != "") "-${type}"}";
src = fetchurl { src = fetchurl {
url = "http://wiki.qemu.org/download/${n}.tar.bz2"; url = "http://wiki.qemu.org/download/${n}.tar.bz2";
sha256 = "181m2ddsg3adw8y5dmimsi8x678imn9f6i5p20zbhi7pdr61a5s6"; sha256 = "120m53c3p28qxmfzllicjzr8syjv6v4d9rsyrgkp7gnmcgvvgfmn";
}; };
buildInputs = nativeBuildInputs = [ pkgconfig libtool perl texinfo flex bison gettext makeWrapper ];
[ python zlib pkgconfig glib ncurses perl pixman attr libcap
vde2 texinfo libuuid flex bison makeWrapper lzo snappy libseccomp buildInputs = [
libcap_ng gnutls python glib zlib pixman optSDL2 optGtk optNcurses optCurl optBluez optVde2
] optLibcap_ng optAttr optLibuuid optLibceph optLibxfs optLibusb optUsbredir
++ optionals pulseSupport [ pulseaudio ] optMesa optLzo optSnappy optBzip2 optLibseccomp optGlusterfs optLibssh2
++ optionals sdlSupport [ SDL ] optNumactl optLibpulseaudio optAlsaLib
++ optionals vncSupport [ libjpeg libpng ] ] ++ optionals (hasVncTls || hasVncWs) [
++ optionals spiceSupport [ spice_protocol spice usbredir ] optGnutls
++ optionals (hasSuffix "linux" stdenv.system) [ alsaLib libaio ]; ] ++ optionals hasVncSasl [
optCyrus_sasl
] ++ optionals hasVncJpeg [
optLibjpeg
] ++ optionals hasVncPng [
optLibpng
] ++ optionals hasVirtfs [
optLibcap
] ++ optionals hasRdma [
optLibibverbs optLibrdmacm
] ++ optionals hasLinuxAio [
optLibaio
] ++ optionals hasSpice [
optSpice optSpice_protocol
] ++ optionals hasNss [
optNss optNspr
];
enableParallelBuilding = true; enableParallelBuilding = true;
patches = [ ./no-etc-install.patch ]; configureFlags = [
(mkOther "smbd" "smbd")
(mkOther "sysconfdir" "/etc")
(mkOther "localstatedir" "/var")
(mkEnable true "modules" null)
(mkEnable false "debug-tcg" null)
(mkEnable false "debug-info" null)
(mkEnable false "sparse" null)
(mkEnable false "werror" null)
(mkEnable (optSDL2 != null) "sdl" null)
(mkWith hasSDLAbi "sdlabi" "2.0")
(mkEnable (optGtk != null) "gtk" null)
(mkEnable hasVirtfs "virtfs" null)
(mkEnable hasVnc "vnc" null)
(mkEnable stdenv.isDarwin "cocoa" null)
(mkOther "audio-drv-list" audio)
(mkEnable false "xen" null)
(mkEnable false "xen-pci-passthrough" null)
(mkEnable false "brlapi" null)
(mkEnable hasVncTls "vnc-tls" null)
(mkEnable hasVncSasl "vnc-sasl" null)
(mkEnable hasVncJpeg "vnc-jpeg" null)
(mkEnable hasVncPng "vnc-png" null)
(mkEnable hasVncWs "vnc-ws" null)
(mkEnable (optNcurses != null) "curses" null)
(mkEnable (optCurl != null) "curl" null)
(mkEnable hasFdt "fdt" null)
(mkEnable (optBluez != null) "bluez" null)
(mkEnable stdenv.isLinux "kvm" null)
(mkEnable hasRdma "rdma" null)
(mkEnable (type != "nix") "system" null)
(mkEnable (type != "kvm-only") "user" null)
(mkEnable (type != "kvm-only") "guest-base" null)
(mkEnable true "pie" null)
(mkEnable (optLibuuid != null) "uuid" null)
(mkEnable (optVde2 != null) "vde" null)
(mkEnable false "netmap" null) # TODO(wkennington): Add Support
(mkEnable hasLinuxAio "linux-aio" null)
(mkEnable (optLibcap_ng != null) "cap-ng" null)
(mkEnable (optAttr != null) "attr" null)
(mkEnable (type != "nix") "docs" null)
(mkEnable stdenv.isLinux "vhost-net" null)
(mkEnable hasSpice "spice" null)
(mkEnable (optLibceph != null) "rbd" null)
(mkEnable false "libiscsi" null) # TODO(wkennington): Add support
(mkEnable false "libnfs" null) # TODO(wkennington): Add support
(mkEnable (optLibxfs != null) "xfsctl" null)
(mkEnable hasNss "smartcard-nss" null)
(mkEnable (optLibusb != null) "libusb" null)
(mkEnable (optUsbredir != null) "usb-redir" null)
(mkEnable (optMesa != null) "opengl" null)
(mkEnable (optLzo != null) "lzo" null)
(mkEnable (optSnappy != null) "snappy" null)
(mkEnable (optBzip2 != null) "bzip2" null)
(mkEnable true "guest-agent" null)
(mkEnable (optLibseccomp != null) "seccomp" null)
(mkEnable (optGlusterfs != null) "glusterfs" null)
(mkEnable false "archipelago" null)
(mkEnable true "tpm" null)
(mkEnable (optLibssh2 != null) "libssh2" null)
(mkEnable (optLibuuid != null) "vhdx" null)
(mkEnable (optGnutls != null) "quorum" null)
(mkEnable (optNumactl != null) "numa" null)
] ++ optionals (type == "kvm-only") [
(mkOther "target-list" targetList)
];
configureFlags = installFlags = [
[ "--enable-seccomp" "sysconfdir=\${out}/etc"
"--smbd=smbd" # use `smbd' from $PATH "qemu_confdir=\${out}/etc/qemu"
"--audio-drv-list=${audio}" "qemu_localstatedir=\${TMPDIR}"
"--sysconfdir=/etc" ];
"--localstatedir=/var"
]
++ optional spiceSupport "--enable-spice"
++ optional x86Only "--target-list=i386-softmmu,x86_64-softmmu"
++ optional (hasSuffix "linux" stdenv.system) "--enable-linux-aio";
postInstall = postInstall = optionalString (systemBinary != null) ''
'' # Add a qemu-kvm wrapper for compatibility/convenience.
# Add a qemu-kvm wrapper for compatibility/convenience. p="$out/bin/qemu-system-${systemBinary}"
p="$out/bin/qemu-system-${if stdenv.system == "x86_64-linux" then "x86_64" else "i386"}" if [ -e "$p" ]; then
if [ -e "$p" ]; then makeWrapper "$p" $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"
makeWrapper "$p" $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)" fi
fi '';
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://www.qemu.org/; homepage = http://www.qemu.org/;
description = "A generic and open source machine emulator and virtualizer"; description = "A generic and open source machine emulator and virtualizer";
license = licenses.gpl2Plus; license = licenses.gpl2Plus;
maintainers = with maintainers; [ viric shlevy eelco ]; maintainers = with maintainers; [ viric shlevy eelco wkennington ];
platforms = platforms.linux; platforms = if type == "kvm-only" then platforms.linux else platforms.all;
}; };
} }

View file

@ -14,8 +14,9 @@ stdenv.mkDerivation rec {
installTargets = "install install-lib install-dev"; installTargets = "install install-lib install-dev";
meta = { meta = with stdenv.lib; {
homepage = http://savannah.nongnu.org/projects/attr/; homepage = http://savannah.nongnu.org/projects/attr/;
description = "Library and tools for manipulating extended attributes"; description = "Library and tools for manipulating extended attributes";
platforms = platforms.all;
}; };
} }

View file

@ -182,11 +182,11 @@ stdenv.mkDerivation {
passthru = { inherit libdrm version driverLink; }; passthru = { inherit libdrm version driverLink; };
meta = { meta = with stdenv.lib; {
description = "An open source implementation of OpenGL"; description = "An open source implementation of OpenGL";
homepage = http://www.mesa3d.org/; homepage = http://www.mesa3d.org/;
license = "bsd"; license = "bsd";
platforms = stdenv.lib.platforms.mesaPlatforms; platforms = platforms.mesaPlatforms;
maintainers = with stdenv.lib.maintainers; [ eduarrrd simons vcunat ]; maintainers = with maintainers; [ eduarrrd simons vcunat ];
}; };
} }

View file

@ -21,8 +21,9 @@ stdenv.mkDerivation {
enableParallelBuilding = true; enableParallelBuilding = true;
meta = { meta = with stdenv.lib; {
homepage = http://www.mozilla.org/projects/nspr/; homepage = http://www.mozilla.org/projects/nspr/;
description = "Netscape Portable Runtime, a platform-neutral API for system-level and libc-like functions"; description = "Netscape Portable Runtime, a platform-neutral API for system-level and libc-like functions";
platforms = platforms.all;
}; };
} }

View file

@ -79,8 +79,9 @@ in stdenv.mkDerivation rec {
find $out/bin -type f \( -name nss-config -o -delete \) find $out/bin -type f \( -name nss-config -o -delete \)
''; '';
meta = { meta = with stdenv.lib; {
homepage = https://developer.mozilla.org/en-US/docs/NSS; homepage = https://developer.mozilla.org/en-US/docs/NSS;
description = "A set of libraries for development of security-enabled client and server applications"; description = "A set of libraries for development of security-enabled client and server applications";
platforms = platforms.all;
}; };
} }

View file

@ -10,8 +10,9 @@ stdenv.mkDerivation rec {
buildInputs = [ openssl libpcap python ]; buildInputs = [ openssl libpcap python ];
meta = { meta = with stdenv.lib; {
homepage = http://vde.sourceforge.net/; homepage = http://vde.sourceforge.net/;
description = "Virtual Distributed Ethernet, an Ethernet compliant virtual network"; description = "Virtual Distributed Ethernet, an Ethernet compliant virtual network";
platforms = platforms.all;
}; };
} }

View file

@ -9749,7 +9749,7 @@ let
watch = callPackage ../os-specific/linux/procps/watch.nix { }; watch = callPackage ../os-specific/linux/procps/watch.nix { };
qemu_kvm = lowPrio (qemu.override { x86Only = true; }); qemu_kvm = lowPrio (qemu.override { type = "kvm-only"; });
firmwareLinuxNonfree = callPackage ../os-specific/linux/firmware/firmware-linux-nonfree { }; firmwareLinuxNonfree = callPackage ../os-specific/linux/firmware/firmware-linux-nonfree { };
@ -11962,7 +11962,14 @@ let
eiskaltdcpp = callPackage ../applications/networking/p2p/eiskaltdcpp { lua5 = lua5_1; }; eiskaltdcpp = callPackage ../applications/networking/p2p/eiskaltdcpp { lua5 = lua5_1; };
qemu = callPackage ../applications/virtualization/qemu { }; qemu = callPackage ../applications/virtualization/qemu {
gtk = gtk3;
bluez = bluez5;
libusb = libusb1;
mesa = mesa_noglu;
};
qemu-nix = qemu.override { type = "nix"; };
qmmp = callPackage ../applications/audio/qmmp { }; qmmp = callPackage ../applications/audio/qmmp { };