gnu: make-bootstrap: Simplify '%gcc-static'.
[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)
e7b38500 32 #:use-module (gnu packages algebra)
85e0dc6a
LC
33 #:use-module ((gnu packages gettext)
34 #:renamer (symbol-prefix-proc 'g:))
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
dfb52abb 149 (let* ((version "3.11")
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
e7b38500 195 "1vlk04xkvyy1kc9zz556md173rn1qzlnvhz7c9sljv4bpk3mdspl"))))
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
LC
212 (description
213 "Linux Libre is a free (as in freedom) variant of the Linux kernel. It
214has been modified to remove any 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)
238 (inputs
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)
02b80c3f
NK
317 ("ncurses" ,ncurses)
318 ("perl" ,perl)))
319 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
35ec07c7 320 (synopsis "Collection of utilities for the Linux kernel")
02b80c3f
NK
321 (description
322 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 323
02b80c3f 324 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 325 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 326 ;; explicitly defined license.
fe8ccfcc
LC
327 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
328 bsd-4 public-domain))))
5d5c4278 329
e47e3eff
LC
330(define-public procps
331 (package
332 (name "procps")
333 (version "3.2.8")
334 (source (origin
335 (method url-fetch)
336 (uri (string-append "http://procps.sourceforge.net/procps-"
337 version ".tar.gz"))
338 (sha256
339 (base32
01eafd38
LC
340 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
341 (patches (list (search-patch "procps-make-3.82.patch")))))
e47e3eff 342 (build-system gnu-build-system)
01eafd38 343 (inputs `(("ncurses" ,ncurses)))
e47e3eff 344 (arguments
01eafd38 345 '(#:phases (alist-replace
e47e3eff
LC
346 'configure
347 (lambda* (#:key outputs #:allow-other-keys)
348 ;; No `configure', just a single Makefile.
349 (let ((out (assoc-ref outputs "out")))
350 (substitute* "Makefile"
351 (("/usr/") "/")
352 (("--(owner|group) 0") "")
353 (("ldconfig") "true")
354 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
355 ;; Add libproc to the RPATH.
356 (string-append "LDFLAGS := -Wl,-rpath="
357 out "/lib" value))))
358 (setenv "CC" "gcc"))
359 (alist-replace
360 'install
361 (lambda* (#:key outputs #:allow-other-keys)
362 (let ((out (assoc-ref outputs "out")))
363 (and (zero?
364 (system* "make" "install"
365 (string-append "DESTDIR=" out)))
366
367 ;; Sanity check.
368 (zero?
369 (system* (string-append out "/bin/ps")
370 "--version")))))
371 %standard-phases))
372
373 ;; What did you expect? Tests?
374 #:tests? #f))
375 (home-page "http://procps.sourceforge.net/")
35ec07c7 376 (synopsis "Utilities that give information about processes")
e47e3eff
LC
377 (description
378 "procps is the package that has a bunch of small useful utilities
379that give information about processes using the Linux /proc file system.
380The package includes the programs ps, top, vmstat, w, kill, free,
381slabtop, and skill.")
382 (license gpl2)))
383
5d5c4278
NK
384(define-public usbutils
385 (package
386 (name "usbutils")
387 (version "006")
388 (source
389 (origin
390 (method url-fetch)
391 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
392 "usbutils-" version ".tar.xz"))
393 (sha256
394 (base32
395 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
396 (build-system gnu-build-system)
397 (inputs
398 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
399 (home-page "http://www.linux-usb.org/")
400 (synopsis
401 "Tools for working with USB devices, such as lsusb")
402 (description
403 "Tools for working with USB devices, such as lsusb.")
4050e5d6 404 (license gpl2+)))
0750452a
LC
405
406(define-public e2fsprogs
407 (package
408 (name "e2fsprogs")
409 (version "1.42.7")
410 (source (origin
411 (method url-fetch)
412 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
413 version ".tar.gz"))
414 (sha256
415 (base32
416 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
417 (build-system gnu-build-system)
418 (inputs `(("util-linux" ,util-linux)
419 ("pkg-config" ,pkg-config)))
420 (arguments
421 '(#:phases (alist-cons-before
422 'configure 'patch-shells
423 (lambda _
424 (substitute* "configure"
425 (("/bin/sh (.*)parse-types.sh" _ dir)
426 (string-append (which "sh") " " dir
427 "parse-types.sh")))
428 (substitute* (find-files "." "^Makefile.in$")
429 (("#!/bin/sh")
430 (string-append "#!" (which "sh")))))
431 %standard-phases)
432
433 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
434 ;; they fail because we get an extra line that says "Can't check if
435 ;; filesystem is mounted due to missing mtab file".
436 #:tests? #f))
437 (home-page "http://e2fsprogs.sourceforge.net/")
35ec07c7 438 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
0750452a
LC
439 (description
440 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
441 (license (list gpl2 ; programs
442 lgpl2.0 ; libext2fs
443 x11)))) ; libuuid
d8482ad0
LC
444
445(define-public strace
446 (package
447 (name "strace")
448 (version "4.7")
449 (source (origin
450 (method url-fetch)
451 (uri (string-append "mirror://sourceforge/strace/strace-"
452 version ".tar.xz"))
453 (sha256
454 (base32
455 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
456 (build-system gnu-build-system)
457 (inputs `(("perl" ,perl)))
458 (home-page "http://strace.sourceforge.net/")
459 (synopsis "System call tracer for Linux")
460 (description
461 "strace is a system call tracer, i.e. a debugging tool which prints out a
462trace of all the system calls made by a another process/program.")
463 (license bsd-3)))
ba04571a
LC
464
465(define-public alsa-lib
466 (package
467 (name "alsa-lib")
468 (version "1.0.27.1")
469 (source (origin
470 (method url-fetch)
471 (uri (string-append
472 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
473 version ".tar.bz2"))
474 (sha256
475 (base32
bcd94e19
MW
476 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
477 (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
ba04571a
LC
478 (build-system gnu-build-system)
479 (home-page "http://www.alsa-project.org/")
480 (synopsis "The Advanced Linux Sound Architecture libraries")
481 (description
482 "The Advanced Linux Sound Architecture (ALSA) provides audio and
483MIDI functionality to the Linux-based operating system.")
484 (license lgpl2.1+)))
10afdf50 485
17b293a0
LC
486(define-public alsa-utils
487 (package
488 (name "alsa-utils")
489 (version "1.0.27.2")
490 (source (origin
491 (method url-fetch)
492 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
493 version ".tar.bz2"))
494 (sha256
495 (base32
496 "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
497 (build-system gnu-build-system)
498 (arguments
499 ;; XXX: Disable man page creation until we have DocBook.
500 '(#:configure-flags (list "--disable-xmlto"
501 (string-append "--with-udev-rules-dir="
502 (assoc-ref %outputs "out")
503 "/lib/udev/rules.d"))
504 #:phases (alist-cons-before
505 'install 'pre-install
506 (lambda _
507 ;; Don't try to mkdir /var/lib/alsa.
508 (substitute* "Makefile"
509 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
510 "true\n")))
511 %standard-phases)))
512 (inputs
513 `(("libsamplerate" ,libsamplerate)
514 ("ncurses" ,ncurses)
515 ("alsa-lib" ,alsa-lib)
516 ("xmlto" ,xmlto)
517 ("gettext" ,g:gettext)))
518 (home-page "http://www.alsa-project.org/")
519 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
520 (description
521 "The Advanced Linux Sound Architecture (ALSA) provides audio and
522MIDI functionality to the Linux-based operating system.")
523
524 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
525 ;; GPLv2-only.
526 (license gpl2)))
527
10afdf50
LC
528(define-public iptables
529 (package
530 (name "iptables")
531 (version "1.4.16.2")
532 (source (origin
533 (method url-fetch)
534 (uri (string-append
535 "http://www.netfilter.org/projects/iptables/files/iptables-"
536 version ".tar.bz2"))
537 (sha256
538 (base32
539 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
540 (build-system gnu-build-system)
541 (arguments '(#:tests? #f)) ; no test suite
542 (home-page "http://www.netfilter.org/projects/iptables/index.html")
543 (synopsis "Program to configure the Linux IP packet filtering rules")
544 (description
545 "iptables is the userspace command line program used to configure the
546Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
547system administrators. Since Network Address Translation is also configured
548from the packet filter ruleset, iptables is used for this, too. The iptables
549package also includes ip6tables. ip6tables is used for configuring the IPv6
550packet filter.")
551 (license gpl2+)))
90a0048f
LC
552
553(define-public iproute
554 (package
555 (name "iproute2")
556 (version "3.8.0")
557 (source (origin
558 (method url-fetch)
559 (uri (string-append
560 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
561 version ".tar.xz"))
562 (sha256
563 (base32
564 "0kqy30wz2krbg4y7750hjq5218hgy2vj9pm5qzkn1bqskxs4b4ap"))))
565 (build-system gnu-build-system)
566 (arguments
567 `(#:tests? #f ; no test suite
568 #:make-flags (let ((out (assoc-ref %outputs "out")))
569 (list "DESTDIR="
570 (string-append "LIBDIR=" out "/lib")
571 (string-append "SBINDIR=" out "/sbin")
572 (string-append "CONFDIR=" out "/etc")
573 (string-append "DOCDIR=" out "/share/doc/"
574 ,name "-" ,version)
575 (string-append "MANDIR=" out "/share/man")))
576 #:phases (alist-cons-before
577 'install 'pre-install
578 (lambda _
579 ;; Don't attempt to create /var/lib/arpd.
580 (substitute* "Makefile"
581 (("^.*ARPDDIR.*$") "")))
582 %standard-phases)))
583 (inputs
584 `(("iptables" ,iptables)
585 ("db4" ,bdb)
586 ("pkg-config" ,pkg-config)
587 ("flex" ,flex)
588 ("bison" ,bison)))
589 (home-page
590 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
591 (synopsis
592 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
593 (description
594 "Iproute2 is a collection of utilities for controlling TCP/IP
595networking and traffic with the Linux kernel.
596
597Most network configuration manuals still refer to ifconfig and route as the
598primary network configuration tools, but ifconfig is known to behave
599inadequately in modern network environments. They should be deprecated, but
600most distros still include them. Most network configuration systems make use
601of ifconfig and thus provide a limited feature set. The /etc/net project aims
602to support most modern network technologies, as it doesn't use ifconfig and
603allows a system administrator to make use of all iproute2 features, including
604traffic control.
605
606iproute2 is usually shipped in a package called iproute or iproute2 and
607consists of several tools, of which the most important are ip and tc. ip
608controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
609tools print detailed usage messages and are accompanied by a set of
610manpages.")
611 (license gpl2+)))
85e0dc6a
LC
612
613(define-public net-tools
614 ;; XXX: This package is basically unmaintained, but it provides a few
615 ;; commands not yet provided by Inetutils, such as 'route', so we have to
616 ;; live with it.
617 (package
618 (name "net-tools")
619 (version "1.60")
620 (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
621 (source (origin
622 (method url-fetch)
623 (uri (string-append home-page "/" name "-"
624 version ".tar.bz2"))
625 (sha256
626 (base32
627 "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))))
628 (build-system gnu-build-system)
629 (arguments
630 '(#:phases (alist-replace
631 'patch
632 (lambda* (#:key inputs #:allow-other-keys)
633 (define (apply-patch file)
634 (zero? (system* "patch" "-p1" "--batch"
635 "--input" file)))
636
637 (let ((patch.gz (assoc-ref inputs "patch")))
638 (format #t "applying Debian patch set '~a'...~%"
639 patch.gz)
640 (system (string-append "gunzip < " patch.gz " > the-patch"))
641 (pk 'here)
642 (and (apply-patch "the-patch")
643 (for-each apply-patch
644 (find-files "debian/patches"
645 "\\.patch")))))
646 (alist-replace
647 'configure
648 (lambda* (#:key outputs #:allow-other-keys)
649 (let ((out (assoc-ref outputs "out")))
650 (mkdir-p (string-append out "/bin"))
651 (mkdir-p (string-append out "/sbin"))
652
653 ;; Pretend we have everything...
654 (system "yes | make config")
655
656 ;; ... except we don't have libdnet, so remove that
657 ;; definition.
658 (substitute* '("config.make" "config.h")
659 (("^.*HAVE_AFDECnet.*$") ""))))
660 %standard-phases))
661
662 ;; Binaries that depend on libnet-tools.a don't declare that
663 ;; dependency, making it parallel-unsafe.
664 #:parallel-build? #f
665
666 #:tests? #f ; no test suite
667 #:make-flags (list "CC=gcc"
668 (string-append "BASEDIR="
669 (assoc-ref %outputs "out")))))
670
671 ;; Use the big Debian patch set (the thing does not even compile out of
672 ;; the box.)
673 (inputs `(("patch" ,(origin
674 (method url-fetch)
675 (uri
676 "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
677 (sha256
678 (base32
679 "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
680 (native-inputs `(("gettext" ,g:gettext)))
681
682 (synopsis "Tools for controlling the network subsystem in Linux")
683 (description
684 "This package includes the important tools for controlling the network
685subsystem of the Linux kernel. This includes arp, hostname, ifconfig,
686netstat, rarp and route. Additionally, this package contains utilities
687relating to particular network hardware types (plipconfig, slattach) and
688advanced aspects of IP configuration (iptunnel, ipmaddr).")
689 (license gpl2+)))
c762e82e
LC
690
691(define-public libcap
692 (package
693 (name "libcap")
694 (version "2.22")
695 (source (origin
696 (method url-fetch)
697
698 ;; Tarballs used to be available from
699 ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
700 ;; but they never came back after kernel.org was compromised.
701 (uri (string-append
702 "mirror://debian/pool/main/libc/libcap2/libcap2_"
703 version ".orig.tar.gz"))
704 (sha256
705 (base32
706 "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
707 (build-system gnu-build-system)
708 (arguments '(#:phases (alist-delete 'configure %standard-phases)
709 #:tests? #f ; no 'check' target
710 #:make-flags (list "lib=lib"
711 (string-append "prefix="
712 (assoc-ref %outputs "out"))
713 "RAISE_SETFCAP=no")))
714 (native-inputs `(("perl" ,perl)))
715 (inputs `(("attr" ,attr)))
716 (home-page "https://sites.google.com/site/fullycapable/")
717 (synopsis "Library for working with POSIX capabilities")
718 (description
719 "libcap2 provides a programming interface to POSIX capabilities on
720Linux-based operating systems.")
721
722 ;; License is BSD-3 or GPLv2, at the user's choice.
723 (license gpl2)))
215b6431
LC
724
725(define-public bridge-utils
726 (package
727 (name "bridge-utils")
728 (version "1.5")
729 (source (origin
730 (method url-fetch)
731 (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
732 version ".tar.gz"))
733 (sha256
734 (base32
735 "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
736 (build-system gnu-build-system)
737
738 ;; The tarball lacks all the generated files.
739 (native-inputs `(("autoconf" ,autoconf)
740 ("automake" ,automake)))
741 (arguments
742 '(#:phases (alist-cons-before
743 'configure 'bootstrap
744 (lambda _
745 (zero? (system* "autoreconf" "-vf")))
746 %standard-phases)
747 #:tests? #f)) ; no 'check' target
748
749 (home-page
750 "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
751 (synopsis "Manipulate Ethernet bridges")
752 (description
753 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
754to connect two Ethernet segments together in a protocol independent way.
755Packets are forwarded based on Ethernet address, rather than IP address (like
756a router). Since forwarding is done at Layer 2, all protocols can go
757transparently through a bridge.")
758 (license gpl2+)))