gnu: linux-libre: Add alternate URLs.
[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 25 #:use-module (gnu packages flex)
90a0048f 26 #:use-module (gnu packages bison)
1ffa7090
LC
27 #:use-module (gnu packages libusb)
28 #:use-module (gnu packages ncurses)
90a0048f 29 #:use-module (gnu packages bdb)
1ffa7090
LC
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages pkg-config)
02b80c3f
NK
32 #:use-module (guix packages)
33 #:use-module (guix download)
fd76c904
LC
34 #:use-module (guix build-system gnu))
35
aaf4cb20
LC
36(define-public (system->linux-architecture arch)
37 "Return the Linux architecture name for ARCH, a Guix system name such as
38\"x86_64-linux\"."
618cea69
NK
39 (let ((arch (car (string-split arch #\-))))
40 (cond ((string=? arch "i686") "i386")
41 ((string-prefix? "mips" arch) "mips")
aaf4cb20 42 ((string-prefix? "arm" arch) "arm")
618cea69
NK
43 (else arch))))
44
6023cc74
LC
45(define (linux-libre-urls version)
46 "Return a list of URLs for Linux-Libre VERSION."
47 (list (string-append
48 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
49 version "-gnu/linux-libre-" version "-gnu.tar.xz")
50
51 ;; XXX: Work around <http://bugs.gnu.org/14851>.
52 (string-append
53 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
54 version "-gnu.tar.xz")
55
56 ;; Maybe this URL will become valid eventually.
57 (string-append
58 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
59 version "-gnu.tar.xz")))
60
80fe5c60
LC
61(define-public linux-libre-headers
62 (let* ((version* "3.3.8")
63 (build-phase
618cea69
NK
64 (lambda (arch)
65 `(lambda _
66 (setenv "ARCH" ,(system->linux-architecture arch))
67 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
45298f8f 68
618cea69
NK
69 (and (zero? (system* "make" "defconfig"))
70 (zero? (system* "make" "mrproper" "headers_check"))))))
80fe5c60
LC
71 (install-phase
72 `(lambda* (#:key outputs #:allow-other-keys)
73 (let ((out (assoc-ref outputs "out")))
74 (and (zero? (system* "make"
75 (string-append "INSTALL_HDR_PATH=" out)
76 "headers_install"))
77 (mkdir (string-append out "/include/config"))
78 (call-with-output-file
79 (string-append out
80 "/include/config/kernel.release")
81 (lambda (p)
82 (format p "~a-default~%" ,version*))))))))
83 (package
84 (name "linux-libre-headers")
85 (version version*)
86 (source (origin
87 (method url-fetch)
6023cc74 88 (uri (linux-libre-urls version))
80fe5c60
LC
89 (sha256
90 (base32
91 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
92 (build-system gnu-build-system)
93 (native-inputs `(("perl" ,perl)))
94 (arguments
95 `(#:modules ((guix build gnu-build-system)
96 (guix build utils)
56c092ce 97 (srfi srfi-1))
80fe5c60 98 #:phases (alist-replace
618cea69 99 'build ,(build-phase (%current-system))
80fe5c60
LC
100 (alist-replace
101 'install ,install-phase
56c092ce 102 (alist-delete 'configure %standard-phases)))
80fe5c60
LC
103 #:tests? #f))
104 (synopsis "GNU Linux-Libre kernel headers")
105 (description "Headers of the Linux-Libre kernel.")
38bbd61d 106 (license gpl2)
80fe5c60
LC
107 (home-page "http://www.gnu.org/software/linux-libre/"))))
108
b4fcb735
LC
109(define-public module-init-tools
110 (package
111 (name "module-init-tools")
112 (version "3.16")
113 (source (origin
114 (method url-fetch)
115 (uri (string-append
116 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
117 version ".tar.bz2"))
118 (sha256
119 (base32
120 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
121 (build-system gnu-build-system)
122 (inputs
123 ;; The upstream tarball lacks man pages, and building them would require
124 ;; DocBook & co. Thus, use Gentoo's pre-built man pages.
125 `(("man-pages"
126 ,(origin
127 (method url-fetch)
128 (uri (string-append
129 "http://distfiles.gentoo.org/distfiles/module-init-tools-" version
130 "-man.tar.bz2"))
131 (sha256
132 (base32
133 "1j1nzi87kgsh4scl645fhwhjvljxj83cmdasa4n4p5krhasgw358"))))))
134 (arguments
135 '(#:phases (alist-cons-before
136 'unpack 'unpack-man-pages
137 (lambda* (#:key inputs #:allow-other-keys)
138 (let ((man-pages (assoc-ref inputs "man-pages")))
139 (zero? (system* "tar" "xvf" man-pages))))
140 %standard-phases)))
141 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
142 (synopsis "Tools for loading and managing Linux kernel modules")
143 (description
144 "Tools for loading and managing Linux kernel modules, such as `modprobe',
145`insmod', `lsmod', and more.")
146 (license gpl2+)))
147
beacfcab
LC
148(define-public linux-libre
149 (let* ((version* "3.3.8")
150 (build-phase
151 '(lambda* (#:key system #:allow-other-keys #:rest args)
152 (let ((arch (car (string-split system #\-))))
153 (setenv "ARCH"
154 (cond ((string=? arch "i686") "i386")
155 (else arch)))
156 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
157
158 (let ((build (assoc-ref %standard-phases 'build)))
2e48455d
LC
159 (and (zero? (system* "make" "defconfig"))
160 (begin
161 (format #t "enabling additional modules...~%")
162 (substitute* ".config"
163 (("^# CONFIG_CIFS.*$")
164 "CONFIG_CIFS=m\n"))
165 (zero? (system* "make" "oldconfig")))
beacfcab
LC
166
167 ;; Call the default `build' phase so `-j' is correctly
168 ;; passed.
169 (apply build #:make-flags "all" args)))))
170 (install-phase
171 `(lambda* (#:key inputs outputs #:allow-other-keys)
172 (let* ((out (assoc-ref outputs "out"))
173 (moddir (string-append out "/lib/modules"))
174 (mit (assoc-ref inputs "module-init-tools")))
175 (mkdir-p moddir)
176 (for-each (lambda (file)
177 (copy-file file
178 (string-append out "/" (basename file))))
179 (find-files "." "^(bzImage|System\\.map)$"))
180 (copy-file ".config" (string-append out "/config"))
181 (zero? (system* "make"
182 (string-append "DEPMOD=" mit "/sbin/depmod")
183 (string-append "MODULE_DIR=" moddir)
184 (string-append "INSTALL_PATH=" out)
185 (string-append "INSTALL_MOD_PATH=" out)
186 "modules_install"))))))
187 (package
188 (name "linux-libre")
189 (version version*)
190 (source (origin
191 (method url-fetch)
6023cc74 192 (uri (linux-libre-urls version))
beacfcab
LC
193 (sha256
194 (base32
195 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
196 (build-system gnu-build-system)
197 (native-inputs `(("perl" ,perl)
198 ("module-init-tools" ,module-init-tools)))
199 (arguments
200 `(#:modules ((guix build gnu-build-system)
201 (guix build utils)
202 (srfi srfi-1)
203 (ice-9 match))
204 #:phases (alist-replace
205 'build ,build-phase
206 (alist-replace
207 'install ,install-phase
208 (alist-delete 'configure %standard-phases)))
209 #:tests? #f))
f50d2669 210 (synopsis "100% free redistribution of a cleaned Linux kernel")
beacfcab
LC
211 (description "Linux-Libre operating system kernel.")
212 (license gpl2)
213 (home-page "http://www.gnu.org/software/linux-libre/"))))
214
fd76c904
LC
215(define-public linux-pam
216 (package
217 (name "linux-pam")
218 (version "1.1.6")
219 (source
220 (origin
221 (method url-fetch)
222 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
223 version ".tar.bz2")
224 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
225 version ".tar.bz2")))
226 (sha256
227 (base32
228 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
229 (build-system gnu-build-system)
230 (inputs
231 `(("flex" ,flex)
232
233 ;; TODO: optional dependencies
234 ;; ("libxcrypt" ,libxcrypt)
235 ;; ("cracklib" ,cracklib)
236 ))
237 (arguments
238 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
239 ;; isn't available.
240 '(#:tests? #f))
241 (home-page "http://www.linux-pam.org/")
242 (synopsis "Pluggable authentication modules for Linux")
243 (description
244 "A *Free* project to implement OSF's RFC 86.0.
245Pluggable authentication modules are small shared object files that can
246be used through the PAM API to perform tasks, like authenticating a user
247at login. Local and dynamic reconfiguration are its key features")
4a44e743 248 (license bsd-3)))
686f14e8
LC
249
250(define-public psmisc
251 (package
252 (name "psmisc")
253 (version "22.20")
254 (source
255 (origin
256 (method url-fetch)
257 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
258 version ".tar.gz"))
259 (sha256
260 (base32
261 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
262 (build-system gnu-build-system)
263 (inputs `(("ncurses" ,ncurses)))
264 (home-page "http://psmisc.sourceforge.net/")
265 (synopsis
266 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
267 (description
268 "This PSmisc package is a set of some small useful utilities that
269use the proc filesystem. We're not about changing the world, but
270providing the system administrator with some help in common tasks.")
4a44e743 271 (license gpl2+)))
02b80c3f
NK
272
273(define-public util-linux
274 (package
275 (name "util-linux")
276 (version "2.21")
277 (source
278 (origin
279 (method url-fetch)
280 (uri (string-append "mirror://kernel.org/linux/utils/"
281 name "/v" version "/"
282 name "-" version ".2" ".tar.xz"))
283 (sha256
284 (base32
285 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
286 (build-system gnu-build-system)
287 (arguments
288 `(#:configure-flags '("--disable-use-tty-group")
289 #:phases (alist-cons-after
290 'install 'patch-chkdupexe
291 (lambda* (#:key outputs #:allow-other-keys)
292 (let ((out (assoc-ref outputs "out")))
293 (substitute* (string-append out "/bin/chkdupexe")
294 ;; Allow 'patch-shebang' to do its work.
295 (("@PERL@") "/bin/perl"))))
296 %standard-phases)))
4a44e743 297 (inputs `(("zlib" ,guix:zlib)
02b80c3f
NK
298 ("ncurses" ,ncurses)
299 ("perl" ,perl)))
300 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
35ec07c7 301 (synopsis "Collection of utilities for the Linux kernel")
02b80c3f
NK
302 (description
303 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 304
02b80c3f 305 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 306 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 307 ;; explicitly defined license.
fe8ccfcc
LC
308 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
309 bsd-4 public-domain))))
5d5c4278 310
e47e3eff
LC
311(define-public procps
312 (package
313 (name "procps")
314 (version "3.2.8")
315 (source (origin
316 (method url-fetch)
317 (uri (string-append "http://procps.sourceforge.net/procps-"
318 version ".tar.gz"))
319 (sha256
320 (base32
321 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))))
322 (build-system gnu-build-system)
323 (inputs `(("ncurses" ,ncurses)
324 ("patch/make-3.82" ,(search-patch "procps-make-3.82.patch"))))
325 (arguments
326 '(#:patches (list (assoc-ref %build-inputs "patch/make-3.82"))
327 #:phases (alist-replace
328 'configure
329 (lambda* (#:key outputs #:allow-other-keys)
330 ;; No `configure', just a single Makefile.
331 (let ((out (assoc-ref outputs "out")))
332 (substitute* "Makefile"
333 (("/usr/") "/")
334 (("--(owner|group) 0") "")
335 (("ldconfig") "true")
336 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
337 ;; Add libproc to the RPATH.
338 (string-append "LDFLAGS := -Wl,-rpath="
339 out "/lib" value))))
340 (setenv "CC" "gcc"))
341 (alist-replace
342 'install
343 (lambda* (#:key outputs #:allow-other-keys)
344 (let ((out (assoc-ref outputs "out")))
345 (and (zero?
346 (system* "make" "install"
347 (string-append "DESTDIR=" out)))
348
349 ;; Sanity check.
350 (zero?
351 (system* (string-append out "/bin/ps")
352 "--version")))))
353 %standard-phases))
354
355 ;; What did you expect? Tests?
356 #:tests? #f))
357 (home-page "http://procps.sourceforge.net/")
35ec07c7 358 (synopsis "Utilities that give information about processes")
e47e3eff
LC
359 (description
360 "procps is the package that has a bunch of small useful utilities
361that give information about processes using the Linux /proc file system.
362The package includes the programs ps, top, vmstat, w, kill, free,
363slabtop, and skill.")
364 (license gpl2)))
365
5d5c4278
NK
366(define-public usbutils
367 (package
368 (name "usbutils")
369 (version "006")
370 (source
371 (origin
372 (method url-fetch)
373 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
374 "usbutils-" version ".tar.xz"))
375 (sha256
376 (base32
377 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
378 (build-system gnu-build-system)
379 (inputs
380 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
381 (home-page "http://www.linux-usb.org/")
382 (synopsis
383 "Tools for working with USB devices, such as lsusb")
384 (description
385 "Tools for working with USB devices, such as lsusb.")
4050e5d6 386 (license gpl2+)))
0750452a
LC
387
388(define-public e2fsprogs
389 (package
390 (name "e2fsprogs")
391 (version "1.42.7")
392 (source (origin
393 (method url-fetch)
394 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
395 version ".tar.gz"))
396 (sha256
397 (base32
398 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
399 (build-system gnu-build-system)
400 (inputs `(("util-linux" ,util-linux)
401 ("pkg-config" ,pkg-config)))
402 (arguments
403 '(#:phases (alist-cons-before
404 'configure 'patch-shells
405 (lambda _
406 (substitute* "configure"
407 (("/bin/sh (.*)parse-types.sh" _ dir)
408 (string-append (which "sh") " " dir
409 "parse-types.sh")))
410 (substitute* (find-files "." "^Makefile.in$")
411 (("#!/bin/sh")
412 (string-append "#!" (which "sh")))))
413 %standard-phases)
414
415 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
416 ;; they fail because we get an extra line that says "Can't check if
417 ;; filesystem is mounted due to missing mtab file".
418 #:tests? #f))
419 (home-page "http://e2fsprogs.sourceforge.net/")
35ec07c7 420 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
0750452a
LC
421 (description
422 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
423 (license (list gpl2 ; programs
424 lgpl2.0 ; libext2fs
425 x11)))) ; libuuid
d8482ad0
LC
426
427(define-public strace
428 (package
429 (name "strace")
430 (version "4.7")
431 (source (origin
432 (method url-fetch)
433 (uri (string-append "mirror://sourceforge/strace/strace-"
434 version ".tar.xz"))
435 (sha256
436 (base32
437 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
438 (build-system gnu-build-system)
439 (inputs `(("perl" ,perl)))
440 (home-page "http://strace.sourceforge.net/")
441 (synopsis "System call tracer for Linux")
442 (description
443 "strace is a system call tracer, i.e. a debugging tool which prints out a
444trace of all the system calls made by a another process/program.")
445 (license bsd-3)))
ba04571a
LC
446
447(define-public alsa-lib
448 (package
449 (name "alsa-lib")
450 (version "1.0.27.1")
451 (source (origin
452 (method url-fetch)
453 (uri (string-append
454 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
455 version ".tar.bz2"))
456 (sha256
457 (base32
458 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))))
459 (build-system gnu-build-system)
460 (home-page "http://www.alsa-project.org/")
461 (synopsis "The Advanced Linux Sound Architecture libraries")
462 (description
463 "The Advanced Linux Sound Architecture (ALSA) provides audio and
464MIDI functionality to the Linux-based operating system.")
465 (license lgpl2.1+)))
10afdf50
LC
466
467(define-public iptables
468 (package
469 (name "iptables")
470 (version "1.4.16.2")
471 (source (origin
472 (method url-fetch)
473 (uri (string-append
474 "http://www.netfilter.org/projects/iptables/files/iptables-"
475 version ".tar.bz2"))
476 (sha256
477 (base32
478 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
479 (build-system gnu-build-system)
480 (arguments '(#:tests? #f)) ; no test suite
481 (home-page "http://www.netfilter.org/projects/iptables/index.html")
482 (synopsis "Program to configure the Linux IP packet filtering rules")
483 (description
484 "iptables is the userspace command line program used to configure the
485Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
486system administrators. Since Network Address Translation is also configured
487from the packet filter ruleset, iptables is used for this, too. The iptables
488package also includes ip6tables. ip6tables is used for configuring the IPv6
489packet filter.")
490 (license gpl2+)))
90a0048f
LC
491
492(define-public iproute
493 (package
494 (name "iproute2")
495 (version "3.8.0")
496 (source (origin
497 (method url-fetch)
498 (uri (string-append
499 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
500 version ".tar.xz"))
501 (sha256
502 (base32
503 "0kqy30wz2krbg4y7750hjq5218hgy2vj9pm5qzkn1bqskxs4b4ap"))))
504 (build-system gnu-build-system)
505 (arguments
506 `(#:tests? #f ; no test suite
507 #:make-flags (let ((out (assoc-ref %outputs "out")))
508 (list "DESTDIR="
509 (string-append "LIBDIR=" out "/lib")
510 (string-append "SBINDIR=" out "/sbin")
511 (string-append "CONFDIR=" out "/etc")
512 (string-append "DOCDIR=" out "/share/doc/"
513 ,name "-" ,version)
514 (string-append "MANDIR=" out "/share/man")))
515 #:phases (alist-cons-before
516 'install 'pre-install
517 (lambda _
518 ;; Don't attempt to create /var/lib/arpd.
519 (substitute* "Makefile"
520 (("^.*ARPDDIR.*$") "")))
521 %standard-phases)))
522 (inputs
523 `(("iptables" ,iptables)
524 ("db4" ,bdb)
525 ("pkg-config" ,pkg-config)
526 ("flex" ,flex)
527 ("bison" ,bison)))
528 (home-page
529 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
530 (synopsis
531 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
532 (description
533 "Iproute2 is a collection of utilities for controlling TCP/IP
534networking and traffic with the Linux kernel.
535
536Most network configuration manuals still refer to ifconfig and route as the
537primary network configuration tools, but ifconfig is known to behave
538inadequately in modern network environments. They should be deprecated, but
539most distros still include them. Most network configuration systems make use
540of ifconfig and thus provide a limited feature set. The /etc/net project aims
541to support most modern network technologies, as it doesn't use ifconfig and
542allows a system administrator to make use of all iproute2 features, including
543traffic control.
544
545iproute2 is usually shipped in a package called iproute or iproute2 and
546consists of several tools, of which the most important are ip and tc. ip
547controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
548tools print detailed usage messages and are accompanied by a set of
549manpages.")
550 (license gpl2+)))