gnu: python: Replace input python by python-wrapper.
[jackhill/guix/guix.git] / gnu / packages / qemu.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages qemu)
20 #:use-module (guix download)
21 #:use-module (guix packages)
22 #:use-module (guix utils)
23 #:use-module ((guix licenses) #:select (gpl2))
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages texinfo)
28 #:use-module (gnu packages pkg-config)
29 #:use-module (gnu packages glib)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages ncurses)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages libpng)
34 #:use-module (gnu packages libjpeg)
35 #:use-module (gnu packages attr)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages samba)
38 #:use-module (gnu packages xorg)
39 #:use-module (gnu packages perl))
40
41 (define-public qemu
42 ;; Since QEMU 1.3, it incorporates KVM support formerly found in QEMU-KVM.
43 (package
44 (name "qemu")
45 (version "1.5.1")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "http://wiki.qemu-project.org/download/qemu-"
49 version ".tar.bz2"))
50 (sha256
51 (base32
52 "1s7316pgizpayr472la8p8a4vhv7ymmzd5qlbkmq6y9q5zpa25ac"))))
53 (build-system gnu-build-system)
54 (arguments
55 '(#:phases (alist-replace
56 'configure
57 (lambda* (#:key inputs outputs #:allow-other-keys)
58 ;; The `configure' script doesn't understand some of the
59 ;; GNU options. Thus, add a new phase that's compatible.
60 (let ((out (assoc-ref outputs "out"))
61 (samba (assoc-ref inputs "samba")))
62 (setenv "SHELL" (which "bash"))
63
64 ;; While we're at it, patch for tests.
65 (substitute* "tests/libqtest.c"
66 (("/bin/sh") (which "sh")))
67
68 ;; The binaries need to be linked against -lrt.
69 (setenv "LDFLAGS" "-lrt")
70 (zero?
71 (system* "./configure"
72 (string-append "--cc=" (which "gcc"))
73 (string-append "--prefix=" out)
74 (string-append "--smbd=" samba
75 "/sbin/smbd")))))
76 (alist-cons-after
77 'install 'install-info
78 (lambda* (#:key inputs outputs #:allow-other-keys)
79 ;; Install the Info manual, unless Texinfo is missing.
80 (or (not (assoc-ref inputs "texinfo"))
81 (let ((out (assoc-ref outputs "out")))
82 (and (zero? (system* "make" "info"))
83 (let ((infodir (string-append out "/share/info")))
84 (mkdir-p infodir)
85 (for-each (lambda (info)
86 (copy-file
87 info
88 (string-append infodir "/" info)))
89 (find-files "." "\\.info$"))
90 #t)))))
91 %standard-phases))))
92
93 (inputs ; TODO: Add optional inputs.
94 `(;; ("mesa" ,mesa)
95 ;; ("libaio" ,libaio)
96 ("glib" ,glib)
97 ("python" ,python-wrapper)
98 ("ncurses" ,ncurses)
99 ("libpng" ,libpng)
100 ("libjpeg" ,libjpeg-8)
101 ("pixman" ,pixman)
102 ;; ("vde2" ,vde2)
103 ("util-linux" ,util-linux)
104 ;; ("pciutils" ,pciutils)
105 ("pkg-config" ,pkg-config)
106 ("alsa-lib" ,alsa-lib)
107 ;; ("SDL" ,SDL)
108 ("zlib" ,zlib)
109 ("attr" ,attr)
110 ("samba" ,samba))) ; an optional dependency
111 (native-inputs `(("texinfo" ,texinfo)
112 ("perl" ,perl)))
113
114 (home-page "http://www.qemu-project.org")
115 (synopsis "Machine emulator and virtualizer")
116 (description
117 "QEMU is a generic machine emulator and virtualizer.
118
119 When used as a machine emulator, QEMU can run OSes and programs made for one
120 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
121 using dynamic translation, it achieves very good performance.
122
123 When used as a virtualizer, QEMU achieves near native performances by
124 executing the guest code directly on the host CPU. QEMU supports
125 virtualization when executing under the Xen hypervisor or using
126 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
127 server and embedded PowerPC, and S390 guests.")
128
129 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
130 (license gpl2)))
131
132 (define-public qemu/smb-shares
133 ;; A patched QEMU where `-net smb' yields two shares instead of one: one for
134 ;; the store, and another one for exchanges with the host.
135 (package (inherit qemu)
136 (name "qemu-with-multiple-smb-shares")
137 (inputs `(,@(package-inputs qemu)
138 ("patch/smb-shares"
139 ,(search-patch "qemu-multiple-smb-shares.patch"))))
140 (arguments
141 `(#:patches (list (assoc-ref %build-inputs "patch/smb-shares"))
142 ,@(package-arguments qemu)))))