gnu: Move numerous "inputs" which should be "native-inputs".
[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)
023fef7d
LC
21 #:use-module ((guix licenses)
22 #:hide (zlib))
59a43334 23 #:use-module (gnu packages)
1ffa7090 24 #:use-module ((gnu packages compression)
4a44e743 25 #:renamer (symbol-prefix-proc 'guix:))
1ffa7090 26 #:use-module (gnu packages flex)
90a0048f 27 #:use-module (gnu packages bison)
1ffa7090
LC
28 #:use-module (gnu packages libusb)
29 #:use-module (gnu packages ncurses)
90a0048f 30 #:use-module (gnu packages bdb)
1ffa7090
LC
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages pkg-config)
e7b38500 33 #:use-module (gnu packages algebra)
1dba6407 34 #:use-module (gnu packages gettext)
17b293a0 35 #:use-module (gnu packages pulseaudio)
c762e82e 36 #:use-module (gnu packages attr)
17b293a0 37 #:use-module (gnu packages xml)
215b6431 38 #:use-module (gnu packages autotools)
02b80c3f
NK
39 #:use-module (guix packages)
40 #:use-module (guix download)
0ded70f3 41 #:use-module (guix build-system gnu))
fd76c904 42
aaf4cb20
LC
43(define-public (system->linux-architecture arch)
44 "Return the Linux architecture name for ARCH, a Guix system name such as
45\"x86_64-linux\"."
618cea69
NK
46 (let ((arch (car (string-split arch #\-))))
47 (cond ((string=? arch "i686") "i386")
48 ((string-prefix? "mips" arch) "mips")
aaf4cb20 49 ((string-prefix? "arm" arch) "arm")
618cea69
NK
50 (else arch))))
51
6023cc74
LC
52(define (linux-libre-urls version)
53 "Return a list of URLs for Linux-Libre VERSION."
54 (list (string-append
55 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
56 version "-gnu/linux-libre-" version "-gnu.tar.xz")
57
58 ;; XXX: Work around <http://bugs.gnu.org/14851>.
59 (string-append
60 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
61 version "-gnu.tar.xz")
62
63 ;; Maybe this URL will become valid eventually.
64 (string-append
65 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
66 version "-gnu.tar.xz")))
67
80fe5c60 68(define-public linux-libre-headers
dfb52abb 69 (let* ((version "3.3.8")
80fe5c60 70 (build-phase
618cea69
NK
71 (lambda (arch)
72 `(lambda _
73 (setenv "ARCH" ,(system->linux-architecture arch))
74 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
45298f8f 75
618cea69
NK
76 (and (zero? (system* "make" "defconfig"))
77 (zero? (system* "make" "mrproper" "headers_check"))))))
80fe5c60
LC
78 (install-phase
79 `(lambda* (#:key outputs #:allow-other-keys)
80 (let ((out (assoc-ref outputs "out")))
81 (and (zero? (system* "make"
82 (string-append "INSTALL_HDR_PATH=" out)
83 "headers_install"))
84 (mkdir (string-append out "/include/config"))
85 (call-with-output-file
86 (string-append out
87 "/include/config/kernel.release")
88 (lambda (p)
dfb52abb 89 (format p "~a-default~%" ,version))))))))
80fe5c60
LC
90 (package
91 (name "linux-libre-headers")
dfb52abb 92 (version version)
80fe5c60
LC
93 (source (origin
94 (method url-fetch)
6023cc74 95 (uri (linux-libre-urls version))
80fe5c60
LC
96 (sha256
97 (base32
98 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
99 (build-system gnu-build-system)
100 (native-inputs `(("perl" ,perl)))
101 (arguments
102 `(#:modules ((guix build gnu-build-system)
103 (guix build utils)
56c092ce 104 (srfi srfi-1))
80fe5c60 105 #:phases (alist-replace
fb6c2fa8
LC
106 'build ,(build-phase (or (%current-target-system)
107 (%current-system)))
80fe5c60
LC
108 (alist-replace
109 'install ,install-phase
56c092ce 110 (alist-delete 'configure %standard-phases)))
80fe5c60
LC
111 #:tests? #f))
112 (synopsis "GNU Linux-Libre kernel headers")
113 (description "Headers of the Linux-Libre kernel.")
38bbd61d 114 (license gpl2)
80fe5c60
LC
115 (home-page "http://www.gnu.org/software/linux-libre/"))))
116
b4fcb735
LC
117(define-public module-init-tools
118 (package
119 (name "module-init-tools")
120 (version "3.16")
121 (source (origin
122 (method url-fetch)
123 (uri (string-append
124 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
125 version ".tar.bz2"))
126 (sha256
127 (base32
128 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
129 (build-system gnu-build-system)
b4fcb735 130 (arguments
5c413a9c
LC
131 ;; FIXME: The upstream tarball lacks man pages, and building them would
132 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
133 ;; but they vanished. In the meantime, fake it.
b4fcb735 134 '(#:phases (alist-cons-before
5c413a9c
LC
135 'configure 'fake-docbook
136 (lambda _
137 (substitute* "Makefile.in"
138 (("^DOCBOOKTOMAN.*$")
139 "DOCBOOKTOMAN = true\n")))
b4fcb735
LC
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 148(define-public linux-libre
257f5601 149 (let* ((version "3.12")
beacfcab
LC
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")
dfb52abb 189 (version version)
beacfcab
LC
190 (source (origin
191 (method url-fetch)
6023cc74 192 (uri (linux-libre-urls version))
beacfcab
LC
193 (sha256
194 (base32
257f5601 195 "0drjxm9h2k9bik2mhrqqqi6cm5rn2db647wf0zvb58xldj0zmhb6"))))
beacfcab
LC
196 (build-system gnu-build-system)
197 (native-inputs `(("perl" ,perl)
e7b38500 198 ("bc" ,bc)
beacfcab
LC
199 ("module-init-tools" ,module-init-tools)))
200 (arguments
201 `(#:modules ((guix build gnu-build-system)
202 (guix build utils)
203 (srfi srfi-1)
204 (ice-9 match))
205 #:phases (alist-replace
206 'build ,build-phase
207 (alist-replace
208 'install ,install-phase
209 (alist-delete 'configure %standard-phases)))
210 #:tests? #f))
f50d2669 211 (synopsis "100% free redistribution of a cleaned Linux kernel")
a22dc0c4 212 (description
79c311b8
LC
213 "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
214It has been modified to remove all non-free binary blobs.")
beacfcab
LC
215 (license gpl2)
216 (home-page "http://www.gnu.org/software/linux-libre/"))))
217
c84d0eca
LC
218\f
219;;;
220;;; Pluggable authentication modules (PAM).
221;;;
222
fd76c904
LC
223(define-public linux-pam
224 (package
225 (name "linux-pam")
226 (version "1.1.6")
227 (source
228 (origin
229 (method url-fetch)
230 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
231 version ".tar.bz2")
232 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
233 version ".tar.bz2")))
234 (sha256
235 (base32
236 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
237 (build-system gnu-build-system)
c4c4cc05 238 (native-inputs
fd76c904
LC
239 `(("flex" ,flex)
240
241 ;; TODO: optional dependencies
242 ;; ("libxcrypt" ,libxcrypt)
243 ;; ("cracklib" ,cracklib)
244 ))
245 (arguments
c134056a
LC
246 '(;; Most users, such as `shadow', expect the headers to be under
247 ;; `security'.
248 #:configure-flags (list (string-append "--includedir="
249 (assoc-ref %outputs "out")
250 "/include/security"))
251
252 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
253 ;; isn't available.
254 #:tests? #f))
fd76c904
LC
255 (home-page "http://www.linux-pam.org/")
256 (synopsis "Pluggable authentication modules for Linux")
257 (description
258 "A *Free* project to implement OSF's RFC 86.0.
259Pluggable authentication modules are small shared object files that can
260be used through the PAM API to perform tasks, like authenticating a user
261at login. Local and dynamic reconfiguration are its key features")
4a44e743 262 (license bsd-3)))
686f14e8 263
c84d0eca
LC
264\f
265;;;
266;;; Miscellaneous.
267;;;
268
686f14e8
LC
269(define-public psmisc
270 (package
271 (name "psmisc")
272 (version "22.20")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
277 version ".tar.gz"))
278 (sha256
279 (base32
280 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
281 (build-system gnu-build-system)
282 (inputs `(("ncurses" ,ncurses)))
283 (home-page "http://psmisc.sourceforge.net/")
284 (synopsis
285 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
286 (description
287 "This PSmisc package is a set of some small useful utilities that
288use the proc filesystem. We're not about changing the world, but
289providing the system administrator with some help in common tasks.")
4a44e743 290 (license gpl2+)))
02b80c3f
NK
291
292(define-public util-linux
293 (package
294 (name "util-linux")
295 (version "2.21")
296 (source
297 (origin
298 (method url-fetch)
299 (uri (string-append "mirror://kernel.org/linux/utils/"
300 name "/v" version "/"
301 name "-" version ".2" ".tar.xz"))
302 (sha256
303 (base32
304 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
305 (build-system gnu-build-system)
306 (arguments
307 `(#:configure-flags '("--disable-use-tty-group")
308 #:phases (alist-cons-after
309 'install 'patch-chkdupexe
310 (lambda* (#:key outputs #:allow-other-keys)
311 (let ((out (assoc-ref outputs "out")))
312 (substitute* (string-append out "/bin/chkdupexe")
313 ;; Allow 'patch-shebang' to do its work.
314 (("@PERL@") "/bin/perl"))))
315 %standard-phases)))
4a44e743 316 (inputs `(("zlib" ,guix:zlib)
c4c4cc05
JD
317 ("ncurses" ,ncurses)))
318 (native-inputs
319 `(("perl" ,perl)))
02b80c3f 320 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
35ec07c7 321 (synopsis "Collection of utilities for the Linux kernel")
02b80c3f
NK
322 (description
323 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 324
02b80c3f 325 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 326 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 327 ;; explicitly defined license.
fe8ccfcc
LC
328 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
329 bsd-4 public-domain))))
5d5c4278 330
e47e3eff
LC
331(define-public procps
332 (package
333 (name "procps")
334 (version "3.2.8")
335 (source (origin
336 (method url-fetch)
337 (uri (string-append "http://procps.sourceforge.net/procps-"
338 version ".tar.gz"))
339 (sha256
340 (base32
01eafd38
LC
341 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
342 (patches (list (search-patch "procps-make-3.82.patch")))))
e47e3eff 343 (build-system gnu-build-system)
01eafd38 344 (inputs `(("ncurses" ,ncurses)))
e47e3eff 345 (arguments
01eafd38 346 '(#:phases (alist-replace
e47e3eff
LC
347 'configure
348 (lambda* (#:key outputs #:allow-other-keys)
349 ;; No `configure', just a single Makefile.
350 (let ((out (assoc-ref outputs "out")))
351 (substitute* "Makefile"
352 (("/usr/") "/")
353 (("--(owner|group) 0") "")
354 (("ldconfig") "true")
355 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
356 ;; Add libproc to the RPATH.
357 (string-append "LDFLAGS := -Wl,-rpath="
358 out "/lib" value))))
359 (setenv "CC" "gcc"))
360 (alist-replace
361 'install
362 (lambda* (#:key outputs #:allow-other-keys)
363 (let ((out (assoc-ref outputs "out")))
364 (and (zero?
365 (system* "make" "install"
366 (string-append "DESTDIR=" out)))
367
368 ;; Sanity check.
369 (zero?
370 (system* (string-append out "/bin/ps")
371 "--version")))))
372 %standard-phases))
373
374 ;; What did you expect? Tests?
375 #:tests? #f))
376 (home-page "http://procps.sourceforge.net/")
35ec07c7 377 (synopsis "Utilities that give information about processes")
e47e3eff
LC
378 (description
379 "procps is the package that has a bunch of small useful utilities
380that give information about processes using the Linux /proc file system.
381The package includes the programs ps, top, vmstat, w, kill, free,
382slabtop, and skill.")
383 (license gpl2)))
384
5d5c4278
NK
385(define-public usbutils
386 (package
387 (name "usbutils")
388 (version "006")
389 (source
390 (origin
391 (method url-fetch)
392 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
393 "usbutils-" version ".tar.xz"))
394 (sha256
395 (base32
396 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
397 (build-system gnu-build-system)
398 (inputs
c4c4cc05
JD
399 `(("libusb" ,libusb)))
400 (native-inputs
401 `(("pkg-config" ,pkg-config)))
5d5c4278
NK
402 (home-page "http://www.linux-usb.org/")
403 (synopsis
404 "Tools for working with USB devices, such as lsusb")
405 (description
406 "Tools for working with USB devices, such as lsusb.")
4050e5d6 407 (license gpl2+)))
0750452a
LC
408
409(define-public e2fsprogs
410 (package
411 (name "e2fsprogs")
412 (version "1.42.7")
413 (source (origin
414 (method url-fetch)
415 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
416 version ".tar.gz"))
417 (sha256
418 (base32
419 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
420 (build-system gnu-build-system)
c4c4cc05
JD
421 (inputs `(("util-linux" ,util-linux)))
422 (native-inputs `(("pkg-config" ,pkg-config)))
0750452a
LC
423 (arguments
424 '(#:phases (alist-cons-before
425 'configure 'patch-shells
426 (lambda _
427 (substitute* "configure"
428 (("/bin/sh (.*)parse-types.sh" _ dir)
429 (string-append (which "sh") " " dir
430 "parse-types.sh")))
431 (substitute* (find-files "." "^Makefile.in$")
432 (("#!/bin/sh")
433 (string-append "#!" (which "sh")))))
434 %standard-phases)
435
436 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
437 ;; they fail because we get an extra line that says "Can't check if
438 ;; filesystem is mounted due to missing mtab file".
439 #:tests? #f))
440 (home-page "http://e2fsprogs.sourceforge.net/")
35ec07c7 441 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
0750452a
LC
442 (description
443 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
444 (license (list gpl2 ; programs
445 lgpl2.0 ; libext2fs
446 x11)))) ; libuuid
d8482ad0
LC
447
448(define-public strace
449 (package
450 (name "strace")
451 (version "4.7")
452 (source (origin
453 (method url-fetch)
454 (uri (string-append "mirror://sourceforge/strace/strace-"
455 version ".tar.xz"))
456 (sha256
457 (base32
458 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
459 (build-system gnu-build-system)
c4c4cc05 460 (native-inputs `(("perl" ,perl)))
d8482ad0
LC
461 (home-page "http://strace.sourceforge.net/")
462 (synopsis "System call tracer for Linux")
463 (description
464 "strace is a system call tracer, i.e. a debugging tool which prints out a
465trace of all the system calls made by a another process/program.")
466 (license bsd-3)))
ba04571a
LC
467
468(define-public alsa-lib
469 (package
470 (name "alsa-lib")
471 (version "1.0.27.1")
472 (source (origin
473 (method url-fetch)
474 (uri (string-append
475 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
476 version ".tar.bz2"))
477 (sha256
478 (base32
bcd94e19
MW
479 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
480 (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
ba04571a
LC
481 (build-system gnu-build-system)
482 (home-page "http://www.alsa-project.org/")
483 (synopsis "The Advanced Linux Sound Architecture libraries")
484 (description
485 "The Advanced Linux Sound Architecture (ALSA) provides audio and
486MIDI functionality to the Linux-based operating system.")
487 (license lgpl2.1+)))
10afdf50 488
17b293a0
LC
489(define-public alsa-utils
490 (package
491 (name "alsa-utils")
492 (version "1.0.27.2")
493 (source (origin
494 (method url-fetch)
495 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
496 version ".tar.bz2"))
497 (sha256
498 (base32
499 "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
500 (build-system gnu-build-system)
501 (arguments
502 ;; XXX: Disable man page creation until we have DocBook.
503 '(#:configure-flags (list "--disable-xmlto"
504 (string-append "--with-udev-rules-dir="
505 (assoc-ref %outputs "out")
506 "/lib/udev/rules.d"))
507 #:phases (alist-cons-before
508 'install 'pre-install
509 (lambda _
510 ;; Don't try to mkdir /var/lib/alsa.
511 (substitute* "Makefile"
512 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
513 "true\n")))
514 %standard-phases)))
515 (inputs
516 `(("libsamplerate" ,libsamplerate)
517 ("ncurses" ,ncurses)
518 ("alsa-lib" ,alsa-lib)
519 ("xmlto" ,xmlto)
1dba6407 520 ("gettext" ,gnu-gettext)))
17b293a0
LC
521 (home-page "http://www.alsa-project.org/")
522 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
523 (description
524 "The Advanced Linux Sound Architecture (ALSA) provides audio and
525MIDI functionality to the Linux-based operating system.")
526
527 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
528 ;; GPLv2-only.
529 (license gpl2)))
530
10afdf50
LC
531(define-public iptables
532 (package
533 (name "iptables")
534 (version "1.4.16.2")
535 (source (origin
536 (method url-fetch)
537 (uri (string-append
538 "http://www.netfilter.org/projects/iptables/files/iptables-"
539 version ".tar.bz2"))
540 (sha256
541 (base32
542 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
543 (build-system gnu-build-system)
544 (arguments '(#:tests? #f)) ; no test suite
545 (home-page "http://www.netfilter.org/projects/iptables/index.html")
546 (synopsis "Program to configure the Linux IP packet filtering rules")
547 (description
548 "iptables is the userspace command line program used to configure the
549Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
550system administrators. Since Network Address Translation is also configured
551from the packet filter ruleset, iptables is used for this, too. The iptables
552package also includes ip6tables. ip6tables is used for configuring the IPv6
553packet filter.")
554 (license gpl2+)))
90a0048f
LC
555
556(define-public iproute
557 (package
558 (name "iproute2")
5fd7f3e0 559 (version "3.12.0")
90a0048f
LC
560 (source (origin
561 (method url-fetch)
562 (uri (string-append
563 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
564 version ".tar.xz"))
565 (sha256
566 (base32
5fd7f3e0 567 "04gi11gh087bg2nlxhj0lxrk8l9qxkpr88nsiil23917bm3h1xj4"))))
90a0048f
LC
568 (build-system gnu-build-system)
569 (arguments
570 `(#:tests? #f ; no test suite
571 #:make-flags (let ((out (assoc-ref %outputs "out")))
572 (list "DESTDIR="
573 (string-append "LIBDIR=" out "/lib")
574 (string-append "SBINDIR=" out "/sbin")
575 (string-append "CONFDIR=" out "/etc")
576 (string-append "DOCDIR=" out "/share/doc/"
577 ,name "-" ,version)
578 (string-append "MANDIR=" out "/share/man")))
579 #:phases (alist-cons-before
580 'install 'pre-install
581 (lambda _
582 ;; Don't attempt to create /var/lib/arpd.
583 (substitute* "Makefile"
584 (("^.*ARPDDIR.*$") "")))
585 %standard-phases)))
586 (inputs
587 `(("iptables" ,iptables)
c4c4cc05
JD
588 ("db4" ,bdb)))
589 (native-inputs
590 `(("pkg-config" ,pkg-config)
90a0048f
LC
591 ("flex" ,flex)
592 ("bison" ,bison)))
593 (home-page
594 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
595 (synopsis
596 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
597 (description
598 "Iproute2 is a collection of utilities for controlling TCP/IP
599networking and traffic with the Linux kernel.
600
601Most network configuration manuals still refer to ifconfig and route as the
602primary network configuration tools, but ifconfig is known to behave
603inadequately in modern network environments. They should be deprecated, but
604most distros still include them. Most network configuration systems make use
605of ifconfig and thus provide a limited feature set. The /etc/net project aims
606to support most modern network technologies, as it doesn't use ifconfig and
607allows a system administrator to make use of all iproute2 features, including
608traffic control.
609
610iproute2 is usually shipped in a package called iproute or iproute2 and
611consists of several tools, of which the most important are ip and tc. ip
612controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
613tools print detailed usage messages and are accompanied by a set of
614manpages.")
615 (license gpl2+)))
85e0dc6a
LC
616
617(define-public net-tools
618 ;; XXX: This package is basically unmaintained, but it provides a few
619 ;; commands not yet provided by Inetutils, such as 'route', so we have to
620 ;; live with it.
621 (package
622 (name "net-tools")
623 (version "1.60")
624 (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
625 (source (origin
626 (method url-fetch)
627 (uri (string-append home-page "/" name "-"
628 version ".tar.bz2"))
629 (sha256
630 (base32
631 "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))))
632 (build-system gnu-build-system)
633 (arguments
cd143df0
LC
634 '(#:phases (alist-cons-after
635 'unpack 'patch
85e0dc6a
LC
636 (lambda* (#:key inputs #:allow-other-keys)
637 (define (apply-patch file)
638 (zero? (system* "patch" "-p1" "--batch"
639 "--input" file)))
640
641 (let ((patch.gz (assoc-ref inputs "patch")))
642 (format #t "applying Debian patch set '~a'...~%"
643 patch.gz)
644 (system (string-append "gunzip < " patch.gz " > the-patch"))
645 (pk 'here)
646 (and (apply-patch "the-patch")
647 (for-each apply-patch
648 (find-files "debian/patches"
649 "\\.patch")))))
650 (alist-replace
651 'configure
652 (lambda* (#:key outputs #:allow-other-keys)
653 (let ((out (assoc-ref outputs "out")))
654 (mkdir-p (string-append out "/bin"))
655 (mkdir-p (string-append out "/sbin"))
656
657 ;; Pretend we have everything...
658 (system "yes | make config")
659
660 ;; ... except we don't have libdnet, so remove that
661 ;; definition.
662 (substitute* '("config.make" "config.h")
663 (("^.*HAVE_AFDECnet.*$") ""))))
664 %standard-phases))
665
666 ;; Binaries that depend on libnet-tools.a don't declare that
667 ;; dependency, making it parallel-unsafe.
668 #:parallel-build? #f
669
670 #:tests? #f ; no test suite
671 #:make-flags (list "CC=gcc"
672 (string-append "BASEDIR="
673 (assoc-ref %outputs "out")))))
674
675 ;; Use the big Debian patch set (the thing does not even compile out of
676 ;; the box.)
677 (inputs `(("patch" ,(origin
678 (method url-fetch)
679 (uri
680 "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
681 (sha256
682 (base32
683 "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
1dba6407 684 (native-inputs `(("gettext" ,gnu-gettext)))
85e0dc6a
LC
685
686 (synopsis "Tools for controlling the network subsystem in Linux")
687 (description
688 "This package includes the important tools for controlling the network
689subsystem of the Linux kernel. This includes arp, hostname, ifconfig,
690netstat, rarp and route. Additionally, this package contains utilities
691relating to particular network hardware types (plipconfig, slattach) and
692advanced aspects of IP configuration (iptunnel, ipmaddr).")
693 (license gpl2+)))
c762e82e
LC
694
695(define-public libcap
696 (package
697 (name "libcap")
698 (version "2.22")
699 (source (origin
700 (method url-fetch)
701
702 ;; Tarballs used to be available from
703 ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
704 ;; but they never came back after kernel.org was compromised.
705 (uri (string-append
706 "mirror://debian/pool/main/libc/libcap2/libcap2_"
707 version ".orig.tar.gz"))
708 (sha256
709 (base32
710 "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
711 (build-system gnu-build-system)
712 (arguments '(#:phases (alist-delete 'configure %standard-phases)
713 #:tests? #f ; no 'check' target
714 #:make-flags (list "lib=lib"
715 (string-append "prefix="
716 (assoc-ref %outputs "out"))
717 "RAISE_SETFCAP=no")))
718 (native-inputs `(("perl" ,perl)))
719 (inputs `(("attr" ,attr)))
720 (home-page "https://sites.google.com/site/fullycapable/")
721 (synopsis "Library for working with POSIX capabilities")
722 (description
723 "libcap2 provides a programming interface to POSIX capabilities on
724Linux-based operating systems.")
725
726 ;; License is BSD-3 or GPLv2, at the user's choice.
727 (license gpl2)))
215b6431
LC
728
729(define-public bridge-utils
730 (package
731 (name "bridge-utils")
732 (version "1.5")
733 (source (origin
734 (method url-fetch)
735 (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
736 version ".tar.gz"))
737 (sha256
738 (base32
739 "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
740 (build-system gnu-build-system)
741
742 ;; The tarball lacks all the generated files.
743 (native-inputs `(("autoconf" ,autoconf)
744 ("automake" ,automake)))
745 (arguments
746 '(#:phases (alist-cons-before
747 'configure 'bootstrap
748 (lambda _
749 (zero? (system* "autoreconf" "-vf")))
750 %standard-phases)
751 #:tests? #f)) ; no 'check' target
752
753 (home-page
754 "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
755 (synopsis "Manipulate Ethernet bridges")
756 (description
757 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
758to connect two Ethernet segments together in a protocol independent way.
759Packets are forwarded based on Ethernet address, rather than IP address (like
760a router). Since forwarding is done at Layer 2, all protocols can go
761transparently through a bridge.")
762 (license gpl2+)))
3cc20675
LC
763
764(define-public libnl
765 (package
766 (name "libnl")
767 (version "3.2.13")
768 (source (origin
769 (method url-fetch)
770 (uri (string-append
771 "http://www.infradead.org/~tgr/libnl/files/libnl-"
772 version ".tar.gz"))
773 (sha256
774 (base32
775 "1ydw42lsd572qwrfgws97n76hyvjdpanwrxm03lysnhfxkna1ssd"))))
776 (build-system gnu-build-system)
777 (native-inputs `(("flex" ,flex) ("bison" ,bison)))
778 (home-page "http://www.infradead.org/~tgr/libnl/")
779 (synopsis "NetLink protocol library suite")
780 (description
781 "The libnl suite is a collection of libraries providing APIs to netlink
782protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarly
783between the kernel and user space processes. It was designed to be a more
784flexible successor to ioctl to provide mainly networking related kernel
785configuration and monitoring interfaces.")
786
787 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
788 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
789 (license gpl2)))
023fef7d
LC
790
791(define-public powertop
792 (package
793 (name "powertop")
794 (version "2.5")
795 (source
796 (origin
797 (method url-fetch)
798 (uri (string-append
799 "https://01.org/powertop/sites/default/files/downloads/powertop-"
800 version ".tar.gz"))
801 (sha256
802 (base32
803 "02rwqbpasdayl201v0549gbp2f82rd0hqiv3i111r7npanjhhb4b"))))
804 (build-system gnu-build-system)
805 (inputs
806 ;; TODO: Add pciutils.
807 `(("zlib" ,guix:zlib)
023fef7d
LC
808 ;; ("pciutils" ,pciutils)
809 ("ncurses" ,ncurses)
810 ("libnl" ,libnl)))
c4c4cc05
JD
811 (native-inputs
812 `(("pkg-config" ,pkg-config)))
023fef7d
LC
813 (home-page "https://01.org/powertop/")
814 (synopsis "Analyze power consumption on Intel-based laptops")
815 (description
816 "PowerTOP is a Linux tool to diagnose issues with power consumption and
817power management. In addition to being a diagnostic tool, PowerTOP also has
818an interactive mode where the user can experiment various power management
819settings for cases where the operating system has not enabled these
820settings.")
821 (license gpl2)))