Commit | Line | Data |
---|---|---|
b15fcf9e | 1 | ;;; GNU Guix --- Functional package management for GNU |
829c095d | 2 | ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org> |
b15fcf9e LC |
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) | |
e55354b8 | 33 | #:use-module (gnu packages image) |
b15fcf9e | 34 | #:use-module (gnu packages attr) |
72b9eebf | 35 | #:use-module (gnu packages linux) |
2b2fdd45 | 36 | #:use-module (gnu packages xorg) |
200726ed | 37 | #:use-module (gnu packages gl) |
4942d42a | 38 | #:use-module (gnu packages sdl) |
72b9eebf | 39 | #:use-module (gnu packages perl)) |
b15fcf9e | 40 | |
4942d42a LC |
41 | (define-public qemu-headless |
42 | ;; This is QEMU without GUI support. | |
b15fcf9e | 43 | (package |
4942d42a | 44 | (name "qemu-headless") |
6ab6ca4c | 45 | (version "2.0.0") |
b15fcf9e LC |
46 | (source (origin |
47 | (method url-fetch) | |
50731c51 LC |
48 | (uri (string-append "http://wiki.qemu-project.org/download/qemu-" |
49 | version ".tar.bz2")) | |
b15fcf9e LC |
50 | (sha256 |
51 | (base32 | |
6ab6ca4c | 52 | "0frsahiw56jr4cqr9m6s383lyj4ar9hfs2wp3y4yr76krah1mk30")))) |
b15fcf9e LC |
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. | |
b344c505 | 60 | (let ((out (assoc-ref outputs "out"))) |
b15fcf9e LC |
61 | (setenv "SHELL" (which "bash")) |
62 | ||
50731c51 LC |
63 | ;; While we're at it, patch for tests. |
64 | (substitute* "tests/libqtest.c" | |
65 | (("/bin/sh") (which "sh"))) | |
66 | ||
b15fcf9e LC |
67 | ;; The binaries need to be linked against -lrt. |
68 | (setenv "LDFLAGS" "-lrt") | |
69 | (zero? | |
70 | (system* "./configure" | |
2b2fdd45 | 71 | (string-append "--cc=" (which "gcc")) |
75475ff7 | 72 | "--disable-debug-info" ; save build space |
e1f88ff0 | 73 | "--enable-virtfs" ; just to be sure |
b344c505 | 74 | (string-append "--prefix=" out))))) |
bbc08c79 LC |
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)))) | |
50731c51 | 91 | |
b15fcf9e | 92 | (inputs ; TODO: Add optional inputs. |
4942d42a | 93 | `(;; ("libaio" ,libaio) |
b15fcf9e | 94 | ("glib" ,glib) |
b15fcf9e LC |
95 | ("ncurses" ,ncurses) |
96 | ("libpng" ,libpng) | |
97 | ("libjpeg" ,libjpeg-8) | |
2b2fdd45 | 98 | ("pixman" ,pixman) |
b15fcf9e LC |
99 | ;; ("vde2" ,vde2) |
100 | ("util-linux" ,util-linux) | |
e1f88ff0 LC |
101 | ("libcap" ,libcap) ; virtfs support requires libcap & libattr |
102 | ("libattr" ,attr) | |
b15fcf9e | 103 | ;; ("pciutils" ,pciutils) |
2b2fdd45 | 104 | ("alsa-lib" ,alsa-lib) |
b15fcf9e | 105 | ("zlib" ,zlib) |
b344c505 | 106 | ("attr" ,attr))) |
c4c4cc05 JD |
107 | (native-inputs `(("pkg-config" ,pkg-config) |
108 | ("python" ,python-2) ; incompatible with Python 3 according to error message | |
44add1ce | 109 | ("glib" ,glib "bin") ; gtester, etc. |
c4c4cc05 | 110 | ("texinfo" ,texinfo) |
bbc08c79 | 111 | ("perl" ,perl))) |
2b2fdd45 | 112 | (home-page "http://www.qemu-project.org") |
4942d42a | 113 | (synopsis "Machine emulator and virtualizer (without GUI)") |
72b9eebf | 114 | (description |
50731c51 | 115 | "QEMU is a generic machine emulator and virtualizer. |
72b9eebf LC |
116 | |
117 | When used as a machine emulator, QEMU can run OSes and programs made for one | |
50731c51 LC |
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. | |
72b9eebf LC |
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, | |
50731c51 LC |
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 | ||
4942d42a LC |
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))))) |