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) |
72b9eebf | 25 | #:use-module (gnu packages autotools) |
b15fcf9e LC |
26 | #:use-module (gnu packages pkg-config) |
27 | #:use-module (gnu packages glib) | |
28 | #:use-module (gnu packages python) | |
29 | #:use-module (gnu packages ncurses) | |
30 | #:use-module (gnu packages compression) | |
31 | #:use-module (gnu packages libpng) | |
32 | #:use-module (gnu packages libjpeg) | |
33 | #:use-module (gnu packages attr) | |
72b9eebf | 34 | #:use-module (gnu packages linux) |
ffb1ee52 | 35 | #:use-module (gnu packages samba) |
72b9eebf | 36 | #:use-module (gnu packages perl)) |
b15fcf9e LC |
37 | |
38 | (define-public qemu-kvm | |
39 | (package | |
40 | (name "qemu-kvm") | |
41 | (version "1.2.0") | |
42 | (source (origin | |
43 | (method url-fetch) | |
44 | (uri (string-append "mirror://sourceforge/kvm/qemu-kvm/" | |
45 | version "/qemu-kvm-" version ".tar.gz")) | |
46 | (sha256 | |
47 | (base32 | |
48 | "018vb5nmk2fsm143bs2bl2wirhasd4b10d7jchl32zik4inbk2p9")))) | |
49 | (build-system gnu-build-system) | |
50 | (arguments | |
51 | '(#:phases (alist-replace | |
52 | 'configure | |
53 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
54 | ;; The `configure' script doesn't understand some of the | |
55 | ;; GNU options. Thus, add a new phase that's compatible. | |
ffb1ee52 LC |
56 | (let ((out (assoc-ref outputs "out")) |
57 | (samba (assoc-ref inputs "samba"))) | |
b15fcf9e LC |
58 | (setenv "SHELL" (which "bash")) |
59 | ||
60 | ;; The binaries need to be linked against -lrt. | |
61 | (setenv "LDFLAGS" "-lrt") | |
62 | (zero? | |
63 | (system* "./configure" | |
ffb1ee52 LC |
64 | (string-append "--prefix=" out) |
65 | (string-append "--smbd=" samba | |
66 | "/sbin/smbd"))))) | |
b15fcf9e LC |
67 | %standard-phases))) |
68 | (inputs ; TODO: Add optional inputs. | |
69 | `(;; ("mesa" ,mesa) | |
70 | ;; ("libaio" ,libaio) | |
71 | ("glib" ,glib) | |
72 | ("python" ,python) | |
73 | ("ncurses" ,ncurses) | |
74 | ("libpng" ,libpng) | |
75 | ("libjpeg" ,libjpeg-8) | |
76 | ;; ("vde2" ,vde2) | |
77 | ("util-linux" ,util-linux) | |
78 | ;; ("pciutils" ,pciutils) | |
79 | ("pkg-config" ,pkg-config) | |
80 | ;; ("alsa-lib" ,alsa-lib) | |
81 | ;; ("SDL" ,SDL) | |
82 | ("zlib" ,zlib) | |
ffb1ee52 LC |
83 | ("attr" ,attr) |
84 | ("samba" ,samba))) ; an optional dependency | |
b15fcf9e LC |
85 | (home-page "http://www.linux-kvm.org/") |
86 | (synopsis | |
2aee33cf LC |
87 | "Virtualization for Linux on x86 hardware containing virtualization extensions") |
88 | (description | |
89 | "KVM (for Kernel-based Virtual Machine) is a full virtualization solution | |
90 | for Linux on x86 hardware containing virtualization extensions (Intel VT or | |
91 | AMD-V). It consists of a loadable kernel module, kvm.ko, that provides the | |
92 | core virtualization infrastructure and a processor specific module, | |
93 | kvm-intel.ko or kvm-amd.ko. KVM also requires a modified QEMU although work is | |
94 | underway to get the required changes upstream.") | |
95 | ||
96 | ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'. | |
97 | (license gpl2))) | |
72b9eebf LC |
98 | |
99 | (define-public qemu | |
100 | ;; The real one, with a complete target list. | |
101 | (package (inherit qemu-kvm) | |
102 | (name "qemu") | |
103 | (version "1.3.1") | |
104 | (location (source-properties->location (current-source-location))) | |
105 | (source (origin | |
106 | (method url-fetch) | |
107 | (uri (string-append "http://wiki.qemu-project.org/download/qemu-" | |
108 | version ".tar.bz2")) | |
109 | (sha256 | |
110 | (base32 | |
111 | "1bqfrb5dlsxm8gxhkksz8qzi5fhj3xqhxyfwbqcphhcv1kpyfwip")))) | |
112 | (arguments | |
113 | (substitute-keyword-arguments (package-arguments qemu-kvm) | |
114 | ((#:phases phases) | |
115 | `(alist-cons-before | |
116 | 'build 'pre-build | |
117 | (lambda* (#:key inputs #:allow-other-keys) | |
118 | (let ((libtool (assoc-ref inputs "libtool")) | |
119 | (pkg-config (assoc-ref inputs "pkg-config"))) | |
120 | ;; XXX: For lack of generic search path handling. | |
121 | (setenv "ACLOCAL_PATH" | |
122 | (format #f "~a/share/aclocal:~a/share/aclocal" | |
123 | libtool pkg-config))) | |
124 | ||
125 | ;; For pixman's `configure' script. | |
126 | (setenv "CONFIG_SHELL" (which "bash")) | |
127 | ||
128 | (substitute* "pixman/configure.ac" | |
129 | (("AM_CONFIG_HEADER") "AC_CONFIG_HEADERS"))) | |
130 | ,phases)))) | |
131 | (native-inputs `(("autoconf" ,autoconf-wrapper) ; for "pixman" | |
132 | ("automake" ,automake) | |
133 | ("libtool" ,libtool) | |
134 | ("libtool-bin" ,libtool "bin") | |
135 | ("perl" ,perl))) | |
136 | (description | |
137 | "QEMU is a generic and open source machine emulator and virtualizer. | |
138 | ||
139 | When used as a machine emulator, QEMU can run OSes and programs made for one | |
140 | machine (e.g. an ARM board) on a different machine | |
141 | (e.g. your own PC). By using dynamic translation, it achieves very good | |
142 | performance. | |
143 | ||
144 | When used as a virtualizer, QEMU achieves near native performances by | |
145 | executing the guest code directly on the host CPU. QEMU supports | |
146 | virtualization when executing under the Xen hypervisor or using | |
147 | the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, | |
148 | server and embedded PowerPC, and S390 guests."))) |