gnu: Move numerous "inputs" which should be "native-inputs".
[jackhill/guix/guix.git] / gnu / packages / qemu.scm
CommitLineData
b15fcf9e
LC
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)
72b9eebf 22 #:use-module (guix utils)
2aee33cf 23 #:use-module ((guix licenses) #:select (gpl2))
b15fcf9e 24 #:use-module (guix build-system gnu)
161ed547 25 #:use-module (gnu packages)
72b9eebf 26 #:use-module (gnu packages autotools)
bbc08c79 27 #:use-module (gnu packages texinfo)
b15fcf9e
LC
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)
72b9eebf 36 #:use-module (gnu packages linux)
ffb1ee52 37 #:use-module (gnu packages samba)
2b2fdd45 38 #:use-module (gnu packages xorg)
4942d42a 39 #:use-module (gnu packages sdl)
72b9eebf 40 #:use-module (gnu packages perl))
b15fcf9e 41
4942d42a
LC
42(define-public qemu-headless
43 ;; This is QEMU without GUI support.
b15fcf9e 44 (package
4942d42a 45 (name "qemu-headless")
079fd3ec 46 (version "1.6.1")
b15fcf9e
LC
47 (source (origin
48 (method url-fetch)
50731c51
LC
49 (uri (string-append "http://wiki.qemu-project.org/download/qemu-"
50 version ".tar.bz2"))
b15fcf9e
LC
51 (sha256
52 (base32
079fd3ec
LC
53 "152jc18mjs543k8ggbcwgra8d0zw81z0lcc1r0iq4iqhm926ywzw"))
54 (patches (list (search-patch "qemu-make-4.0.patch")))))
b15fcf9e
LC
55 (build-system gnu-build-system)
56 (arguments
57 '(#:phases (alist-replace
58 'configure
59 (lambda* (#:key inputs outputs #:allow-other-keys)
60 ;; The `configure' script doesn't understand some of the
61 ;; GNU options. Thus, add a new phase that's compatible.
ffb1ee52
LC
62 (let ((out (assoc-ref outputs "out"))
63 (samba (assoc-ref inputs "samba")))
b15fcf9e
LC
64 (setenv "SHELL" (which "bash"))
65
50731c51
LC
66 ;; While we're at it, patch for tests.
67 (substitute* "tests/libqtest.c"
68 (("/bin/sh") (which "sh")))
69
b15fcf9e
LC
70 ;; The binaries need to be linked against -lrt.
71 (setenv "LDFLAGS" "-lrt")
72 (zero?
73 (system* "./configure"
2b2fdd45 74 (string-append "--cc=" (which "gcc"))
ffb1ee52
LC
75 (string-append "--prefix=" out)
76 (string-append "--smbd=" samba
77 "/sbin/smbd")))))
bbc08c79
LC
78 (alist-cons-after
79 'install 'install-info
80 (lambda* (#:key inputs outputs #:allow-other-keys)
81 ;; Install the Info manual, unless Texinfo is missing.
82 (or (not (assoc-ref inputs "texinfo"))
83 (let ((out (assoc-ref outputs "out")))
84 (and (zero? (system* "make" "info"))
85 (let ((infodir (string-append out "/share/info")))
86 (mkdir-p infodir)
87 (for-each (lambda (info)
88 (copy-file
89 info
90 (string-append infodir "/" info)))
91 (find-files "." "\\.info$"))
92 #t)))))
93 %standard-phases))))
50731c51 94
b15fcf9e 95 (inputs ; TODO: Add optional inputs.
4942d42a 96 `(;; ("libaio" ,libaio)
b15fcf9e 97 ("glib" ,glib)
b15fcf9e
LC
98 ("ncurses" ,ncurses)
99 ("libpng" ,libpng)
100 ("libjpeg" ,libjpeg-8)
2b2fdd45 101 ("pixman" ,pixman)
b15fcf9e
LC
102 ;; ("vde2" ,vde2)
103 ("util-linux" ,util-linux)
104 ;; ("pciutils" ,pciutils)
2b2fdd45 105 ("alsa-lib" ,alsa-lib)
b15fcf9e 106 ("zlib" ,zlib)
ffb1ee52
LC
107 ("attr" ,attr)
108 ("samba" ,samba))) ; an optional dependency
c4c4cc05
JD
109 (native-inputs `(("pkg-config" ,pkg-config)
110 ("python" ,python-2) ; incompatible with Python 3 according to error message
111 ("texinfo" ,texinfo)
bbc08c79 112 ("perl" ,perl)))
2b2fdd45 113 (home-page "http://www.qemu-project.org")
4942d42a 114 (synopsis "Machine emulator and virtualizer (without GUI)")
72b9eebf 115 (description
50731c51 116 "QEMU is a generic machine emulator and virtualizer.
72b9eebf
LC
117
118When used as a machine emulator, QEMU can run OSes and programs made for one
50731c51
LC
119machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
120using dynamic translation, it achieves very good performance.
72b9eebf
LC
121
122When used as a virtualizer, QEMU achieves near native performances by
123executing the guest code directly on the host CPU. QEMU supports
124virtualization when executing under the Xen hypervisor or using
125the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
50731c51
LC
126server and embedded PowerPC, and S390 guests.")
127
128 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
129 (license gpl2)))
130
131(define-public qemu/smb-shares
132 ;; A patched QEMU where `-net smb' yields two shares instead of one: one for
133 ;; the store, and another one for exchanges with the host.
4942d42a 134 (package (inherit qemu-headless)
50731c51 135 (name "qemu-with-multiple-smb-shares")
4942d42a 136 (source (origin (inherit (package-source qemu-headless))
b646c3dd 137 (patches
b455a118
LC
138 (cons (search-patch "qemu-multiple-smb-shares.patch")
139 (origin-patches (package-source qemu-headless))))))))
4942d42a
LC
140
141(define-public qemu
142 ;; QEMU with GUI support.
143 (package (inherit qemu-headless)
144 (name "qemu")
145 (synopsis "Machine emulator and virtualizer")
146 (inputs `(("sdl" ,sdl)
147 ("mesa" ,mesa)
148 ,@(package-inputs qemu-headless)))))