Commit | Line | Data |
---|---|---|
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) |
72b9eebf | 39 | #:use-module (gnu packages perl)) |
b15fcf9e | 40 | |
50731c51 LC |
41 | (define-public qemu |
42 | ;; Since QEMU 1.3, it incorporates KVM support formerly found in QEMU-KVM. | |
b15fcf9e | 43 | (package |
50731c51 LC |
44 | (name "qemu") |
45 | (version "1.5.1") | |
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 | |
50731c51 | 52 | "1s7316pgizpayr472la8p8a4vhv7ymmzd5qlbkmq6y9q5zpa25ac")))) |
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. | |
ffb1ee52 LC |
60 | (let ((out (assoc-ref outputs "out")) |
61 | (samba (assoc-ref inputs "samba"))) | |
b15fcf9e LC |
62 | (setenv "SHELL" (which "bash")) |
63 | ||
50731c51 LC |
64 | ;; While we're at it, patch for tests. |
65 | (substitute* "tests/libqtest.c" | |
66 | (("/bin/sh") (which "sh"))) | |
67 | ||
b15fcf9e LC |
68 | ;; The binaries need to be linked against -lrt. |
69 | (setenv "LDFLAGS" "-lrt") | |
70 | (zero? | |
71 | (system* "./configure" | |
2b2fdd45 | 72 | (string-append "--cc=" (which "gcc")) |
ffb1ee52 LC |
73 | (string-append "--prefix=" out) |
74 | (string-append "--smbd=" samba | |
75 | "/sbin/smbd"))))) | |
bbc08c79 LC |
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)))) | |
50731c51 | 92 | |
b15fcf9e LC |
93 | (inputs ; TODO: Add optional inputs. |
94 | `(;; ("mesa" ,mesa) | |
95 | ;; ("libaio" ,libaio) | |
96 | ("glib" ,glib) | |
ee3e314b | 97 | ("python" ,python-wrapper) |
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) | |
105 | ("pkg-config" ,pkg-config) | |
2b2fdd45 | 106 | ("alsa-lib" ,alsa-lib) |
b15fcf9e LC |
107 | ;; ("SDL" ,SDL) |
108 | ("zlib" ,zlib) | |
ffb1ee52 LC |
109 | ("attr" ,attr) |
110 | ("samba" ,samba))) ; an optional dependency | |
bbc08c79 LC |
111 | (native-inputs `(("texinfo" ,texinfo) |
112 | ("perl" ,perl))) | |
50731c51 | 113 | |
2b2fdd45 | 114 | (home-page "http://www.qemu-project.org") |
50731c51 | 115 | (synopsis "Machine emulator and virtualizer") |
72b9eebf | 116 | (description |
50731c51 | 117 | "QEMU is a generic machine emulator and virtualizer. |
72b9eebf LC |
118 | |
119 | When used as a machine emulator, QEMU can run OSes and programs made for one | |
50731c51 LC |
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. | |
72b9eebf LC |
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, | |
50731c51 LC |
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))))) |