1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
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.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages linux)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages)
23 #:use-module ((gnu packages compression)
24 #:renamer (symbol-prefix-proc 'guix:))
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)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix build-system gnu))
34 (define-public (system->linux-architecture arch)
35 "Return the Linux architecture name for ARCH, a Guix system name such as
37 (let ((arch (car (string-split arch #\-))))
38 (cond ((string=? arch "i686") "i386")
39 ((string-prefix? "mips" arch) "mips")
40 ((string-prefix? "arm" arch) "arm")
43 (define-public linux-libre-headers
44 (let* ((version* "3.3.8")
48 (setenv "ARCH" ,(system->linux-architecture arch))
49 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
51 (and (zero? (system* "make" "defconfig"))
52 (zero? (system* "make" "mrproper" "headers_check"))))))
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)
59 (mkdir (string-append out "/include/config"))
60 (call-with-output-file
62 "/include/config/kernel.release")
64 (format p "~a-default~%" ,version*))))))))
66 (name "linux-libre-headers")
71 "http://linux-libre.fsfla.org/pub/linux-libre/releases/3.3.8-gnu/linux-libre-"
72 version "-gnu.tar.xz"))
75 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
76 (build-system gnu-build-system)
77 (native-inputs `(("perl" ,perl)))
79 `(#:modules ((guix build gnu-build-system)
82 ,@(if (%current-target-system)
83 '((guix build gnu-cross-build))
85 #:phases (alist-replace
86 'build ,(build-phase (%current-system))
88 'install ,install-phase
89 (alist-delete 'configure
90 ,(if (%current-target-system)
91 '%standard-cross-phases
94 (synopsis "GNU Linux-Libre kernel headers")
95 (description "Headers of the Linux-Libre kernel.")
97 (home-page "http://www.gnu.org/software/linux-libre/"))))
99 (define-public module-init-tools
101 (name "module-init-tools")
106 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
110 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
111 (build-system gnu-build-system)
113 ;; The upstream tarball lacks man pages, and building them would require
114 ;; DocBook & co. Thus, use Gentoo's pre-built man pages.
119 "http://distfiles.gentoo.org/distfiles/module-init-tools-" version
123 "1j1nzi87kgsh4scl645fhwhjvljxj83cmdasa4n4p5krhasgw358"))))))
125 '(#:phases (alist-cons-before
126 'unpack 'unpack-man-pages
127 (lambda* (#:key inputs #:allow-other-keys)
128 (let ((man-pages (assoc-ref inputs "man-pages")))
129 (zero? (system* "tar" "xvf" man-pages))))
131 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
132 (synopsis "Tools for loading and managing Linux kernel modules")
134 "Tools for loading and managing Linux kernel modules, such as `modprobe',
135 `insmod', `lsmod', and more.")
138 (define-public linux-libre
139 (let* ((version* "3.3.8")
141 '(lambda* (#:key system #:allow-other-keys #:rest args)
142 (let ((arch (car (string-split system #\-))))
144 (cond ((string=? arch "i686") "i386")
146 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
148 (let ((build (assoc-ref %standard-phases 'build)))
149 (and (zero? (system* "make" "defconfig"))
151 (format #t "enabling additional modules...~%")
152 (substitute* ".config"
153 (("^# CONFIG_CIFS.*$")
155 (zero? (system* "make" "oldconfig")))
157 ;; Call the default `build' phase so `-j' is correctly
159 (apply build #:make-flags "all" args)))))
161 `(lambda* (#:key inputs outputs #:allow-other-keys)
162 (let* ((out (assoc-ref outputs "out"))
163 (moddir (string-append out "/lib/modules"))
164 (mit (assoc-ref inputs "module-init-tools")))
166 (for-each (lambda (file)
168 (string-append out "/" (basename file))))
169 (find-files "." "^(bzImage|System\\.map)$"))
170 (copy-file ".config" (string-append out "/config"))
171 (zero? (system* "make"
172 (string-append "DEPMOD=" mit "/sbin/depmod")
173 (string-append "MODULE_DIR=" moddir)
174 (string-append "INSTALL_PATH=" out)
175 (string-append "INSTALL_MOD_PATH=" out)
176 "modules_install"))))))
183 "http://linux-libre.fsfla.org/pub/linux-libre/releases/3.3.8-gnu/linux-libre-"
184 version "-gnu.tar.xz"))
187 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
188 (build-system gnu-build-system)
189 (native-inputs `(("perl" ,perl)
190 ("module-init-tools" ,module-init-tools)))
192 `(#:modules ((guix build gnu-build-system)
196 #:phases (alist-replace
199 'install ,install-phase
200 (alist-delete 'configure %standard-phases)))
202 (synopsis "100% free redistribution of a cleaned Linux kernel")
203 (description "Linux-Libre operating system kernel.")
205 (home-page "http://www.gnu.org/software/linux-libre/"))))
207 (define-public linux-pam
214 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
216 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
217 version ".tar.bz2")))
220 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
221 (build-system gnu-build-system)
225 ;; TODO: optional dependencies
226 ;; ("libxcrypt" ,libxcrypt)
227 ;; ("cracklib" ,cracklib)
230 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
233 (home-page "http://www.linux-pam.org/")
234 (synopsis "Pluggable authentication modules for Linux")
236 "A *Free* project to implement OSF's RFC 86.0.
237 Pluggable authentication modules are small shared object files that can
238 be used through the PAM API to perform tasks, like authenticating a user
239 at login. Local and dynamic reconfiguration are its key features")
242 (define-public psmisc
249 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
253 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
254 (build-system gnu-build-system)
255 (inputs `(("ncurses" ,ncurses)))
256 (home-page "http://psmisc.sourceforge.net/")
258 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
260 "This PSmisc package is a set of some small useful utilities that
261 use the proc filesystem. We're not about changing the world, but
262 providing the system administrator with some help in common tasks.")
265 (define-public util-linux
272 (uri (string-append "mirror://kernel.org/linux/utils/"
273 name "/v" version "/"
274 name "-" version ".2" ".tar.xz"))
277 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
278 (build-system gnu-build-system)
280 `(#:configure-flags '("--disable-use-tty-group")
281 #:phases (alist-cons-after
282 'install 'patch-chkdupexe
283 (lambda* (#:key outputs #:allow-other-keys)
284 (let ((out (assoc-ref outputs "out")))
285 (substitute* (string-append out "/bin/chkdupexe")
286 ;; Allow 'patch-shebang' to do its work.
287 (("@PERL@") "/bin/perl"))))
289 (inputs `(("zlib" ,guix:zlib)
292 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
293 (synopsis "Collection of utilities for the Linux kernel")
295 "util-linux is a random collection of utilities for the Linux kernel.")
297 ;; Note that util-linux doesn't use the same license for all the
298 ;; code. GPLv2+ is the default license for a code without an
299 ;; explicitly defined license.
300 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
301 bsd-4 public-domain))))
303 (define-public procps
309 (uri (string-append "http://procps.sourceforge.net/procps-"
313 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))))
314 (build-system gnu-build-system)
315 (inputs `(("ncurses" ,ncurses)
316 ("patch/make-3.82" ,(search-patch "procps-make-3.82.patch"))))
318 '(#:patches (list (assoc-ref %build-inputs "patch/make-3.82"))
319 #:phases (alist-replace
321 (lambda* (#:key outputs #:allow-other-keys)
322 ;; No `configure', just a single Makefile.
323 (let ((out (assoc-ref outputs "out")))
324 (substitute* "Makefile"
326 (("--(owner|group) 0") "")
327 (("ldconfig") "true")
328 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
329 ;; Add libproc to the RPATH.
330 (string-append "LDFLAGS := -Wl,-rpath="
335 (lambda* (#:key outputs #:allow-other-keys)
336 (let ((out (assoc-ref outputs "out")))
338 (system* "make" "install"
339 (string-append "DESTDIR=" out)))
343 (system* (string-append out "/bin/ps")
347 ;; What did you expect? Tests?
349 (home-page "http://procps.sourceforge.net/")
350 (synopsis "Utilities that give information about processes")
352 "procps is the package that has a bunch of small useful utilities
353 that give information about processes using the Linux /proc file system.
354 The package includes the programs ps, top, vmstat, w, kill, free,
355 slabtop, and skill.")
358 (define-public usbutils
365 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
366 "usbutils-" version ".tar.xz"))
369 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
370 (build-system gnu-build-system)
372 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
373 (home-page "http://www.linux-usb.org/")
375 "Tools for working with USB devices, such as lsusb")
377 "Tools for working with USB devices, such as lsusb.")
380 (define-public e2fsprogs
386 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
390 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
391 (build-system gnu-build-system)
392 (inputs `(("util-linux" ,util-linux)
393 ("pkg-config" ,pkg-config)))
395 '(#:phases (alist-cons-before
396 'configure 'patch-shells
398 (substitute* "configure"
399 (("/bin/sh (.*)parse-types.sh" _ dir)
400 (string-append (which "sh") " " dir
402 (substitute* (find-files "." "^Makefile.in$")
404 (string-append "#!" (which "sh")))))
407 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
408 ;; they fail because we get an extra line that says "Can't check if
409 ;; filesystem is mounted due to missing mtab file".
411 (home-page "http://e2fsprogs.sourceforge.net/")
412 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
414 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
415 (license (list gpl2 ; programs
419 (define-public strace
425 (uri (string-append "mirror://sourceforge/strace/strace-"
429 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
430 (build-system gnu-build-system)
431 (inputs `(("perl" ,perl)))
432 (home-page "http://strace.sourceforge.net/")
433 (synopsis "System call tracer for Linux")
435 "strace is a system call tracer, i.e. a debugging tool which prints out a
436 trace of all the system calls made by a another process/program.")
439 (define-public alsa-lib
446 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
450 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))))
451 (build-system gnu-build-system)
452 (home-page "http://www.alsa-project.org/")
453 (synopsis "The Advanced Linux Sound Architecture libraries")
455 "The Advanced Linux Sound Architecture (ALSA) provides audio and
456 MIDI functionality to the Linux-based operating system.")
459 (define-public iptables
466 "http://www.netfilter.org/projects/iptables/files/iptables-"
470 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
471 (build-system gnu-build-system)
472 (arguments '(#:tests? #f)) ; no test suite
473 (home-page "http://www.netfilter.org/projects/iptables/index.html")
474 (synopsis "Program to configure the Linux IP packet filtering rules")
476 "iptables is the userspace command line program used to configure the
477 Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
478 system administrators. Since Network Address Translation is also configured
479 from the packet filter ruleset, iptables is used for this, too. The iptables
480 package also includes ip6tables. ip6tables is used for configuring the IPv6