build: Switch to 0.3.
[jackhill/guix/guix.git] / gnu / packages / linux.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
e47e3eff 2;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
233e7676 3;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
fd76c904 4;;;
233e7676 5;;; This file is part of GNU Guix.
fd76c904 6;;;
233e7676 7;;; GNU Guix is free software; you can redistribute it and/or modify it
fd76c904
LC
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
233e7676 12;;; GNU Guix is distributed in the hope that it will be useful, but
fd76c904
LC
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
233e7676 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
fd76c904 19
1ffa7090 20(define-module (gnu packages linux)
4a44e743 21 #:use-module (guix licenses)
59a43334 22 #:use-module (gnu packages)
1ffa7090 23 #:use-module ((gnu packages compression)
4a44e743 24 #:renamer (symbol-prefix-proc 'guix:))
1ffa7090
LC
25 #:use-module (gnu packages flex)
26 #:use-module (gnu packages libusb)
27 #:use-module (gnu packages ncurses)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages pkg-config)
02b80c3f
NK
30 #:use-module (guix packages)
31 #:use-module (guix download)
fd76c904
LC
32 #:use-module (guix build-system gnu))
33
aaf4cb20
LC
34(define-public (system->linux-architecture arch)
35 "Return the Linux architecture name for ARCH, a Guix system name such as
36\"x86_64-linux\"."
618cea69
NK
37 (let ((arch (car (string-split arch #\-))))
38 (cond ((string=? arch "i686") "i386")
39 ((string-prefix? "mips" arch) "mips")
aaf4cb20 40 ((string-prefix? "arm" arch) "arm")
618cea69
NK
41 (else arch))))
42
80fe5c60
LC
43(define-public linux-libre-headers
44 (let* ((version* "3.3.8")
45 (build-phase
618cea69
NK
46 (lambda (arch)
47 `(lambda _
48 (setenv "ARCH" ,(system->linux-architecture arch))
49 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
45298f8f 50
618cea69
NK
51 (and (zero? (system* "make" "defconfig"))
52 (zero? (system* "make" "mrproper" "headers_check"))))))
80fe5c60
LC
53 (install-phase
54 `(lambda* (#:key outputs #:allow-other-keys)
55 (let ((out (assoc-ref outputs "out")))
56 (and (zero? (system* "make"
57 (string-append "INSTALL_HDR_PATH=" out)
58 "headers_install"))
59 (mkdir (string-append out "/include/config"))
60 (call-with-output-file
61 (string-append out
62 "/include/config/kernel.release")
63 (lambda (p)
64 (format p "~a-default~%" ,version*))))))))
65 (package
66 (name "linux-libre-headers")
67 (version version*)
68 (source (origin
69 (method url-fetch)
70 (uri (string-append
71 "http://linux-libre.fsfla.org/pub/linux-libre/releases/3.3.8-gnu/linux-libre-"
72 version "-gnu.tar.xz"))
73 (sha256
74 (base32
75 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
76 (build-system gnu-build-system)
77 (native-inputs `(("perl" ,perl)))
78 (arguments
79 `(#:modules ((guix build gnu-build-system)
80 (guix build utils)
81 (srfi srfi-1))
82 #:phases (alist-replace
618cea69 83 'build ,(build-phase (%current-system))
80fe5c60
LC
84 (alist-replace
85 'install ,install-phase
86 (alist-delete 'configure %standard-phases)))
87 #:tests? #f))
88 (synopsis "GNU Linux-Libre kernel headers")
89 (description "Headers of the Linux-Libre kernel.")
38bbd61d 90 (license gpl2)
80fe5c60
LC
91 (home-page "http://www.gnu.org/software/linux-libre/"))))
92
b4fcb735
LC
93(define-public module-init-tools
94 (package
95 (name "module-init-tools")
96 (version "3.16")
97 (source (origin
98 (method url-fetch)
99 (uri (string-append
100 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
101 version ".tar.bz2"))
102 (sha256
103 (base32
104 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
105 (build-system gnu-build-system)
106 (inputs
107 ;; The upstream tarball lacks man pages, and building them would require
108 ;; DocBook & co. Thus, use Gentoo's pre-built man pages.
109 `(("man-pages"
110 ,(origin
111 (method url-fetch)
112 (uri (string-append
113 "http://distfiles.gentoo.org/distfiles/module-init-tools-" version
114 "-man.tar.bz2"))
115 (sha256
116 (base32
117 "1j1nzi87kgsh4scl645fhwhjvljxj83cmdasa4n4p5krhasgw358"))))))
118 (arguments
119 '(#:phases (alist-cons-before
120 'unpack 'unpack-man-pages
121 (lambda* (#:key inputs #:allow-other-keys)
122 (let ((man-pages (assoc-ref inputs "man-pages")))
123 (zero? (system* "tar" "xvf" man-pages))))
124 %standard-phases)))
125 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
126 (synopsis "Tools for loading and managing Linux kernel modules")
127 (description
128 "Tools for loading and managing Linux kernel modules, such as `modprobe',
129`insmod', `lsmod', and more.")
130 (license gpl2+)))
131
beacfcab
LC
132(define-public linux-libre
133 (let* ((version* "3.3.8")
134 (build-phase
135 '(lambda* (#:key system #:allow-other-keys #:rest args)
136 (let ((arch (car (string-split system #\-))))
137 (setenv "ARCH"
138 (cond ((string=? arch "i686") "i386")
139 (else arch)))
140 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
141
142 (let ((build (assoc-ref %standard-phases 'build)))
2e48455d
LC
143 (and (zero? (system* "make" "defconfig"))
144 (begin
145 (format #t "enabling additional modules...~%")
146 (substitute* ".config"
147 (("^# CONFIG_CIFS.*$")
148 "CONFIG_CIFS=m\n"))
149 (zero? (system* "make" "oldconfig")))
beacfcab
LC
150
151 ;; Call the default `build' phase so `-j' is correctly
152 ;; passed.
153 (apply build #:make-flags "all" args)))))
154 (install-phase
155 `(lambda* (#:key inputs outputs #:allow-other-keys)
156 (let* ((out (assoc-ref outputs "out"))
157 (moddir (string-append out "/lib/modules"))
158 (mit (assoc-ref inputs "module-init-tools")))
159 (mkdir-p moddir)
160 (for-each (lambda (file)
161 (copy-file file
162 (string-append out "/" (basename file))))
163 (find-files "." "^(bzImage|System\\.map)$"))
164 (copy-file ".config" (string-append out "/config"))
165 (zero? (system* "make"
166 (string-append "DEPMOD=" mit "/sbin/depmod")
167 (string-append "MODULE_DIR=" moddir)
168 (string-append "INSTALL_PATH=" out)
169 (string-append "INSTALL_MOD_PATH=" out)
170 "modules_install"))))))
171 (package
172 (name "linux-libre")
173 (version version*)
174 (source (origin
175 (method url-fetch)
176 (uri (string-append
177 "http://linux-libre.fsfla.org/pub/linux-libre/releases/3.3.8-gnu/linux-libre-"
178 version "-gnu.tar.xz"))
179 (sha256
180 (base32
181 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
182 (build-system gnu-build-system)
183 (native-inputs `(("perl" ,perl)
184 ("module-init-tools" ,module-init-tools)))
185 (arguments
186 `(#:modules ((guix build gnu-build-system)
187 (guix build utils)
188 (srfi srfi-1)
189 (ice-9 match))
190 #:phases (alist-replace
191 'build ,build-phase
192 (alist-replace
193 'install ,install-phase
194 (alist-delete 'configure %standard-phases)))
195 #:tests? #f))
f50d2669 196 (synopsis "100% free redistribution of a cleaned Linux kernel")
beacfcab
LC
197 (description "Linux-Libre operating system kernel.")
198 (license gpl2)
199 (home-page "http://www.gnu.org/software/linux-libre/"))))
200
fd76c904
LC
201(define-public linux-pam
202 (package
203 (name "linux-pam")
204 (version "1.1.6")
205 (source
206 (origin
207 (method url-fetch)
208 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
209 version ".tar.bz2")
210 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
211 version ".tar.bz2")))
212 (sha256
213 (base32
214 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
215 (build-system gnu-build-system)
216 (inputs
217 `(("flex" ,flex)
218
219 ;; TODO: optional dependencies
220 ;; ("libxcrypt" ,libxcrypt)
221 ;; ("cracklib" ,cracklib)
222 ))
223 (arguments
224 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
225 ;; isn't available.
226 '(#:tests? #f))
227 (home-page "http://www.linux-pam.org/")
228 (synopsis "Pluggable authentication modules for Linux")
229 (description
230 "A *Free* project to implement OSF's RFC 86.0.
231Pluggable authentication modules are small shared object files that can
232be used through the PAM API to perform tasks, like authenticating a user
233at login. Local and dynamic reconfiguration are its key features")
4a44e743 234 (license bsd-3)))
686f14e8
LC
235
236(define-public psmisc
237 (package
238 (name "psmisc")
239 (version "22.20")
240 (source
241 (origin
242 (method url-fetch)
243 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
244 version ".tar.gz"))
245 (sha256
246 (base32
247 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
248 (build-system gnu-build-system)
249 (inputs `(("ncurses" ,ncurses)))
250 (home-page "http://psmisc.sourceforge.net/")
251 (synopsis
252 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
253 (description
254 "This PSmisc package is a set of some small useful utilities that
255use the proc filesystem. We're not about changing the world, but
256providing the system administrator with some help in common tasks.")
4a44e743 257 (license gpl2+)))
02b80c3f
NK
258
259(define-public util-linux
260 (package
261 (name "util-linux")
262 (version "2.21")
263 (source
264 (origin
265 (method url-fetch)
266 (uri (string-append "mirror://kernel.org/linux/utils/"
267 name "/v" version "/"
268 name "-" version ".2" ".tar.xz"))
269 (sha256
270 (base32
271 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
272 (build-system gnu-build-system)
273 (arguments
274 `(#:configure-flags '("--disable-use-tty-group")
275 #:phases (alist-cons-after
276 'install 'patch-chkdupexe
277 (lambda* (#:key outputs #:allow-other-keys)
278 (let ((out (assoc-ref outputs "out")))
279 (substitute* (string-append out "/bin/chkdupexe")
280 ;; Allow 'patch-shebang' to do its work.
281 (("@PERL@") "/bin/perl"))))
282 %standard-phases)))
4a44e743 283 (inputs `(("zlib" ,guix:zlib)
02b80c3f
NK
284 ("ncurses" ,ncurses)
285 ("perl" ,perl)))
286 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
287 (synopsis
288 "util-linux is a random collection of utilities for the Linux kernel")
289 (description
290 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 291
02b80c3f 292 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 293 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 294 ;; explicitly defined license.
fe8ccfcc
LC
295 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
296 bsd-4 public-domain))))
5d5c4278 297
e47e3eff
LC
298(define-public procps
299 (package
300 (name "procps")
301 (version "3.2.8")
302 (source (origin
303 (method url-fetch)
304 (uri (string-append "http://procps.sourceforge.net/procps-"
305 version ".tar.gz"))
306 (sha256
307 (base32
308 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))))
309 (build-system gnu-build-system)
310 (inputs `(("ncurses" ,ncurses)
311 ("patch/make-3.82" ,(search-patch "procps-make-3.82.patch"))))
312 (arguments
313 '(#:patches (list (assoc-ref %build-inputs "patch/make-3.82"))
314 #:phases (alist-replace
315 'configure
316 (lambda* (#:key outputs #:allow-other-keys)
317 ;; No `configure', just a single Makefile.
318 (let ((out (assoc-ref outputs "out")))
319 (substitute* "Makefile"
320 (("/usr/") "/")
321 (("--(owner|group) 0") "")
322 (("ldconfig") "true")
323 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
324 ;; Add libproc to the RPATH.
325 (string-append "LDFLAGS := -Wl,-rpath="
326 out "/lib" value))))
327 (setenv "CC" "gcc"))
328 (alist-replace
329 'install
330 (lambda* (#:key outputs #:allow-other-keys)
331 (let ((out (assoc-ref outputs "out")))
332 (and (zero?
333 (system* "make" "install"
334 (string-append "DESTDIR=" out)))
335
336 ;; Sanity check.
337 (zero?
338 (system* (string-append out "/bin/ps")
339 "--version")))))
340 %standard-phases))
341
342 ;; What did you expect? Tests?
343 #:tests? #f))
344 (home-page "http://procps.sourceforge.net/")
345 (synopsis
346 "Utilities that give information about processes using the /proc filesystem")
347 (description
348 "procps is the package that has a bunch of small useful utilities
349that give information about processes using the Linux /proc file system.
350The package includes the programs ps, top, vmstat, w, kill, free,
351slabtop, and skill.")
352 (license gpl2)))
353
5d5c4278
NK
354(define-public usbutils
355 (package
356 (name "usbutils")
357 (version "006")
358 (source
359 (origin
360 (method url-fetch)
361 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
362 "usbutils-" version ".tar.xz"))
363 (sha256
364 (base32
365 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
366 (build-system gnu-build-system)
367 (inputs
368 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
369 (home-page "http://www.linux-usb.org/")
370 (synopsis
371 "Tools for working with USB devices, such as lsusb")
372 (description
373 "Tools for working with USB devices, such as lsusb.")
4050e5d6 374 (license gpl2+)))
0750452a
LC
375
376(define-public e2fsprogs
377 (package
378 (name "e2fsprogs")
379 (version "1.42.7")
380 (source (origin
381 (method url-fetch)
382 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
383 version ".tar.gz"))
384 (sha256
385 (base32
386 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
387 (build-system gnu-build-system)
388 (inputs `(("util-linux" ,util-linux)
389 ("pkg-config" ,pkg-config)))
390 (arguments
391 '(#:phases (alist-cons-before
392 'configure 'patch-shells
393 (lambda _
394 (substitute* "configure"
395 (("/bin/sh (.*)parse-types.sh" _ dir)
396 (string-append (which "sh") " " dir
397 "parse-types.sh")))
398 (substitute* (find-files "." "^Makefile.in$")
399 (("#!/bin/sh")
400 (string-append "#!" (which "sh")))))
401 %standard-phases)
402
403 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
404 ;; they fail because we get an extra line that says "Can't check if
405 ;; filesystem is mounted due to missing mtab file".
406 #:tests? #f))
407 (home-page "http://e2fsprogs.sourceforge.net/")
408 (synopsis "Tools for creating and checking ext2/ext3/ext4 filesystems")
409 (description
410 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
411 (license (list gpl2 ; programs
412 lgpl2.0 ; libext2fs
413 x11)))) ; libuuid