gnu: docbook-xsl update to 1.78.1
[jackhill/guix/guix.git] / gnu / packages / qemu.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 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 image)
34 #:use-module (gnu packages attr)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages xorg)
37 #:use-module (gnu packages gl)
38 #:use-module (gnu packages sdl)
39 #:use-module (gnu packages perl))
40
41 (define-public qemu-headless
42 ;; This is QEMU without GUI support.
43 (package
44 (name "qemu-headless")
45 (version "2.0.0")
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 "0frsahiw56jr4cqr9m6s383lyj4ar9hfs2wp3y4yr76krah1mk30"))))
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 (setenv "SHELL" (which "bash"))
62
63 ;; While we're at it, patch for tests.
64 (substitute* "tests/libqtest.c"
65 (("/bin/sh") (which "sh")))
66
67 ;; The binaries need to be linked against -lrt.
68 (setenv "LDFLAGS" "-lrt")
69 (zero?
70 (system* "./configure"
71 (string-append "--cc=" (which "gcc"))
72 "--disable-debug-info" ; save build space
73 "--enable-virtfs" ; just to be sure
74 (string-append "--prefix=" out)))))
75 (alist-cons-after
76 'install 'install-info
77 (lambda* (#:key inputs outputs #:allow-other-keys)
78 ;; Install the Info manual, unless Texinfo is missing.
79 (or (not (assoc-ref inputs "texinfo"))
80 (let ((out (assoc-ref outputs "out")))
81 (and (zero? (system* "make" "info"))
82 (let ((infodir (string-append out "/share/info")))
83 (mkdir-p infodir)
84 (for-each (lambda (info)
85 (copy-file
86 info
87 (string-append infodir "/" info)))
88 (find-files "." "\\.info$"))
89 #t)))))
90 %standard-phases))))
91
92 (inputs ; TODO: Add optional inputs.
93 `(;; ("libaio" ,libaio)
94 ("glib" ,glib)
95 ("ncurses" ,ncurses)
96 ("libpng" ,libpng)
97 ("libjpeg" ,libjpeg-8)
98 ("pixman" ,pixman)
99 ;; ("vde2" ,vde2)
100 ("util-linux" ,util-linux)
101 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
102 ("libattr" ,attr)
103 ;; ("pciutils" ,pciutils)
104 ("alsa-lib" ,alsa-lib)
105 ("zlib" ,zlib)
106 ("attr" ,attr)))
107 (native-inputs `(("pkg-config" ,pkg-config)
108 ("python" ,python-2) ; incompatible with Python 3 according to error message
109 ("glib" ,glib "bin") ; gtester, etc.
110 ("texinfo" ,texinfo)
111 ("perl" ,perl)))
112 (home-page "http://www.qemu-project.org")
113 (synopsis "Machine emulator and virtualizer (without GUI)")
114 (description
115 "QEMU is a generic machine emulator and virtualizer.
116
117 When used as a machine emulator, QEMU can run OSes and programs made for one
118 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
119 using dynamic translation, it achieves very good performance.
120
121 When used as a virtualizer, QEMU achieves near native performances by
122 executing the guest code directly on the host CPU. QEMU supports
123 virtualization when executing under the Xen hypervisor or using
124 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
125 server and embedded PowerPC, and S390 guests.")
126
127 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
128 (license gpl2)))
129
130 (define-public qemu
131 ;; QEMU with GUI support.
132 (package (inherit qemu-headless)
133 (name "qemu")
134 (synopsis "Machine emulator and virtualizer")
135 (inputs `(("sdl" ,sdl)
136 ("mesa" ,mesa)
137 ,@(package-inputs qemu-headless)))))